UNPKG

587 BTypeScriptView Raw
1export interface JwtDecodeOptions {
2 header?: boolean;
3}
4export interface JwtHeader {
5 typ?: string;
6 alg?: string;
7 kid?: string;
8}
9export interface JwtPayload {
10 iss?: string;
11 sub?: string;
12 aud?: string[] | string;
13 exp?: number;
14 nbf?: number;
15 iat?: number;
16 jti?: string;
17}
18export declare class InvalidTokenError extends Error {
19}
20export declare function jwtDecode<T = JwtHeader>(token: string, options: JwtDecodeOptions & {
21 header: true;
22}): T;
23export declare function jwtDecode<T = JwtPayload>(token: string, options?: JwtDecodeOptions): T;