jose 4.6.1 → 4.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -58,13 +58,8 @@ export default (protectedHeader, encodedPayload, options = {}) => {
|
|
|
58
58
|
}
|
|
59
59
|
const { currentDate } = options;
|
|
60
60
|
const now = epoch(currentDate || new Date());
|
|
61
|
-
if (payload.iat !== undefined || options.maxTokenAge) {
|
|
62
|
-
|
|
63
|
-
throw new JWTClaimValidationFailed('"iat" claim must be a number', 'iat', 'invalid');
|
|
64
|
-
}
|
|
65
|
-
if (payload.exp === undefined && payload.iat > now + tolerance) {
|
|
66
|
-
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', 'iat', 'check_failed');
|
|
67
|
-
}
|
|
61
|
+
if ((payload.iat !== undefined || options.maxTokenAge) && typeof payload.iat !== 'number') {
|
|
62
|
+
throw new JWTClaimValidationFailed('"iat" claim must be a number', 'iat', 'invalid');
|
|
68
63
|
}
|
|
69
64
|
if (payload.nbf !== undefined) {
|
|
70
65
|
if (typeof payload.nbf !== 'number') {
|
|
@@ -60,13 +60,8 @@ exports.default = (protectedHeader, encodedPayload, options = {}) => {
|
|
|
60
60
|
}
|
|
61
61
|
const { currentDate } = options;
|
|
62
62
|
const now = (0, epoch_js_1.default)(currentDate || new Date());
|
|
63
|
-
if (payload.iat !== undefined || options.maxTokenAge) {
|
|
64
|
-
|
|
65
|
-
throw new errors_js_1.JWTClaimValidationFailed('"iat" claim must be a number', 'iat', 'invalid');
|
|
66
|
-
}
|
|
67
|
-
if (payload.exp === undefined && payload.iat > now + tolerance) {
|
|
68
|
-
throw new errors_js_1.JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', 'iat', 'check_failed');
|
|
69
|
-
}
|
|
63
|
+
if ((payload.iat !== undefined || options.maxTokenAge) && typeof payload.iat !== 'number') {
|
|
64
|
+
throw new errors_js_1.JWTClaimValidationFailed('"iat" claim must be a number', 'iat', 'invalid');
|
|
70
65
|
}
|
|
71
66
|
if (payload.nbf !== undefined) {
|
|
72
67
|
if (typeof payload.nbf !== 'number') {
|
|
@@ -58,13 +58,8 @@ export default (protectedHeader, encodedPayload, options = {}) => {
|
|
|
58
58
|
}
|
|
59
59
|
const { currentDate } = options;
|
|
60
60
|
const now = epoch(currentDate || new Date());
|
|
61
|
-
if (payload.iat !== undefined || options.maxTokenAge) {
|
|
62
|
-
|
|
63
|
-
throw new JWTClaimValidationFailed('"iat" claim must be a number', 'iat', 'invalid');
|
|
64
|
-
}
|
|
65
|
-
if (payload.exp === undefined && payload.iat > now + tolerance) {
|
|
66
|
-
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', 'iat', 'check_failed');
|
|
67
|
-
}
|
|
61
|
+
if ((payload.iat !== undefined || options.maxTokenAge) && typeof payload.iat !== 'number') {
|
|
62
|
+
throw new JWTClaimValidationFailed('"iat" claim must be a number', 'iat', 'invalid');
|
|
68
63
|
}
|
|
69
64
|
if (payload.nbf !== undefined) {
|
|
70
65
|
if (typeof payload.nbf !== 'number') {
|