Skip to content
GitLab
Menu
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
a81872bd
Commit
a81872bd
authored
Jul 28, 2017
by
Sietse Ringers
Browse files
Fix timestamp (de)serializing
parent
11cf952d
Changes
2
Hide whitespace changes
Inline
Side-by-side
protocol/protocol_test.go
View file @
a81872bd
...
...
@@ -4,6 +4,8 @@ import (
"encoding/json"
"testing"
"time"
"github.com/credentials/irmago"
"github.com/stretchr/testify/require"
)
...
...
@@ -50,6 +52,17 @@ func TestAttributeDisjunctionMarshaling(t *testing.T) {
require
.
True
(
t
,
disjunction
.
Satisfied
())
}
func
TestTimestamp
(
t
*
testing
.
T
)
{
mytime
:=
Timestamp
(
time
.
Unix
(
1500000000
,
0
))
timestruct
:=
struct
{
Time
*
Timestamp
}{
Time
:
&
mytime
}
bytes
,
err
:=
json
.
Marshal
(
timestruct
)
require
.
NoError
(
t
,
err
)
timestruct
=
struct
{
Time
*
Timestamp
}{}
require
.
NoError
(
t
,
json
.
Unmarshal
(
bytes
,
&
timestruct
))
require
.
Equal
(
t
,
time
.
Time
(
*
timestruct
.
Time
)
.
Unix
(),
int64
(
1500000000
))
}
func
TestServiceProviderRequest
(
t
*
testing
.
T
)
{
var
sprequest
ServiceProviderRequest
...
...
protocol/requests.go
View file @
a81872bd
...
...
@@ -44,16 +44,16 @@ type SignatureRequest struct {
}
type
CredentialRequest
struct
{
Validity
Timestamp
Validity
*
Timestamp
KeyCounter
int
Credential
irmago
.
CredentialTypeIdentifier
Attributes
map
[
string
]
string
}
type
ServerRequest
struct
{
ServerName
string
`json:"iss"`
IssuedAt
Timestamp
`json:"iat"`
Type
string
`json:"subject"`
ServerName
string
`json:"iss"`
IssuedAt
*
Timestamp
`json:"iat"`
Type
string
`json:"subject"`
}
type
IssuanceRequest
struct
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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