Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidCaptcha = errors.New("invalid captcha")
View Source
var ErrMissingCaptcha = errors.New("missing captcha token")
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config holds optional SmartCaptcha keys.
type Verifier ¶
type Verifier interface {
Enabled() bool
Verify(ctx context.Context, token, clientIP string) error
}
Verifier checks a Yandex SmartCaptcha token.
func NewFromConfig ¶
NewFromConfig returns a nop verifier when captcha is disabled.
type YandexVerifier ¶
type YandexVerifier struct {
// contains filtered or unexported fields
}
YandexVerifier validates tokens against Yandex SmartCaptcha.
func NewYandexVerifier ¶
func NewYandexVerifier(serverKey string) *YandexVerifier
NewYandexVerifier builds a verifier with a 5s HTTP timeout.
func (*YandexVerifier) Enabled ¶
func (y *YandexVerifier) Enabled() bool
Enabled reports whether a server key is configured.
func (*YandexVerifier) SetValidateURL ¶
func (y *YandexVerifier) SetValidateURL(u string)
SetValidateURL overrides the validation endpoint (tests).
Click to show internal directories.
Click to hide internal directories.