mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-19 08:31:17 +08:00
@types/jsonwebtoken: Added clockTimestamp member to VerifyOptions interface
This commit is contained in:
1
types/jsonwebtoken/index.d.ts
vendored
1
types/jsonwebtoken/index.d.ts
vendored
@@ -58,6 +58,7 @@ export interface SignOptions {
|
||||
export interface VerifyOptions {
|
||||
algorithms?: string[];
|
||||
audience?: string | string[];
|
||||
clockTimestamp?: number;
|
||||
clockTolerance?: number;
|
||||
issuer?: string | string[];
|
||||
ignoreExpiration?: boolean;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user