-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathauthenticator_flags.go
38 lines (31 loc) · 1.14 KB
/
authenticator_flags.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
package webauthn
// AuthenticatorFlagsSize is the number of bytes in the AuthenticatorFlags.
const AuthenticatorFlagsSize = 1
// AuthenticatorFlags are flags that indicate information about AuthenticatorData.
type AuthenticatorFlags byte
// UserPresent returns true if the user is "present".
func (flags AuthenticatorFlags) UserPresent() bool {
return (flags & authenticatorFlagsUP) == authenticatorFlagsUP
}
// UserVerified returns true if the user is "verified".
func (flags AuthenticatorFlags) UserVerified() bool {
return (flags & authenticatorFlagsUV) == authenticatorFlagsUV
}
// AttestedCredentialDataIncluded returns true if the AuthenticatorData has attested credential data.
func (flags AuthenticatorFlags) AttestedCredentialDataIncluded() bool {
return (flags & authenticatorFlagsAT) == authenticatorFlagsAT
}
// ExtensionDataIncluded returns true if the AuthenticatorData has extension data.
func (flags AuthenticatorFlags) ExtensionDataIncluded() bool {
return (flags & authenticatorFlagsED) == authenticatorFlagsED
}
const (
authenticatorFlagsUP = 1 << iota
_
authenticatorFlagsUV
_
_
_
authenticatorFlagsAT
authenticatorFlagsED
)