Simplified checking for missing key

This commit is contained in:
Jakub Mikulas
2015-04-22 16:20:44 +02:00
parent ffe68dbe02
commit f1cffd033b
+2 -1
View File
@@ -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') ||