Library for generating QR-Code, Random Secret and Verify Time Based Password
MIT License
‼️ | This library is insecure and barery maintained, we suggest you to use https://github.com/dashbitco/nimble_totp |
---|
Library for generating QR-Code, Random Secret and Verify Time Based Password
This package can be installed by adding elixir2fa
to your list of dependencies in mix.exs
:
def deps do
[
{:elixir2fa, "~> 0.1.0"}
]
end
iex> secret = Elixir2fa.random_secret(16)
"HpJBFRtHjgIQJWIB"
iex> Elixir2fa.generate_qr("account_name", secret)
"https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=200x200&chld=M|0&cht=qr&chl=otpauth://totp/account_name?secret=HpJBFRtHjgIQJWIB" # scan via Google Authenticator, Authy, etc
iex> Elixir2fa.generate_totp(secret)
"573671" # compare with user token
Some source code taken from :
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/elixir2fa.