Updated example to work with new API. Fixes issue #4
This commit is contained in:
parent
ff3803e2f4
commit
b889c99a1e
@ -1,19 +1,15 @@
|
|||||||
|
|
||||||
var notp = require('../lib/notp'),
|
var notp = require('../index'),
|
||||||
args = {
|
t2 = require('thirty-two'),
|
||||||
K : '12345678901234567890'
|
K = '12345678901234567890',
|
||||||
},
|
b32 = t2.encode(K);
|
||||||
b32 = notp.encBase32(args.K);
|
|
||||||
|
|
||||||
console.log('Getting current counter value for K = 12345678901234567890');
|
console.log('Getting current counter value for K = 12345678901234567890');
|
||||||
console.log('This has a base32 value of ' + b32);
|
console.log('This has a base32 value of ' + b32);
|
||||||
console.log('The base32 value should be entered in the Google Authenticator App');
|
console.log('The base32 value should be entered in the Google Authenticator App');
|
||||||
console.log('');
|
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));
|
||||||
|
|
||||||
notp.getTOTP(args,
|
console.log('The current TOTP value is ' + notp.totp.gen(K, {}));
|
||||||
function(err) { console.log(err); },
|
|
||||||
function(code) {
|
|
||||||
console.log('The current TOTP value is ' + code);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user