Commit 774e3097 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Renaming server configuration fields

parent 4f1f1235
......@@ -25,7 +25,7 @@ func StartIrmaClientServer(t *testing.T) {
require.NoError(t, irmarequestor.Initialize(&server.Configuration{
Logger: logger,
IrmaConfigurationPath: filepath.Join(testdata, "irma_configuration"),
PrivateKeysPath: filepath.Join(testdata, "privatekeys"),
IssuerPrivateKeysPath: filepath.Join(testdata, "privatekeys"),
}))
mux := http.NewServeMux()
......
......@@ -26,7 +26,7 @@ func StartIrmaServer() {
Configuration: &server.Configuration{
Logger: logger,
IrmaConfigurationPath: filepath.Join(testdata, "irma_configuration"),
PrivateKeysPath: filepath.Join(testdata, "privatekeys"),
IssuerPrivateKeysPath: filepath.Join(testdata, "privatekeys"),
},
Port: 48682,
})
......
......@@ -14,12 +14,12 @@ var Logger *logrus.Logger = logrus.StandardLogger()
type Configuration struct {
IrmaConfigurationPath string
PrivateKeysPath string
IssuerPrivateKeysPath string
Logger *logrus.Logger
Logger *logrus.Logger `json:"-"`
PrivateKeys map[irma.IssuerIdentifier]*gabi.PrivateKey
IrmaConfiguration *irma.Configuration
IssuerPrivateKeys map[irma.IssuerIdentifier]*gabi.PrivateKey `json:"-"`
IrmaConfiguration *irma.Configuration `json:"-"`
}
type SessionResult struct {
......
......@@ -37,11 +37,11 @@ func Initialize(configuration *server.Configuration) error {
}
}
if conf.PrivateKeys == nil {
conf.PrivateKeys = make(map[irma.IssuerIdentifier]*gabi.PrivateKey)
if conf.IssuerPrivateKeys == nil {
conf.IssuerPrivateKeys = make(map[irma.IssuerIdentifier]*gabi.PrivateKey)
}
if conf.PrivateKeysPath != "" {
files, err := ioutil.ReadDir(conf.PrivateKeysPath)
if conf.IssuerPrivateKeysPath != "" {
files, err := ioutil.ReadDir(conf.IssuerPrivateKeysPath)
if err != nil {
return err
}
......@@ -51,14 +51,14 @@ func Initialize(configuration *server.Configuration) error {
if _, ok := conf.IrmaConfiguration.Issuers[issid]; !ok {
return errors.Errorf("Private key %s belongs to an unknown issuer", filename)
}
sk, err := gabi.NewPrivateKeyFromFile(filepath.Join(conf.PrivateKeysPath, filename))
sk, err := gabi.NewPrivateKeyFromFile(filepath.Join(conf.IssuerPrivateKeysPath, filename))
if err != nil {
return err
}
conf.PrivateKeys[issid] = sk
conf.IssuerPrivateKeys[issid] = sk
}
}
for issid, sk := range conf.PrivateKeys {
for issid, sk := range conf.IssuerPrivateKeys {
pk, err := conf.IrmaConfiguration.PublicKey(issid, int(sk.Counter))
if err != nil {
return err
......
......@@ -145,7 +145,7 @@ func (session *session) handlePostCommitments(commitments *gabi.IssueCommitmentM
for i, cred := range request.Credentials {
id := cred.CredentialTypeID.IssuerIdentifier()
pk, _ := conf.IrmaConfiguration.PublicKey(id, cred.KeyCounter)
issuer := gabi.NewIssuer(conf.PrivateKeys[id], pk, one)
issuer := gabi.NewIssuer(conf.IssuerPrivateKeys[id], pk, one)
proof := commitments.Proofs[i+discloseCount].(*gabi.ProofU)
attributes, err := cred.AttributeList(conf.IrmaConfiguration, 0x03)
if err != nil {
......
......@@ -41,7 +41,7 @@ func validateIssuanceRequest(request *irma.IssuanceRequest) error {
for _, cred := range request.Credentials {
// Check that we have the appropriate private key
iss := cred.CredentialTypeID.IssuerIdentifier()
privatekey, havekey := conf.PrivateKeys[iss]
privatekey, havekey := conf.IssuerPrivateKeys[iss]
if !havekey {
return errors.Errorf("missing private key of issuer %s", iss.String())
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment