Comparing version 2.0.0 to 2.0.1
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); | ||
@@ -12,9 +11,6 @@ console.log('Getting current counter value for K = 12345678901234567890'); | ||
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, {})); | ||
@@ -85,3 +85,3 @@ | ||
// a correct code | ||
for(var i = counter; i <= counter + window; ++i) { | ||
for(var i = counter - window; i <= counter + window; ++i) { | ||
opt.counter = i; | ||
@@ -88,0 +88,0 @@ if(this.gen(key, opt) === token) { |
@@ -5,3 +5,3 @@ { | ||
"description": "Node One Time Password library, supports HOTP, TOTP and works with Google Authenticator", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"homepage": "https://github.com/guyht/notp", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -135,2 +135,8 @@ | ||
assert.ok(notp.hotp.verify(token, key, opt), 'Should pass for value of window >= 9'); | ||
// counterheck that test should pass for negative counter values | ||
token = '755224'; | ||
opt.counter = 7 | ||
opt.window = 8; | ||
assert.ok(notp.hotp.verify(token, key, opt), 'Should pass for negative counter values'); | ||
}; | ||
@@ -137,0 +143,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
20549
9
397
0