Make captcha (kocaptcha) stateless
[akkoma] / lib / pleroma / captcha / captcha_service.ex
1 defmodule Pleroma.Captcha.Service do
2 @doc """
3 Request new captcha from a captcha service.
4
5 Returns:
6
7 Service-specific data for using the newly created captcha
8 """
9 @callback new() :: map
10
11 @doc """
12 Validated the provided captcha solution.
13
14 Arguments:
15 * `token` the captcha is associated with
16 * `captcha` solution of the captcha to validate
17 * `answer_data` is the data needed to validate the answer (presumably encrypted)
18
19 Returns:
20
21 `true` if captcha is valid, `false` if not
22 """
23 @callback validate(
24 token :: String.t(),
25 captcha :: String.t(),
26 answer_data :: String.t()
27 ) :: :ok | {:error, String.t()}
28 end