Separate captcha implementation into a behaviour and use it
[akkoma] / lib / pleroma / captcha / captcha_service.ex
1 defmodule Pleroma.Captcha.Service do
2
3 @doc """
4 Request new captcha from a captcha service.
5
6 Returns:
7
8 Service-specific data for using the newly created captcha
9 """
10 @callback new() :: map
11
12 @doc """
13 Validated the provided captcha solution.
14
15 Arguments:
16 * `token` the captcha is associated with
17 * `captcha` solution of the captcha to validate
18
19 Returns:
20
21 `true` if captcha is valid, `false` if not
22 """
23 @callback validate(token :: String.t, captcha :: String.t) :: boolean
24 end