otp

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OTP

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

func New

func New(db *sql.DB, driverName ...string) *OTP

func (*OTP) Generate

func (c *OTP) Generate(ctx context.Context, email string, expirationHours int) (*OTPPayload, error)

func (*OTP) Validate

func (c *OTP) Validate(ctx context.Context, email, code string) error

type OTPPayload

type OTPPayload struct {
	Email     string    `json:"email,omitempty"`
	Code      string    `json:"code,omitempty"`
	ExpiresAt time.Time `json:"expires_at,omitempty"`
}

Jump to

Keyboard shortcuts

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