captcha_service.ex 774 Bytes
Newer Older
1
# Pleroma: A lightweight social networking server
kaniini's avatar
kaniini committed
2
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3
4
# SPDX-License-Identifier: AGPL-3.0-only

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
26
  @callback validate(token :: String.t(), captcha :: String.t()) :: boolean
27
28
29
30

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