-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
device.go
52 lines (46 loc) · 1008 Bytes
/
device.go
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
package mock
import (
"github.com/google/uuid"
"github.com/keys-pub/keysd/auth/fido2"
)
type device struct {
dev *fido2.Device
info *fido2.DeviceInfo
pin string
credentials map[string]*credential
}
type credential struct {
cred *fido2.Credential
secret []byte
}
type deviceOpts struct{}
func newDevice(path string, opts *deviceOpts) *device {
if opts == nil {
opts = &deviceOpts{}
}
dev := &fido2.Device{
Path: path,
ProductID: 123,
VendorID: 456,
Manufacturer: "Test Co.",
Product: "Test Key",
}
info := &fido2.DeviceInfo{
Versions: []string{},
Extensions: []string{"hmac-secret", "credMgmt"},
AAGUID: uuid.New().String(),
Options: []*fido2.Option{},
}
return &device{
dev: dev,
info: info,
pin: "12345",
credentials: map[string]*credential{},
}
}
func newCredential(cred *fido2.Credential, secret []byte) *credential {
return &credential{
cred: cred,
secret: secret,
}
}