package webauthn import ( "github.com/go-webauthn/webauthn/webauthn" ) // AccountUser implements the webauthn.User interface for an MCIAS account. // The WebAuthnCredentials field must be populated with decrypted credentials // before passing to the library. type AccountUser struct { id []byte // UUID as bytes name string displayName string credentials []webauthn.Credential } // NewAccountUser creates a new AccountUser from account details and decrypted credentials. func NewAccountUser(uuidBytes []byte, username string, creds []webauthn.Credential) *AccountUser { return &AccountUser{ id: uuidBytes, name: username, displayName: username, credentials: creds, } } // WebAuthnID returns the user's unique ID as bytes. func (u *AccountUser) WebAuthnID() []byte { return u.id } // WebAuthnName returns the user's login name. func (u *AccountUser) WebAuthnName() string { return u.name } // WebAuthnDisplayName returns the user's display name. func (u *AccountUser) WebAuthnDisplayName() string { return u.displayName } // WebAuthnCredentials returns the user's registered credentials. func (u *AccountUser) WebAuthnCredentials() []webauthn.Credential { return u.credentials }