Skip to content

r7com/go-hcaptcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-hcaptcha

About

This package handles hCaptcha form submissions in Go.

Usage

Install the package in your environment:

go get github.com/r7com/go-hcaptcha

To use it within your own code, import github.com/r7com/go-hcaptcha and call:

hcaptcha.Init(recaptchaPrivateKey, recaptchaScore)

once, to set the hCaptcha private key for your domain, then:

hcaptcha.Confirm(recaptchaResponse)

for each hCaptcha form input you need to check, using the values obtained by reading the form's POST parameters (the hcaptchaResponse in the above corresponds to the value of h-recaptcha-response sent by the hCaptcha server.)

The hcaptcha.Confirm() function returns true if the captcha was completed correctly and the score was equal or above the value passed in hCaptcha.Init() or false if the captcha had an invalid token or the score failed, along with any errors (from the HTTP io read or the attempt to unmarshal the JSON reply).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages