From b889c99a1e139370c60ac597963a19237d34bbe9 Mon Sep 17 00:00:00 2001 From: Guy Halford-Thompson Date: Wed, 13 Jun 2012 17:38:17 +0000 Subject: [PATCH] Updated example to work with new API. Fixes issue #4 --- examples/TOTP.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/examples/TOTP.js b/examples/TOTP.js index 1406c81..b81a21c 100644 --- a/examples/TOTP.js +++ b/examples/TOTP.js @@ -1,19 +1,15 @@ -var notp = require('../lib/notp'), - args = { - K : '12345678901234567890' - }, - b32 = notp.encBase32(args.K); +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)); -notp.getTOTP(args, - function(err) { console.log(err); }, - function(code) { - console.log('The current TOTP value is ' + code); - } -); +console.log('The current TOTP value is ' + notp.totp.gen(K, {}));