2018-12-15 12:06:44 -07:00
|
|
|
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
|
|
|
|
"""
|
2018-12-15 12:08:26 -07:00
|
|
|
@callback validate(token :: String.t(), captcha :: String.t()) :: boolean
|
2018-12-16 12:04:43 -07:00
|
|
|
|
|
|
|
@doc """
|
|
|
|
This function is called periodically to clean up old captchas
|
|
|
|
"""
|
2018-12-16 13:41:11 -07:00
|
|
|
@callback cleanup() :: :ok
|
2018-12-15 12:06:44 -07:00
|
|
|
end
|