@types/jsonwebtoken
Advanced tools
Comparing version 8.5.1 to 8.5.2
@@ -14,2 +14,3 @@ // Type definitions for jsonwebtoken 8.5 | ||
// Piotr Błażejewicz <https://github.com/peterblazejewicz> | ||
// Nandor Kraszlan <https://github.com/nandi95> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -66,3 +67,3 @@ | ||
noTimestamp?: boolean; | ||
header?: object; | ||
header?: JwtHeader; | ||
encoding?: string; | ||
@@ -103,5 +104,5 @@ } | ||
| TokenExpiredError; | ||
export type VerifyCallback = ( | ||
export type VerifyCallback<T = JwtPayload> = ( | ||
err: VerifyErrors | null, | ||
decoded: object | undefined, | ||
decoded: T | undefined, | ||
) => void; | ||
@@ -113,11 +114,35 @@ | ||
// standard names https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1 | ||
export interface JwtHeader { | ||
alg: string; | ||
alg: string | Algorithm; | ||
typ?: string; | ||
cty?: string; | ||
crit?: Array<string | Exclude<keyof JwtHeader, 'crit'>>; | ||
kid?: string; | ||
jku?: string; | ||
x5u?: string; | ||
x5u?: string | string[]; | ||
'x5t#S256'?: string; | ||
x5t?: string; | ||
x5c?: string | string[]; | ||
} | ||
// standard claims https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 | ||
export interface JwtPayload { | ||
[key: string]: any; | ||
iss?: string; | ||
sub?: string; | ||
aud?: string | string[]; | ||
exp?: number; | ||
nbf?: number; | ||
iat?: number; | ||
jti?: string; | ||
} | ||
export interface Jwt { | ||
header: JwtHeader; | ||
payload: JwtPayload; | ||
signature: string; | ||
} | ||
// https://github.com/auth0/node-jsonwebtoken#algorithms-supported | ||
export type Algorithm = | ||
@@ -184,3 +209,4 @@ "HS256" | "HS384" | "HS512" | | ||
*/ | ||
export function verify(token: string, secretOrPublicKey: Secret, options?: VerifyOptions): object | string; | ||
export function verify(token: string, secretOrPublicKey: Secret, options: VerifyOptions & { complete: true }): Jwt | string; | ||
export function verify(token: string, secretOrPublicKey: Secret, options?: VerifyOptions): JwtPayload | string; | ||
@@ -204,2 +230,8 @@ /** | ||
secretOrPublicKey: Secret | GetPublicKeyOrSecret, | ||
options?: VerifyOptions & { complete: true }, | ||
callback?: VerifyCallback<Jwt>, | ||
): void; | ||
export function verify( | ||
token: string, | ||
secretOrPublicKey: Secret | GetPublicKeyOrSecret, | ||
options?: VerifyOptions, | ||
@@ -215,3 +247,3 @@ callback?: VerifyCallback, | ||
*/ | ||
export function decode(token: string, options: DecodeOptions & { json: true } | DecodeOptions & { complete: true }): null | { [key: string]: any }; | ||
export function decode(token: string, options?: DecodeOptions): null | { [key: string]: any } | string; | ||
export function decode(token: string, options: DecodeOptions & { json: true } | DecodeOptions & { complete: true }): null | Jwt; | ||
export function decode(token: string, options?: DecodeOptions): null | JwtPayload | string; |
{ | ||
"name": "@types/jsonwebtoken", | ||
"version": "8.5.1", | ||
"version": "8.5.2", | ||
"description": "TypeScript definitions for jsonwebtoken", | ||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jsonwebtoken", | ||
"license": "MIT", | ||
@@ -61,2 +62,7 @@ "contributors": [ | ||
"githubUsername": "peterblazejewicz" | ||
}, | ||
{ | ||
"name": "Nandor Kraszlan", | ||
"url": "https://github.com/nandi95", | ||
"githubUsername": "nandi95" | ||
} | ||
@@ -75,4 +81,4 @@ ], | ||
}, | ||
"typesPublisherContentHash": "610698456faaddf0271a63e8dc369e20d59c750c922fef91ec1490566da3d1aa", | ||
"typeScriptVersion": "3.5" | ||
"typesPublisherContentHash": "1cbe834f580d9a2fd6ebc9c6ab8b3cd5c5ee7f666eabe4b8c7a3b06bbe0f2858", | ||
"typeScriptVersion": "3.6" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 16 Mar 2021 16:00:48 GMT | ||
* Last updated: Fri, 18 Jun 2021 07:01:20 GMT | ||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node) | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by [Maxime LUCE](https://github.com/SomaticIT), [Daniel Heim](https://github.com/danielheim), [Brice BERNARD](https://github.com/brikou), [Veli-Pekka Kestilä](https://github.com/vpk), [Daniel Parker](https://github.com/rlgod), [Kjell Dießel](https://github.com/kettil), [Robert Gajda](https://github.com/RunAge), [Nico Flaig](https://github.com/nflaig), [Linus Unnebäck](https://github.com/LinusU), [Ivan Sieder](https://github.com/ivansieder), and [Piotr Błażejewicz](https://github.com/peterblazejewicz). | ||
These definitions were written by [Maxime LUCE](https://github.com/SomaticIT), [Daniel Heim](https://github.com/danielheim), [Brice BERNARD](https://github.com/brikou), [Veli-Pekka Kestilä](https://github.com/vpk), [Daniel Parker](https://github.com/rlgod), [Kjell Dießel](https://github.com/kettil), [Robert Gajda](https://github.com/RunAge), [Nico Flaig](https://github.com/nflaig), [Linus Unnebäck](https://github.com/LinusU), [Ivan Sieder](https://github.com/ivansieder), [Piotr Błażejewicz](https://github.com/peterblazejewicz), and [Nandor Kraszlan](https://github.com/nandi95). |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
12882
219
0