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') ||