Captcha

Module VersionHex DocsTotal DownloadLicenseLast Updated

NIF bindings for the captcha Rust implementation

Installation

The package can be installed by adding captcha to your list of dependencies in mix.exs:

def deps do
  [
    {:captcha, "~> 0.1", hex: :captcha_nif}
  ]
end

Documentation can be found at https://hexdocs.pm/captcha_nif.

Rust Documentation can be found at https://docs.rs/captcha/latest/captcha.

Usage

Crate to generate CAPTCHAs.

Easy example:

iex> {chars, png} = Captcha.easy()
{"SnZw8", <<...>>}
iex> File.write!("captcha.png", png)
:ok

Or create by custom chars:

iex> Captcha.easy(set_color: %{r: 0, g: 116, b: 204})
{"SnZw8", <<...>>}

Create by options:

iex> Captcha.create(
...>   set_chars: "123456789abcdefgABCDEFG",
...>   add_chars: 6,
...>   set_color: %{r: 0, g: 116, b: 204},
...>   view: %{w: 220, h: 120},
...>   filters: [filter, ...]
...> )
{"78a23G", <<...>>}

More use case can see: test/captcha_test.exs or rust docs.