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
86dc307d
Commit
86dc307d
authored
Jul 25, 2017
by
Sietse Ringers
Browse files
Make field names of credentialtypes, issuers, scheme managers more consistent
parent
36bf911a
Changes
3
Hide whitespace changes
Inline
Side-by-side
descriptions.go
View file @
86dc307d
...
...
@@ -8,9 +8,9 @@ import (
// SchemeManager describes a scheme manager.
type
SchemeManager
struct
{
Name
string
`xml:"Id"`
ID
string
`xml:"Id"`
Name
TranslatedString
`xml:"Name"`
URL
string
`xml:"Contact"`
HRName
TranslatedString
`xml:"Name"`
Description
TranslatedString
KeyshareServer
string
KeyshareWebsite
string
...
...
@@ -21,28 +21,28 @@ type SchemeManager struct {
// Issuer describes an issuer.
type
Issuer
struct
{
HRName
TranslatedString
`xml:"
Name
"`
HRShortName
TranslatedString
`xml:"
Short
Name"`
Name
string
`xml:"ID
"`
SchemeManager
Name
string
`xml:"SchemeManager"`
ContactAddress
string
ContactEMail
string
URL
string
`xml:"baseURL"`
XMLVersion
int
`xml:"version,attr"`
ID
string
`xml:"
ID
"`
Name
TranslatedString
`xml:"Name"`
ShortName
TranslatedString
`xml:"ShortName
"`
SchemeManager
ID
string
`xml:"SchemeManager"`
ContactAddress
string
ContactEMail
string
URL
string
`xml:"baseURL"`
XMLVersion
int
`xml:"version,attr"`
}
// CredentialType is a description of a credential type, specifying (a.o.) its name, issuer, and attributes.
type
CredentialType
struct
{
HRName
TranslatedString
`xml:"Name
"`
HRShortName
TranslatedString
`xml:"
Short
Name"`
Issuer
Name
string
`xml:"IssuerID
"`
SchemeManagerName
string
`xml:"
SchemeManager
"`
Name
string
`xml:"
CredentialID
"`
IsSingleton
bool
`xml:"ShouldBeSingleton"`
Description
TranslatedString
Attributes
[]
AttributeDescription
`xml:"Attributes>Attribute"`
XMLVersion
int
`xml:"version,attr"`
XMLName
xml
.
Name
`xml:"IssueSpecification"`
ID
string
`xml:"CredentialID
"`
Name
TranslatedString
`xml:"Name"`
Short
Name
TranslatedString
`xml:"ShortName
"`
IssuerID
string
`xml:"
IssuerID
"`
SchemeManagerID
string
`xml:"
SchemeManager
"`
IsSingleton
bool
`xml:"ShouldBeSingleton"`
Description
TranslatedString
Attributes
[]
AttributeDescription
`xml:"Attributes>Attribute"`
XMLVersion
int
`xml:"version,attr"`
XMLName
xml
.
Name
`xml:"IssueSpecification"`
}
// AttributeDescription is a description of an attribute within a credential type.
...
...
@@ -93,17 +93,17 @@ func (ts *TranslatedString) Translation(lang string) string {
// Identifier returns the identifier of the specified credential type.
func
(
cd
*
CredentialType
)
Identifier
()
string
{
return
cd
.
SchemeManager
Name
+
"."
+
cd
.
Issuer
Name
+
"."
+
cd
.
Name
return
cd
.
SchemeManager
ID
+
"."
+
cd
.
Issuer
ID
+
"."
+
cd
.
ID
}
// IssuerIdentifier returns the issuer identifier of the specified credential type.
func
(
cd
*
CredentialType
)
IssuerIdentifier
()
string
{
return
cd
.
SchemeManager
Name
+
"."
+
cd
.
Issuer
Name
return
cd
.
SchemeManager
ID
+
"."
+
cd
.
Issuer
ID
}
// Identifier returns the identifier of the specified issuer description.
func
(
id
*
Issuer
)
Identifier
()
string
{
return
id
.
SchemeManager
Name
+
"."
+
id
.
Name
return
id
.
SchemeManager
ID
+
"."
+
id
.
ID
}
// CurrentPublicKey returns the latest known public key of the issuer identified by this instance.
...
...
irmago_test.go
View file @
86dc307d
...
...
@@ -94,15 +94,15 @@ func TestParseStore(t *testing.T) {
assert
.
NotNil
(
t
,
MetaStore
.
Issuers
[
"irma-demo.RU"
]
.
CurrentPublicKey
()
.
N
,
"irma-demo.RU public key has no modulus"
)
assert
.
Equal
(
t
,
"Irma Demo"
,
MetaStore
.
SchemeManagers
[
"irma-demo"
]
.
HR
Name
.
Translation
(
"en"
),
MetaStore
.
SchemeManagers
[
"irma-demo"
]
.
Name
.
Translation
(
"en"
),
"irma-demo scheme manager has unexpected name"
)
assert
.
Equal
(
t
,
"Radboud Universiteit Nijmegen"
,
MetaStore
.
Issuers
[
"irma-demo.RU"
]
.
HR
Name
.
Translation
(
"en"
),
MetaStore
.
Issuers
[
"irma-demo.RU"
]
.
Name
.
Translation
(
"en"
),
"irma-demo.RU issuer has unexpected name"
)
assert
.
Equal
(
t
,
"Student Card"
,
MetaStore
.
Credentials
[
"irma-demo.RU.studentCard"
]
.
HR
ShortName
.
Translation
(
"en"
),
MetaStore
.
Credentials
[
"irma-demo.RU.studentCard"
]
.
ShortName
.
Translation
(
"en"
),
"irma-demo.RU.studentCard has unexpected name"
)
assert
.
Equal
(
t
,
...
...
store.go
View file @
86dc307d
...
...
@@ -74,7 +74,7 @@ func (store *ConfigurationStore) ParseFolder(path string) error {
return
err
}
if
exists
{
MetaStore
.
SchemeManagers
[
manager
.
Name
]
=
manager
MetaStore
.
SchemeManagers
[
manager
.
ID
]
=
manager
return
store
.
parseIssuerFolders
(
dir
)
}
return
nil
...
...
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