Module captcherl

Simplifies the process of verifying CAPTCHA responses.

Authors: bunopnu.

Description

Simplifies the process of verifying CAPTCHA responses.

Erlang library that provides easy-to-use functions for interacting with Cloudflare Turnstile, reCAPTCHA and hCaptcha.

Data Types

api_request_data()

api_request_data() = {Secret::binary(), Response::binary()} | {Secret::binary(), Response::binary(), IpAddress::binary()}

Representing the data required for making a request.

captcha_services()

captcha_services() = turnstile | recaptcha | hcaptcha

Representing the available CAPTCHA services.

request_response()

request_response() = {ok, map()} | {error, term()}

Representing the response from a CAPTCHA service request.

Function Index

request/2Sends a request to the specified CAPTCHA service.
request/3Sends a request to the specified CAPTCHA service with HTTP options.
start/0Starts the application along with its dependent applications.
verify/2Verifies the CAPTCHA response from the specified service.

Function Details

request/2

request(Service, Data) -> Result

Sends a request to the specified CAPTCHA service.

Parameters

Service
The CAPTCHA service to send the request to.
Data
The request data to be sent to the CAPTCHA service.

Returns

A map containing the response from the CAPTCHA service, which can have different fields and values depending on the service.

request/3

request(Service, Data, Opts) -> Result

Sends a request to the specified CAPTCHA service with HTTP options.

The function behaviour remains the same as request/2, but it additionally allows you to pass custom HTTP options in the Opts parameter.

You can find more information about HTTP options from httpc documentation.

start/0

start() -> ok | {error, term()}

Starts the application along with its dependent applications.

verify/2

verify(Service, Data) -> Result

Verifies the CAPTCHA response from the specified service.

Returns

A boolean representation of the verification status.


Generated by EDoc