aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/captcha/captcha_service.ex
blob: 8d0b76f86340ef099e9a5d03b6b469a936514653 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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

  Returns:

  `true` if captcha is valid, `false` if not
  """
  @callback validate(token :: String.t(), captcha :: String.t()) :: boolean

  @doc """
  This function is called periodically to clean up old captchas
  """
  @callback cleanup() :: :ok
end