Skip to content

Instantly share code, notes, and snippets.

@yan12125 yan12125/main.js
Created Jul 10, 2017

Embed
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
You can’t perform that action at this time.