mirror of
https://github.com/hanzoai/node-jsonwebtoken.git
synced 2026-09-24 17:00:48 +00:00
Simplified checking for missing key
This commit is contained in:
@@ -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') ||
|
||||
|
||||
Reference in New Issue
Block a user