passkey

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPasskeyNotFound              = auth.ErrPasskeyNotFound
	ErrPasskeyAlreadyExists         = auth.ErrPasskeyAlreadyExists
	ErrPasskeyRegistrationInvalid   = auth.ErrPasskeyRegistrationInvalid
	ErrPasskeyAuthenticationInvalid = auth.ErrPasskeyAuthenticationInvalid
	ErrCannotRemoveLastAuthMethod   = auth.ErrCannotRemoveLastAuthMethod
	ErrCannotRemoveLastAuthProvider = ErrCannotRemoveLastAuthMethod
)
View Source
var ErrInvalidListPage = errors.New("invalid passkey list page")

Functions

This section is empty.

Types

type AuthenticationDecision added in v0.22.0

type AuthenticationDecision struct {
	AllowSession bool
}

type Config

type Config struct {
	RPDisplayName  string
	RPID           string
	RPOrigins      []string
	Store          *store.Store
	Tx             *tx.Manager
	ChallengeTTL   time.Duration
	Logger         *slog.Logger
	Policy         config.AuthenticationPolicyReader
	SessionRevoker SessionRevoker
	SecurityEvents securityevent.Recorder
}

type ListOptions added in v0.22.0

type ListOptions = keyset.Options

type LoginResult added in v0.22.0

type LoginResult struct {
	User      domain.User
	PasskeyID uuid.UUID
	Decision  AuthenticationDecision
}

type OptionsResponse

type OptionsResponse struct {
	ChallengeID string          `json:"challenge_id"`
	Options     json.RawMessage `json:"options"`
}

type PasskeyPage added in v0.22.0

type PasskeyPage = keyset.Page[domain.Passkey]

type RegistrationMetadata

type RegistrationMetadata struct {
	Name         string
	UserAgent    string
	PlatformHint string
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (*Service, error)

func (*Service) BeginLogin

func (s *Service) BeginLogin(ctx context.Context) ([]byte, uuid.UUID, error)

func (*Service) BeginReauthentication added in v0.22.0

func (s *Service) BeginReauthentication(
	ctx context.Context,
	userID uuid.UUID,
	sessionID uuid.UUID,
) ([]byte, uuid.UUID, error)

func (*Service) BeginRegistration

func (s *Service) BeginRegistration(ctx context.Context, userID uuid.UUID) ([]byte, uuid.UUID, error)

func (*Service) DeletePasskey

func (s *Service) DeletePasskey(ctx context.Context, userID uuid.UUID, passkeyID uuid.UUID) error

func (*Service) FinishLogin

func (s *Service) FinishLogin(
	ctx context.Context,
	challengeID uuid.UUID,
	assertionResponseJSON []byte,
	now time.Time,
) (LoginResult, error)

func (*Service) FinishReauthentication added in v0.22.0

func (s *Service) FinishReauthentication(
	ctx context.Context,
	userID uuid.UUID,
	sessionID uuid.UUID,
	challengeID uuid.UUID,
	assertionResponseJSON []byte,
	now time.Time,
) (AuthenticationDecision, error)

func (*Service) FinishRegistration

func (s *Service) FinishRegistration(
	ctx context.Context,
	userID uuid.UUID,
	challengeID uuid.UUID,
	credentialResponseJSON []byte,
	metadata RegistrationMetadata,
) error

func (*Service) ListUserPasskeys

func (s *Service) ListUserPasskeys(ctx context.Context, userID uuid.UUID) ([]domain.Passkey, error)

func (*Service) ListUserPasskeysPage added in v0.22.0

func (s *Service) ListUserPasskeysPage(ctx context.Context, userID uuid.UUID, options ListOptions) (PasskeyPage, error)

type SessionRevoker added in v0.22.0

type SessionRevoker interface {
	RevokeAllSessions(context.Context, uuid.UUID) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL