Code Monkey home page Code Monkey logo

totpex's Introduction

Totpex

TOTP: Time-Based One-Time Password written in Elixir

I'm learning Elixir and gave myself a challenge to write a TOTP client with it.

At the moment it's more a proof of concept than a client, there is no interface. It's a work in process.

How to use it

Clone the directory :

git clone [email protected]:jameslafa/totpex.git
cd totpex

In debug mode:

iex -S mix

iex(1)> Totpex.generate_totp("mysecretkey_base32encoded")
"798396"

As a standalone application

# build binary (one time operation)
mix escript.build

# Execute application
./totpex
Please enter your secret key: 634hszwpdilkzqe2
Your One-Time Password is 382765

Requirements

  1. Elixir installed
  2. A computer running at the correct time. Most of the system are automatically so it shouldn't be a problem.
  3. A Base32 encoded secret key given by the service you enabled 2 factor authentication on.

How to get a secret key on Github to try this tool

  1. Go to your security settings
  2. Click on Set up two-factor authentication
  3. Choose Set up using an app. If you don't have Google Authenticator installed on your phone, get it from your App Store
  4. Scan the square code from your app, then it's safe and easy to use from your phone
  5. Click on enter this text code to get the Base32 encoded value. Save it somewhere safe
  6. Enter the value generated by your phone
  7. Click on Enable 2 factor authentication

You can now use your secret key obtained at step 5 and compare the generated value with the one given by your phone.

Thank you

I want to thank my friend Alexandre who helped me to understand the Java code of the official documentation.

I want also to thank the authors of the following articles or projects, it was a great help:

Contact

Contact me on twitter @jameslafa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.