Skip to content

Instantly share code, notes, and snippets.

Created Jul 10, 2017
What would you like to do?
TOTP with Node.js
'use strict';
var notp = require('notp'),
thirty_two = require('thirty-two');
var stdin = process.openStdin();
console.log("Entery TOTP key:");
stdin.addListener("data", function(d) {
var key = d.toString().trim().replace(/ /g, '');
var totp_token = notp.totp.gen(thirty_two.decode(key));
console.log("TOTP token: " + totp_token);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment