Skip to content
Library for generating QR-Code, Random Secret and Verify Time Based Password
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config prod May 6, 2019
lib
test t test May 6, 2019
.formatter.exs prod May 6, 2019
.gitignore prod May 6, 2019
LICENSE.txt
README.md
mix.exs update May 6, 2019
mix.lock

README.md

Elixir2fa

Library for generating QR-Code, Random Secret and Verify Time Based Password

Installation

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

def deps do
  [
    {:elixir2fa, "~> 0.1.0"}
  ]
end

Usage

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.

You can’t perform that action at this time.