-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreturnUafRequest.go
More file actions
74 lines (62 loc) · 1.34 KB
/
returnUafRequest.go
File metadata and controls
74 lines (62 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package k6fido
const lifetimeMillis int64 = 300000
// UafStatusCode An enum to define FIDO UafStatusCode
type UafStatusCode int
const (
OK = 1200
ACCEPTED = 1202
)
func (c UafStatusCode) code() int {
return int(c)
}
func (c UafStatusCode) fromCode() UafStatusCode {
switch c {
case OK:
return OK
case ACCEPTED:
return ACCEPTED
default:
return 0
}
}
// Operation An enum used to define FIDO operation which a user requests
type Operation int
const (
Reg = iota
Auth
Dereg
)
func (o Operation) fromOperation() string {
switch o {
case Reg:
return "Reg"
case Auth:
return "Auth"
case Dereg:
return "Dereg"
default:
return ""
}
}
type ReturnUafRequest struct {
StatusCode UafStatusCode `json:"statusCode"`
UafRequest string `json:"uafRequest"`
Op Operation `json:"op"`
LifetimeMillis int64 `json:"lifetimeMillis"`
}
func NewFidoRegistrationReturnUafRequest(uafRequest string) *ReturnUafRequest {
return &ReturnUafRequest{
StatusCode: OK,
UafRequest: uafRequest,
Op: Reg,
LifetimeMillis: lifetimeMillis,
}
}
func NewFidoAuthenticationReturnUafRequest(uafRequest string) *ReturnUafRequest {
return &ReturnUafRequest{
StatusCode: OK,
UafRequest: uafRequest,
Op: Auth,
LifetimeMillis: lifetimeMillis,
}
}