Skip to content

Commit

Permalink
Simplified checking for missing key
Browse files Browse the repository at this point in the history
  • Loading branch information
JackuB committed Apr 22, 2015
1 parent ffe68db commit f1cffd0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') ||
Expand Down

0 comments on commit f1cffd0

Please sign in to comment.