-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.go
28 lines (24 loc) · 914 Bytes
/
user.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
package webauthn
import (
"github.com/go-webauthn/webauthn/webauthn"
)
// WebAuthnUser implements webauthn.User interface
type WebAuthnUser struct {
id []byte
name string
displayName string
credentials []webauthn.Credential
}
func NewWebAuthnUser(id string, name string, displayName string) *WebAuthnUser {
return &WebAuthnUser{
id: []byte(id),
name: name,
displayName: displayName,
}
}
// Implementation of webauthn.User interface
func (u *WebAuthnUser) WebAuthnID() []byte { return u.id }
func (u *WebAuthnUser) WebAuthnName() string { return u.name }
func (u *WebAuthnUser) WebAuthnDisplayName() string { return u.displayName }
func (u *WebAuthnUser) WebAuthnCredentials() []webauthn.Credential { return u.credentials }
func (u *WebAuthnUser) WebAuthnIcon() string { return "" }