logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

service.ex (1037B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Captcha.Service do
  5. @doc """
  6. Request new captcha from a captcha service.
  7. Returns:
  8. Type/Name of the service, the token to identify the captcha,
  9. the data of the answer and service-specific data to use the newly created captcha
  10. """
  11. @callback new() :: %{
  12. type: atom(),
  13. token: String.t(),
  14. answer_data: any()
  15. }
  16. @doc """
  17. Validated the provided captcha solution.
  18. Arguments:
  19. * `token` the captcha is associated with
  20. * `captcha` solution of the captcha to validate
  21. * `answer_data` is the data needed to validate the answer (presumably encrypted)
  22. Returns:
  23. `true` if captcha is valid, `false` if not
  24. """
  25. @callback validate(
  26. token :: String.t(),
  27. captcha :: String.t(),
  28. answer_data :: any()
  29. ) :: :ok | {:error, String.t()}
  30. end