Commit 235c5e6b authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Rename ConfigurationStore.Credential -> CredentialTypes

parent 2e3036ca
......@@ -302,7 +302,7 @@ func (disjunction *AttributeDisjunction) Satisfied() bool {
// present in the specified configuration store.
func (disjunction *AttributeDisjunction) MatchesStore(store *ConfigurationStore) bool {
for ai := range disjunction.Values {
creddescription, exists := store.Credentials[ai.CredentialTypeIdentifier()]
creddescription, exists := store.CredentialTypes[ai.CredentialTypeIdentifier()]
if !exists {
return false
}
......
......@@ -15,9 +15,9 @@ import (
// ConfigurationStore keeps track of scheme managers, issuers, credential types and public keys.
type ConfigurationStore struct {
SchemeManagers map[SchemeManagerIdentifier]*SchemeManager
Issuers map[IssuerIdentifier]*Issuer
Credentials map[CredentialTypeIdentifier]*CredentialType
SchemeManagers map[SchemeManagerIdentifier]*SchemeManager
Issuers map[IssuerIdentifier]*Issuer
CredentialTypes map[CredentialTypeIdentifier]*CredentialType
publicKeys map[IssuerIdentifier][]*gabi.PublicKey
reverseHashes map[string]CredentialTypeIdentifier
......@@ -56,7 +56,7 @@ func (store *ConfigurationStore) ParseFolder() error {
// Init all maps
store.SchemeManagers = make(map[SchemeManagerIdentifier]*SchemeManager)
store.Issuers = make(map[IssuerIdentifier]*Issuer)
store.Credentials = make(map[CredentialTypeIdentifier]*CredentialType)
store.CredentialTypes = make(map[CredentialTypeIdentifier]*CredentialType)
store.publicKeys = make(map[IssuerIdentifier][]*gabi.PublicKey)
store.reverseHashes = make(map[string]CredentialTypeIdentifier)
......@@ -104,7 +104,7 @@ func (store *ConfigurationStore) addReverseHash(credid CredentialTypeIdentifier)
func (store *ConfigurationStore) hashToCredentialType(hash []byte) *CredentialType {
if str, exists := store.reverseHashes[base64.StdEncoding.EncodeToString(hash)]; exists {
return store.Credentials[str]
return store.CredentialTypes[str]
}
return nil
}
......@@ -161,7 +161,7 @@ func (store *ConfigurationStore) parseCredentialsFolder(path string) error {
}
if exists {
credid := cred.Identifier()
store.Credentials[credid] = cred
store.CredentialTypes[credid] = cred
store.addReverseHash(credid)
}
return nil
......@@ -222,7 +222,7 @@ func pathToDescription(path string, description interface{}) (bool, error) {
func (store *ConfigurationStore) Contains(cred CredentialTypeIdentifier) bool {
return store.SchemeManagers[cred.IssuerIdentifier().SchemeManagerIdentifier()] != nil &&
store.Issuers[cred.IssuerIdentifier()] != nil &&
store.Credentials[cred] != nil
store.CredentialTypes[cred] != nil
}
func (store *ConfigurationStore) Copy(source string, parse bool) error {
......
......@@ -98,5 +98,5 @@ func (cl CredentialInfoList) Swap(i, j int) {
// Less implements sort.Interface.
func (cl CredentialInfoList) Less(i, j int) bool {
// TODO Decide on sorting, and if it depends on a TranslatedString, allow language choosing
return strings.Compare(cl[i].Type.Name["en"], cl[j].Type.Name["en"]) > 0
return strings.Compare(cl[i].Name, cl[j].Name) > 0
}
......@@ -149,12 +149,12 @@ func verifyStoreIsLoaded(t *testing.T, store *ConfigurationStore, android bool)
"irma-demo.RU issuer has unexpected name")
require.Equal(t,
"Student Card",
store.Credentials[NewCredentialTypeIdentifier("irma-demo.RU.studentCard")].ShortName["en"],
store.CredentialTypes[NewCredentialTypeIdentifier("irma-demo.RU.studentCard")].ShortName["en"],
"irma-demo.RU.studentCard has unexpected name")
require.Equal(t,
"studentID",
store.Credentials[NewCredentialTypeIdentifier("irma-demo.RU.studentCard")].Attributes[2].ID,
store.CredentialTypes[NewCredentialTypeIdentifier("irma-demo.RU.studentCard")].Attributes[2].ID,
"irma-demo.RU.studentCard.studentID has unexpected name")
// Hash algorithm pseudocode:
......
......@@ -436,7 +436,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.ConfigurationStore.Credentials[identifier.CredentialTypeIdentifier()].IndexOf(identifier)
index, err := cm.ConfigurationStore.CredentialTypes[identifier.CredentialTypeIdentifier()].IndexOf(identifier)
if err != nil {
return nil, err
}
......
......@@ -122,7 +122,7 @@ func (cr *CredentialRequest) AttributeList(store *ConfigurationStore) (*Attribut
}
attrs := make([]*big.Int, len(cr.Attributes)+1, len(cr.Attributes)+1)
credtype := store.Credentials[*cr.Credential]
credtype := store.CredentialTypes[*cr.Credential]
if credtype == nil {
return nil, errors.New("Unknown credential type")
}
......
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