Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotHuman = errors.New("robot detected")
Functions ¶
func NewErrorFromCodes ¶
Types ¶
type Botswat ¶
type Botswat interface { ResponseTokenPrompt() []byte // VerifyResponseToken should return `nil` for valid tokens, [ErrNotHuman] for rejected tokens, or an [Error] for any other condition. // // A response may only be validated once. If the same response is presented twice, the second and each subsequent request will generate an error stating that the response has already been consumed. VerifyResponseToken( ctx context.Context, clientToken string, clientIPAddress string, ) error }
type CacheAdaptor ¶
type Error ¶
type Error string
const ( ErrMissingInputSecret Error = "missing-input-secret" ErrInvalidInputSecret Error = "invalid-input-secret" ErrMissingInputResponse Error = "missing-input-response" ErrInvalidInputResponse Error = "invalid-input-response" ErrBadRequest Error = "bad-request" ErrTimeoutOrDuplicate Error = "timeout-or-duplicate" ErrInternalError Error = "internal-error" )
type Option ¶
type Option func(*options) error
func WithCacheAdaptor ¶
func WithCacheAdaptor(adaptor CacheAdaptor) Option
func WithDefaultOptions ¶
func WithDefaultOptions() Option
func WithResponseExtractor ¶
func WithResponseExtractor(e ResponseExtractor) Option
func WithVerifier ¶
type ResponseExtractor ¶
type Verifier ¶
type Verifier func( ctx context.Context, clientResponseToken string, clientIPAddress string, ) ( userData string, err error, )
Verifier returns ErrNotHuman if client response was not recognized as valid.
A response may only be validated once. If the same response is presented twice, the second and each subsequent request will generate an error stating that the response has already been consumed.
Click to show internal directories.
Click to hide internal directories.