akkoma/lib/pleroma/captcha/captcha_service.ex
Ekaterina Vaartis 336e37d98f Make captcha (kocaptcha) stateless
Also rename seconds_retained to seconds_valid since that's how it is
now. Put it down from 180 to 20 seconds. The answer data is now
stored in an encrypted text transfered to the client and back, so no
ETS is needed
2018-12-21 09:55:47 +03:00

28 lines
689 B
Elixir

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
* `answer_data` is the data needed to validate the answer (presumably encrypted)
Returns:
`true` if captcha is valid, `false` if not
"""
@callback validate(
token :: String.t(),
captcha :: String.t(),
answer_data :: String.t()
) :: :ok | {:error, String.t()}
end