@twin.org/web 0.0.1-next.5 → 0.0.1-next.50

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.
Files changed (33) hide show
  1. package/dist/cjs/index.cjs +271 -96
  2. package/dist/esm/index.mjs +272 -98
  3. package/dist/types/index.d.ts +3 -1
  4. package/dist/types/models/IJwk.d.ts +2 -58
  5. package/dist/types/models/IJwtHeader.d.ts +2 -18
  6. package/dist/types/models/IJwtPayload.d.ts +2 -33
  7. package/dist/types/models/headerTypes.d.ts +8 -8
  8. package/dist/types/models/jwkCryptoKey.d.ts +4 -0
  9. package/dist/types/models/mimeTypes.d.ts +4 -0
  10. package/dist/types/utils/fetchHelper.d.ts +7 -0
  11. package/dist/types/utils/jwk.d.ts +34 -0
  12. package/dist/types/utils/jws.d.ts +22 -0
  13. package/dist/types/utils/jwt.d.ts +67 -29
  14. package/docs/changelog.md +16 -1
  15. package/docs/reference/classes/FetchError.md +13 -5
  16. package/docs/reference/classes/FetchHelper.md +85 -19
  17. package/docs/reference/classes/Jwk.md +101 -0
  18. package/docs/reference/classes/Jws.md +81 -0
  19. package/docs/reference/classes/Jwt.md +222 -102
  20. package/docs/reference/classes/MimeTypeHelper.md +6 -2
  21. package/docs/reference/index.md +3 -2
  22. package/docs/reference/interfaces/IHttpHeaders.md +1 -1
  23. package/docs/reference/interfaces/IJwk.md +2 -106
  24. package/docs/reference/interfaces/IJwtHeader.md +4 -24
  25. package/docs/reference/interfaces/IJwtPayload.md +4 -56
  26. package/docs/reference/type-aliases/JwkCryptoKey.md +5 -0
  27. package/docs/reference/variables/HeaderTypes.md +8 -8
  28. package/docs/reference/variables/MimeTypes.md +6 -0
  29. package/locales/en.json +11 -1
  30. package/package.json +7 -6
  31. package/dist/types/models/jwtAlgorithms.d.ts +0 -17
  32. package/docs/reference/type-aliases/JwtAlgorithms.md +0 -5
  33. package/docs/reference/variables/JwtAlgorithms.md +0 -19
@@ -5,35 +5,35 @@ export declare const HeaderTypes: {
5
5
  /**
6
6
  * Content Type.
7
7
  */
8
- readonly ContentType: "Content-Type";
8
+ readonly ContentType: "content-type";
9
9
  /**
10
10
  * Content Length.
11
11
  */
12
- readonly ContentLength: "Content-Length";
12
+ readonly ContentLength: "content-length";
13
13
  /**
14
14
  * Content Disposition.
15
15
  */
16
- readonly ContentDisposition: "Content-Disposition";
16
+ readonly ContentDisposition: "content-disposition";
17
17
  /**
18
18
  * Accept.
19
19
  */
20
- readonly Accept: "Accept";
20
+ readonly Accept: "accept";
21
21
  /**
22
22
  * Authorization.
23
23
  */
24
- readonly Authorization: "Authorization";
24
+ readonly Authorization: "authorization";
25
25
  /**
26
26
  * Cookie.
27
27
  */
28
- readonly Cookie: "Cookie";
28
+ readonly Cookie: "cookie";
29
29
  /**
30
30
  * Set Cookie.
31
31
  */
32
- readonly SetCookie: "Set-Cookie";
32
+ readonly SetCookie: "set-cookie";
33
33
  /**
34
34
  * Location
35
35
  */
36
- readonly Location: "Location";
36
+ readonly Location: "location";
37
37
  };
