Commit bfde049d authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Renaming, 6: irmago.ConfigurationStore -> irma.Configuration

The struct name now matches exactly (up to idiomatic spelling differences)
with the name of the folder that it parses and updates.
parent b9e02b87
......@@ -38,9 +38,9 @@ type metadataField struct {
// MetadataAttribute represent a metadata attribute. Contains the credential type, signing date, validity, and the public key counter.
type MetadataAttribute struct {
Int *big.Int
pk *gabi.PublicKey
Store *ConfigurationStore
Int *big.Int
pk *gabi.PublicKey
Conf *Configuration
}
// AttributeList contains attributes, excluding the secret key,
......@@ -54,16 +54,16 @@ type AttributeList struct {
}
// NewAttributeListFromInts initializes a new AttributeList from a list of bigints.
func NewAttributeListFromInts(ints []*big.Int, store *ConfigurationStore) *AttributeList {
func NewAttributeListFromInts(ints []*big.Int, conf *Configuration) *AttributeList {
return &AttributeList{
Ints: ints,
MetadataAttribute: MetadataFromInt(ints[0], store),
MetadataAttribute: MetadataFromInt(ints[0], conf),
}
}
func (al *AttributeList) Info() *CredentialInfo {
if al.info == nil {
al.info = NewCredentialInfo(al.Ints, al.Store)
al.info = NewCredentialInfo(al.Ints, al.Conf)
}
return al.info
}
......@@ -117,8 +117,8 @@ func (al *AttributeList) Attribute(identifier AttributeTypeIdentifier) Translate
}
// MetadataFromInt wraps the given Int
func MetadataFromInt(i *big.Int, store *ConfigurationStore) *MetadataAttribute {
return &MetadataAttribute{Int: i, Store: store}
func MetadataFromInt(i *big.Int, conf *Configuration) *MetadataAttribute {
return &MetadataAttribute{Int: i, Conf: conf}
}
// NewMetadataAttribute constructs a new instance containing the default values:
......@@ -149,7 +149,7 @@ func (attr *MetadataAttribute) Bytes() []byte {
func (attr *MetadataAttribute) PublicKey() (*gabi.PublicKey, error) {
if attr.pk == nil {
var err error
attr.pk, err = attr.Store.PublicKey(attr.CredentialType().IssuerIdentifier(), attr.KeyCounter())
attr.pk, err = attr.Conf.PublicKey(attr.CredentialType().IssuerIdentifier(), attr.KeyCounter())
if err != nil {
return nil, err
}
......@@ -204,9 +204,9 @@ func (attr *MetadataAttribute) setExpiryDate(timestamp *Timestamp) error {
}
// CredentialType returns the credential type of the current instance
// using the MetaStore.
// using the Configuration.
func (attr *MetadataAttribute) CredentialType() *CredentialType {
return attr.Store.hashToCredentialType(attr.field(credentialID))
return attr.Conf.hashToCredentialType(attr.field(credentialID))
}
func (attr *MetadataAttribute) setCredentialTypeIdentifier(id string) {
......@@ -303,11 +303,11 @@ func (disjunction *AttributeDisjunction) Satisfied() bool {
return false
}
// MatchesStore returns true if all attributes contained in the disjunction are
// present in the specified configuration store.
func (disjunction *AttributeDisjunction) MatchesStore(store *ConfigurationStore) bool {
// MatchesConfig returns true if all attributes contained in the disjunction are
// present in the specified configuration.
func (disjunction *AttributeDisjunction) MatchesConfig(conf *Configuration) bool {
for ai := range disjunction.Values {
creddescription, exists := store.CredentialTypes[ai.CredentialTypeIdentifier()]
creddescription, exists := conf.CredentialTypes[ai.CredentialTypeIdentifier()]
if !exists {
return false
}
......
......@@ -25,8 +25,8 @@ type CredentialInfo struct {
// A CredentialInfoList is a list of credentials (implements sort.Interface).
type CredentialInfoList []*CredentialInfo
func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialInfo {
meta := MetadataFromInt(ints[0], store)
func NewCredentialInfo(ints []*big.Int, conf *Configuration) *CredentialInfo {
meta := MetadataFromInt(ints[0], conf)
credtype := meta.CredentialType()
attrs := make([]TranslatedString, len(credtype.Attributes))
......@@ -35,7 +35,7 @@ func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialIn
attrs[i] = TranslatedString(map[string]string{"en": val, "nl": val})
}
path := fmt.Sprintf("%s/%s/%s/Issues/%s/logo.png", store.path, credtype.SchemeManagerID, credtype.IssuerID, credtype.ID)
path := fmt.Sprintf("%s/%s/%s/Issues/%s/logo.png", conf.path, credtype.SchemeManagerID, credtype.IssuerID, credtype.ID)
exists, err := fs.PathExists(path)
if err != nil {
return nil
......@@ -54,7 +54,7 @@ func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialIn
Expires: Timestamp(meta.Expiry()),
Attributes: attrs,
Logo: path,
Hash: NewAttributeListFromInts(ints, store).Hash(),
Hash: NewAttributeListFromInts(ints, conf).Hash(),
}
}
......
......@@ -166,9 +166,9 @@ func (id *AttributeTypeIdentifier) UnmarshalText(text []byte) error {
return nil
}
func (set *IrmaIdentifierSet) Distributed(store *ConfigurationStore) bool {
func (set *IrmaIdentifierSet) Distributed(conf *Configuration) bool {
for id := range set.SchemeManagers {
if store.SchemeManagers[id].Distributed() {
if conf.SchemeManagers[id].Distributed() {
return true
}
}
......
......@@ -48,7 +48,7 @@ type Client struct {
storage storage
// Other state
ConfigurationStore *irma.ConfigurationStore
Configuration *irma.Configuration
UnenrolledSchemeManagers []irma.SchemeManagerIdentifier
irmaConfigurationPath string
androidStoragePath string
......@@ -66,7 +66,7 @@ type KeyshareHandler interface {
type ClientHandler interface {
KeyshareHandler
UpdateConfigurationStore(new *irma.IrmaIdentifierSet)
UpdateConfiguration(new *irma.IrmaIdentifierSet)
UpdateAttributes()
}
......@@ -109,16 +109,16 @@ func New(
handler: handler,
}
cm.ConfigurationStore, err = irma.NewConfigurationStore(storagePath+"/irma_configuration", irmaConfigurationPath)
cm.Configuration, err = irma.NewConfiguration(storagePath+"/irma_configuration", irmaConfigurationPath)
if err != nil {
return nil, err
}
if err = cm.ConfigurationStore.ParseFolder(); err != nil {
if err = cm.Configuration.ParseFolder(); err != nil {
return nil, err
}
// Ensure storage path exists, and populate it with necessary files
cm.storage = storage{storagePath: storagePath, ConfigurationStore: cm.ConfigurationStore}
cm.storage = storage{storagePath: storagePath, Configuration: cm.Configuration}
if err = cm.storage.EnsureStorageExists(); err != nil {
return nil, err
}
......@@ -377,7 +377,7 @@ func (client *Client) credential(id irma.CredentialTypeIdentifier, counter int)
Attributes: append([]*big.Int{client.secretkey.Key}, attrs.Ints...),
Signature: sig,
Pk: pk,
}, client.ConfigurationStore)
}, client.Configuration)
if err != nil {
return nil, err
}
......@@ -396,7 +396,7 @@ func (client *Client) Candidates(disjunction *irma.AttributeDisjunction) []*irma
for _, attribute := range disjunction.Attributes {
credID := attribute.CredentialTypeIdentifier()
if !client.ConfigurationStore.Contains(credID) {
if !client.Configuration.Contains(credID) {
continue
}
creds := client.attributes[credID]
......@@ -462,7 +462,7 @@ func (client *Client) groupCredentials(choice *irma.DisclosureChoice) (map[irma.
if identifier.IsCredential() {
continue // In this case we only disclose the metadata attribute, which is already handled
}
index, err := client.ConfigurationStore.CredentialTypes[identifier.CredentialTypeIdentifier()].IndexOf(identifier)
index, err := client.Configuration.CredentialTypes[identifier.CredentialTypeIdentifier()].IndexOf(identifier)
if err != nil {
return nil, err
}
......@@ -514,7 +514,7 @@ func (client *Client) IssuanceProofBuilders(request *irma.IssuanceRequest) (gabi
proofBuilders := gabi.ProofBuilderList([]gabi.ProofBuilder{})
for _, futurecred := range request.Credentials {
var pk *gabi.PublicKey
pk, err = client.ConfigurationStore.PublicKey(futurecred.CredentialTypeID.IssuerIdentifier(), futurecred.KeyCounter)
pk, err = client.Configuration.PublicKey(futurecred.CredentialTypeID.IssuerIdentifier(), futurecred.KeyCounter)
if err != nil {
return nil, err
}
......@@ -554,7 +554,7 @@ func (client *Client) ConstructCredentials(msg []*gabi.IssueSignatureMessage, re
// we save none of them to fail the session cleanly
gabicreds := []*gabi.Credential{}
for i, sig := range msg {
attrs, err := request.Credentials[i].AttributeList(client.ConfigurationStore)
attrs, err := request.Credentials[i].AttributeList(client.Configuration)
if err != nil {
return err
}
......@@ -566,7 +566,7 @@ func (client *Client) ConstructCredentials(msg []*gabi.IssueSignatureMessage, re
}
for _, gabicred := range gabicreds {
newcred, err := newCredential(gabicred, client.ConfigurationStore)
newcred, err := newCredential(gabicred, client.Configuration)
if err != nil {
return err
}
......@@ -608,7 +608,7 @@ func (client *Client) paillierKeyWorker(wait bool, ch chan bool) {
func (client *Client) unenrolledSchemeManagers() []irma.SchemeManagerIdentifier {
list := []irma.SchemeManagerIdentifier{}
for name, manager := range client.ConfigurationStore.SchemeManagers {
for name, manager := range client.Configuration.SchemeManagers {
if _, contains := client.keyshareServers[name]; manager.Distributed() && !contains {
list = append(list, manager.Identifier())
}
......@@ -639,7 +639,7 @@ func (client *Client) KeyshareEnroll(manager irma.SchemeManagerIdentifier, email
}
func (client *Client) keyshareEnrollWorker(managerID irma.SchemeManagerIdentifier, email, pin string) error {
manager, ok := client.ConfigurationStore.SchemeManagers[managerID]
manager, ok := client.Configuration.SchemeManagers[managerID]
if !ok {
return errors.New("Unknown scheme manager")
}
......
......@@ -13,14 +13,14 @@ type credential struct {
attrs *irma.AttributeList
}
func newCredential(gabicred *gabi.Credential, store *irma.ConfigurationStore) (*credential, error) {
meta := irma.MetadataFromInt(gabicred.Attributes[1], store)
func newCredential(gabicred *gabi.Credential, conf *irma.Configuration) (*credential, error) {
meta := irma.MetadataFromInt(gabicred.Attributes[1], conf)
cred := &credential{
Credential: gabicred,
MetadataAttribute: meta,
}
var err error
cred.Pk, err = store.PublicKey(meta.CredentialType().IssuerIdentifier(), cred.KeyCounter())
cred.Pk, err = conf.PublicKey(meta.CredentialType().IssuerIdentifier(), cred.KeyCounter())
if err != nil {
return nil, err
}
......@@ -29,7 +29,7 @@ func newCredential(gabicred *gabi.Credential, store *irma.ConfigurationStore) (*
func (cred *credential) AttributeList() *irma.AttributeList {
if cred.attrs == nil {
cred.attrs = irma.NewAttributeListFromInts(cred.Credential.Attributes[1:], cred.MetadataAttribute.Store)
cred.attrs = irma.NewAttributeListFromInts(cred.Credential.Attributes[1:], cred.MetadataAttribute.Conf)
}
return cred.attrs
}
......@@ -31,7 +31,7 @@ func TestMain(m *testing.M) {
type IgnoringClientHandler struct{}
func (i *IgnoringClientHandler) UpdateConfigurationStore(new *irma.IrmaIdentifierSet) {}
func (i *IgnoringClientHandler) UpdateConfiguration(new *irma.IrmaIdentifierSet) {}
func (i *IgnoringClientHandler) UpdateAttributes() {}
func (i *IgnoringClientHandler) EnrollmentError(manager irma.SchemeManagerIdentifier, err error) {}
func (i *IgnoringClientHandler) EnrollmentSuccess(manager irma.SchemeManagerIdentifier) {}
......@@ -133,46 +133,46 @@ func verifyKeyshareIsUnmarshaled(t *testing.T, client *Client) {
}
// TODO move up to irmago?
func verifyStoreIsLoaded(t *testing.T, store *irma.ConfigurationStore, android bool) {
require.Contains(t, store.SchemeManagers, irma.NewSchemeManagerIdentifier("irma-demo"))
require.Contains(t, store.SchemeManagers, irma.NewSchemeManagerIdentifier("test"))
func verifyConfigurationIsLoaded(t *testing.T, conf *irma.Configuration, android bool) {
require.Contains(t, conf.SchemeManagers, irma.NewSchemeManagerIdentifier("irma-demo"))
require.Contains(t, conf.SchemeManagers, irma.NewSchemeManagerIdentifier("test"))
if android {
require.Contains(t, store.SchemeManagers, irma.NewSchemeManagerIdentifier("test2"))
require.Contains(t, conf.SchemeManagers, irma.NewSchemeManagerIdentifier("test2"))
}
pk, err := store.PublicKey(irma.NewIssuerIdentifier("irma-demo.RU"), 0)
pk, err := conf.PublicKey(irma.NewIssuerIdentifier("irma-demo.RU"), 0)
require.NoError(t, err)
require.NotNil(t, pk)
require.NotNil(t, pk.N, "irma-demo.RU public key has no modulus")
require.Equal(t,
"Irma Demo",
store.SchemeManagers[irma.NewSchemeManagerIdentifier("irma-demo")].Name["en"],
conf.SchemeManagers[irma.NewSchemeManagerIdentifier("irma-demo")].Name["en"],
"irma-demo scheme manager has unexpected name")
require.Equal(t,
"Radboud University Nijmegen",
store.Issuers[irma.NewIssuerIdentifier("irma-demo.RU")].Name["en"],
conf.Issuers[irma.NewIssuerIdentifier("irma-demo.RU")].Name["en"],
"irma-demo.RU issuer has unexpected name")
require.Equal(t,
"Student Card",
store.CredentialTypes[irma.NewCredentialTypeIdentifier("irma-demo.RU.studentCard")].ShortName["en"],
conf.CredentialTypes[irma.NewCredentialTypeIdentifier("irma-demo.RU.studentCard")].ShortName["en"],
"irma-demo.RU.studentCard has unexpected name")
require.Equal(t,
"studentID",
store.CredentialTypes[irma.NewCredentialTypeIdentifier("irma-demo.RU.studentCard")].Attributes[2].ID,
conf.CredentialTypes[irma.NewCredentialTypeIdentifier("irma-demo.RU.studentCard")].Attributes[2].ID,
"irma-demo.RU.studentCard.studentID has unexpected name")
// Hash algorithm pseudocode:
// Base64(SHA256("irma-demo.RU.studentCard")[0:16])
//require.Contains(t, store.reverseHashes, "1stqlPad5edpfS1Na1U+DA==",
//require.Contains(t, conf.reverseHashes, "1stqlPad5edpfS1Na1U+DA==",
// "irma-demo.RU.studentCard had improper hash")
//require.Contains(t, store.reverseHashes, "CLjnADMBYlFcuGOT7Z0xRg==",
//require.Contains(t, conf.reverseHashes, "CLjnADMBYlFcuGOT7Z0xRg==",
// "irma-demo.MijnOverheid.root had improper hash")
}
func TestAndroidParse(t *testing.T) {
client := parseStorage(t)
verifyStoreIsLoaded(t, client.ConfigurationStore, true)
verifyConfigurationIsLoaded(t, client.Configuration, true)
verifyClientIsUnmarshaled(t, client)
verifyCredentials(t, client)
verifyKeyshareIsUnmarshaled(t, client)
......@@ -232,12 +232,12 @@ func TestMetadataAttribute(t *testing.T) {
}
func TestMetadataCompatibility(t *testing.T) {
store, err := irma.NewConfigurationStore("testdata/irma_configuration", "")
conf, err := irma.NewConfiguration("testdata/irma_configuration", "")
require.NoError(t, err)
require.NoError(t, store.ParseFolder())
require.NoError(t, conf.ParseFolder())
// An actual metadata attribute of an IRMA credential extracted from the IRMA app
attr := irma.MetadataFromInt(s2big("49043481832371145193140299771658227036446546573739245068"), store)
attr := irma.MetadataFromInt(s2big("49043481832371145193140299771658227036446546573739245068"), conf)
require.NotNil(t, attr.CredentialType(), "attr.CredentialType() should not be nil")
require.Equal(t,
......@@ -386,13 +386,13 @@ func TestCredentialRemoval(t *testing.T) {
func TestDownloadSchemeManager(t *testing.T) {
client := parseStorage(t)
require.NoError(t, client.ConfigurationStore.RemoveSchemeManager(irma.NewSchemeManagerIdentifier("irma-demo")))
require.NoError(t, client.Configuration.RemoveSchemeManager(irma.NewSchemeManagerIdentifier("irma-demo")))
url := "https://raw.githubusercontent.com/credentials/irma_configuration/translate/irma-demo"
sm, err := client.ConfigurationStore.DownloadSchemeManager(url)
sm, err := client.Configuration.DownloadSchemeManager(url)
require.NoError(t, err)
require.NotNil(t, sm)
require.NoError(t, client.ConfigurationStore.AddSchemeManager(sm))
require.NoError(t, client.Configuration.AddSchemeManager(sm))
jwt := getIssuanceJwt("testip", irma.NewAttributeTypeIdentifier("irma-demo.RU.studentCard.studentID"))
sessionHelper(t, jwt, "issue", client)
......
......@@ -33,7 +33,7 @@ type keyshareSession struct {
pinRequestor KeysharePinRequestor
builders gabi.ProofBuilderList
session irma.IrmaSession
store *irma.ConfigurationStore
conf *irma.Configuration
keyshareServers map[irma.SchemeManagerIdentifier]*keyshareServer
keyshareServer *keyshareServer // The one keyshare server in use in case of issuance
transports map[irma.SchemeManagerIdentifier]*irma.HTTPTransport
......@@ -136,13 +136,13 @@ func startKeyshareSession(
pin KeysharePinRequestor,
builders gabi.ProofBuilderList,
session irma.IrmaSession,
store *irma.ConfigurationStore,
conf *irma.Configuration,
keyshareServers map[irma.SchemeManagerIdentifier]*keyshareServer,
state *issuanceState,
) {
ksscount := 0
for managerID := range session.Identifiers().SchemeManagers {
if store.SchemeManagers[managerID].Distributed() {
if conf.SchemeManagers[managerID].Distributed() {
ksscount++
if _, enrolled := keyshareServers[managerID]; !enrolled {
err := errors.New("Not enrolled to keyshare server of scheme manager " + managerID.String())
......@@ -163,7 +163,7 @@ func startKeyshareSession(
sessionHandler: sessionHandler,
transports: map[irma.SchemeManagerIdentifier]*irma.HTTPTransport{},
pinRequestor: pin,
store: store,
conf: conf,
keyshareServers: keyshareServers,
state: state,
}
......@@ -171,7 +171,7 @@ func startKeyshareSession(
requestPin := false
for managerID := range session.Identifiers().SchemeManagers {
if !ks.store.SchemeManagers[managerID].Distributed() {
if !ks.conf.SchemeManagers[managerID].Distributed() {
continue
}
......@@ -240,7 +240,7 @@ func (ks *keyshareSession) VerifyPin(attempts int) {
// If all is ok, success will be true.
func (ks *keyshareSession) verifyPinAttempt(pin string) (success bool, tries int, blocked int, err error) {
for managerID := range ks.session.Identifiers().SchemeManagers {
if !ks.store.SchemeManagers[managerID].Distributed() {
if !ks.conf.SchemeManagers[managerID].Distributed() {
continue
}
......@@ -291,7 +291,7 @@ func (ks *keyshareSession) GetCommitments() {
for _, builder := range ks.builders {
pk := builder.PublicKey()
managerID := irma.NewIssuerIdentifier(pk.Issuer).SchemeManagerIdentifier()
if !ks.store.SchemeManagers[managerID].Distributed() {
if !ks.conf.SchemeManagers[managerID].Distributed() {
continue
}
if _, contains := pkids[managerID]; !contains {
......@@ -303,7 +303,7 @@ func (ks *keyshareSession) GetCommitments() {
// Now inform each keyshare server of with respect to which public keys
// we want them to send us commitments
for managerID := range ks.session.Identifiers().SchemeManagers {
if !ks.store.SchemeManagers[managerID].Distributed() {
if !ks.conf.SchemeManagers[managerID].Distributed() {
continue
}
......@@ -407,7 +407,7 @@ func (ks *keyshareSession) finishDisclosureOrSigning(challenge *big.Int, respons
for i, builder := range ks.builders {
// Parse each received JWT
managerID := irma.NewIssuerIdentifier(builder.PublicKey().Issuer).SchemeManagerIdentifier()
if !ks.store.SchemeManagers[managerID].Distributed() {
if !ks.conf.SchemeManagers[managerID].Distributed() {
continue
}
msg := struct {
......
......@@ -53,7 +53,7 @@ func (session *session) createLogEntry(response interface{}) (*LogEntry, error)
entry.Received = map[irma.CredentialTypeIdentifier][]irma.TranslatedString{}
}
for _, req := range session.jwt.(*irma.IdentityProviderJwt).Request.Request.Credentials {
list, err := req.AttributeList(session.client.ConfigurationStore)
list, err := req.AttributeList(session.client.Configuration)
if err != nil {
continue // TODO?
}
......@@ -75,7 +75,7 @@ func (session *session) createLogEntry(response interface{}) (*LogEntry, error)
if entry.Disclosed == nil {
entry.Disclosed = map[irma.CredentialTypeIdentifier]map[int]irma.TranslatedString{}
}
meta := irma.MetadataFromInt(proofd.ADisclosed[1], session.client.ConfigurationStore)
meta := irma.MetadataFromInt(proofd.ADisclosed[1], session.client.Configuration)
id := meta.CredentialType().Identifier()
entry.Disclosed[id] = map[int]irma.TranslatedString{}
for i, attr := range proofd.ADisclosed {
......
......@@ -186,7 +186,7 @@ func (session *session) start() {
// Check if we are enrolled into all involved keyshare servers
for id := range session.irmaSession.Identifiers().SchemeManagers {
manager, ok := session.client.ConfigurationStore.SchemeManagers[id]
manager, ok := session.client.Configuration.SchemeManagers[id]
if !ok {
session.fail(&irma.SessionError{ErrorType: irma.ErrorUnknownSchemeManager, Info: id.String()})
return
......@@ -201,10 +201,10 @@ func (session *session) start() {
}
// Download missing credential types/issuers/public keys from the scheme manager
if session.downloaded, err = session.client.ConfigurationStore.Download(session.irmaSession.Identifiers()); err != nil {
if session.downloaded, err = session.client.Configuration.Download(session.irmaSession.Identifiers()); err != nil {
session.Handler.Failure(
session.Action,
&irma.SessionError{ErrorType: irma.ErrorConfigurationStoreDownload, Err: err},
&irma.SessionError{ErrorType: irma.ErrorConfigurationDownload, Err: err},
)
return
}
......@@ -212,7 +212,7 @@ func (session *session) start() {
if session.Action == irma.ActionIssuing {
ir := session.irmaSession.(*irma.IssuanceRequest)
for _, credreq := range ir.Credentials {
info, err := credreq.Info(session.client.ConfigurationStore)
info, err := credreq.Info(session.client.Configuration)
if err != nil {
session.fail(&irma.SessionError{ErrorType: irma.ErrorUnknownCredentialType, Err: err})
return
......@@ -266,7 +266,7 @@ func (session *session) do(proceed bool) {
}
session.Handler.StatusUpdate(session.Action, irma.StatusCommunicating)
if !session.irmaSession.Identifiers().Distributed(session.client.ConfigurationStore) {
if !session.irmaSession.Identifiers().Distributed(session.client.Configuration) {
var message interface{}
var err error
switch session.Action {
......@@ -302,7 +302,7 @@ func (session *session) do(proceed bool) {
session.Handler,
builders,
session.irmaSession,
session.client.ConfigurationStore,
session.client.Configuration,
session.client.keyshareServers,
session.client.state,
)
......@@ -360,7 +360,7 @@ func (session *session) sendResponse(message interface{}) {
_ = session.client.addLogEntry(log) // TODO err
if !session.downloaded.Empty() {
session.client.handler.UpdateConfigurationStore(session.downloaded)
session.client.handler.UpdateConfiguration(session.downloaded)
}
if session.Action == irma.ActionIssuing {
session.client.handler.UpdateAttributes()
......@@ -370,7 +370,7 @@ func (session *session) sendResponse(message interface{}) {
}
func (session *session) managerSession() {
manager, err := session.client.ConfigurationStore.DownloadSchemeManager(session.ServerURL)
manager, err := session.client.Configuration.DownloadSchemeManager(session.ServerURL)
if err != nil {
session.Handler.Failure(session.Action, &irma.SessionError{Err: err}) // TODO
return
......@@ -380,14 +380,14 @@ func (session *session) managerSession() {
session.Handler.Cancelled(session.Action) // No need to DELETE session here
return
}
if err := session.client.ConfigurationStore.AddSchemeManager(manager); err != nil {
if err := session.client.Configuration.AddSchemeManager(manager); err != nil {
session.Handler.Failure(session.Action, &irma.SessionError{})
return
}
if manager.Distributed() {
session.client.UnenrolledSchemeManagers = session.client.unenrolledSchemeManagers()
}
session.client.handler.UpdateConfigurationStore(
session.client.handler.UpdateConfiguration(
&irma.IrmaIdentifierSet{
SchemeManagers: map[irma.SchemeManagerIdentifier]struct{}{manager.Identifier(): {}},
Issuers: map[irma.IssuerIdentifier]struct{}{},
......@@ -434,7 +434,7 @@ func (session *session) fail(err *irma.SessionError) {
if session.delete() {
err.Err = errors.Wrap(err.Err, 0)
if session.downloaded != nil && !session.downloaded.Empty() {
session.client.handler.UpdateConfigurationStore(session.downloaded)
session.client.handler.UpdateConfiguration(session.downloaded)
}
session.Handler.Failure(session.Action, err)
}
......@@ -443,7 +443,7 @@ func (session *session) fail(err *irma.SessionError) {
func (session *session) cancel() {
if session.delete() {
if session.downloaded != nil && !session.downloaded.Empty() {
session.client.handler.UpdateConfigurationStore(session.downloaded)
session.client.handler.UpdateConfiguration(session.downloaded)
}
session.Handler.Cancelled(session.Action)
}
......
......@@ -15,8 +15,8 @@ import (
// Storage provider for a Client
type storage struct {
storagePath string
ConfigurationStore *irma.ConfigurationStore
storagePath string
Configuration *irma.Configuration
}
// Filenames in which we store stuff
......@@ -156,7 +156,7 @@ func (s *storage) LoadAttributes() (list map[irma.CredentialTypeIdentifier][]*ir
list = make(map[irma.CredentialTypeIdentifier][]*irma.AttributeList)
for _, attrlist := range temp {
attrlist.MetadataAttribute = irma.MetadataFromInt(attrlist.Ints[0], s.ConfigurationStore)
attrlist.MetadataAttribute = irma.MetadataFromInt(attrlist.Ints[0], s.Configuration)
id := attrlist.CredentialType()
var ct irma.CredentialTypeIdentifier
if id != nil {
......
......@@ -130,7 +130,7 @@ func (client *Client) ParseAndroidStorage() (present bool, err error) {
gabicred.Signature.KeyshareP = oldcred.SharedPoints[0]
}
var cred *credential
if cred, err = newCredential(gabicred, client.ConfigurationStore); err != nil {
if cred, err = newCredential(gabicred, client.Configuration); err != nil {
return
}
if cred.CredentialType() == nil {
......@@ -167,9 +167,9 @@ func (client *Client) ParseAndroidStorage() (present bool, err error) {
client.paillierKey(false) // trigger calculating a new one
}
if err = client.ConfigurationStore.Copy(client.androidStoragePath+"/app_store/irma_configuration", false); err != nil {
if err = client.Configuration.Copy(client.androidStoragePath+"/app_store/irma_configuration", false); err != nil {
return
}
// Copy from assets again to ensure we have the latest versions
return present, client.ConfigurationStore.Copy(client.irmaConfigurationPath, true)
return present, client.Configuration.Copy(client.irmaConfigurationPath, true)
}
......@@ -19,9 +19,9 @@ import (
"github.com/mhe/gabi"
)
// ConfigurationStore keeps track of scheme managers, issuers, credential types and public keys,
// Configuration keeps track of scheme managers, issuers, credential types and public keys,
// dezerializing them from an irma_configuration folder, and downloads and saves new ones on demand.
type ConfigurationStore struct {
type Configuration struct {
SchemeManagers map[SchemeManagerIdentifier]*SchemeManager
Issuers map[IssuerIdentifier]*Issuer
CredentialTypes map[CredentialTypeIdentifier]*CredentialType
......@@ -32,18 +32,18 @@ type ConfigurationStore struct {
initialized bool
}
// NewConfigurationStore returns a new configuration store. After this
// NewConfiguration returns a new configuration. After this