Documentation ¶
Overview ¶
Package webauthn is a provider package offering Passkey login functionality
Index ¶
Constants ¶
View Source
const (
ProviderName = "WEBAUTHN"
)
Variables ¶
View Source
var ( // ErrUserNotFound is returned when the user couldn't be found ErrUserNotFound = errors.New("user not found") // ErrSessionNotFound is returned when the session couldn't be found ErrSessionNotFound = errors.New("session not found") )
View Source
var Sessions = map[string]*webauthn.SessionData{}
View Source
var Users = map[string]*User{}
Functions ¶
func NewWithConfig ¶
func NewWithConfig(config ProviderConfig) *webauthn.WebAuthn
NewWithConfig returns a configured Webauthn Provider
Types ¶
type ProviderConfig ¶
type ProviderConfig struct { // Enabled is the provider enabled Enabled bool `json:"enabled" koanf:"enabled" default:"true"` // DisplayName is the site display name DisplayName string `json:"displayName" koanf:"displayName" jsonschema:"required" default:"Datum"` // RelyingPartyID is the relying party identifier // set to localhost for development, no port RelyingPartyID string `json:"relyingPartyId" koanf:"relyingPartyId" jsonschema:"required" default:"localhost"` // RequestOrigin the origin domain for authentication requests // include the scheme and port RequestOrigin string `json:"requestOrigin" koanf:"requestOrigin" jsonschema:"required" default:"http://localhost:3001"` // MaxDevices is the maximum number of devices that can be associated with a user MaxDevices int `json:"maxDevices" koanf:"maxDevices" default:"10"` // EnforceTimeout at the Relying Party / Server. This means if enabled and the user takes too long that even if the browser does not // enforce a timeout, the server will EnforceTimeout bool `json:"enforceTimeout" koanf:"enforceTimeout" default:"true"` // Timeout is the timeout in seconds Timeout time.Duration `json:"timeout" koanf:"timeout" default:"60s"` // Debug enables debug mode Debug bool `json:"debug" koanf:"debug" default:"false"` }
ProviderConfig represents the configuration settings for a Webauthn Provider
type User ¶
type User struct { ID string FirstName string LastName string DisplayName string Name string Email string WebauthnCredentials []webauthn.Credential `json:"-"` }
func (*User) CredentialExcludeList ¶
func (u *User) CredentialExcludeList() []protocol.CredentialDescriptor
CredentialExcludeList returns a list of credentials to exclude from the webauthn credential list
func (*User) WebAuthnCredentials ¶
func (u *User) WebAuthnCredentials() []webauthn.Credential
WebAuthnCredentials is the user's webauthn credentials
func (*User) WebAuthnDisplayName ¶
WebAuthnDisplayName is the user's webauthn display name
func (*User) WebAuthnIcon ¶
WebAuthnIcon is the user's webauthn icon
func (*User) WebAuthnName ¶
WebAuthnName is the user's webauthn name
Click to show internal directories.
Click to hide internal directories.