engine

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid = errors.New("invalid request")
	ErrAuth    = errors.New("authentication failed")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	RPID           string
	RPName         string
	Origins        []string
	Pepper         []byte
	MaxCredentials int
	Now            func() time.Time
}

type Engine

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

func New

func New(s store.Store, cfg Config) (*Engine, error)

func (*Engine) BeginAddCredential

func (e *Engine) BeginAddCredential(ctx context.Context, userID string, ttl time.Duration) ([]byte, error)

func (*Engine) BeginLogin

func (e *Engine) BeginLogin(ctx context.Context, slot, userID string, ttl time.Duration) ([]byte, error)

func (*Engine) BeginRegistration

func (e *Engine) BeginRegistration(ctx context.Context, in RegistrationInput) ([]byte, error)

func (*Engine) CredentialIDs

func (e *Engine) CredentialIDs(ctx context.Context, userID string) ([][]byte, error)

func (*Engine) DeleteUser

func (e *Engine) DeleteUser(ctx context.Context, userID string) error

func (*Engine) Extend

func (e *Engine) Extend(ctx context.Context, token string, by time.Duration) (Session, error)

func (*Engine) FinishAddCredential

func (e *Engine) FinishAddCredential(ctx context.Context, userID string, body []byte) error

func (*Engine) FinishLogin

func (e *Engine) FinishLogin(ctx context.Context, slot string, body []byte, sessionTTL time.Duration) (Session, error)

func (*Engine) FinishRegistration

func (e *Engine) FinishRegistration(ctx context.Context, slot string, body []byte) (RegistrationResult, error)

func (*Engine) Introspect

func (e *Engine) Introspect(ctx context.Context, token string) (Session, error)

func (*Engine) Logout

func (e *Engine) Logout(ctx context.Context, token string) error

func (*Engine) LogoutAll

func (e *Engine) LogoutAll(ctx context.Context, userID string) error

func (*Engine) Recover

func (e *Engine) Recover(ctx context.Context, userID, code string, ttl time.Duration) (RecoverResult, error)

func (*Engine) RemoveCredential

func (e *Engine) RemoveCredential(ctx context.Context, userID string, credentialID []byte) error

func (*Engine) Reset

func (e *Engine) Reset(ctx context.Context, userID string, ttl time.Duration) (string, time.Time, error)

func (*Engine) RotateRecovery

func (e *Engine) RotateRecovery(ctx context.Context, userID string) (string, error)

type RecoverResult

type RecoverResult struct {
	Session
	RecoveryCode    string
	CredentialCount int
}

type RegistrationInput

type RegistrationInput struct {
	Slot        string
	UserID      string
	Name        string
	TTL         time.Duration
	EnrollToken string
}

type RegistrationResult

type RegistrationResult struct {
	UserID       string
	RecoveryCode string
}

type Session

type Session struct {
	UserID    string
	Token     string
	ExpiresAt time.Time
}

Jump to

Keyboard shortcuts

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