Time-based One-time Password

This TOTP (About Modules) module implements a Time-based One-time Password for Espruino.

How to use the module:

const TOTP = require('totp');
const totp = TOTP.create('JBSWY3DPEHPK3PXP');
// 6 digits, period of 30 seconds
console.log(totp.generate(getTime(), 6, 30));

Reference

// For example totp.generate(getTime(), 6/*digits*, 30/*seconds*/)
TOTP.prototype.generate = function (timestamp, digits, tokenPeriod) { ... }

// Create a TOTP generator with a secret code in base32
exports.create = function (secret) { ... }

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.