You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.0 KiB
38 lines
1.0 KiB
6 years ago
|
# Pleroma: A lightweight social networking server
|
||
5 years ago
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||
6 years ago
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||
|
|
||
6 years ago
|
defmodule Pleroma.Captcha.Service do
|
||
|
@doc """
|
||
|
Request new captcha from a captcha service.
|
||
|
|
||
|
Returns:
|
||
|
|
||
6 years ago
|
Type/Name of the service, the token to identify the captcha,
|
||
|
the data of the answer and service-specific data to use the newly created captcha
|
||
6 years ago
|
"""
|
||
6 years ago
|
@callback new() :: %{
|
||
|
type: atom(),
|
||
|
token: String.t(),
|
||
|
answer_data: any()
|
||
|
}
|
||
6 years ago
|
|
||
|
@doc """
|
||
|
Validated the provided captcha solution.
|
||
|
|
||
|
Arguments:
|
||
|
* `token` the captcha is associated with
|
||
|
* `captcha` solution of the captcha to validate
|
||
6 years ago
|
* `answer_data` is the data needed to validate the answer (presumably encrypted)
|
||
6 years ago
|
|
||
|
Returns:
|
||
|
|
||
|
`true` if captcha is valid, `false` if not
|
||
|
"""
|
||
6 years ago
|
@callback validate(
|
||
|
token :: String.t(),
|
||
|
captcha :: String.t(),
|
||
6 years ago
|
answer_data :: any()
|
||
6 years ago
|
) :: :ok | {:error, String.t()}
|
||
6 years ago
|
end
|