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
f4262fdf
Commit
f4262fdf
authored
Feb 28, 2018
by
Sietse Ringers
Browse files
Floor credential validity to epoch boundary in issuance unit tests
parent
c7a2406c
Changes
2
Hide whitespace changes
Inline
Side-by-side
attributes.go
View file @
f4262fdf
...
...
@@ -256,6 +256,13 @@ func (attr *MetadataAttribute) IsValid() bool {
return
attr
.
IsValidOn
(
time
.
Now
())
}
// FloorToEpochBoundary returns the greatest time not greater than the argument
// that falls on the boundary of an epoch for attribute validity or expiry,
// of which the value is defined by ExpiryFactor (one week).
func
FloorToEpochBoundary
(
t
time
.
Time
)
time
.
Time
{
return
time
.
Unix
((
t
.
Unix
()
/
ExpiryFactor
)
*
ExpiryFactor
,
0
)
}
func
(
attr
*
MetadataAttribute
)
field
(
field
metadataField
)
[]
byte
{
return
attr
.
Bytes
()[
field
.
offset
:
field
.
offset
+
field
.
length
]
}
...
...
irmaclient/session_test.go
View file @
f4262fdf
...
...
@@ -106,7 +106,7 @@ func getSigningJwt(name string, id irma.AttributeTypeIdentifier) interface{} {
}
func
getIssuanceRequest
(
defaultValidity
bool
)
*
irma
.
IssuanceRequest
{
temp
:=
irma
.
Timestamp
(
time
.
Now
()
.
AddDate
(
1
,
0
,
0
))
temp
:=
irma
.
Timestamp
(
irma
.
FloorToEpochBoundary
(
time
.
Now
()
.
AddDate
(
1
,
0
,
0
))
)
var
expiry
*
irma
.
Timestamp
credid1
:=
irma
.
NewCredentialTypeIdentifier
(
"irma-demo.RU.studentCard"
)
credid2
:=
irma
.
NewCredentialTypeIdentifier
(
"irma-demo.MijnOverheid.root"
)
...
...
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