mcaptcha

package module
v0.0.0-...-4f3072e Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: MIT Imports: 8 Imported by: 3

README

mCaptcha Go

mCaptcha is a Go library to interact with mCaptcha.

Implemented

The library currently only implements the PoW verification endpoint and not an of the other endpoints.

Check the documentation for currently implemented functions.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingSecret errors when no secret was provided by the code.
	ErrMissingSecret = errors.New("no secret was provided")

	// ErrMissingSitekey errors when no sitekey was provided by the code.
	ErrMissingSitekey = errors.New("no sitekey was provided")

	// ErrMissingToken errors when no token was provided by the code.
	ErrMissingToken = errors.New("no token was provided")
)

Functions

func Verify

func Verify(ctx context.Context, opts *VerifyOpts) (bool, error)

Verify takes in a context and options to make a verification request. It will verify if the given token is validated on the given mCaptcha instance.

Types

type VerifyOpts

type VerifyOpts struct {
	Secret      string `json:"secret"`
	Sitekey     string `json:"key"` //nolint:tagliatelle // `Sitekey` is the correct naming, but API expects `key`.
	Token       string `json:"token"`
	InstanceURL string `json:"-"`
}

VerifyOpts holds all the information that is need to make a verification request.

func (*VerifyOpts) GetOpts

func (opts *VerifyOpts) GetOpts() (io.Reader, error)

GetOpts returns a io.Reader that contains a JSON representation of the options.

Jump to

Keyboard shortcuts

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