turnstile

package
v0.0.0-...-197cbbb Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRequest   = errors.New("invalid request")
	ErrValidationFailed = errors.New("response validation failed")
)

Functions

This section is empty.

Types

type VerificationRequest

type VerificationRequest struct {
	Response       string `json:"response"`
	RemoteIP       string `json:"remoteip"`
	IdempotencyKey string `json:"idempotency_key"`
}

type VerificationResponse

type VerificationResponse struct {
	Success     bool                 `json:"success"`
	ChallengeTs time.Time            `json:"challenge_ts"`
	Hostname    string               `json:"hostname"`
	ErrorCodes  []turnstileErrorCode `json:"error-codes"`
	Action      string               `json:"action"`
	Cdata       string               `json:"cdata"`
}

type Verifier

type Verifier interface {
	Verify(ctx context.Context, req *VerificationRequest) (*VerificationResponse, error)
}

func NewVerifierClient

func NewVerifierClient(secret string) Verifier

func NewVerifierClientWithURL

func NewVerifierClientWithURL(secret string, url string) Verifier

Jump to

Keyboard shortcuts

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