Created
July 10, 2017 16:48
-
-
Save yan12125/3dcebd58a4c789f387c523fefa6eb5d9 to your computer and use it in GitHub Desktop.
TOTP with Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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