Documentation ¶
Overview ¶
Package recaptcha handles reCaptcha (http://www.google.com/recaptcha) form submissions
This package is designed to be called from within an HTTP server or web framework which offers reCaptcha form inputs and requires them to be evaluated for correctness
Edit the recaptchaPrivateKey constant before building and using
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Confirm ¶
Confirm is the public interface function that validates the reCAPTCHA token. It accepts the client ip address and the token returned to the client after completing the challenge. It returns a boolean value indicating whether or not the client token is authentic, meaning the challenge was answered correctly.
Types ¶
type RecaptchaResponse ¶
type RecaptchaResponse struct { Success bool `json:"success"` Score float64 `json:"score"` Action string `json:"action"` ChallengeTS time.Time `json:"challenge_ts"` Hostname string `json:"hostname"` ErrorCodes []string `json:"error-codes"` }
func Check ¶
func Check(remoteip, response string) (RecaptchaResponse, error)
Check will construct the request to the verification API, send it, and return the result.