verify_code

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RedisStoreVerifyCodeErrFast    = errors.New("verify code is too fast")
	RedisStoreVerifyCodeErrLimit   = errors.New("verify code is too many")
	RedisValidateVerifyCodeErr     = errors.New("verify code is invalid")
	RedisValidateVerifyCodeExpired = errors.New("verify code is expired")
	RedisNeedResetVerifyCode       = errors.New("verify code need reset")
)

Functions

This section is empty.

Types

type VerifyCode

type VerifyCode interface {
	StoreVerifyCode(ctx context.Context, key, code, ip string) (int, error)
	ValidateVerifyCode(ctx context.Context, key, code, ip string) error
	ResetVerifyCode(ctx context.Context, key string) error
}

func NewRedisVerifyCodeService

func NewRedisVerifyCodeService(rdb redis.UniversalClient, opt VerifyCodeOption, template string) VerifyCode

type VerifyCodeOption

type VerifyCodeOption struct {
	Interval     int `yaml:"interval"`
	Limit        int `yaml:"limit"`
	Lifetime     int `yaml:"lifetime"`
	ErrorTimes   int `yaml:"error_times"`
	SuccessTimes int `yaml:"success_times"`
}

Jump to

Keyboard shortcuts

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