hcaptcha

package module
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 3 Imported by: 0

README

Go-hCaptcha

Simple hCaptcha middleware written in Go, using fasthttp, which is up to 10x faster than net/http.

This package works with any framework, since it only handles the verification.

Inspired by flask-hcaptcha and hcaptcha.

Installation

go get -u github.com/ross714/hcaptcha

Getting Started

First of all, create an account on https://www.hcaptcha.com/, and attach a new site for development.

import "github.com/ross714/hcaptcha"
client := hcaptcha.New("secret_key", "site_key")
res := client.Verify("token") // => Bool

if res {
  // Success
} else {
  // Failed
}

See the full example in examples directory.

License

This software is licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Secret  string
	Sitekey string
}

func New

func New(secret_key, site_key string) *Client

func (*Client) Verify

func (c *Client) Verify(token string) bool

type Response

type Response struct {
	Success     bool   `json:"success"`
	Credit      bool   `json:"credit"`
	Hostname    string `json:"hostname"`
	ChallengeTs string `json:"challenge_ts"`
}

Jump to

Keyboard shortcuts

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