Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IRMA
Github mirrors
irmago
Commits
235c5e6b
Commit
235c5e6b
authored
Oct 05, 2017
by
Sietse Ringers
Browse files
Rename ConfigurationStore.Credential -> CredentialTypes
parent
2e3036ca
Changes
6
Hide whitespace changes
Inline
Side-by-side
attributes.go
View file @
235c5e6b
...
...
@@ -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
.
Credential
Type
s
[
ai
.
CredentialTypeIdentifier
()]
if
!
exists
{
return
false
}
...
...
configstore.go
View file @
235c5e6b
...
...
@@ -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
Credential
s
map
[
CredentialTypeIdentifier
]
*
CredentialType
SchemeManagers
map
[
SchemeManagerIdentifier
]
*
SchemeManager
Issuers
map
[
IssuerIdentifier
]
*
Issuer
Credential
Types
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
.
Credential
Type
s
=
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
.
Credential
Type
s
[
str
]
}
return
nil
}
...
...
@@ -161,7 +161,7 @@ func (store *ConfigurationStore) parseCredentialsFolder(path string) error {
}
if
exists
{
credid
:=
cred
.
Identifier
()
store
.
Credentials
[
credid
]
=
cred
store
.
Credential
Type
s
[
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
.
Credential
Type
s
[
cred
]
!=
nil
}
func
(
store
*
ConfigurationStore
)
Copy
(
source
string
,
parse
bool
)
error
{
...
...
credential.go
View file @
235c5e6b
...
...
@@ -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
}
irmago_test.go
View file @
235c5e6b
...
...
@@ -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
.
Credential
Type
s
[
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
.
Credential
Type
s
[
NewCredentialTypeIdentifier
(
"irma-demo.RU.studentCard"
)]
.
Attributes
[
2
]
.
ID
,
"irma-demo.RU.studentCard.studentID has unexpected name"
)
// Hash algorithm pseudocode:
...
...
manager.go
View file @
235c5e6b
...
...
@@ -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
.
Credential
Type
s
[
identifier
.
CredentialTypeIdentifier
()]
.
IndexOf
(
identifier
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
requests.go
View file @
235c5e6b
...
...
@@ -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
.
Credential
Type
s
[
*
cr
.
Credential
]
if
credtype
==
nil
{
return
nil
,
errors
.
New
(
"Unknown credential type"
)
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment