captcha

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCaptchaNotExists    = errors.NewPublic("the captcha does not exists")
	ErrCaptchaInconsistent = errors.NewPublic("tha captcha is invalid")
)

Functions

This section is empty.

Types

type Captcha

type Captcha struct {
	Namespace string
	RDb       *redis.Client
}

func New

func New(options ...Option) *Captcha

func (*Captcha) Create

func (x *Captcha) Create(ctx context.Context, name string, code string, ttl time.Duration) string

func (*Captcha) Delete

func (x *Captcha) Delete(ctx context.Context, name string) int64

func (*Captcha) Exists

func (x *Captcha) Exists(ctx context.Context, name string) bool

func (*Captcha) Key

func (x *Captcha) Key(name string) string

func (*Captcha) Verify

func (x *Captcha) Verify(ctx context.Context, name string, code string) error

type Option

type Option func(x *Captcha)

func SetNamespace

func SetNamespace(v string) Option

func SetRedis

func SetRedis(v *redis.Client) Option

Jump to

Keyboard shortcuts

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