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
6ad21f06
Commit
6ad21f06
authored
Jul 26, 2018
by
Sietse Ringers
Browse files
Rename AttributeDescription -> AttributeType
Co-authored-by:
Confiks
<
confiks@scriptbase.org
>
parent
658c3375
Changes
2
Hide whitespace changes
Inline
Side-by-side
descriptions.go
View file @
6ad21f06
...
...
@@ -55,15 +55,15 @@ type CredentialType struct {
SchemeManagerID
string
`xml:"SchemeManager"`
IsSingleton
bool
`xml:"ShouldBeSingleton"`
Description
TranslatedString
Attributes
[]
Attribute
Description
`xml:"Attributes>Attribute"`
XMLVersion
int
`xml:"version,attr"`
XMLName
xml
.
Name
`xml:"IssueSpecification"`
Attributes
[]
Attribute
Type
`xml:"Attributes>Attribute"`
XMLVersion
int
`xml:"version,attr"`
XMLName
xml
.
Name
`xml:"IssueSpecification"`
Valid
bool
`xml:"-"`
}
// Attribute
Description
is a description of an attribute within a credential type.
type
Attribute
Description
struct
{
// Attribute
Type
is a description of an attribute within a credential type.
type
Attribute
Type
struct
{
ID
string
`xml:"id,attr"`
Optional
string
`xml:"optional,attr" json:",omitempty"`
Index
*
int
`xml:"index,attr" json:",omitempty"`
...
...
@@ -71,11 +71,11 @@ type AttributeDescription struct {
Description
TranslatedString
}
func
(
ad
Attribute
Description
)
GetAttributeTypeIdentifier
(
cred
CredentialTypeIdentifier
)
AttributeTypeIdentifier
{
func
(
ad
Attribute
Type
)
GetAttributeTypeIdentifier
(
cred
CredentialTypeIdentifier
)
AttributeTypeIdentifier
{
return
NewAttributeTypeIdentifier
(
cred
.
String
()
+
"."
+
ad
.
ID
)
}
func
(
ad
Attribute
Description
)
IsOptional
()
bool
{
func
(
ad
Attribute
Type
)
IsOptional
()
bool
{
return
ad
.
Optional
==
"true"
}
...
...
@@ -107,7 +107,7 @@ func (ct CredentialType) IndexOf(ai AttributeTypeIdentifier) (int, error) {
return
-
1
,
errors
.
New
(
"Attribute identifier not found"
)
}
func
(
ct
CredentialType
)
Attribute
Description
(
ai
AttributeTypeIdentifier
)
*
Attribute
Description
{
func
(
ct
CredentialType
)
Attribute
Type
(
ai
AttributeTypeIdentifier
)
*
Attribute
Type
{
i
,
_
:=
ct
.
IndexOf
(
ai
)
if
i
==
-
1
{
return
nil
...
...
irmaclient/irmaclient_test.go
View file @
6ad21f06
...
...
@@ -423,13 +423,13 @@ func TestIssueOptionalAttributeUpdateSchemeManager(t *testing.T) {
schemeid
:=
irma
.
NewSchemeManagerIdentifier
(
"irma-demo"
)
credid
:=
irma
.
NewCredentialTypeIdentifier
(
"irma-demo.RU.studentCard"
)
attrid
:=
irma
.
NewAttributeTypeIdentifier
(
"irma-demo.RU.studentCard.level"
)
require
.
False
(
t
,
client
.
Configuration
.
CredentialTypes
[
credid
]
.
Attribute
Description
(
attrid
)
.
IsOptional
())
require
.
False
(
t
,
client
.
Configuration
.
CredentialTypes
[
credid
]
.
Attribute
Type
(
attrid
)
.
IsOptional
())
client
.
Configuration
.
SchemeManagers
[
schemeid
]
.
URL
=
"http://localhost:48681/irma_configuration_updated/irma-demo"
issuanceRequest
:=
getIssuanceRequest
(
true
)
delete
(
issuanceRequest
.
Credentials
[
0
]
.
Attributes
,
"level"
)
client
.
Configuration
.
Download
(
issuanceRequest
)
require
.
True
(
t
,
client
.
Configuration
.
CredentialTypes
[
credid
]
.
Attribute
Description
(
attrid
)
.
IsOptional
())
require
.
True
(
t
,
client
.
Configuration
.
CredentialTypes
[
credid
]
.
Attribute
Type
(
attrid
)
.
IsOptional
())
test
.
ClearTestStorage
(
t
)
}
...
...
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