From 4475c95ecba7cf4caadfe19e9247a9fed50a794e Mon Sep 17 00:00:00 2001 From: Roman Shtylman Date: Thu, 31 May 2012 19:03:58 -0400 Subject: [PATCH] remove `err` argument from functions It was never used and is not really the node.js way to do things. --- lib/notp.js | 8 ++++---- test/notp.js | 48 ------------------------------------------------ 2 files changed, 4 insertions(+), 52 deletions(-) diff --git a/lib/notp.js b/lib/notp.js index b415930..3a27690 100644 --- a/lib/notp.js +++ b/lib/notp.js @@ -35,7 +35,7 @@ var base32 = require('thirty-two'); * be user specific, and be incremented for each request. * */ -module.exports.checkHOTP = function(args, err, cb) { +module.exports.checkHOTP = function(args, cb) { var hmac, digest, @@ -103,7 +103,7 @@ module.exports.checkHOTP = function(args, err, cb) { * Default - 30 * */ -module.exports.checkTOTP = function(args, err, cb) { +module.exports.checkTOTP = function(args, cb) { var hmac, digest, @@ -168,7 +168,7 @@ module.exports.checkTOTP = function(args, err, cb) { * be user specific, and be incremented for each request. * */ -module.exports.getHOTP = function(args, err, cb) { +module.exports.getHOTP = function(args, cb) { var hmac, digest, @@ -203,7 +203,7 @@ module.exports.getHOTP = function(args, err, cb) { * Default - 30 * */ -module.exports.getTOTP = function(args, err, cb) { +module.exports.getTOTP = function(args, cb) { var hmac, digest, offset, h, v, p = 6, b, diff --git a/test/notp.js b/test/notp.js index 87aec47..896f08b 100644 --- a/test/notp.js +++ b/test/notp.js @@ -60,9 +60,6 @@ exports.testHOTP = function(beforeExit, assert) { args.C = 0; args.P = 'WILLNOTPASS'; notp.checkHOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, false, 'Should not pass'); n++; @@ -74,9 +71,6 @@ exports.testHOTP = function(beforeExit, assert) { args.C = i; args.P = HOTP[i]; notp.checkHOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, true, 'Should pass'); assert.eql(w, 0, 'Should be in sync'); @@ -108,9 +102,6 @@ exports.testTOTP = function(beforeExit, assert) { args.T = 0; args.P = 'WILLNOTPASS'; notp.checkTOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, false, 'Should not pass'); n++; @@ -121,9 +112,6 @@ exports.testTOTP = function(beforeExit, assert) { args._t = 59*1000; args.P = '287082'; notp.checkTOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, true, 'Should pass'); assert.eql(w, 0, 'Should be in sync'); @@ -135,9 +123,6 @@ exports.testTOTP = function(beforeExit, assert) { args._t = 1234567890*1000; args.P = '005924'; notp.checkTOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, true, 'Should pass'); assert.eql(w, 0, 'Should be in sync'); @@ -149,9 +134,6 @@ exports.testTOTP = function(beforeExit, assert) { args._t = 1111111109*1000; args.P = '081804'; notp.checkTOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, true, 'Should pass'); assert.eql(w, 0, 'Should be in sync'); @@ -163,9 +145,6 @@ exports.testTOTP = function(beforeExit, assert) { args._t = 2000000000*1000; args.P = '279037'; notp.checkTOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, true, 'Should pass'); assert.eql(w, 0, 'Should be in sync'); @@ -196,9 +175,6 @@ exports.testHOTPOutOfSync = function(beforeExit, assert) { // Check that the test should fail for W < 8 args.W = 7; notp.checkHOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, false, 'Should not pass for value of W < 8'); n++; @@ -208,9 +184,6 @@ exports.testHOTPOutOfSync = function(beforeExit, assert) { // Check that the test should pass for W >= 9 args.W = 8; notp.checkHOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, true, 'Should pass for value of W >= 9'); n++; @@ -239,9 +212,6 @@ exports.testTOTPOutOfSync = function(beforeExit, assert) { // Check that the test should fail for W < 2 args.W = 2; notp.checkTOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, false, 'Should not pass for value of W < 3'); n++; @@ -251,9 +221,6 @@ exports.testTOTPOutOfSync = function(beforeExit, assert) { // Check that the test should pass for W >= 3 args.W = 3; notp.checkTOTP(args, - function(err) { - assert.eql(true, false, err); - }, function(ret, w) { assert.eql(ret, true, 'Should pass for value of W >= 3'); n++; @@ -281,9 +248,6 @@ exports.testGetHOTP = function(beforeExit, assert) { for(i=0;i