summaryrefslogtreecommitdiff
path: root/node_modules/notp/examples/TOTP.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-10 10:38:44 +0200
committerMinteck <contact@minteck.org>2022-08-10 10:38:44 +0200
commitc6dbf0450566c40efc4a26f4f0717452b6ef95cd (patch)
treeb4be2d508223820d0a77d5a3e35e82684da3b6ec /node_modules/notp/examples/TOTP.js
downloadhornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.gz
hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.bz2
hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.zip
Initial commitHEADmane
Diffstat (limited to 'node_modules/notp/examples/TOTP.js')
-rw-r--r--node_modules/notp/examples/TOTP.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/node_modules/notp/examples/TOTP.js b/node_modules/notp/examples/TOTP.js
new file mode 100644
index 0000000..b81a21c
--- /dev/null
+++ b/node_modules/notp/examples/TOTP.js
@@ -0,0 +1,15 @@
+
+var notp = require('../index'),
+ t2 = require('thirty-two'),
+ K = '12345678901234567890',
+ b32 = t2.encode(K);
+
+console.log('Getting current counter value for K = 12345678901234567890');
+console.log('This has a base32 value of ' + b32);
+console.log('The base32 value should be entered in the Google Authenticator App');
+console.log('');
+console.log('Open the following URL for a QR code. Google Authenticator can read this QR code using your phone\'s camera:');
+console.log('http://qrcode.kaywa.com/img.php?s=8&d=' + encodeURIComponent('otpauth://totp/notp@example.com?secret=' + b32));
+
+console.log('The current TOTP value is ' + notp.totp.gen(K, {}));
+