authenticators

package
v0.0.0-...-1726717 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependencies

type Dependencies struct {
	Log             *zerolog.Logger
	StorageProvider storage.Provider
}

Dependencies defines the dependencies for authenticators provider

type Provider

type Provider interface {
	// Generate totp: to generate totp, store secret into db and returns base64 of QR code image
	Generate(ctx context.Context, id string) (*ac.AuthenticatorConfig, error)
	// Validate totp: user passcode with secret stored in our db
	Validate(ctx context.Context, passcode string, userID string) (bool, error)
	// ValidateRecoveryCode totp: allows user to validate using recovery code incase if they lost their device
	ValidateRecoveryCode(ctx context.Context, recoveryCode, userID string) (bool, error)
}

Provider defines authenticators provider

func New

func New(cfg *config.Config, deps *Dependencies) (Provider, error)

New returns a new authenticators provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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