Code Monkey home page Code Monkey logo

lambdatotp's Introduction

lambdatotp

An easy implementation of TOTP to be used in the AWS Lambda and DynamoDB.

It is built with Chalice and PyOTP.

How to deploy it

1 - Set up your AWS Credentials

2 - Create a table in DynamoDB

3 - Configure the TABLE_NAME constant in the chalicelib/config.py file with the name of your table.

4 - Create a new virtualenv with Python 3.

5 - Inside of the virtualenv, install the requirements with pip install -r requirements.txt

6 - Execute the command chalice deploy

7 - Save the link returned by the chalice. It's the link to your application


How to use it

Registering a new user

To register a new user send a POST request to the root path of your application with the value user containing some kind of identification of your user, like an e-mail or user_id. The application will return a JSON in the following format:

{
    "user_id": "[email protected]",
    "qr_code": "",
    "qr_code_url": ""
}
  • user_id: The user id you have registred your user
  • qr_code: The code used to create the QRcode image
  • qr_code_url: The QRcode image that your user must read in his TOTP app to generate the Time Based One Time Password

The application will return an HTTP Conflict error in case the user is already registered.

Verifying the code of a registered user.

Once the user is registered, you can send a GET request passing in the params user and code

  • user is the user identification you registered your user
  • code is the code generated by the TOTP application of your user

Contributions are welcome!

lambdatotp's People

Contributors

marcelo-theodoro avatar

Watchers

James Cloos avatar David Cuentas Mar avatar

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.