Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

notp

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notp - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

examples/TOTP-verify.js

18

examples/TOTP.js
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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc