codeutil

package
v0.0.0-...-07bc221 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coder

type Coder interface {
	Create(length int) string
	Save(topic string, email string, code string, timeout time.Duration) error
	Check(topic string, email string, code string) (bool, error)
	Consume(topic string, email string)
}

type VerifyCode

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

func New

func New(ctx context.Context) *VerifyCode

func (VerifyCode) Check

func (c VerifyCode) Check(topic string, email string, code string) (bool, error)

Check @description: 判断验证码是否正确

func (VerifyCode) Consume

func (c VerifyCode) Consume(topic string, email string)

Consume @description: 消费(删除)验证码

func (VerifyCode) Create

func (c VerifyCode) Create(length int) string

Create @description: create verify code

func (VerifyCode) Save

func (c VerifyCode) Save(topic string, email string, code string, timeout time.Duration) error

Save @description: save verify code 存储验证码 timeout: expire time (second)

Jump to

Keyboard shortcuts

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