Documentation
¶
Index ¶
- Constants
- Variables
- type Argon2idParams
- type ChallengeStore
- type Enrollment
- type EnrollmentLookup
- type IssueTokenInput
- type ListedToken
- type Lookup
- type Passkey
- type Passkeys
- func (p *Passkeys) BeginLogin(ctx context.Context) (*protocol.CredentialAssertion, *wa.SessionData, error)
- func (p *Passkeys) BeginRegistration(ctx context.Context, slug, displayName string) (*protocol.CredentialCreation, *wa.SessionData, error)
- func (p *Passkeys) FinishLogin(ctx context.Context, sd *wa.SessionData, ...) (string, error)
- func (p *Passkeys) FinishRegistration(ctx context.Context, slug, label string, sd *wa.SessionData, ...) (Passkey, error)
- func (p *Passkeys) List(ctx context.Context, slug string) ([]Passkey, error)
- func (p *Passkeys) Remove(ctx context.Context, credID []byte) error
- type Password
- type Tokens
- func (t *Tokens) Issue(ctx context.Context, in IssueTokenInput) (plaintext, tokenID string, err error)
- func (t *Tokens) List(ctx context.Context, userSlug string) ([]ListedToken, error)
- func (t *Tokens) Revoke(ctx context.Context, tokenID, byPrincipal string) error
- func (t *Tokens) TouchLastUsed(ctx context.Context, tokenID string) error
- func (t *Tokens) Verify(ctx context.Context, plaintext string) (Lookup, error)
Constants ¶
const IntentRegisterPasskey = "register_passkey"
const IntentSetPassword = "set_password"
Variables ¶
var ErrChallengeNotFound = errors.New("webauthn: challenge not found or expired")
ErrChallengeNotFound is returned when a challenge id is missing, expired, or belongs to a different session.
var ErrEnrollmentConsumed = errors.New("credentials: enrollment token already used")
var ErrEnrollmentExpired = errors.New("credentials: enrollment token expired")
var ErrEnrollmentInvalid = errors.New("credentials: enrollment token invalid")
var ErrPasskeyUnknown = errors.New("credentials: passkey unknown")
var ErrSignCountRegression = errors.New("credentials: passkey sign-count regression")
var ErrTokenExpired = errors.New("credentials: token expired")
var ErrTokenInvalid = errors.New("credentials: token invalid")
var ErrTokenRevoked = errors.New("credentials: token revoked")
Functions ¶
This section is empty.
Types ¶
type Argon2idParams ¶
func DefaultArgon2idParams ¶
func DefaultArgon2idParams() Argon2idParams
type ChallengeStore ¶
type ChallengeStore struct {
// contains filtered or unexported fields
}
ChallengeStore holds per-session WebAuthn challenges between StartWebAuthnChallenge and Login. In-process only; expiry by TTL.
func NewChallengeStore ¶
func NewChallengeStore(ttl time.Duration) *ChallengeStore
NewChallengeStore creates a new store with the given TTL per challenge.
type Enrollment ¶
type Enrollment struct {
// contains filtered or unexported fields
}
func NewEnrollment ¶
func NewEnrollment(db *sql.DB) *Enrollment
func (*Enrollment) Redeem ¶
func (e *Enrollment) Redeem(ctx context.Context, plaintext string) (EnrollmentLookup, error)
type EnrollmentLookup ¶
type IssueTokenInput ¶
type ListedToken ¶
type Passkeys ¶
type Passkeys struct {
// contains filtered or unexported fields
}
func (*Passkeys) BeginLogin ¶
func (p *Passkeys) BeginLogin(ctx context.Context) (*protocol.CredentialAssertion, *wa.SessionData, error)
BeginLogin starts a discoverable (resident-key) login ceremony.
func (*Passkeys) BeginRegistration ¶
func (p *Passkeys) BeginRegistration(ctx context.Context, slug, displayName string) (*protocol.CredentialCreation, *wa.SessionData, error)
BeginRegistration starts a registration ceremony for a slug, returning the creation options to send to the client and session data to persist for the finish step.
func (*Passkeys) FinishLogin ¶
func (p *Passkeys) FinishLogin(ctx context.Context, sd *wa.SessionData, response *protocol.ParsedCredentialAssertionData) (string, error)
FinishLogin validates the parsed assertion against the stored credential, enforces sign-count regression, and bumps last_used_at + sign_count. Returns the user slug owning the credential.
func (*Passkeys) FinishRegistration ¶
func (p *Passkeys) FinishRegistration(ctx context.Context, slug, label string, sd *wa.SessionData, response *protocol.ParsedCredentialCreationData) (Passkey, error)
FinishRegistration verifies the parsed registration response, persists the resulting credential, and returns the stored Passkey.
type Password ¶
type Password struct {
// contains filtered or unexported fields
}
func NewPassword ¶
func NewPassword(db *sql.DB, p Argon2idParams) *Password
func (*Password) Set ¶
Set stores or replaces the user's password hash. setBy carries audit provenance ("self", "admin:<slug>", "system:bootstrap").