otp

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOTPInvalid = errors.New("OTP invalid")

Functions

func Generate

func Generate(args CreateParams) (string, error)

Types

type CreateParams

type CreateParams struct {
	CharSetAlphaLower bool
	CharSetAlphaUpper bool
	CharSetNumeric    bool
	Expires           time.Time
	Length            uint
}

type CreateResult

type CreateResult struct {
	CreateParams CreateParams
	ID           string
	OTP          string
}

type Storage

type Storage interface {
	OTPCreate(ctx context.Context, params CreateParams) (CreateResult, error)
	OTPValidate(ctx context.Context, id, o string) error
}

Jump to

Keyboard shortcuts

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