Pleroma v1.1.9-10-g42f76306+dev Pleroma.Captcha.Service behaviour View Source

Link to this section Summary

Callbacks

Request new captcha from a captcha service.

Validated the provided captcha solution.

Link to this section Callbacks

Link to this callback

new()

View Source
new() :: %{type: atom(), token: String.t(), answer_data: any()}

Request new captcha from a captcha service.

Returns:

Type/Name of the service, the token to identify the captcha, the data of the answer and service-specific data to use the newly created captcha

Link to this callback

validate(token, captcha, answer_data)

View Source
validate(token :: String.t(), captcha :: String.t(), answer_data :: any()) ::
  :ok | {:error, String.t()}

Validated the provided captcha solution.

Arguments:

  • token the captcha is associated with
  • captcha solution of the captcha to validate
  • answer_data is the data needed to validate the answer (presumably encrypted)

Returns:

true if captcha is valid, false if not