mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Added options parameters to decode method of jsonwebtoken
Added options parameters to decode method of jsonwebtoken
This commit is contained in:
parent
44c9273e1e
commit
8d9e2d7993
@ -74,3 +74,9 @@ jwt.verify(token, cert, { ignoreExpiration: true }, function(err, decoded) {
|
||||
* https://github.com/auth0/node-jsonwebtoken#jwtdecodetoken
|
||||
*/
|
||||
var decoded = jwt.decode(token);
|
||||
|
||||
decoded = jwt.decode(token, { complete: false });
|
||||
|
||||
decoded = jwt.decode(token, { json: false });
|
||||
|
||||
decoded = jwt.decode(token, { complete: false, json: false });
|
||||
|
||||
8
jsonwebtoken/jsonwebtoken.d.ts
vendored
8
jsonwebtoken/jsonwebtoken.d.ts
vendored
@ -43,6 +43,11 @@ declare module "jsonwebtoken" {
|
||||
maxAge?: string;
|
||||
}
|
||||
|
||||
export interface DecodeOptions {
|
||||
complete?: boolean;
|
||||
json?: boolean;
|
||||
}
|
||||
|
||||
export interface VerifyCallback {
|
||||
(err: Error, decoded: any): void;
|
||||
}
|
||||
@ -93,7 +98,8 @@ declare module "jsonwebtoken" {
|
||||
/**
|
||||
* Returns the decoded payload without verifying if the signature is valid.
|
||||
* @param {String} token - JWT string to decode
|
||||
* @param {DecodeOptions} [options] - Options for decoding
|
||||
* @returns {Object} The decoded Token
|
||||
*/
|
||||
function decode(token: string): any;
|
||||
function decode(token: string, options?: DecodeOptions): any;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user