@types/jsonwebtoken: Added clockTimestamp member to VerifyOptions interface

This commit is contained in:
Halt
2017-12-10 11:33:53 +01:00
parent 14d6d73e6d
commit 3db792b26a
2 changed files with 8 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ export interface SignOptions {
export interface VerifyOptions {
algorithms?: string[];
audience?: string | string[];
clockTimestamp?: number;
clockTolerance?: number;
issuer?: string | string[];
ignoreExpiration?: boolean;

View File

@@ -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