captcha_service.ex 615 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
  """
vaartis's avatar
vaartis committed
22
  @callback validate(token :: String.t(), captcha :: String.t()) :: boolean
23
24
25
26

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