diff --git a/types/jsonwebtoken/index.d.ts b/types/jsonwebtoken/index.d.ts index 766042e627..26e223df53 100644 --- a/types/jsonwebtoken/index.d.ts +++ b/types/jsonwebtoken/index.d.ts @@ -58,6 +58,7 @@ export interface SignOptions { export interface VerifyOptions { algorithms?: string[]; audience?: string | string[]; + clockTimestamp?: number; clockTolerance?: number; issuer?: string | string[]; ignoreExpiration?: boolean; diff --git a/types/jsonwebtoken/jsonwebtoken-tests.ts b/types/jsonwebtoken/jsonwebtoken-tests.ts index 9e495d31cb..0b04c23e63 100644 --- a/types/jsonwebtoken/jsonwebtoken-tests.ts +++ b/types/jsonwebtoken/jsonwebtoken-tests.ts @@ -57,6 +57,13 @@ jwt.verify(token, 'shhhhh', function(err, decoded) { console.log(result.foo) // bar }); +// use external time for verifying +jwt.verify(token, 'shhhhh', { clockTimestamp: 1 }, function(err, decoded) { + const result = decoded as ITestObject + + console.log(result.foo) // bar +}); + // invalid token jwt.verify(token, 'wrong-secret', function(err, decoded) { // err