deno.land / x / hono@v4.2.5 / utils / jwt / types.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
export class JwtAlgorithmNotImplemented extends Error { constructor(alg: string) { super(`${alg} is not an implemented algorithm`) this.name = 'JwtAlgorithmNotImplemented' }}
export class JwtTokenInvalid extends Error { constructor(token: string) { super(`invalid JWT token: ${token}`) this.name = 'JwtTokenInvalid' }}
export class JwtTokenNotBefore extends Error { constructor(token: string) { super(`token (${token}) is being used before it's valid`) this.name = 'JwtTokenNotBefore' }}
export class JwtTokenExpired extends Error { constructor(token: string) { super(`token (${token}) expired`) this.name = 'JwtTokenExpired' }}
export class JwtTokenIssuedAt extends Error { constructor(currentTimestamp: number, iat: number) { super(`Incorrect "iat" claim must be a older than "${currentTimestamp}" (iat: "${iat}")`) this.name = 'JwtTokenIssuedAt' }}
export class JwtHeaderInvalid extends Error { constructor(header: object) { super(`jwt header is invalid: ${JSON.stringify(header)}`) this.name = 'JwtHeaderInvalid' }}
export class JwtTokenSignatureMismatched extends Error { constructor(token: string) { super(`token(${token}) signature mismatched`) this.name = 'JwtTokenSignatureMismatched' }}
export enum CryptoKeyUsage { Encrypt = 'encrypt', Decrypt = 'decrypt', Sign = 'sign', Verify = 'verify', DeriveKey = 'deriveKey', DeriveBits = 'deriveBits', WrapKey = 'wrapKey', UnwrapKey = 'unwrapKey',}
/** * JWT Payload */export type JWTPayload = | (unknown & {}) | { [key: string]: unknown /** * The token is checked to ensure it has not expired. */ exp?: number /** * The token is checked to ensure it is not being used before a specified time. */ nbf?: number /** * The token is checked to ensure it is not issued in the future. */ iat?: number }
hono

Version Info

Tagged at
a year ago