diff --git a/lib/jwt/verify.js b/lib/jwt/verify.js index 4640ef35bd..8af4b5fcfe 100644 --- a/lib/jwt/verify.js +++ b/lib/jwt/verify.js @@ -20,8 +20,8 @@ const isTimestamp = (value, label, required = false) => { throw new JWTClaimInvalid(`"${label}" claim is missing`, label, 'missing') } - if (value !== undefined && (typeof value !== 'number' || !Number.isSafeInteger(value))) { - throw new JWTClaimInvalid(`"${label}" claim must be a unix timestamp`, label, 'invalid') + if (value !== undefined && (typeof value !== 'number')) { + throw new JWTClaimInvalid(`"${label}" claim must be a JSON numeric value`, label, 'invalid') } } diff --git a/test/jwt/verify.test.js b/test/jwt/verify.test.js index 4a2a15d648..a752fd9fd5 100644 --- a/test/jwt/verify.test.js +++ b/test/jwt/verify.test.js @@ -108,7 +108,7 @@ test('options.ignoreIat & options.maxTokenAge may not be used together', t => { const err = t.throws(() => { const invalid = JWS.sign({ [claim]: val }, key) JWT.verify(invalid, key) - }, { instanceOf: errors.JWTClaimInvalid, message: `"${claim}" claim must be a unix timestamp` }) + }, { instanceOf: errors.JWTClaimInvalid, message: `"${claim}" claim must be a JSON numeric value` }) t.is(err.claim, claim) t.is(err.reason, 'invalid')