mirror of
https://github.com/hanzoai/node-jsonwebtoken.git
synced 2026-09-24 17:00:48 +00:00
Merge branch 'marwanhilmi-master'
This commit is contained in:
@@ -35,6 +35,9 @@ module.exports.verify = function(jwtString, secretOrPublicKey, options, callback
|
||||
if ((typeof options === 'function') && !callback) callback = options;
|
||||
if (!options) options = {};
|
||||
|
||||
if (!jwtString)
|
||||
return callback(new JsonWebTokenError('jwt must be provided'));
|
||||
|
||||
var parts = jwtString.split('.');
|
||||
if (parts.length !== 3)
|
||||
return callback(new JsonWebTokenError('jwt malformed'));
|
||||
|
||||
@@ -41,5 +41,13 @@ describe('HS256', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw when verifying null', function(done) {
|
||||
jwt.verify(null, 'secret', function(err, decoded) {
|
||||
assert.isUndefined(decoded);
|
||||
assert.isNotNull(err);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user