@twin.org/web 0.0.3-next.3 → 0.0.3-next.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/es/index.js +3 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IHttpLinkHeader.js +2 -0
- package/dist/es/models/IHttpLinkHeader.js.map +1 -0
- package/dist/es/models/headerTypes.js +129 -1
- package/dist/es/models/headerTypes.js.map +1 -1
- package/dist/es/models/httpLinkRelType.js +130 -0
- package/dist/es/models/httpLinkRelType.js.map +1 -0
- package/dist/es/models/httpMethod.js +36 -0
- package/dist/es/models/httpMethod.js.map +1 -1
- package/dist/es/models/httpStatusCode.js +63 -0
- package/dist/es/models/httpStatusCode.js.map +1 -1
- package/dist/es/models/mimeTypes.js +170 -1
- package/dist/es/models/mimeTypes.js.map +1 -1
- package/dist/es/utils/cookieHelper.js +83 -0
- package/dist/es/utils/cookieHelper.js.map +1 -0
- package/dist/es/utils/headerHelper.js +383 -1
- package/dist/es/utils/headerHelper.js.map +1 -1
- package/dist/es/utils/mimeTypeHelper.js +42 -1
- package/dist/es/utils/mimeTypeHelper.js.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/models/IHttpLinkHeader.d.ts +26 -0
- package/dist/types/models/headerTypes.d.ts +128 -0
- package/dist/types/models/httpLinkRelType.d.ts +130 -0
- package/dist/types/models/httpMethod.d.ts +36 -0
- package/dist/types/models/httpStatusCode.d.ts +63 -0
- package/dist/types/models/mimeTypes.d.ts +169 -0
- package/dist/types/utils/cookieHelper.d.ts +49 -0
- package/dist/types/utils/headerHelper.d.ts +115 -0
- package/docs/changelog.md +592 -1
- package/docs/examples.md +108 -1
- package/docs/reference/classes/CookieHelper.md +155 -0
- package/docs/reference/classes/FetchError.md +453 -1
- package/docs/reference/classes/FetchHelper.md +12 -12
- package/docs/reference/classes/HeaderHelper.md +385 -2
- package/docs/reference/classes/Jwk.md +6 -6
- package/docs/reference/classes/Jws.md +3 -3
- package/docs/reference/classes/Jwt.md +17 -17
- package/docs/reference/classes/MimeTypeHelper.md +4 -4
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/IFetchOptions.md +12 -12
- package/docs/reference/interfaces/IHttpHeaders.md +1 -1
- package/docs/reference/interfaces/IHttpLinkHeader.md +43 -0
- package/docs/reference/type-aliases/HttpLinkRelType.md +5 -0
- package/docs/reference/variables/HeaderTypes.md +280 -8
- package/docs/reference/variables/HttpLinkRelType.md +191 -0
- package/docs/reference/variables/HttpMethod.md +63 -9
- package/docs/reference/variables/HttpStatusCode.md +314 -62
- package/docs/reference/variables/MimeTypes.md +279 -23
- package/locales/en.json +4 -0
- package/package.json +6 -6
|
@@ -14,7 +14,7 @@ Class to helper with fetch operations.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### CLASS\_NAME
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
18
|
|
|
19
19
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Runtime name for the class.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### fetch()
|
|
25
|
+
### fetch() {#fetch}
|
|
26
26
|
|
|
27
27
|
> `static` **fetch**(`source`, `url`, `method`, `body?`, `options?`): `Promise`\<`Response`\>
|
|
28
28
|
|
|
@@ -50,9 +50,9 @@ The http method.
|
|
|
50
50
|
|
|
51
51
|
##### body?
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
`string` \| `Uint8Array`\<`ArrayBufferLike`\>
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
Request to send to the endpoint.
|
|
56
56
|
|
|
57
57
|
##### options?
|
|
58
58
|
|
|
@@ -68,7 +68,7 @@ The response.
|
|
|
68
68
|
|
|
69
69
|
***
|
|
70
70
|
|
|
71
|
-
### fetchJson()
|
|
71
|
+
### fetchJson() {#fetchjson}
|
|
72
72
|
|
|
73
73
|
> `static` **fetchJson**\<`T`, `U`\>(`source`, `url`, `method`, `requestData?`, `options?`): `Promise`\<`U`\>
|
|
74
74
|
|
|
@@ -124,7 +124,7 @@ The response.
|
|
|
124
124
|
|
|
125
125
|
***
|
|
126
126
|
|
|
127
|
-
### fetchBinary()
|
|
127
|
+
### fetchBinary() {#fetchbinary}
|
|
128
128
|
|
|
129
129
|
> `static` **fetchBinary**\<`T`\>(`source`, `url`, `method`, `requestData?`, `options?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `T`\>
|
|
130
130
|
|
|
@@ -152,9 +152,9 @@ The url for the request.
|
|
|
152
152
|
|
|
153
153
|
##### method
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
`"GET"` \| `"POST"`
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
The http method.
|
|
158
158
|
|
|
159
159
|
##### requestData?
|
|
160
160
|
|
|
@@ -176,7 +176,7 @@ The response.
|
|
|
176
176
|
|
|
177
177
|
***
|
|
178
178
|
|
|
179
|
-
### clearCache()
|
|
179
|
+
### clearCache() {#clearcache}
|
|
180
180
|
|
|
181
181
|
> `static` **clearCache**(): `void`
|
|
182
182
|
|
|
@@ -188,7 +188,7 @@ Clears the cache.
|
|
|
188
188
|
|
|
189
189
|
***
|
|
190
190
|
|
|
191
|
-
### getCacheEntry()
|
|
191
|
+
### getCacheEntry() {#getcacheentry}
|
|
192
192
|
|
|
193
193
|
> `static` **getCacheEntry**\<`T`\>(`url`): `Promise`\<`T` \| `undefined`\>
|
|
194
194
|
|
|
@@ -216,7 +216,7 @@ The cache entry if it exists.
|
|
|
216
216
|
|
|
217
217
|
***
|
|
218
218
|
|
|
219
|
-
### setCacheEntry()
|
|
219
|
+
### setCacheEntry() {#setcacheentry}
|
|
220
220
|
|
|
221
221
|
> `static` **setCacheEntry**\<`T`\>(`url`, `value`): `Promise`\<`void`\>
|
|
222
222
|
|
|
@@ -250,7 +250,7 @@ The cache entry if it exists.
|
|
|
250
250
|
|
|
251
251
|
***
|
|
252
252
|
|
|
253
|
-
### removeCacheEntry()
|
|
253
|
+
### removeCacheEntry() {#removecacheentry}
|
|
254
254
|
|
|
255
255
|
> `static` **removeCacheEntry**(`url`): `void`
|
|
256
256
|
|
|
@@ -12,9 +12,17 @@ Class to helper with header operations.
|
|
|
12
12
|
|
|
13
13
|
`HeaderHelper`
|
|
14
14
|
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
|
+
|
|
19
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
|
+
|
|
21
|
+
Runtime name for the class.
|
|
22
|
+
|
|
15
23
|
## Methods
|
|
16
24
|
|
|
17
|
-
### createBearer()
|
|
25
|
+
### createBearer() {#createbearer}
|
|
18
26
|
|
|
19
27
|
> `static` **createBearer**(`token`): `string`
|
|
20
28
|
|
|
@@ -36,7 +44,7 @@ The bearer token header.
|
|
|
36
44
|
|
|
37
45
|
***
|
|
38
46
|
|
|
39
|
-
### extractBearer()
|
|
47
|
+
### extractBearer() {#extractbearer}
|
|
40
48
|
|
|
41
49
|
> `static` **extractBearer**(`header`): `string`
|
|
42
50
|
|
|
@@ -55,3 +63,378 @@ The header value to extract the token from.
|
|
|
55
63
|
`string`
|
|
56
64
|
|
|
57
65
|
The extracted token if it exists.
|
|
66
|
+
|
|
67
|
+
***
|
|
68
|
+
|
|
69
|
+
### extractAcceptLanguage() {#extractacceptlanguage}
|
|
70
|
+
|
|
71
|
+
> `static` **extractAcceptLanguage**(`headers?`): `object`[] \| `undefined`
|
|
72
|
+
|
|
73
|
+
Extract parsed language preferences from the Accept-Language header.
|
|
74
|
+
|
|
75
|
+
#### Parameters
|
|
76
|
+
|
|
77
|
+
##### headers?
|
|
78
|
+
|
|
79
|
+
[`IHttpHeaders`](../interfaces/IHttpHeaders.md)
|
|
80
|
+
|
|
81
|
+
The HTTP request headers.
|
|
82
|
+
|
|
83
|
+
#### Returns
|
|
84
|
+
|
|
85
|
+
`object`[] \| `undefined`
|
|
86
|
+
|
|
87
|
+
The parsed language preferences ordered by highest quality first, or undefined if missing or invalid.
|
|
88
|
+
|
|
89
|
+
***
|
|
90
|
+
|
|
91
|
+
### parseAcceptLanguage() {#parseacceptlanguage}
|
|
92
|
+
|
|
93
|
+
> `static` **parseAcceptLanguage**(`acceptLanguage`): `object`[] \| `undefined`
|
|
94
|
+
|
|
95
|
+
Parse one or more Accept-Language header values into language preferences.
|
|
96
|
+
|
|
97
|
+
#### Parameters
|
|
98
|
+
|
|
99
|
+
##### acceptLanguage
|
|
100
|
+
|
|
101
|
+
`string` \| `string`[] \| `undefined`
|
|
102
|
+
|
|
103
|
+
The Accept-Language header value or values.
|
|
104
|
+
|
|
105
|
+
#### Returns
|
|
106
|
+
|
|
107
|
+
`object`[] \| `undefined`
|
|
108
|
+
|
|
109
|
+
The parsed language preferences ordered by highest quality first, or undefined if missing or if any entry is invalid.
|
|
110
|
+
|
|
111
|
+
***
|
|
112
|
+
|
|
113
|
+
### extractClientIps() {#extractclientips}
|
|
114
|
+
|
|
115
|
+
> `static` **extractClientIps**(`headers?`): `string`[]
|
|
116
|
+
|
|
117
|
+
Extract client IP addresses from HTTP request headers.
|
|
118
|
+
Checks all `X-Forwarded-For` and `X-Real-IP` header values for proxied requests.
|
|
119
|
+
|
|
120
|
+
#### Parameters
|
|
121
|
+
|
|
122
|
+
##### headers?
|
|
123
|
+
|
|
124
|
+
[`IHttpHeaders`](../interfaces/IHttpHeaders.md)
|
|
125
|
+
|
|
126
|
+
The HTTP request headers.
|
|
127
|
+
|
|
128
|
+
#### Returns
|
|
129
|
+
|
|
130
|
+
`string`[]
|
|
131
|
+
|
|
132
|
+
The extracted client IP addresses in header order.
|
|
133
|
+
|
|
134
|
+
***
|
|
135
|
+
|
|
136
|
+
### extractUserAgent() {#extractuseragent}
|
|
137
|
+
|
|
138
|
+
> `static` **extractUserAgent**(`headers?`, `maxLength?`): `string` \| `undefined`
|
|
139
|
+
|
|
140
|
+
Extract the User-Agent header from the HTTP request context.
|
|
141
|
+
|
|
142
|
+
#### Parameters
|
|
143
|
+
|
|
144
|
+
##### headers?
|
|
145
|
+
|
|
146
|
+
[`IHttpHeaders`](../interfaces/IHttpHeaders.md)
|
|
147
|
+
|
|
148
|
+
The HTTP request headers.
|
|
149
|
+
|
|
150
|
+
##### maxLength?
|
|
151
|
+
|
|
152
|
+
`number`
|
|
153
|
+
|
|
154
|
+
Optional maximum length for the User-Agent string to prevent excessively long values.
|
|
155
|
+
|
|
156
|
+
#### Returns
|
|
157
|
+
|
|
158
|
+
`string` \| `undefined`
|
|
159
|
+
|
|
160
|
+
The user agent string or undefined if not available.
|
|
161
|
+
|
|
162
|
+
***
|
|
163
|
+
|
|
164
|
+
### extractCorrelationId() {#extractcorrelationid}
|
|
165
|
+
|
|
166
|
+
> `static` **extractCorrelationId**(`headers?`, `maxLength?`): `string` \| `undefined`
|
|
167
|
+
|
|
168
|
+
Extract a correlation ID for request tracing from the X-Correlation-ID header.
|
|
169
|
+
|
|
170
|
+
#### Parameters
|
|
171
|
+
|
|
172
|
+
##### headers?
|
|
173
|
+
|
|
174
|
+
[`IHttpHeaders`](../interfaces/IHttpHeaders.md)
|
|
175
|
+
|
|
176
|
+
The HTTP request headers.
|
|
177
|
+
|
|
178
|
+
##### maxLength?
|
|
179
|
+
|
|
180
|
+
`number`
|
|
181
|
+
|
|
182
|
+
Optional maximum length for the extracted correlation ID.
|
|
183
|
+
|
|
184
|
+
#### Returns
|
|
185
|
+
|
|
186
|
+
`string` \| `undefined`
|
|
187
|
+
|
|
188
|
+
The correlation ID, or undefined if the header is missing or invalid.
|
|
189
|
+
|
|
190
|
+
***
|
|
191
|
+
|
|
192
|
+
### isIpAddress() {#isipaddress}
|
|
193
|
+
|
|
194
|
+
> `static` **isIpAddress**(`ip`): `boolean`
|
|
195
|
+
|
|
196
|
+
Validate if a string is a valid IP address (IPv4 or IPv6).
|
|
197
|
+
|
|
198
|
+
#### Parameters
|
|
199
|
+
|
|
200
|
+
##### ip
|
|
201
|
+
|
|
202
|
+
`string`
|
|
203
|
+
|
|
204
|
+
The IP address to validate.
|
|
205
|
+
|
|
206
|
+
#### Returns
|
|
207
|
+
|
|
208
|
+
`boolean`
|
|
209
|
+
|
|
210
|
+
True if valid, false otherwise.
|
|
211
|
+
|
|
212
|
+
***
|
|
213
|
+
|
|
214
|
+
### isIpAddressV4() {#isipaddressv4}
|
|
215
|
+
|
|
216
|
+
> `static` **isIpAddressV4**(`ip`): `boolean`
|
|
217
|
+
|
|
218
|
+
Validate if a string is a valid IP address IPv4.
|
|
219
|
+
|
|
220
|
+
#### Parameters
|
|
221
|
+
|
|
222
|
+
##### ip
|
|
223
|
+
|
|
224
|
+
`string`
|
|
225
|
+
|
|
226
|
+
The IP address to validate.
|
|
227
|
+
|
|
228
|
+
#### Returns
|
|
229
|
+
|
|
230
|
+
`boolean`
|
|
231
|
+
|
|
232
|
+
True if valid, false otherwise.
|
|
233
|
+
|
|
234
|
+
***
|
|
235
|
+
|
|
236
|
+
### isIpAddressV6() {#isipaddressv6}
|
|
237
|
+
|
|
238
|
+
> `static` **isIpAddressV6**(`ip`): `boolean`
|
|
239
|
+
|
|
240
|
+
Validate if a string is a valid IP address IPv6.
|
|
241
|
+
|
|
242
|
+
#### Parameters
|
|
243
|
+
|
|
244
|
+
##### ip
|
|
245
|
+
|
|
246
|
+
`string`
|
|
247
|
+
|
|
248
|
+
The IP address to validate.
|
|
249
|
+
|
|
250
|
+
#### Returns
|
|
251
|
+
|
|
252
|
+
`boolean`
|
|
253
|
+
|
|
254
|
+
True if valid, false otherwise.
|
|
255
|
+
|
|
256
|
+
***
|
|
257
|
+
|
|
258
|
+
### extractLinkHeaderRelation() {#extractlinkheaderrelation}
|
|
259
|
+
|
|
260
|
+
> `static` **extractLinkHeaderRelation**(`linkHeader`, `relation`): [`IHttpLinkHeader`](../interfaces/IHttpLinkHeader.md) \| `undefined`
|
|
261
|
+
|
|
262
|
+
Extract the first occurrence of properties from a Link header for a specific relation type.
|
|
263
|
+
|
|
264
|
+
#### Parameters
|
|
265
|
+
|
|
266
|
+
##### linkHeader
|
|
267
|
+
|
|
268
|
+
`unknown`
|
|
269
|
+
|
|
270
|
+
The Link header value in format `<url>; rel="..."; param1=""; param2=""`.
|
|
271
|
+
|
|
272
|
+
##### relation
|
|
273
|
+
|
|
274
|
+
`string` \| `RegExp`
|
|
275
|
+
|
|
276
|
+
The relation type to extract.
|
|
277
|
+
|
|
278
|
+
#### Returns
|
|
279
|
+
|
|
280
|
+
[`IHttpLinkHeader`](../interfaces/IHttpLinkHeader.md) \| `undefined`
|
|
281
|
+
|
|
282
|
+
The extracted URL, rel and optional params or undefined if invalid/missing.
|
|
283
|
+
|
|
284
|
+
#### See
|
|
285
|
+
|
|
286
|
+
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Link
|
|
287
|
+
|
|
288
|
+
***
|
|
289
|
+
|
|
290
|
+
### extractLinkHeaderRelations() {#extractlinkheaderrelations}
|
|
291
|
+
|
|
292
|
+
> `static` **extractLinkHeaderRelations**(`linkHeader`, `relation`): [`IHttpLinkHeader`](../interfaces/IHttpLinkHeader.md)[] \| `undefined`
|
|
293
|
+
|
|
294
|
+
Extract multiple properties from a Link header for a specific relation type.
|
|
295
|
+
|
|
296
|
+
#### Parameters
|
|
297
|
+
|
|
298
|
+
##### linkHeader
|
|
299
|
+
|
|
300
|
+
`unknown`
|
|
301
|
+
|
|
302
|
+
The Link header value in format `<url>; rel="..."; param1=""; param2=""`.
|
|
303
|
+
|
|
304
|
+
##### relation
|
|
305
|
+
|
|
306
|
+
`string` \| `RegExp`
|
|
307
|
+
|
|
308
|
+
The relation type to extract.
|
|
309
|
+
|
|
310
|
+
#### Returns
|
|
311
|
+
|
|
312
|
+
[`IHttpLinkHeader`](../interfaces/IHttpLinkHeader.md)[] \| `undefined`
|
|
313
|
+
|
|
314
|
+
The extracted URL, rel and optional params or undefined if invalid/missing.
|
|
315
|
+
|
|
316
|
+
#### See
|
|
317
|
+
|
|
318
|
+
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Link
|
|
319
|
+
|
|
320
|
+
***
|
|
321
|
+
|
|
322
|
+
### extractLinkHeaders() {#extractlinkheaders}
|
|
323
|
+
|
|
324
|
+
> `static` **extractLinkHeaders**(`linkHeader`): [`IHttpLinkHeader`](../interfaces/IHttpLinkHeader.md)[] \| `undefined`
|
|
325
|
+
|
|
326
|
+
Extract the link headers.
|
|
327
|
+
|
|
328
|
+
#### Parameters
|
|
329
|
+
|
|
330
|
+
##### linkHeader
|
|
331
|
+
|
|
332
|
+
`unknown`
|
|
333
|
+
|
|
334
|
+
The Link header value in format `<url>; rel="..."; param1=""; param2=""`.
|
|
335
|
+
|
|
336
|
+
#### Returns
|
|
337
|
+
|
|
338
|
+
[`IHttpLinkHeader`](../interfaces/IHttpLinkHeader.md)[] \| `undefined`
|
|
339
|
+
|
|
340
|
+
The extracted possible array of URL, rel and optional params or undefined if invalid/missing.
|
|
341
|
+
|
|
342
|
+
#### See
|
|
343
|
+
|
|
344
|
+
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Link
|
|
345
|
+
|
|
346
|
+
***
|
|
347
|
+
|
|
348
|
+
### extractLinkHeaderSegments() {#extractlinkheadersegments}
|
|
349
|
+
|
|
350
|
+
> `static` **extractLinkHeaderSegments**(`linkHeader`): `string`[]
|
|
351
|
+
|
|
352
|
+
Split a combined Link header value into individual link-value segments, comma separated.
|
|
353
|
+
|
|
354
|
+
#### Parameters
|
|
355
|
+
|
|
356
|
+
##### linkHeader
|
|
357
|
+
|
|
358
|
+
`string`
|
|
359
|
+
|
|
360
|
+
Raw Link header string.
|
|
361
|
+
|
|
362
|
+
#### Returns
|
|
363
|
+
|
|
364
|
+
`string`[]
|
|
365
|
+
|
|
366
|
+
Array of individual link-value segments.
|
|
367
|
+
|
|
368
|
+
#### See
|
|
369
|
+
|
|
370
|
+
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Link
|
|
371
|
+
|
|
372
|
+
***
|
|
373
|
+
|
|
374
|
+
### extractLinkHeader() {#extractlinkheader}
|
|
375
|
+
|
|
376
|
+
> `static` **extractLinkHeader**(`linkHeader`): [`IHttpLinkHeader`](../interfaces/IHttpLinkHeader.md) \| `undefined`
|
|
377
|
+
|
|
378
|
+
Extract the properties from a Link header.
|
|
379
|
+
|
|
380
|
+
#### Parameters
|
|
381
|
+
|
|
382
|
+
##### linkHeader
|
|
383
|
+
|
|
384
|
+
`string`
|
|
385
|
+
|
|
386
|
+
The Link header value in format `<url>; rel="..."; param1=""; param2=""`.
|
|
387
|
+
|
|
388
|
+
#### Returns
|
|
389
|
+
|
|
390
|
+
[`IHttpLinkHeader`](../interfaces/IHttpLinkHeader.md) \| `undefined`
|
|
391
|
+
|
|
392
|
+
The extracted URL, rel and optional params or undefined if invalid/missing.
|
|
393
|
+
|
|
394
|
+
#### See
|
|
395
|
+
|
|
396
|
+
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Link
|
|
397
|
+
|
|
398
|
+
***
|
|
399
|
+
|
|
400
|
+
### createLinkHeader() {#createlinkheader}
|
|
401
|
+
|
|
402
|
+
> `static` **createLinkHeader**(`url`, `urlQueryParams`, `rel`, `params?`): `string`
|
|
403
|
+
|
|
404
|
+
Create a compliant Link header.
|
|
405
|
+
|
|
406
|
+
#### Parameters
|
|
407
|
+
|
|
408
|
+
##### url
|
|
409
|
+
|
|
410
|
+
`string`
|
|
411
|
+
|
|
412
|
+
The URL to include in the Link header.
|
|
413
|
+
|
|
414
|
+
##### urlQueryParams
|
|
415
|
+
|
|
416
|
+
\{\[`id`: `string`\]: `string`; \} \| `undefined`
|
|
417
|
+
|
|
418
|
+
Optional query parameters to include in the URL.
|
|
419
|
+
|
|
420
|
+
##### rel
|
|
421
|
+
|
|
422
|
+
`string` \| `string`[] \| [`HttpLinkRelType`](../type-aliases/HttpLinkRelType.md)[]
|
|
423
|
+
|
|
424
|
+
The relation type (e.g., "next", "prev", "self").
|
|
425
|
+
|
|
426
|
+
##### params?
|
|
427
|
+
|
|
428
|
+
#### Returns
|
|
429
|
+
|
|
430
|
+
`string`
|
|
431
|
+
|
|
432
|
+
The formatted Link header string.
|
|
433
|
+
|
|
434
|
+
#### Throws
|
|
435
|
+
|
|
436
|
+
GeneralError if the URL or rel are invalid.
|
|
437
|
+
|
|
438
|
+
#### See
|
|
439
|
+
|
|
440
|
+
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Link
|
|
@@ -14,7 +14,7 @@ Class to handle JSON Web Keys.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### CLASS\_NAME
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
18
|
|
|
19
19
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Runtime name for the class.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### toCryptoKey()
|
|
25
|
+
### toCryptoKey() {#tocryptokey}
|
|
26
26
|
|
|
27
27
|
> `static` **toCryptoKey**(`jwk`, `alg?`): `Promise`\<[`JwkCryptoKey`](../type-aliases/JwkCryptoKey.md)\>
|
|
28
28
|
|
|
@@ -50,7 +50,7 @@ The crypto key.
|
|
|
50
50
|
|
|
51
51
|
***
|
|
52
52
|
|
|
53
|
-
### fromEd25519Private()
|
|
53
|
+
### fromEd25519Private() {#fromed25519private}
|
|
54
54
|
|
|
55
55
|
> `static` **fromEd25519Private**(`privateKey`, `overrideUse?`): `Promise`\<`JWK`\>
|
|
56
56
|
|
|
@@ -78,7 +78,7 @@ The crypto key.
|
|
|
78
78
|
|
|
79
79
|
***
|
|
80
80
|
|
|
81
|
-
### fromEd25519Public()
|
|
81
|
+
### fromEd25519Public() {#fromed25519public}
|
|
82
82
|
|
|
83
83
|
> `static` **fromEd25519Public**(`publicKey`, `overrideUse?`): `Promise`\<`JWK`\>
|
|
84
84
|
|
|
@@ -106,7 +106,7 @@ The crypto key.
|
|
|
106
106
|
|
|
107
107
|
***
|
|
108
108
|
|
|
109
|
-
### toRaw()
|
|
109
|
+
### toRaw() {#toraw}
|
|
110
110
|
|
|
111
111
|
> `static` **toRaw**(`jwk`): `Promise`\<\{ `publicKey?`: `Uint8Array`\<`ArrayBufferLike`\>; `privateKey?`: `Uint8Array`\<`ArrayBufferLike`\>; \}\>
|
|
112
112
|
|
|
@@ -128,7 +128,7 @@ The crypto key.
|
|
|
128
128
|
|
|
129
129
|
***
|
|
130
130
|
|
|
131
|
-
### generateKid()
|
|
131
|
+
### generateKid() {#generatekid}
|
|
132
132
|
|
|
133
133
|
> `static` **generateKid**(`jwk`): `Promise`\<`string`\>
|
|
134
134
|
|
|
@@ -14,7 +14,7 @@ Class to handle JSON Web Signatures.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### CLASS\_NAME
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
18
|
|
|
19
19
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Runtime name for the class.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### create()
|
|
25
|
+
### create() {#create}
|
|
26
26
|
|
|
27
27
|
> `static` **create**(`privateKey`, `hash`, `algOverride?`): `Promise`\<`string`\>
|
|
28
28
|
|
|
@@ -56,7 +56,7 @@ The signature.
|
|
|
56
56
|
|
|
57
57
|
***
|
|
58
58
|
|
|
59
|
-
### verify()
|
|
59
|
+
### verify() {#verify}
|
|
60
60
|
|
|
61
61
|
> `static` **verify**(`jws`, `publicKey`, `hash`): `Promise`\<`boolean`\>
|
|
62
62
|
|
|
@@ -14,7 +14,7 @@ Class to handle JSON Web Tokens.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### CLASS\_NAME
|
|
17
|
+
### CLASS\_NAME {#class_name}
|
|
18
18
|
|
|
19
19
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ Runtime name for the class.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### encode()
|
|
25
|
+
### encode() {#encode}
|
|
26
26
|
|
|
27
27
|
> `static` **encode**\<`T`, `U`\>(`header`, `payload`, `key`): `Promise`\<`string`\>
|
|
28
28
|
|
|
@@ -66,7 +66,7 @@ The encoded token.
|
|
|
66
66
|
|
|
67
67
|
***
|
|
68
68
|
|
|
69
|
-
### encodeWithSigner()
|
|
69
|
+
### encodeWithSigner() {#encodewithsigner}
|
|
70
70
|
|
|
71
71
|
> `static` **encodeWithSigner**\<`T`, `U`\>(`header`, `payload`, `signer`): `Promise`\<`string`\>
|
|
72
72
|
|
|
@@ -110,7 +110,7 @@ The encoded token.
|
|
|
110
110
|
|
|
111
111
|
***
|
|
112
112
|
|
|
113
|
-
### decode()
|
|
113
|
+
### decode() {#decode}
|
|
114
114
|
|
|
115
115
|
> `static` **decode**\<`T`, `U`\>(`token`): `Promise`\<\{ `header?`: `T`; `payload?`: `U`; `signature?`: `Uint8Array`\<`ArrayBufferLike`\>; \}\>
|
|
116
116
|
|
|
@@ -142,7 +142,7 @@ The decoded payload.
|
|
|
142
142
|
|
|
143
143
|
***
|
|
144
144
|
|
|
145
|
-
### verify()
|
|
145
|
+
### verify() {#verify}
|
|
146
146
|
|
|
147
147
|
> `static` **verify**\<`T`, `U`\>(`token`, `key`): `Promise`\<\{ `header`: `T`; `payload`: `U`; \}\>
|
|
148
148
|
|
|
@@ -180,7 +180,7 @@ The decoded payload.
|
|
|
180
180
|
|
|
181
181
|
***
|
|
182
182
|
|
|
183
|
-
### verifyWithVerifier()
|
|
183
|
+
### verifyWithVerifier() {#verifywithverifier}
|
|
184
184
|
|
|
185
185
|
> `static` **verifyWithVerifier**\<`T`, `U`\>(`token`, `verifier`): `Promise`\<\{ `header`: `T`; `payload`: `U`; \}\>
|
|
186
186
|
|
|
@@ -218,7 +218,7 @@ The decoded payload.
|
|
|
218
218
|
|
|
219
219
|
***
|
|
220
220
|
|
|
221
|
-
### verifySignature()
|
|
221
|
+
### verifySignature() {#verifysignature}
|
|
222
222
|
|
|
223
223
|
> `static` **verifySignature**\<`T`, `U`\>(`token`, `key?`, `verifier?`): `Promise`\<\{ `header`: `T`; `payload`: `U`; \}\>
|
|
224
224
|
|
|
@@ -262,7 +262,7 @@ True if the parts are verified.
|
|
|
262
262
|
|
|
263
263
|
***
|
|
264
264
|
|
|
265
|
-
### defaultSigner()
|
|
265
|
+
### defaultSigner() {#defaultsigner}
|
|
266
266
|
|
|
267
267
|
> `static` **defaultSigner**(`header`, `payload`, `key`): `Promise`\<`string`\>
|
|
268
268
|
|
|
@@ -284,9 +284,9 @@ The payload to sign.
|
|
|
284
284
|
|
|
285
285
|
##### key
|
|
286
286
|
|
|
287
|
-
|
|
287
|
+
[`JwkCryptoKey`](../type-aliases/JwkCryptoKey.md) \| `undefined`
|
|
288
288
|
|
|
289
|
-
|
|
289
|
+
The optional key to sign with.
|
|
290
290
|
|
|
291
291
|
#### Returns
|
|
292
292
|
|
|
@@ -296,7 +296,7 @@ The signature.
|
|
|
296
296
|
|
|
297
297
|
***
|
|
298
298
|
|
|
299
|
-
### defaultVerifier()
|
|
299
|
+
### defaultVerifier() {#defaultverifier}
|
|
300
300
|
|
|
301
301
|
> `static` **defaultVerifier**\<`T`, `U`\>(`token`, `key`): `Promise`\<\{ `header`: `T`; `payload`: `U`; \}\>
|
|
302
302
|
|
|
@@ -322,9 +322,9 @@ The token to verify.
|
|
|
322
322
|
|
|
323
323
|
##### key
|
|
324
324
|
|
|
325
|
-
|
|
325
|
+
[`JwkCryptoKey`](../type-aliases/JwkCryptoKey.md) \| `undefined`
|
|
326
326
|
|
|
327
|
-
|
|
327
|
+
The key to verify with.
|
|
328
328
|
|
|
329
329
|
#### Returns
|
|
330
330
|
|
|
@@ -334,7 +334,7 @@ The header and payload if verification successful.
|
|
|
334
334
|
|
|
335
335
|
***
|
|
336
336
|
|
|
337
|
-
### toSigningBytes()
|
|
337
|
+
### toSigningBytes() {#tosigningbytes}
|
|
338
338
|
|
|
339
339
|
> `static` **toSigningBytes**\<`T`, `U`\>(`header`, `payload`): `Uint8Array`
|
|
340
340
|
|
|
@@ -372,7 +372,7 @@ The bytes to sign.
|
|
|
372
372
|
|
|
373
373
|
***
|
|
374
374
|
|
|
375
|
-
### fromSigningBytes()
|
|
375
|
+
### fromSigningBytes() {#fromsigningbytes}
|
|
376
376
|
|
|
377
377
|
> `static` **fromSigningBytes**\<`T`, `U`\>(`signingBytes`): `object`
|
|
378
378
|
|
|
@@ -416,7 +416,7 @@ If the signing bytes are invalid
|
|
|
416
416
|
|
|
417
417
|
***
|
|
418
418
|
|
|
419
|
-
### tokenFromBytes()
|
|
419
|
+
### tokenFromBytes() {#tokenfrombytes}
|
|
420
420
|
|
|
421
421
|
> `static` **tokenFromBytes**(`signingBytes`, `signature`): `string`
|
|
422
422
|
|
|
@@ -444,7 +444,7 @@ The token.
|
|
|
444
444
|
|
|
445
445
|
***
|
|
446
446
|
|
|
447
|
-
### tokenToBytes()
|
|
447
|
+
### tokenToBytes() {#tokentobytes}
|
|
448
448
|
|
|
449
449
|
> `static` **tokenToBytes**(`token`): `object`
|
|
450
450
|
|