/
warp.go
67 lines (59 loc) · 1.81 KB
/
warp.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package warp
//User defines functions which return data required about the authenticating
//user in order to perform WebAuthn transactions.
type User interface {
Name() string
Icon() string
ID() []byte
DisplayName() string
Credentials() map[string]Credential
}
//UserFinder defines a function which takes a user handle as a parameter and
//returns an object which implements the User interface and an error
type UserFinder func([]byte) (User, error)
//Credential defines functions which return data required about the stored
//credentials
type Credential interface {
User() User
ID() string
PublicKey() []byte
SignCount() uint
}
//CredentialFinder defines a function which takes a credential ID as a parameter
//and returns an object which implements the Credential interface and an error
type CredentialFinder func(string) (Credential, error)
//RelyingParty defines functions which return data required about the Relying
//Party in order to perform WebAuthn transactions.
type RelyingParty interface {
ID() string
Name() string
Icon() string
Origin() string
}
//ChallengeLength represents the size of the generated challenge. Must be
//greater than 16.
var ChallengeLength = 32
//SupportedAttestationStatementFormats returns the list of attestation formats
//currently supported by the library
func SupportedAttestationStatementFormats() []AttestationStatementFormat {
return []AttestationStatementFormat{
AttestationFormatNone,
}
}
//SupportedKeyAlgorithms returns the list of key algorithms currently supported
//by the library
func SupportedKeyAlgorithms() []COSEAlgorithmIdentifier {
return []COSEAlgorithmIdentifier{
AlgorithmEdDSA,
AlgorithmES512,
AlgorithmES384,
AlgorithmES256,
AlgorithmPS512,
AlgorithmPS384,
AlgorithmPS256,
AlgorithmRS512,
AlgorithmRS384,
AlgorithmRS256,
AlgorithmRS1,
}
}