2018-12-15 20:06:44 +01:00
|
|
|
defmodule Pleroma.Captcha.Service do
|
|
|
|
@doc """
|
|
|
|
Request new captcha from a captcha service.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
Service-specific data for using the newly created captcha
|
|
|
|
"""
|
|
|
|
@callback new() :: map
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
Validated the provided captcha solution.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
* `token` the captcha is associated with
|
|
|
|
* `captcha` solution of the captcha to validate
|
2018-12-20 22:32:37 +01:00
|
|
|
* `answer_data` is the data needed to validate the answer (presumably encrypted)
|
2018-12-15 20:06:44 +01:00
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
`true` if captcha is valid, `false` if not
|
|
|
|
"""
|
2018-12-20 22:32:37 +01:00
|
|
|
@callback validate(
|
|
|
|
token :: String.t(),
|
|
|
|
captcha :: String.t(),
|
|
|
|
answer_data :: String.t()
|
|
|
|
) :: :ok | {:error, String.t()}
|
2018-12-15 20:06:44 +01:00
|
|
|
end
|