Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including totp-generator with all npm packages installed. Try it out:

var totpGenerator = require("totp-generator")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

totp-generator v0.0.7

Generate TOTP tokens from key

totp-generator

Build Status Code Climate Test Coverage npm Version

totp-generator lets you generate TOTP tokens from a TOTP key

How to use

var totp = require('totp-generator');

var token = totp('JBSWY3DPEHPK3PXP');

console.log(token); // prints a 6 digit time base token based on inputed key and time

Works with these token requirements

  • SHA-1
  • 30 sec epoch interval
  • 6 digit tokens

What do I use this library for?

  • E2E tests (where you need to login with 2-factor authentication)
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free