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

Rename CredentialManager.Store to ConfigurationStore

parent 1093f9d0
......@@ -165,7 +165,7 @@ func verifyStoreIsLoaded(t *testing.T, store *ConfigurationStore, android bool)
func TestAndroidParse(t *testing.T) {
manager := parseStorage(t)
verifyStoreIsLoaded(t, manager.Store, true)
verifyStoreIsLoaded(t, manager.ConfigurationStore, true)
verifyManagerIsUnmarshaled(t, manager)
verifyCredentials(t, manager)
verifyKeyshareIsUnmarshaled(t, manager)
......
......@@ -139,7 +139,7 @@ func startKeyshareSession(
) {
ksscount := 0
for _, managerID := range session.SchemeManagers() {
if credManager.Store.SchemeManagers[managerID].Distributed() {
if credManager.ConfigurationStore.SchemeManagers[managerID].Distributed() {
ksscount++
if _, registered := credManager.keyshareServers[managerID]; !registered {
err := errors.New("Not registered to keyshare server of scheme manager " + managerID.String())
......@@ -166,7 +166,7 @@ func startKeyshareSession(
askPin := false
for _, managerID := range session.SchemeManagers() {
if !ks.credManager.Store.SchemeManagers[managerID].Distributed() {
if !ks.credManager.ConfigurationStore.SchemeManagers[managerID].Distributed() {
continue
}
......@@ -234,7 +234,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.SchemeManagers() {
if !ks.credManager.Store.SchemeManagers[managerID].Distributed() {
if !ks.credManager.ConfigurationStore.SchemeManagers[managerID].Distributed() {
continue
}
......@@ -285,7 +285,7 @@ func (ks *keyshareSession) GetCommitments() {
for _, builder := range ks.builders {
pk := builder.PublicKey()
managerID := NewIssuerIdentifier(pk.Issuer).SchemeManagerIdentifier()
if !ks.credManager.Store.SchemeManagers[managerID].Distributed() {
if !ks.credManager.ConfigurationStore.SchemeManagers[managerID].Distributed() {
continue
}
if _, contains := pkids[managerID]; !contains {
......@@ -297,7 +297,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.SchemeManagers() {
if !ks.credManager.Store.SchemeManagers[managerID].Distributed() {
if !ks.credManager.ConfigurationStore.SchemeManagers[managerID].Distributed() {
continue
}
......@@ -401,7 +401,7 @@ func (ks *keyshareSession) finishDisclosureOrSigning(challenge *big.Int, respons
for i, builder := range ks.builders {
// Parse each received JWT
managerID := NewIssuerIdentifier(builder.PublicKey().Issuer).SchemeManagerIdentifier()
if !ks.credManager.Store.SchemeManagers[managerID].Distributed() {
if !ks.credManager.ConfigurationStore.SchemeManagers[managerID].Distributed() {
continue
}
msg := struct {
......
......@@ -58,7 +58,7 @@ func (session *session) createLogEntry(response gabi.ProofList) (*LogEntry, erro
case ActionIssuing:
item := &IssuanceLog{Proofs: proofs}
for _, req := range session.jwt.(*IdentityProviderJwt).Request.Request.Credentials {
list, err := req.AttributeList(session.credManager.Store)
list, err := req.AttributeList(session.credManager.ConfigurationStore)
if err != nil {
continue // TODO?
}
......
......@@ -22,7 +22,7 @@ type CredentialManager struct {
irmaConfigurationPath string
androidStoragePath string
Store *ConfigurationStore
ConfigurationStore *ConfigurationStore
updates []update
}
......@@ -114,7 +114,7 @@ func (cm *CredentialManager) credential(id CredentialTypeIdentifier, counter int
Attributes: append([]*big.Int{cm.secretkey.Key}, attrs.Ints...),
Signature: sig,
Pk: pk,
}, cm.Store)
}, cm.ConfigurationStore)
if err != nil {
return nil, err
}
......@@ -152,7 +152,7 @@ func (cm *CredentialManager) Candidates(disjunction *AttributeDisjunction) []*At
for _, attribute := range disjunction.Attributes {
credID := attribute.CredentialTypeIdentifier()
if !cm.Store.Contains(credID) {
if !cm.ConfigurationStore.Contains(credID) {
continue
}
creds := cm.credentials[credID]
......@@ -212,7 +212,7 @@ func (cm *CredentialManager) groupCredentials(choice *DisclosureChoice) (map[Cre
if identifier.IsCredential() {
continue // In this case we only disclose the metadata attribute, which is already handled
}
index, err := cm.Store.Credentials[identifier.CredentialTypeIdentifier()].IndexOf(identifier)
index, err := cm.ConfigurationStore.Credentials[identifier.CredentialTypeIdentifier()].IndexOf(identifier)
if err != nil {
return nil, err
}
......@@ -276,7 +276,7 @@ func (cm *CredentialManager) IssuanceProofBuilders(request *IssuanceRequest) (ga
proofBuilders := gabi.ProofBuilderList([]gabi.ProofBuilder{})
for _, futurecred := range request.Credentials {
pk, err := cm.Store.PublicKey(futurecred.Credential.IssuerIdentifier(), futurecred.KeyCounter)
pk, err := cm.ConfigurationStore.PublicKey(futurecred.Credential.IssuerIdentifier(), futurecred.KeyCounter)
if err != nil {
return nil, err
}
......@@ -316,7 +316,7 @@ func (cm *CredentialManager) ConstructCredentials(msg []*gabi.IssueSignatureMess
// we save none of them to fail the session cleanly
gabicreds := []*gabi.Credential{}
for i, sig := range msg {
attrs, err := request.Credentials[i].AttributeList(cm.Store)
attrs, err := request.Credentials[i].AttributeList(cm.ConfigurationStore)
if err != nil {
return err
}
......@@ -328,7 +328,7 @@ func (cm *CredentialManager) ConstructCredentials(msg []*gabi.IssueSignatureMess
}
for _, gabicred := range gabicreds {
newcred, err := newCredential(gabicred, cm.Store)
newcred, err := newCredential(gabicred, cm.ConfigurationStore)
if err != nil {
return err
}
......@@ -359,7 +359,7 @@ func (cm *CredentialManager) paillierKey(wait bool) *paillierPrivateKey {
func (cm *CredentialManager) unenrolledKeyshareServers() []*SchemeManager {
list := []*SchemeManager{}
for name, manager := range cm.Store.SchemeManagers {
for name, manager := range cm.ConfigurationStore.SchemeManagers {
if _, contains := cm.keyshareServers[name]; len(manager.KeyshareServer) > 0 && !contains {
list = append(list, manager)
}
......@@ -369,7 +369,7 @@ func (cm *CredentialManager) unenrolledKeyshareServers() []*SchemeManager {
// KeyshareEnroll attempts to register at the keyshare server of the specified scheme manager.
func (cm *CredentialManager) KeyshareEnroll(managerID SchemeManagerIdentifier, email, pin string) error {
manager, ok := cm.Store.SchemeManagers[managerID]
manager, ok := cm.ConfigurationStore.SchemeManagers[managerID]
if !ok {
return errors.New("Unknown scheme manager")
}
......
......@@ -191,7 +191,7 @@ func (session *session) do(proceed bool) {
}
session.Handler.StatusUpdate(session.Action, StatusCommunicating)
if !session.irmaSession.Distributed(session.credManager.Store) {
if !session.irmaSession.Distributed(session.credManager.ConfigurationStore) {
var message interface{}
var err error
switch session.Action {
......
......@@ -96,7 +96,7 @@ func NewCredentialManager(
attributes: make(map[CredentialTypeIdentifier][]*AttributeList),
irmaConfigurationPath: irmaConfigurationPath,
androidStoragePath: androidStoragePath,
Store: NewConfigurationStore(storagePath + "/irma_configuration"),
ConfigurationStore: NewConfigurationStore(storagePath + "/irma_configuration"),
}
exists, err := PathExists(cm.irmaConfigurationPath)
......@@ -109,7 +109,7 @@ func NewCredentialManager(
if err = cm.ensureStorageExists(); err != nil {
return nil, err
}
if err = cm.Store.ParseFolder(); err != nil {
if err = cm.ConfigurationStore.ParseFolder(); err != nil {
return nil, err
}
......@@ -222,14 +222,14 @@ func (cm *CredentialManager) ensureStorageExists() error {
return errors.New("credential storage path does not exist")
}
if exist, err = PathExists(cm.Store.path); err != nil {
if exist, err = PathExists(cm.ConfigurationStore.path); err != nil {
return err
}
if !exist {
if err = ensureDirectoryExists(cm.Store.path); err != nil {
if err = ensureDirectoryExists(cm.ConfigurationStore.path); err != nil {
return err
}
cm.Store.Copy(cm.irmaConfigurationPath, false)
cm.ConfigurationStore.Copy(cm.irmaConfigurationPath, false)
}
return ensureDirectoryExists(cm.path(signaturesDir))
}
......@@ -366,7 +366,7 @@ func (cm *CredentialManager) loadAttributes() (list map[CredentialTypeIdentifier
return nil, err
}
for _, attrlist := range temp {
attrlist.MetadataAttribute = MetadataFromInt(attrlist.Ints[0], cm.Store)
attrlist.MetadataAttribute = MetadataFromInt(attrlist.Ints[0], cm.ConfigurationStore)
id := attrlist.CredentialType()
var ct CredentialTypeIdentifier
if id != nil {
......
......@@ -94,7 +94,7 @@ func (cm *CredentialManager) ParseAndroidStorage() (present bool, err error) {
gabicred.Signature.KeyshareP = oldcred.SharedPoints[0]
}
var cred *credential
if cred, err = newCredential(gabicred, cm.Store); err != nil {
if cred, err = newCredential(gabicred, cm.ConfigurationStore); err != nil {
return
}
if cred.CredentialType() == nil {
......@@ -130,9 +130,9 @@ func (cm *CredentialManager) ParseAndroidStorage() (present bool, err error) {
cm.paillierKey(false) // trigger calculating a new one
}
if err = cm.Store.Copy(cm.androidStoragePath+"/app_store/irma_configuration", false); err != nil {
if err = cm.ConfigurationStore.Copy(cm.androidStoragePath+"/app_store/irma_configuration", false); err != nil {
return
}
// Copy from assets again to ensure we have the latest versions
return present, cm.Store.Copy(cm.irmaConfigurationPath, true)
return present, cm.ConfigurationStore.Copy(cm.irmaConfigurationPath, true)
}
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