38
38
  /**
39
39
  * Common http header types.
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The crypto key for a JWK.
3
+ */
4
+ export type JwkCryptoKey = CryptoKey | Uint8Array;
@@ -22,6 +22,10 @@ export declare const MimeTypes: {
22
22
  * JSON-LD - application/ld+json
23
23
  */
24
24
  readonly JsonLd: "application/ld+json";
25
+ /**
26
+ * JWT - application/jwt
27
+ */
28
+ readonly Jwt: "application/jwt";
25
29
  /**
26
30
  * XML - application/xml
27
31
  */
@@ -44,6 +44,13 @@ export declare class FetchHelper {
44
44
  * @returns The cache entry if it exists.
45
45
  */
46
46
  static getCacheEntry<T>(url: string): Promise<T | undefined>;
47
+ /**
48
+ * Set a cache entry.
49
+ * @param url The url for the request.
50
+ * @param value The value to cache.
51
+ * @returns The cache entry if it exists.
52
+ */
53
+ static setCacheEntry<T>(url: string, value: T): Promise<void>;
47
54
  /**
48
55
  * Remove a cache entry.
49
56
  * @param url The url for the request.
@@ -0,0 +1,34 @@
1
+ import type { IJwk } from "../models/IJwk";
2
+ import type { JwkCryptoKey } from "../models/jwkCryptoKey";
3
+ /**
4
+ * Class to handle JSON Web Keys.
5
+ */
6
+ export declare class Jwk {
7
+ /**
8
+ * Convert the JWK to a crypto key.
9
+ * @param jwk The JWK to convert.
10
+ * @returns The crypto key.
11
+ */
12
+ static toCryptoKey(jwk: IJwk): Promise<JwkCryptoKey>;
13
+ /**
14
+ * Convert the Ed25519 private key to a crypto key.
15
+ * @param privateKey The private key to use.
16
+ * @returns The crypto key.
17
+ */
18
+ static fromEd25519Private(privateKey: Uint8Array): Promise<IJwk>;
19
+ /**
20
+ * Convert the Ed25519 public key to a crypto key.
21
+ * @param publicKey The private key to use.
22
+ * @returns The crypto key.
23
+ */
24
+ static fromEd25519Public(publicKey: Uint8Array): Promise<IJwk>;
25
+ /**
26
+ * Convert the JWK to raw keys.
27
+ * @param jwk The JWK to convert to raw.
28
+ * @returns The crypto key.
29
+ */
30
+ static toRaw(jwk: IJwk): Promise<{
31
+ publicKey?: Uint8Array;
32
+ privateKey?: Uint8Array;
33
+ }>;
34
+ }
@@ -0,0 +1,22 @@
1
+ import type { JwkCryptoKey } from "../models/jwkCryptoKey";
2
+ /**
3
+ * Class to handle JSON Web Signatures.
4
+ */
5
+ export declare class Jws {
6
+ /**
7
+ * Create a signature.
8
+ * @param privateKey The private key to use.
9
+ * @param hash The hash to sign.
10
+ * @param algOverride An optional algorithm override.
11
+ * @returns The signature.
12
+ */
13
+ static create(privateKey: JwkCryptoKey, hash: Uint8Array, algOverride?: string): Promise<string>;
14
+ /**
15
+ * Verify a signature.
16
+ * @param jws The signature to verify.
17
+ * @param publicKey The public key to verify the signature with.
18
+ * @param hash The hash to verify.
19
+ * @returns True if the signature was verified.
20
+ */
21
+ static verify(jws: string, publicKey: JwkCryptoKey, hash: Uint8Array): Promise<boolean>;
22
+ }
@@ -1,8 +1,8 @@
1
1
  import type { IJwtHeader } from "../models/IJwtHeader";
2
2
  import type { IJwtPayload } from "../models/IJwtPayload";
3
- import { JwtAlgorithms } from "../models/jwtAlgorithms";
3
+ import type { JwkCryptoKey } from "../models/jwkCryptoKey";
4
4
  /**
5
- * Class to encode and decode JSON Web Tokens.
5
+ * Class to handle JSON Web Tokens.
6
6
  */
7
7
  export declare class Jwt {
8
8
  /**
@@ -12,7 +12,7 @@ export declare class Jwt {
12
12
  * @param key The key for signing the token, can be omitted if a signer is provided.
13
13
  * @returns The encoded token.
14
14
  */
15
- static encode<U extends IJwtHeader, T extends IJwtPayload>(header: U, payload: T, key: Uint8Array): Promise<string>;
15
+ static encode<T extends IJwtHeader, U extends IJwtPayload>(header: T, payload: U, key: JwkCryptoKey): Promise<string>;
16
16
  /**
17
17
  * Encode a token.
18
18
  * @param header The header to encode.
@@ -20,15 +20,15 @@ export declare class Jwt {
20
20
  * @param signer Custom signer method.
21
21
  * @returns The encoded token.
22
22
  */
23
- static encodeWithSigner<U extends IJwtHeader, T extends IJwtPayload>(header: U, payload: T, signer: (alg: JwtAlgorithms, key: Uint8Array | undefined, payload: Uint8Array) => Promise<Uint8Array>): Promise<string>;
23
+ static encodeWithSigner<T extends IJwtHeader, U extends IJwtPayload>(header: T, payload: U, signer: (header: IJwtHeader, payload: IJwtPayload, key: JwkCryptoKey | undefined) => Promise<string>): Promise<string>;
24
24
  /**
25
25
  * Decode a token.
26
26
  * @param token The token to decode.
27
27
  * @returns The decoded payload.
28
28
  */
29
- static decode<U extends IJwtHeader, T extends IJwtPayload>(token: string): Promise<{
30
- header?: U;
31
- payload?: T;
29
+ static decode<T extends IJwtHeader, U extends IJwtPayload>(token: string): Promise<{
30
+ header?: T;
31
+ payload?: U;
32
32
  signature?: Uint8Array;
33
33
  }>;
34
34
  /**
@@ -37,11 +37,9 @@ export declare class Jwt {
37
37
  * @param key The key for verifying the token
38
38
  * @returns The decoded payload.
39
39
  */
40
- static verify<U extends IJwtHeader, T extends IJwtPayload>(token: string, key: Uint8Array): Promise<{
41
- verified: boolean;
42
- header?: U;
43
- payload?: T;
44
- signature?: Uint8Array;
40
+ static verify<T extends IJwtHeader, U extends IJwtPayload>(token: string, key: JwkCryptoKey): Promise<{
41
+ header: T;
42
+ payload: U;
45
43
  }>;
46
44
  /**
47
45
  * Verify a token.
@@ -49,37 +47,77 @@ export declare class Jwt {
49
47
  * @param verifier Custom verification method.
50
48
  * @returns The decoded payload.
51
49
  */
52
- static verifyWithVerifier<U extends IJwtHeader, T extends IJwtPayload>(token: string, verifier: (alg: JwtAlgorithms, key: Uint8Array | undefined, payload: Uint8Array, signature: Uint8Array) => Promise<boolean>): Promise<{
53
- verified: boolean;
54
- header?: U;
55
- payload?: T;
56
- signature?: Uint8Array;
50
+ static verifyWithVerifier<T extends IJwtHeader, U extends IJwtPayload>(token: string, verifier: (token: string, key: JwkCryptoKey | undefined) => Promise<{
51
+ header: T;
52
+ payload: U;
53
+ }>): Promise<{
54
+ header: T;
55
+ payload: U;
57
56
  }>;
58
57
  /**
59
58
  * Verify a token by parts.
60
- * @param header The header to verify.
61
- * @param payload The payload to verify.
62
- * @param signature The signature to verify.
59
+ * @param token The token to verify.
63
60
  * @param key The key for verifying the token, if not provided no verification occurs.
64
61
  * @param verifier Custom verification method.
65
62
  * @returns True if the parts are verified.
66
63
  */
67
- static verifySignature<U extends IJwtHeader, T extends IJwtPayload>(header?: U, payload?: T, signature?: Uint8Array, key?: Uint8Array, verifier?: (alg: JwtAlgorithms, key: Uint8Array | undefined, payload: Uint8Array, signature: Uint8Array) => Promise<boolean>): Promise<boolean>;
64
+ static verifySignature<T extends IJwtHeader, U extends IJwtPayload>(token: string, key?: JwkCryptoKey, verifier?: (token: string, key: JwkCryptoKey | undefined) => Promise<{
65
+ header: T;
66
+ payload: U;
67
+ }>): Promise<{
68
+ header: T;
69
+ payload: U;
70
+ }>;
68
71
  /**
69
72
  * The default signer for the JWT.
70
- * @param alg The algorithm to use.
71
- * @param key The key to sign with.
73
+ * @param header The header to sign.
72
74
  * @param payload The payload to sign.
75
+ * @param key The optional key to sign with.
73
76
  * @returns The signature.
74
77
  */
75
- static defaultSigner(alg: JwtAlgorithms, key: Uint8Array | undefined, payload: Uint8Array): Promise<Uint8Array>;
78
+ static defaultSigner(header: IJwtHeader, payload: IJwtPayload, key: JwkCryptoKey | undefined): Promise<string>;
76
79
  /**
77
80
  * The default verifier for the JWT.
78
- * @param alg The algorithm to use.
81
+ * @param token The token to verify.
79
82
  * @param key The key to verify with.
80
- * @param payload The payload to verify.
81
- * @param signature The signature to verify.
82
- * @returns True if the signature was verified.
83
+ * @returns The header and payload if verification successful.
84
+ */
85
+ static defaultVerifier<T extends IJwtHeader, U extends IJwtPayload>(token: string, key: JwkCryptoKey | undefined): Promise<{
86
+ header: T;
87
+ payload: U;
88
+ }>;
89
+ /**
90
+ * Create bytes for signing from header and payload.
91
+ * @param header The header.
92
+ * @param payload The payload.
93
+ * @returns The bytes to sign.
94
+ */
95
+ static toSigningBytes<T extends IJwtHeader, U extends IJwtPayload>(header: T, payload: U): Uint8Array;
96
+ /**
97
+ * Create header and payload from signing bytes.
98
+ * @param signingBytes The signing bytes from a token.
99
+ * @returns The header and payload.
100
+ * @throws If the signing bytes are invalid
101
+ */
102
+ static fromSigningBytes<T extends IJwtHeader, U extends IJwtPayload>(signingBytes: Uint8Array): {
103
+ header: T;
104
+ payload: U;
105
+ };
106
+ /**
107
+ * Convert signed bytes and signature bytes to token.
108
+ * @param signingBytes The signed bytes.
109
+ * @param signature The signature.
110
+ * @returns The token.
111
+ */
112
+ static tokenFromBytes(signingBytes: Uint8Array, signature: Uint8Array): string;
113
+ /**
114
+ * Convert the token to signing bytes and signature bytes.
115
+ * @param token The token to convert to bytes.
116
+ * @returns The decoded bytes.
117
+ * @throws If the token is invalid.
83
118
  */
84
- static defaultVerifier(alg: JwtAlgorithms, key: Uint8Array | undefined, payload: Uint8Array, signature: Uint8Array): Promise<boolean>;
119
+ static tokenToBytes(token: string): {
120
+ signingBytes: Uint8Array;
121
+ signature: Uint8Array;
122
+ };
85
123
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @twin.org/web - Changelog
2
2
 
3
- ## 0.0.1-next.5
3
+ ## [0.0.1-next.50](https://github.com/twinfoundation/framework/compare/web-v0.0.1-next.49...web-v0.0.1-next.50) (2025-03-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * add set method for async caches ([ba34b55](https://github.com/twinfoundation/framework/commit/ba34b55e651ad56ab8fc59e139e4af631c19cda0))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/core bumped from 0.0.1-next.49 to 0.0.1-next.50
16
+ * @twin.org/crypto bumped from 0.0.1-next.49 to 0.0.1-next.50
17
+
18
+ ## 0.0.1-next.49
4
19
 
5
20
  - Initial Release
@@ -16,23 +16,31 @@ Create a new instance of FetchError.
16
16
 
17
17
  #### Parameters
18
18
 
19
- **source**: `string`
19
+ ##### source
20
+
21
+ `string`
20
22
 
21
23
  The source of the error.
22
24
 
23
- **message**: `string`
25
+ ##### message
26
+
27
+ `string`
24
28
 
25
29
  The message as a code.
26
30
 
27
- **httpStatus**: [`HttpStatusCode`](../type-aliases/HttpStatusCode.md)
31
+ ##### httpStatus
32
+
33
+ [`HttpStatusCode`](../type-aliases/HttpStatusCode.md)
28
34
 
29
35
  The http status code.
30
36
 
31
- **properties?**
37
+ ##### properties?
32
38
 
33
39
  Any additional information for the error.
34
40
 
35
- **inner?**: `unknown`
41
+ ##### inner?
42
+
43
+ `unknown`
36
44
 
37
45
  The inner error if we have wrapped another error.
38
46
 
@@ -22,23 +22,33 @@ Perform a fetch request.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **source**: `string`
25
+ ##### source
26
+
27
+ `string`
26
28
 
27
29
  The source for the request.
28
30
 
29
- **url**: `string`
31
+ ##### url
32
+
33
+ `string`
30
34
 
31
35
  The url for the request.
32
36
 
33
- **method**: [`HttpMethod`](../type-aliases/HttpMethod.md)
37
+ ##### method
38
+
39
+ [`HttpMethod`](../type-aliases/HttpMethod.md)
34
40
 
35
41
  The http method.
36
42
 
37
- **body?**: `string` \| `Uint8Array`
43
+ ##### body?
38
44
 
39
45
  Request to send to the endpoint.
40
46
 
41
- • **options?**: `Omit`\<[`IFetchOptions`](../interfaces/IFetchOptions.md), `"cacheTtlSeconds"`\>
47
+ `string` | `Uint8Array`\<`ArrayBufferLike`\>
48
+
49
+ ##### options?
50
+
51
+ `Omit`\<[`IFetchOptions`](../interfaces/IFetchOptions.md), `"cacheTtlSeconds"`\>
42
52
 
43
53
  Options for sending the requests.
44
54
 
@@ -64,23 +74,33 @@ Perform a request in json format.
64
74
 
65
75
  #### Parameters
66
76
 
67
- **source**: `string`
77
+ ##### source
78
+
79
+ `string`
68
80
 
69
81
  The source for the request.
70
82
 
71
- **url**: `string`
83
+ ##### url
84
+
85
+ `string`
72
86
 
73
87
  The url for the request.
74
88
 
75
- **method**: [`HttpMethod`](../type-aliases/HttpMethod.md)
89
+ ##### method
90
+
91
+ [`HttpMethod`](../type-aliases/HttpMethod.md)
76
92
 
77
93
  The http method.
78
94
 
79
- **requestData?**: `T`
95
+ ##### requestData?
96
+
97
+ `T`
80
98
 
81
99
  Request to send to the endpoint.
82
100
 
83
- **options?**: [`IFetchOptions`](../interfaces/IFetchOptions.md)
101
+ ##### options?
102
+
103
+ [`IFetchOptions`](../interfaces/IFetchOptions.md)
84
104
 
85
105
  Options for sending the requests.
86
106
 
@@ -94,7 +114,7 @@ The response.
94
114
 
95
115
  ### fetchBinary()
96
116
 
97
- > `static` **fetchBinary**\<`T`\>(`source`, `url`, `method`, `requestData`?, `options`?): `Promise`\<`Uint8Array` \| `T`\>
117
+ > `static` **fetchBinary**\<`T`\>(`source`, `url`, `method`, `requestData`?, `options`?): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `T`\>
98
118
 
99
119
  Perform a request for binary data.
100
120
 
@@ -104,29 +124,39 @@ Perform a request for binary data.
104
124
 
105
125
  #### Parameters
106
126
 
107
- **source**: `string`
127
+ ##### source
128
+
129
+ `string`
108
130
 
109
131
  The source for the request.
110
132
 
111
- **url**: `string`
133
+ ##### url
134
+
135
+ `string`
112
136
 
113
137
  The url for the request.
114
138
 
115
- **method**: `"GET"` \| `"POST"`
139
+ ##### method
116
140
 
117
141
  The http method.
118
142
 
119
- **requestData?**: `Uint8Array`
143
+ `"GET"` | `"POST"`
144
+
145
+ ##### requestData?
146
+
147
+ `Uint8Array`\<`ArrayBufferLike`\>
120
148
 
121
149
  Request to send to the endpoint.
122
150
 
123
- **options?**: [`IFetchOptions`](../interfaces/IFetchOptions.md)
151
+ ##### options?
152
+
153
+ [`IFetchOptions`](../interfaces/IFetchOptions.md)
124
154
 
125
155
  Options for sending the requests.
126
156
 
127
157
  #### Returns
128
158
 
129
- `Promise`\<`Uint8Array` \| `T`\>
159
+ `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `T`\>
130
160
 
131
161
  The response.
132
162
 
@@ -156,7 +186,9 @@ Get a cache entry.
156
186
 
157
187
  #### Parameters
158
188
 
159
- **url**: `string`
189
+ ##### url
190
+
191
+ `string`
160
192
 
161
193
  The url for the request.
162
194
 
@@ -168,6 +200,38 @@ The cache entry if it exists.
168
200
 
169
201
  ***
170
202
 
203
+ ### setCacheEntry()
204
+
205
+ > `static` **setCacheEntry**\<`T`\>(`url`, `value`): `Promise`\<`void`\>
206
+
207
+ Set a cache entry.
208
+
209
+ #### Type Parameters
210
+
211
+ • **T**
212
+
213
+ #### Parameters
214
+
215
+ ##### url
216
+
217
+ `string`
218
+
219
+ The url for the request.
220
+
221
+ ##### value
222
+
223
+ `T`
224
+
225
+ The value to cache.
226
+
227
+ #### Returns
228
+
229
+ `Promise`\<`void`\>
230
+
231
+ The cache entry if it exists.
232
+
233
+ ***
234
+
171
235
  ### removeCacheEntry()
172
236
 
173
237
  > `static` **removeCacheEntry**(`url`): `void`
@@ -176,7 +240,9 @@ Remove a cache entry.
176
240
 
177
241
  #### Parameters
178
242
 
179
- **url**: `string`
243
+ ##### url
244
+
245
+ `string`
180
246
 
181
247
  The url for the request.
182
248
 
@@ -0,0 +1,101 @@
1
+ # Class: Jwk
2
+
3
+ Class to handle JSON Web Keys.
4
+
5
+ ## Constructors
6
+
7
+ ### new Jwk()
8
+
9
+ > **new Jwk**(): [`Jwk`](Jwk.md)
10
+
11
+ #### Returns
12
+
13
+ [`Jwk`](Jwk.md)
14
+
15
+ ## Methods
16
+
17
+ ### toCryptoKey()
18
+
19
+ > `static` **toCryptoKey**(`jwk`): `Promise`\<[`JwkCryptoKey`](../type-aliases/JwkCryptoKey.md)\>
20
+
21
+ Convert the JWK to a crypto key.
22
+
23
+ #### Parameters
24
+
25
+ ##### jwk
26
+
27
+ [`IJwk`](../interfaces/IJwk.md)
28
+
29
+ The JWK to convert.
30
+
31
+ #### Returns
32
+
33
+ `Promise`\<[`JwkCryptoKey`](../type-aliases/JwkCryptoKey.md)\>
34
+
35
+ The crypto key.
36
+
37
+ ***
38
+
39
+ ### fromEd25519Private()
40
+
41
+ > `static` **fromEd25519Private**(`privateKey`): `Promise`\<[`IJwk`](../interfaces/IJwk.md)\>
42
+
43
+ Convert the Ed25519 private key to a crypto key.
44
+
45
+ #### Parameters
46
+
47
+ ##### privateKey
48
+
49
+ `Uint8Array`
50
+
51
+ The private key to use.
52
+
53
+ #### Returns
54
+
55
+ `Promise`\<[`IJwk`](../interfaces/IJwk.md)\>
56
+
57
+ The crypto key.
58
+
59
+ ***
60
+
61
+ ### fromEd25519Public()
62
+
63
+ > `static` **fromEd25519Public**(`publicKey`): `Promise`\<[`IJwk`](../interfaces/IJwk.md)\>
64
+
65
+ Convert the Ed25519 public key to a crypto key.
66
+
67
+ #### Parameters
68
+
69
+ ##### publicKey
70
+
71
+ `Uint8Array`
72
+
73
+ The private key to use.
74
+
75
+ #### Returns
76
+
77
+ `Promise`\<[`IJwk`](../interfaces/IJwk.md)\>
78
+
79
+ The crypto key.
80
+
81
+ ***
82
+
83
+ ### toRaw()
84
+
85
+ > `static` **toRaw**(`jwk`): `Promise`\<\{ `publicKey`: `Uint8Array`\<`ArrayBufferLike`\>; `privateKey`: `Uint8Array`\<`ArrayBufferLike`\>; \}\>
86
+
87
+ Convert the JWK to raw keys.
88
+
89
+ #### Parameters
90
+
91
+ ##### jwk
92
+
93
+ [`IJwk`](../interfaces/IJwk.md)
94
+
95
+ The JWK to convert to raw.
96
+
97
+ #### Returns
98
+
99
+ `Promise`\<\{ `publicKey`: `Uint8Array`\<`ArrayBufferLike`\>; `privateKey`: `Uint8Array`\<`ArrayBufferLike`\>; \}\>
100
+
101
+ The crypto key.