Merge branch 'marwanhilmi-master'

This commit is contained in:
José F. Romaniello
2014-09-05 08:02:37 -03:00
2 changed files with 11 additions and 0 deletions
+3
View File
@@ -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'));
+8
View File
@@ -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();
});
});
});
});