Giter VIP home page Giter VIP logo

totp-generator-web's Introduction

TOTP Web Generator

Generate TOTP codes right from your browser for Two-Factor Authentication (2FA). Compatible with authenticator applications like Google Authenticator, Authy and Microsoft Authenticator.

Demo,

Application Screenshot

Design

The application only uses the JavaScript APIs provided by the browser. It consists of only a single HTML file, which allows it to work offline by running it from disk. The design allows it to work without installation and in environments like Tails.

Assumption: Possible to input the TOTP key into the web application's input field. (e.g, Copy/Paste or Manual typing using a hardware/virtual keyboard based on the threat model).

Settings

The default settings are compatible with Google Authenticator,

  • HMAC Algorithm: SHA-1
  • Period: 30 seconds
  • Digits: 6

Use the “Advanced Options” menu to change the above values.

The application supports secret keys in the following formats,

  • Base32 (case-insensitive) — e.g, XY7MXDNK5ZEKJT4Y or xy7mxdnk5zekjt4y
  • Base32 with spaces (case-insensitive) — e.g, g5od kqdo hqkd 4kup qr2d txc2 2cfh wylh

Web Technologies Used

  1. Web Crypto — Used to calculate the HMAC. Browser Support.
  2. Uint8Array — Used to store and process binary data according to RFC 6238 (TOTP) and RFC 4226 (HOTP). Browser Support.
  3. Async/Await — Easier to work with promises. Browser Support.
  4. Custom Elements — Build the UI out of components without a JavaScript framework. Browser Support.

Development

Tools

Content Security Policy whitelists assets (e.g, JavaScript, CSS) by their SHA-256 hash. A minimal build tool (watch.js) updates the CSP hashes. A meta tag is the preferred method of policy configuration as Netlify and CloudFlare host the site.

Use the following command to start the build tool which watches for changes to src/index.html,

$ npm run watch

Use the following command to start live-server,

$ npm run start

Environment

Get started working on this repository from your browser using Gitpod. Click on the button below to create a GitPod environment,

Open in Gitpod

Code Mirrors

Deployment

Development happens on the devel branch and merged with main for a release. A GitHub build hook pushes a new version for every update of the main branch using the contents of the dist folder.

Use the following command to update the dist folder. The command removes CSP configurations which are only required for development.

$ npm run build

Acknowledgements

References used during development,

totp-generator-web's People

Contributors

dependabot[bot] avatar k3karthic avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  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.