package
6.8.0
Repository: https://github.com/app-nerds/kit.git
Documentation: pkg.go.dev

# README

Captcha

This package provides services to add a captcha to your web applications. The following CAPTCHA services are supported.

  • Google ReCAPTCHA v2

Examples

Google ReCAPTCHA v2

import "github.com/app-nerds/kit/v6/captcha"

captchaService := captcha.NewGoogleRecaptchaService(captcha.GoogleRecaptchaServiceConfig{
  CaptchaSecret: "secret",
})

if verifyCaptchaResponse, err := captchaService.VerifyCaptcha(captchaTokenFromFrontEnd, ipAddress); err != nil {
   // error
}

if !verifyCaptchaResponse.Success {
  // No bueno!
}

# Functions

NewGoogleRecaptchaService creates a new Captcha service that uses Google Recaptcha */.
NewVerifyCaptchaResponseFromReader creates a new VerifyCaptchaResponse struct.

# Variables

ErrCaptchaFailed is returned when a CAPTCHA fails.

# Structs

GoogleRecaptchaService provides methods for working with Google Recaptcha */.
GoogleRecaptchaServiceConfig is used to configure a GoogleRecaptchaService */.
VerifyCaptchaRequest is used to request a Captcha verification */.
VerifyCaptchaResponse is the response from a Captcha verification request.

# Interfaces

CaptchaService describes methods for working with Google Captcha */.