Miss any of our Open RFC calls?Watch the recordings here! »

deathmoon-totp-generator

1.0.1 • Public • Published

@deathmoon/totp-generator

Build Status Code Climate Test Coverage npm Version

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

This package is based on bellstrand's totp-generator.

How to use

var totp = require('@deathmoon/totp-generator');
 
var token = totp('JBSWY3DPEHPK3PXP', { time: new Date() });
 
console.log(token); // prints a 6 digit time base token based on inputed key and time

API

totp(<key>, [opts])
  • key (string): the secret key;
  • opts (Object): the options object;
    • opts.time (number): the timestamp, defaults to Date.now().

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)

Install

npm i deathmoon-totp-generator

DownloadsWeekly Downloads

17

Version

1.0.1

License

MIT

Unpacked Size

7.63 kB

Total Files

9

Last publish

Collaborators

  • avatar