add license boilerplate to pleroma core
[akkoma] / lib / pleroma / captcha / captcha_service.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Captcha.Service do
6 @doc """
7 Request new captcha from a captcha service.
8
9 Returns:
10
11 Service-specific data for using the newly created captcha
12 """
13 @callback new() :: map
14
15 @doc """
16 Validated the provided captcha solution.
17
18 Arguments:
19 * `token` the captcha is associated with
20 * `captcha` solution of the captcha to validate
21
22 Returns:
23
24 `true` if captcha is valid, `false` if not
25 """
26 @callback validate(token :: String.t(), captcha :: String.t()) :: boolean
27
28 @doc """
29 This function is called periodically to clean up old captchas
30 """
31 @callback cleanup() :: :ok
32 end