Documentation ¶
Index ¶
Constants ¶
View Source
const ( // V2 recaptcha api v2 V2 VERSION = iota // V3 recaptcha api v3, more details can be found here : https://developers.google.com/recaptcha/docs/v3 V3 // DefaultTreshold Default minimin score when using V3 api DefaultTreshold float32 = 0.5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReCAPTCHA ¶
type ReCAPTCHA struct { Secret string ReCAPTCHALink string Version VERSION Timeout time.Duration // contains filtered or unexported fields }
ReCAPTCHA recpatcha holder struct, make adding mocking code simpler
func NewReCAPTCHA ¶
func NewReCAPTCHA(ReCAPTCHASecret string, version VERSION, timeout time.Duration) (ReCAPTCHA, error)
NewReCAPTCHA new ReCAPTCHA instance if version is set to V2 uses recatpcha v2 API, get your secret from https://www.google.com/recaptcha/admin
if version is set to V2 uses recatpcha v2 API, get your secret from https://g.co/recaptcha/v3
func (*ReCAPTCHA) Verify ¶
Verify returns `nil` if no error and the client solved the challenge correctly
func (*ReCAPTCHA) VerifyWithOptions ¶
func (r *ReCAPTCHA) VerifyWithOptions(challengeResponse string, options VerifyOption) error
VerifyWithOptions returns `nil` if no error and the client solved the challenge correctly and all options are natching `Threshold` and `Action` are ignored when using V2 version
Click to show internal directories.
Click to hide internal directories.