Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 1.62 KB

README.md

File metadata and controls

60 lines (44 loc) · 1.62 KB

Captcha

Module Version Hex Docs Total Download License Last 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.