providers

package
v0.0.0-...-9336d3e Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticatorConfig

type AuthenticatorConfig struct {
	// ScannerImage is the base64 of QR code image
	ScannerImage string
	// Secrets is the secret key
	Secret string
	// RecoveryCode is the list of recovery codes
	RecoveryCodes []string
	// RecoveryCodeMap is the map of recovery codes
	RecoveryCodeMap map[string]bool
}

AuthenticatorConfig defines authenticator config

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) (*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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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