From f1cffd033bffc44f20558eda4a797c3fa2f4ee05 Mon Sep 17 00:00:00 2001 From: Jakub Mikulas Date: Wed, 22 Apr 2015 16:20:44 +0200 Subject: [PATCH] Simplified checking for missing key --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 37dd0c5..6b0be78 100644 --- a/index.js +++ b/index.js @@ -107,8 +107,9 @@ module.exports.verify = function(jwtString, secretOrPublicKey, options, callback return done(new JsonWebTokenError('jwt signature is required')); } - if (typeof secretOrPublicKey === "undefined" || secretOrPublicKey === null) // secretOrPublicKey can be empty string + if (!secretOrPublicKey) { return done(new JsonWebTokenError('secret or public key must be provided')); + } if (!options.algorithms) { options.algorithms = ~secretOrPublicKey.toString().indexOf('BEGIN CERTIFICATE') ||