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
b2f2c486
Commit
b2f2c486
authored
Jul 28, 2017
by
Sietse Ringers
Browse files
Move stuff
parent
a81872bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
protocol/messages.go
0 → 100644
View file @
b2f2c486
package
protocol
import
(
"fmt"
"strconv"
"time"
)
const
(
DISCLOSING
=
"disclosing"
ISSUING
=
"issuing"
SIGNING
=
"signing"
)
type
Timestamp
time
.
Time
type
Qr
struct
{
Url
string
`json:"u"`
ProtocolVersion
string
`json:"v"`
ProtocolMaxVersion
string
`json:"vmax"`
Type
string
`json:"irmaqr"`
}
func
(
t
*
Timestamp
)
MarshalJSON
()
([]
byte
,
error
)
{
ts
:=
time
.
Time
(
*
t
)
.
Unix
()
stamp
:=
fmt
.
Sprint
(
ts
)
return
[]
byte
(
stamp
),
nil
}
func
(
t
*
Timestamp
)
UnmarshalJSON
(
b
[]
byte
)
error
{
ts
,
err
:=
strconv
.
Atoi
(
string
(
b
))
if
err
!=
nil
{
return
err
}
*
t
=
Timestamp
(
time
.
Unix
(
int64
(
ts
),
0
))
return
nil
}
protocol/requests.go
View file @
b2f2c486
...
...
@@ -2,31 +2,10 @@ package protocol
import
(
"math/big"
"time"
"fmt"
"strconv"
"github.com/credentials/irmago"
)
type
Timestamp
time
.
Time
func
(
t
*
Timestamp
)
MarshalJSON
()
([]
byte
,
error
)
{
ts
:=
time
.
Time
(
*
t
)
.
Unix
()
stamp
:=
fmt
.
Sprint
(
ts
)
return
[]
byte
(
stamp
),
nil
}
func
(
t
*
Timestamp
)
UnmarshalJSON
(
b
[]
byte
)
error
{
ts
,
err
:=
strconv
.
Atoi
(
string
(
b
))
if
err
!=
nil
{
return
err
}
*
t
=
Timestamp
(
time
.
Unix
(
int64
(
ts
),
0
))
return
nil
}
type
SessionRequest
struct
{
Context
*
big
.
Int
`json:"nonce"`
Nonce
*
big
.
Int
`json:"context"`
...
...
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