jsonwebtoken
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -6,2 +6,8 @@ # Change Log | ||
## 6.0.1 - 2016-04-27 | ||
This was an immediate change after publishing 6.0.0. | ||
- throw error on invalid options when the payload is not an object ([304f1b33075f79ed66f784e27dc4f5307aa39e27](https://github.com/auth0/node-jsonwebtoken/commit/304f1b33075f79ed66f784e27dc4f5307aa39e27)) | ||
## 6.0.0 - 2016-04-27 | ||
@@ -12,2 +18,3 @@ | ||
- throw error on invalid options like `expiresIn` when the payload is not an object ([304f1b33075f79ed66f784e27dc4f5307aa39e27](https://github.com/auth0/node-jsonwebtoken/commit/304f1b33075f79ed66f784e27dc4f5307aa39e27)) | ||
- `expiresInMinutes` and `expiresInSeconds` are deprecated and no longer supported. | ||
@@ -14,0 +21,0 @@ - `notBeforeInMinutes` and `notBeforeInSeconds` are deprecated and no longer supported. |
{ | ||
"name": "jsonwebtoken", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "JSON Web Token implementation (symmetric and asymmetric)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
18
sign.js
@@ -26,2 +26,12 @@ var Joi = require('joi'); | ||
var options_for_objects = [ | ||
'expiresIn', | ||
'notBefore', | ||
'noTimestamp', | ||
'audience', | ||
'issuer', | ||
'subject', | ||
'jwtid', | ||
]; | ||
module.exports = function(payload, secretOrPrivateKey, options, callback) { | ||
@@ -39,2 +49,10 @@ options = options || {}; | ||
payload = xtend(payload); | ||
} else if (typeof payload !== 'object') { | ||
var invalid_options = options_for_objects.filter(function (opt) { | ||
return typeof options[opt] !== 'undefined'; | ||
}); | ||
if (invalid_options.length > 0) { | ||
throw new Error('invalid ' + invalid_options.join(',') + ' option for ' + (typeof payload ) + ' payload' ); | ||
} | ||
} | ||
@@ -41,0 +59,0 @@ |
@@ -14,3 +14,3 @@ var jwt = require('../index'); | ||
//v6 version will throw in this case: | ||
it.skip('should throw with expiresIn', function () { | ||
it('should throw with expiresIn', function () { | ||
expect(function () { | ||
@@ -34,2 +34,2 @@ jwt.sign('hello', '123', { expiresIn: '12h' }); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78940
1114