8d0b76f86340ef099e9a5d03b6b469a936514653
[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
18 Returns:
19
20 `true` if captcha is valid, `false` if not
21 """
22 @callback validate(token :: String.t(), captcha :: String.t()) :: boolean
23
24 @doc """
25 This function is called periodically to clean up old captchas
26 """
27 @callback cleanup() :: :ok
28 end