-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwarp.go
71 lines (63 loc) · 2.14 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
68
69
70
71
//Package warp is a WebAuthn Relying Party implementation for Go that is not
//attached to net/http. Bring your own everything, parse the standards-compliant
//JSON, and pass into the appropriate functions. For full documentation visit
//https://github.com/e3b0c442/warp
package warp
//User defines functions which return data required about the authenticating
//user in order to perform WebAuthn transactions.
type User interface {
EntityName() string
EntityIcon() string
EntityID() []byte
EntityDisplayName() 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 {
Owner() User
CredentialSignCount() uint
CredentialID() []byte
CredentialPublicKey() []byte
}
//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([]byte) (Credential, error)
//RelyingParty defines functions which return data required about the Relying
//Party in order to perform WebAuthn transactions.
type RelyingParty interface {
EntityID() string
EntityName() string
EntityIcon() 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,
}
}