Documentation ¶ Index ¶ type OTP func New(db *sql.DB, driverName ...string) *OTP func (c *OTP) Generate(ctx context.Context, email string, expirationHours int) (*OTPPayload, error) func (c *OTP) Validate(ctx context.Context, email, code string) error type OTPPayload 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"` } Source Files ¶ View all Source files otp.gotypes.go Click to show internal directories. Click to hide internal directories.