-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
97 lines (88 loc) · 2.12 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
export function sign(
payload: object,
key: string,
options?: SignOptions,
): string;
export function decode(
token: string,
secretOrPublicKey: string,
options: DecodeOptions & { complite: true },
): Jwt;
export function decode(
token: string,
secretOrPublicKey: string,
options?: DecodeOptions,
): object;
export function verify(
token: string,
secretOrPublicKey: string,
options: VerifyOptions & { complite: true },
): Jwt;
export function verify(
token: string,
secretOrPublicKey: string,
options?: VerifyOptions,
): object;
export interface SignOptions {
algorithm?: Algorithm | undefined;
keyid?: string | undefined;
expiresIn?: string | number | undefined;
notBefore?: string | number | undefined;
audience?: string | string[] | undefined;
subject?: string | undefined;
issuer?: string | undefined;
jwtid?: string | undefined;
noTimestamp?: boolean | undefined;
header?: JwtHeader | undefined;
}
export interface DecodeOptions {
complete?: boolean | undefined;
json?: boolean | undefined;
}
export interface VerifyOptions {
algorithms?: Algorithm[] | undefined;
audience?: string | Array<string> | undefined;
complete?: boolean | undefined;
issuer?: string | string[] | undefined;
ignoreExpiration?: boolean | undefined;
ignoreNotBefore?: boolean | undefined;
jwtid?: string | undefined;
subject?: string | undefined;
}
export interface JwtHeader {
alg: string | Algorithm;
typ?: string | undefined;
cty?: string | undefined;
kid?: string | undefined;
jku?: string | undefined;
x5u?: string | string[] | undefined;
x5t?: string | undefined;
}
export interface JwtPayload {
[key: string]: any;
iss?: string | undefined;
sub?: string | undefined;
aud?: string | string[] | undefined;
exp?: number | undefined;
nbf?: number | undefined;
iat?: number | undefined;
jti?: string | undefined;
}
export interface Jwt {
header: JwtHeader;
payload: JwtPayload | string;
signature: string;
}
export type Algorithm =
| 'HS256'
| 'HS384'
| 'HS512'
| 'RS256'
| 'RS384'
| 'RS512'
| 'ES256'
| 'ES384'
| 'ES512'
| 'PS256'
| 'PS384'
| 'PS512';