dchest

package
v0.0.0-...-ba0f816 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHeight = 50
View Source
var DefaultOptionalBytes = []byte("0123456789")
View Source
var DefaultSigner = func(data string) (string, error) {
	sign := md5.Sum([]byte(data))
	return base64.StdEncoding.EncodeToString(sign[:]), nil
}
View Source
var DefaultSize = 8
View Source
var DefaultTTL = 10 * time.Minute
View Source
var DefaultTokenGenerator = func() (string, error) {
	return uniqueid.DefaultGenerator.GenerateID()
}
View Source
var DefaultWidth = 200

Functions

This section is empty.

Types

type Config

type Config struct {
	Secret      string
	Cache       *cache.OptionConfig
	CachePrefix string
	Size        int
	TTLInSecond int64
	Width       int
	Height      int
}

func (*Config) Create

func (c *Config) Create() (*Driver, error)

type Driver

type Driver struct {
	Cache          cache.Cacheable
	CachePrefix    string
	Secret         string
	TTL            time.Duration
	Width          int
	Height         int
	Wanted         *captcha.Wanted
	ImageRender    *dchestimage.Config
	Signer         func(string) (string, error)
	TokenGenerator func() (string, error)
}

func (*Driver) Challenge

func (d *Driver) Challenge(ctx captcha.Context) error

func (*Driver) DoCaptcha

func (d *Driver) DoCaptcha(ctx captcha.Context) (bool, error)

func (*Driver) Sign

func (d *Driver) Sign(token string, ts string, code string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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