@stryke/crypto 0.5.44 → 0.6.0
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/CHANGELOG.md +7 -0
- package/dist/cloudflare.cjs +960 -0
- package/dist/cloudflare.d.cts +251 -0
- package/dist/cloudflare.d.cts.map +1 -0
- package/dist/cloudflare.d.mts +251 -0
- package/dist/cloudflare.d.mts.map +1 -0
- package/dist/cloudflare.mjs +942 -0
- package/dist/cloudflare.mjs.map +1 -0
- package/dist/index.cjs +16 -12
- package/dist/index.d.cts +2 -4
- package/dist/index.d.mts +2 -4
- package/dist/index.mjs +2 -4
- package/dist/neutral-BISXAuIW.cjs +868 -0
- package/dist/{encryption.d.mts → neutral-BJmyEdJq.d.mts} +77 -2
- package/dist/neutral-BJmyEdJq.d.mts.map +1 -0
- package/dist/neutral-BtZoJSl-.mjs +779 -0
- package/dist/neutral-BtZoJSl-.mjs.map +1 -0
- package/dist/{encryption.d.cts → neutral-CW6EXiYo.d.cts} +77 -2
- package/dist/neutral-CW6EXiYo.d.cts.map +1 -0
- package/dist/neutral.cjs +16 -16
- package/dist/neutral.d.cts +2 -4
- package/dist/neutral.d.mts +2 -4
- package/dist/neutral.mjs +2 -4
- package/dist/node.cjs +663 -0
- package/dist/node.d.cts +117 -0
- package/dist/node.d.cts.map +1 -0
- package/dist/node.d.mts +117 -0
- package/dist/node.d.mts.map +1 -0
- package/dist/node.mjs +654 -0
- package/dist/node.mjs.map +1 -0
- package/package.json +55 -20
- package/dist/base-64.cjs +0 -440
- package/dist/base-64.d.cts +0 -40
- package/dist/base-64.d.cts.map +0 -1
- package/dist/base-64.d.mts +0 -40
- package/dist/base-64.d.mts.map +0 -1
- package/dist/base-64.mjs +0 -438
- package/dist/base-64.mjs.map +0 -1
- package/dist/convert/src/array-buffer-to-string.cjs +0 -19
- package/dist/convert/src/array-buffer-to-string.mjs +0 -19
- package/dist/convert/src/array-buffer-to-string.mjs.map +0 -1
- package/dist/convert/src/neutral.cjs +0 -7
- package/dist/convert/src/neutral.mjs +0 -9
- package/dist/convert/src/parse-type-definition.cjs +0 -1
- package/dist/convert/src/parse-type-definition.mjs +0 -3
- package/dist/convert/src/string-to-uint8-array.cjs +0 -24
- package/dist/convert/src/string-to-uint8-array.mjs +0 -23
- package/dist/convert/src/string-to-uint8-array.mjs.map +0 -1
- package/dist/convert/src/string-to-utf8-array.cjs +0 -15
- package/dist/convert/src/string-to-utf8-array.mjs +0 -15
- package/dist/convert/src/string-to-utf8-array.mjs.map +0 -1
- package/dist/convert/src/uint8-array-to-stream.cjs +0 -22
- package/dist/convert/src/uint8-array-to-stream.mjs +0 -22
- package/dist/convert/src/uint8-array-to-stream.mjs.map +0 -1
- package/dist/convert/src/uint8-array-to-string.cjs +0 -15
- package/dist/convert/src/uint8-array-to-string.mjs +0 -16
- package/dist/convert/src/uint8-array-to-string.mjs.map +0 -1
- package/dist/convert/src/utf8-array-to-string.cjs +0 -15
- package/dist/convert/src/utf8-array-to-string.mjs +0 -15
- package/dist/convert/src/utf8-array-to-string.mjs.map +0 -1
- package/dist/encryption.cjs +0 -134
- package/dist/encryption.d.cts.map +0 -1
- package/dist/encryption.d.mts.map +0 -1
- package/dist/encryption.mjs +0 -129
- package/dist/encryption.mjs.map +0 -1
- package/dist/encryption.node.cjs +0 -63
- package/dist/encryption.node.d.cts +0 -42
- package/dist/encryption.node.d.cts.map +0 -1
- package/dist/encryption.node.d.mts +0 -42
- package/dist/encryption.node.d.mts.map +0 -1
- package/dist/encryption.node.mjs +0 -62
- package/dist/encryption.node.mjs.map +0 -1
- package/dist/hex.cjs +0 -62
- package/dist/hex.d.cts +0 -18
- package/dist/hex.d.cts.map +0 -1
- package/dist/hex.d.mts +0 -18
- package/dist/hex.d.mts.map +0 -1
- package/dist/hex.mjs +0 -61
- package/dist/hex.mjs.map +0 -1
- package/dist/type-checks/src/index.cjs +0 -5
- package/dist/type-checks/src/index.mjs +0 -7
- package/dist/type-checks/src/is-buffer.cjs +0 -12
- package/dist/type-checks/src/is-buffer.mjs +0 -12
- package/dist/type-checks/src/is-buffer.mjs.map +0 -1
- package/dist/type-checks/src/is-collection.cjs +0 -1
- package/dist/type-checks/src/is-collection.mjs +0 -3
- package/dist/type-checks/src/is-string.cjs +0 -12
- package/dist/type-checks/src/is-string.mjs +0 -12
- package/dist/type-checks/src/is-string.mjs.map +0 -1
- package/dist/type-checks/src/is-undefined.cjs +0 -8
- package/dist/type-checks/src/is-undefined.mjs +0 -8
- package/dist/type-checks/src/is-undefined.mjs.map +0 -1
- package/dist/type-checks/src/type-detect.cjs +0 -15
- package/dist/type-checks/src/type-detect.mjs +0 -17
- package/dist/type-checks/src/type-detect.mjs.map +0 -1
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
//#region src/ed25519.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for Ed25519 key generation and signing in Cloudflare Workers. This interface defines the algorithm name and named curve used for Ed25519 operations in the Cloudflare Workers environment. The `name` and `namedCurve` properties are set to "NODE-ED25519" to indicate that these parameters are specific to Cloudflare Workers' implementation of Ed25519, which is not compatible with standard Web Crypto API Ed25519 implementations in other environments.
|
|
4
|
+
*/
|
|
5
|
+
interface Ed25519Params {
|
|
6
|
+
name: "NODE-ED25519";
|
|
7
|
+
namedCurve: "NODE-ED25519";
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Represents an Ed25519 key pair with a public key and a private key, both of which are CryptoKey objects. This interface is used to define the structure of the key pair generated by the `generateSigningKeyPair` function, where the `publicKey` is used for signature verification and the `privateKey` is used for signing operations. The keys are generated using Cloudflare Workers' `NODE-ED25519` algorithm parameters, which are specific to Cloudflare Workers' implementation of Ed25519 and are not compatible with standard Web Crypto API Ed25519 implementations in other environments.
|
|
11
|
+
*/
|
|
12
|
+
interface Ed25519KeyPair {
|
|
13
|
+
publicKey: CryptoKey;
|
|
14
|
+
privateKey: CryptoKey;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generates an Ed25519 key pair using Cloudflare Workers' `NODE-ED25519` algorithm and returns the public key as a base64 string, the private key as a JWK object, and a key ID derived from the public key. The private key is returned as a JWK for compatibility with Web Crypto API operations.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This function uses Cloudflare Workers' `NODE-ED25519` algorithm parameters, which are specific to Cloudflare Workers' implementation of Ed25519. The returned key pair is structured as follows:
|
|
21
|
+
* - The `publicKey` is returned as a base64url-encoded string of the raw public key bytes (the 'x' parameter from the JWK).
|
|
22
|
+
* - The `privateKeyJwk` is returned as a JWK object containing the private key parameters, which can be used for signing operations with the Web Crypto API.
|
|
23
|
+
* - The `keyId` is generated by hashing the raw public key bytes and taking the first 4 bytes of the hash, encoded as a hex string prefixed with "ed25519:". This provides a unique identifier for the key pair based on its public key.
|
|
24
|
+
*
|
|
25
|
+
* This function is not compatible with standard Web Crypto API Ed25519 implementations in other environments. The legacy function `generateSigningKeyPairLegacy` is also available for backwards compatibility, which returns the private key as a JSON stringified JWK. However, it is recommended to use this structured version for new code.
|
|
26
|
+
*
|
|
27
|
+
* @returns An object containing the `publicKey` as a base64 string, the `privateKeyJwk` as a JWK object, and a `keyId` derived from the public key.
|
|
28
|
+
* @throws {@link DOMException} If key generation or export fails in the Web Crypto API.
|
|
29
|
+
*/
|
|
30
|
+
declare function generateSigningKeyPair(): Promise<{
|
|
31
|
+
publicKey: string;
|
|
32
|
+
privateKeyJwk: JsonWebKey;
|
|
33
|
+
keyId: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Generates an Ed25519 key pair and returns the public key as a base64 string, the private key as a JSON stringified JWK, and a key ID derived from the public key. The private key is returned in a legacy format for compatibility with existing code that expects a JSON string.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Legacy function for backwards compatibility during migration. Returns the old format but with a proper key.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated Use `generateSigningKeyPair` instead, which returns a structured key object and separate key ID. This legacy function is retained for backwards compatibility but may be removed in future releases.
|
|
42
|
+
*
|
|
43
|
+
* @returns An object containing the `publicKey` as a base64 string, the `privateKey` as a JSON stringified JWK, and a `keyId` derived from the public key.
|
|
44
|
+
* @throws {@link SyntaxError} If the generated private key cannot be stringified to JSON (should not occur under normal circumstances).
|
|
45
|
+
*/
|
|
46
|
+
declare function generateSigningKeyPairLegacy(): Promise<{
|
|
47
|
+
publicKey: string;
|
|
48
|
+
privateKey: string;
|
|
49
|
+
keyId: string;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Creates and attaches an [Ed25519 signature](https://matrix.org/docs/spec/client_server/latest#signing-json-objects) for a JSON object using [Matrix-style](https://matrix.org/docs/spec/client_server/latest#signing-json-objects) signing rules.
|
|
53
|
+
*
|
|
54
|
+
* @see https://matrix.org/docs/spec/client_server/latest#signing-json-objects
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* - Signature output is encoded as un-padded base64url.
|
|
58
|
+
* - The original `obj` is not mutated.
|
|
59
|
+
* - Uses `NODE-ED25519` algorithm parameters for key import/sign operations.
|
|
60
|
+
*
|
|
61
|
+
* The function canonicalizes a copy of the input object after removing the `signatures`
|
|
62
|
+
* and `unsigned` properties, signs that canonical JSON payload with the provided private key,
|
|
63
|
+
* and returns a new object with the generated signature merged into `obj.signatures`.
|
|
64
|
+
*
|
|
65
|
+
* Existing signatures are preserved, including other keys under the same `serverName`.
|
|
66
|
+
*
|
|
67
|
+
* @param obj - The JSON object to sign.
|
|
68
|
+
* @param serverName - The signing entity name used as the top-level key in `signatures`.
|
|
69
|
+
* @param keyId - The key identifier used under `signatures[serverName]`.
|
|
70
|
+
* @param privateKeyJwk - The Ed25519 private key as a JWK object, or a JSON stringified JWK (legacy compatibility).
|
|
71
|
+
* @returns A new object containing all original fields plus an updated `signatures` map with the new signature.
|
|
72
|
+
* @throws {@link SyntaxError} If `privateKeyJwk` is a string that is not valid JSON.
|
|
73
|
+
* @throws {@link DOMException} If key import or signing fails in the Web Crypto API.
|
|
74
|
+
*/
|
|
75
|
+
declare function signJson(obj: Record<string, unknown>, serverName: string, keyId: string, privateKeyJwk: JsonWebKey | string): Promise<Record<string, unknown>>;
|
|
76
|
+
/**
|
|
77
|
+
* Verifies an Ed25519 signature on a JSON object using [Matrix-style signing rules](https://matrix.org/docs/spec/client_server/latest#signing-json-objects). The function extracts the relevant signature from the `signatures` property of the input object, removes the `signatures` and `unsigned` properties to create a canonical JSON payload, and then verifies the signature against the provided public key. The public key is expected to be a base64url-encoded string of the raw public key bytes (the 'x' parameter from the JWK). The function returns `true` if the signature is valid and `false` otherwise. Any errors during the verification process are caught and logged, with a return value of `false` in case of failure.
|
|
78
|
+
*
|
|
79
|
+
* @see https://matrix.org/docs/spec/client_server/latest#signing-json-objects
|
|
80
|
+
*
|
|
81
|
+
* @remarks
|
|
82
|
+
* - Signature input is expected to be un-padded base64url.
|
|
83
|
+
* - The original `obj` is not mutated.
|
|
84
|
+
* - Uses `NODE-ED25519` algorithm parameters for key import/verify operations.
|
|
85
|
+
* - The function does not throw on verification failure; it returns `false` instead. Errors during key import or verification are logged to the console for debugging purposes.
|
|
86
|
+
*
|
|
87
|
+
* @param obj - The JSON object containing the signature to verify.
|
|
88
|
+
* @param serverName - The signing entity name used as the top-level key in `signatures`.
|
|
89
|
+
* @param keyId - The key identifier used under `signatures[serverName]` to locate the specific signature to verify.
|
|
90
|
+
* @param publicKeyB64 - The Ed25519 public key as a base64url-encoded string of the raw public key bytes (the 'x' parameter from the JWK).
|
|
91
|
+
* @returns A boolean indicating whether the signature is valid (`true`) or not (`false`). Returns `false` if the signature is missing, invalid, or if any errors occur during the verification process.
|
|
92
|
+
*/
|
|
93
|
+
declare function verifySignature(obj: Record<string, unknown>, serverName: string, keyId: string, publicKeyB64: string): Promise<boolean>;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/base-64.d.ts
|
|
96
|
+
/**
|
|
97
|
+
* Encodes a Uint8Array into a Base64 encoded Uint8Array.
|
|
98
|
+
*
|
|
99
|
+
* @credit https://github.com/hi-ogawa/js-utils
|
|
100
|
+
*
|
|
101
|
+
* @param input - The input Uint8Array or string to encode.
|
|
102
|
+
* @returns The Base64 encoded Uint8Array.
|
|
103
|
+
*/
|
|
104
|
+
declare function encodeBase64(input: Uint8Array | string): string;
|
|
105
|
+
/**
|
|
106
|
+
* Decodes a Base64 encoded Uint8Array into a Uint8Array.
|
|
107
|
+
*
|
|
108
|
+
* @credit https://github.com/hi-ogawa/js-utils
|
|
109
|
+
*
|
|
110
|
+
* @param input - The Base64 encoded Uint8Array or string to decode.
|
|
111
|
+
* @returns The decoded Uint8Array.
|
|
112
|
+
*/
|
|
113
|
+
declare function decodeBase64(input: Uint8Array | string): Uint8Array;
|
|
114
|
+
/**
|
|
115
|
+
* Converts a Base64 encoded string to a [Base64url](https://datatracker.ietf.org/doc/html/rfc7515#appendix-C) encoded string.
|
|
116
|
+
*
|
|
117
|
+
* @see https://datatracker.ietf.org/doc/html/rfc7515#appendix-C
|
|
118
|
+
*
|
|
119
|
+
* @param base64 - The Base64 encoded string to convert.
|
|
120
|
+
* @returns The Base64url encoded string.
|
|
121
|
+
*/
|
|
122
|
+
declare function base64UrlEncode(base64: Uint8Array): string;
|
|
123
|
+
/**
|
|
124
|
+
* Converts a [Base64url](https://datatracker.ietf.org/doc/html/rfc7515#appendix-C) encoded string to a Base64 encoded string.
|
|
125
|
+
*
|
|
126
|
+
* @see https://datatracker.ietf.org/doc/html/rfc7515#appendix-C
|
|
127
|
+
*
|
|
128
|
+
* @param base64url - The Base64url encoded string to convert.
|
|
129
|
+
* @returns The Base64 encoded string.
|
|
130
|
+
*/
|
|
131
|
+
declare function base64UrlDecode(base64url: string): Uint8Array;
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/encryption.d.ts
|
|
134
|
+
/**
|
|
135
|
+
* Creates a CryptoKey object that can be used to encrypt any string.
|
|
136
|
+
*
|
|
137
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey
|
|
138
|
+
*
|
|
139
|
+
* @returns A promise that resolves to a CryptoKey object that can be used to encrypt and decrypt strings.
|
|
140
|
+
*/
|
|
141
|
+
declare function createKey(): Promise<CryptoKey>;
|
|
142
|
+
/**
|
|
143
|
+
* Encodes a CryptoKey to base64 string, so that it can be embedded in JSON / JavaScript
|
|
144
|
+
*
|
|
145
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/exportKey
|
|
146
|
+
*
|
|
147
|
+
* @param key - The CryptoKey to encode
|
|
148
|
+
* @returns A promise that resolves to a base64 string representing the key
|
|
149
|
+
*/
|
|
150
|
+
declare function encodeKey(key: CryptoKey): Promise<string>;
|
|
151
|
+
/**
|
|
152
|
+
* Decodes a base64 string into bytes and then imports the key.
|
|
153
|
+
*
|
|
154
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey
|
|
155
|
+
*
|
|
156
|
+
* @param encoded - The base64 encoded key
|
|
157
|
+
* @returns A promise that resolves to a CryptoKey object that can be used to encrypt and decrypt strings
|
|
158
|
+
*/
|
|
159
|
+
declare function decodeKey(encoded: string): Promise<CryptoKey>;
|
|
160
|
+
/**
|
|
161
|
+
* Using a CryptoKey, use AES-GCM to encrypt a string into a base64 string.
|
|
162
|
+
*
|
|
163
|
+
* @remarks
|
|
164
|
+
* The initialization vector is randomly generated and prepended to the encrypted string. The IV is required for decryption, so it must be stored alongside the encrypted data.
|
|
165
|
+
*
|
|
166
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt
|
|
167
|
+
*
|
|
168
|
+
* @param key - The CryptoKey to use for encryption
|
|
169
|
+
* @param plaintext - The plaintext string to encrypt
|
|
170
|
+
* @returns A promise that resolves to a base64 string representing the encrypted data
|
|
171
|
+
*/
|
|
172
|
+
declare function encrypt(key: CryptoKey, plaintext: string): Promise<string>;
|
|
173
|
+
/**
|
|
174
|
+
* Takes a base64 encoded string, decodes it and returns the AES-GCM decrypted text.
|
|
175
|
+
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* The initialization vector is expected to be prepended to the encrypted string. The IV is required for decryption, so it must be extracted from the start of the string.
|
|
178
|
+
*
|
|
179
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/decrypt
|
|
180
|
+
*
|
|
181
|
+
* @param key - The CryptoKey to use for decryption
|
|
182
|
+
* @param encrypted - The encrypted base64 encoded string to decrypt
|
|
183
|
+
* @returns A promise that resolves to the decrypted string
|
|
184
|
+
*/
|
|
185
|
+
declare function decrypt(key: CryptoKey, encrypted: string): Promise<string>;
|
|
186
|
+
/**
|
|
187
|
+
* Encrypts a buffer using AES-GCM with a given CryptoKey.
|
|
188
|
+
*
|
|
189
|
+
* @remarks
|
|
190
|
+
* The initialization vector (IV) is randomly generated and prepended to the encrypted data. The resulting data is then encoded as a base64 string for easy storage/transmission.
|
|
191
|
+
*
|
|
192
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt
|
|
193
|
+
*
|
|
194
|
+
* @param key - The CryptoKey to use for encryption
|
|
195
|
+
* @param buffer - The buffer to encrypt
|
|
196
|
+
* @returns A promise that resolves to a base64 string representing the encrypted data
|
|
197
|
+
*/
|
|
198
|
+
declare function encryptBuffer(key: CryptoKey, buffer: BufferSource): Promise<string>;
|
|
199
|
+
/**
|
|
200
|
+
* Decrypts a buffer using AES-GCM with a given CryptoKey.
|
|
201
|
+
*
|
|
202
|
+
* @remarks
|
|
203
|
+
* The initialization vector (IV) is expected to be prepended to the encrypted data. The IV is required for decryption, so it must be extracted from the start of the buffer.
|
|
204
|
+
*
|
|
205
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/decrypt
|
|
206
|
+
*
|
|
207
|
+
* @param key - The CryptoKey to use for decryption
|
|
208
|
+
* @param encrypted - The encrypted base64 encoded string to decrypt
|
|
209
|
+
* @returns A promise that resolves to the decrypted string
|
|
210
|
+
*/
|
|
211
|
+
declare function decryptBuffer(key: CryptoKey, encrypted: string): Promise<ArrayBuffer>;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/hex.d.ts
|
|
214
|
+
/**
|
|
215
|
+
* Encodes a Uint8Array into a hexadecimal string.
|
|
216
|
+
*
|
|
217
|
+
* @param input - The input Uint8Array.
|
|
218
|
+
* @returns The hexadecimal string.
|
|
219
|
+
*/
|
|
220
|
+
declare function encodeHex(input: Uint8Array): string;
|
|
221
|
+
/**
|
|
222
|
+
* Encodes a Uint8Array into an uppercase hexadecimal string.
|
|
223
|
+
*
|
|
224
|
+
* @param input - The input Uint8Array.
|
|
225
|
+
* @returns The uppercase hexadecimal string.
|
|
226
|
+
*/
|
|
227
|
+
declare function decodeHex(input: string): Uint8Array;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/random.d.ts
|
|
230
|
+
/**
|
|
231
|
+
* Generate a random byte array of the specified length using the Web Crypto API.
|
|
232
|
+
*
|
|
233
|
+
* @param length - The length of the random byte array to generate (default is 32 bytes)
|
|
234
|
+
* @returns A Uint8Array containing random bytes of the specified length
|
|
235
|
+
*/
|
|
236
|
+
declare function generateRandomBytes(length?: number): Uint8Array;
|
|
237
|
+
/**
|
|
238
|
+
* Generate a random string of the specified length using characters A-Z, a-z, and 0-9 for CSRF tokens, etc.
|
|
239
|
+
*
|
|
240
|
+
* @remarks
|
|
241
|
+
* This function uses the Web Crypto API's `crypto.getRandomValues` to generate secure random bytes,
|
|
242
|
+
* and then maps those bytes to characters in the specified character set. It uses rejection sampling
|
|
243
|
+
* to ensure a uniform distribution of characters without modulo bias.
|
|
244
|
+
*
|
|
245
|
+
* @param length - The length of the random string to generate (default is 32 characters)
|
|
246
|
+
* @returns A random string of the specified length
|
|
247
|
+
*/
|
|
248
|
+
declare function generateRandomString(length?: number): string;
|
|
249
|
+
//#endregion
|
|
250
|
+
export { Ed25519KeyPair, Ed25519Params, base64UrlDecode, base64UrlEncode, createKey, decodeBase64, decodeHex, decodeKey, decrypt, decryptBuffer, encodeBase64, encodeHex, encodeKey, encrypt, encryptBuffer, generateRandomBytes, generateRandomString, generateSigningKeyPair, generateSigningKeyPairLegacy, signJson, verifySignature };
|
|
251
|
+
//# sourceMappingURL=cloudflare.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare.d.cts","names":[],"sources":["../src/ed25519.ts","../src/base-64.ts","../src/encryption.ts","../src/hex.ts","../src/random.ts"],"sourcesContent":[],"mappings":";;AAwBA;AAQA;AAmBsB,UA3BL,aAAA,CA2B2B;EAgDtB,IAAA,EAAA,cAAA;EAsCA,UAAA,EAAQ,cAAA;;;;;AAKpB,UA9GO,cAAA,CA8GP;EAmEY,SAAA,EAhLT,SAgLwB;cA/KvB;;;ACkCd;AAmDA;AAkFA;AAeA;;;;ACrLA;AAmBA;AAcA;AA4BA;AA8BA;AA4BA;AACO,iBFxGe,sBAAA,CAAA,CEwGf,EFxGyC,OEwGzC,CAAA;EACG,SAAA,EAAA,MAAA;EACP,aAAA,EFxGc,UEwGd;EAAO,KAAA,EAAA,MAAA;AA0BV,CAAA,CAAA;;;;;;;;ACrIA;AAeA;;;iBHkCsB,4BAAA,CAAA,GAAgC;EI3EtC,SAAA,EAAA,MAAA;EAeA,UAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;iBJkGM,QAAA,MACf,2EAGU,sBACd,QAAQ;;;;;;;;;;;;;;;;;;iBAmEW,eAAA,MACf,mFAIJ;;;;AA9LH;AAQA;AAmBA;AAgDA;AAsCA;;;AAKW,iBC1EK,YAAA,CD0EL,KAAA,EC1EyB,UD0EzB,GAAA,MAAA,CAAA,EAAA,MAAA;;;AAmEX;;;;AC7IA;AAmDA;AAkFgB,iBAlFA,YAAA,CAkFwB,KAAA,EAlFJ,UAkFc,GAAA,MAAA,CAAA,EAlFQ,UAkFR;AAelD;;;;ACrLA;AAmBA;AAcA;AA4BA;AA8BsB,iBD2EN,eAAA,CCxEb,MAAO,EDwE8B,UCxE9B,CAAA,EAAA,MAAA;AAyBV;;;;;AA6BA;;;AAGG,iBD8Ba,eAAA,CC9Bb,SAAA,EAAA,MAAA,CAAA,ED8BiD,UC9BjD;;;;AFlKH;AAQA;AAmBA;AAgDA;AAsCA;;AAIiB,iBE1GK,SAAA,CAAA,CF0GL,EE1GkB,OF0GlB,CE1G0B,SF0G1B,CAAA;;;;AAoEjB;;;;AC7IA;AAmDgB,iBCjEM,SAAA,CDiEc,GAAA,ECjEC,SDiEqB,CAAA,ECjET,ODiEmB,CAAA,MAAA,CAAA;AAkFpE;AAeA;;;;ACrLA;AAmBA;AAcA;AA4BsB,iBA5BA,SAAA,CA6Bf,OAEJ,EAAA,MAAO,CAAA,EA/BwC,OA+BxC,CA/BgD,SA+BhD,CAAA;AA2BV;AA4BA;;;;;AA6BA;;;;;;iBAvFsB,OAAA,MACf,+BAEJ;;ACjDH;AAeA;;;;ACzCA;AAeA;;;;;iBFuFsB,OAAA,MACf,+BAEJ;;;;;;;;;;;;;iBAyBmB,aAAA,MACf,mBACG,eACP;;;;;;;;;;;;;iBA0BmB,aAAA,MACf,+BAEJ,QAAQ;;;;AFlKX;AAQA;AAmBA;AAgDA;AAsCA;AACO,iBGxFS,SAAA,CHwFT,KAAA,EGxF0B,UHwF1B,CAAA,EAAA,MAAA;;;;;AAuEP;;iBGhJgB,SAAA,iBAA0B;;;;AHzC1C;AAQA;AAmBA;AAgDA;AAsCA;AACO,iBIlHS,mBAAA,CJkHT,MAAA,CAAA,EAAA,MAAA,CAAA,EIlHmD,UJkHnD;;;;;AAuEP;;;;AC7IA;AAmDA;AAkFA;AAegB,iBGjLA,oBAAA,CHiL8C,MAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
//#region src/ed25519.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for Ed25519 key generation and signing in Cloudflare Workers. This interface defines the algorithm name and named curve used for Ed25519 operations in the Cloudflare Workers environment. The `name` and `namedCurve` properties are set to "NODE-ED25519" to indicate that these parameters are specific to Cloudflare Workers' implementation of Ed25519, which is not compatible with standard Web Crypto API Ed25519 implementations in other environments.
|
|
4
|
+
*/
|
|
5
|
+
interface Ed25519Params {
|
|
6
|
+
name: "NODE-ED25519";
|
|
7
|
+
namedCurve: "NODE-ED25519";
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Represents an Ed25519 key pair with a public key and a private key, both of which are CryptoKey objects. This interface is used to define the structure of the key pair generated by the `generateSigningKeyPair` function, where the `publicKey` is used for signature verification and the `privateKey` is used for signing operations. The keys are generated using Cloudflare Workers' `NODE-ED25519` algorithm parameters, which are specific to Cloudflare Workers' implementation of Ed25519 and are not compatible with standard Web Crypto API Ed25519 implementations in other environments.
|
|
11
|
+
*/
|
|
12
|
+
interface Ed25519KeyPair {
|
|
13
|
+
publicKey: CryptoKey;
|
|
14
|
+
privateKey: CryptoKey;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generates an Ed25519 key pair using Cloudflare Workers' `NODE-ED25519` algorithm and returns the public key as a base64 string, the private key as a JWK object, and a key ID derived from the public key. The private key is returned as a JWK for compatibility with Web Crypto API operations.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This function uses Cloudflare Workers' `NODE-ED25519` algorithm parameters, which are specific to Cloudflare Workers' implementation of Ed25519. The returned key pair is structured as follows:
|
|
21
|
+
* - The `publicKey` is returned as a base64url-encoded string of the raw public key bytes (the 'x' parameter from the JWK).
|
|
22
|
+
* - The `privateKeyJwk` is returned as a JWK object containing the private key parameters, which can be used for signing operations with the Web Crypto API.
|
|
23
|
+
* - The `keyId` is generated by hashing the raw public key bytes and taking the first 4 bytes of the hash, encoded as a hex string prefixed with "ed25519:". This provides a unique identifier for the key pair based on its public key.
|
|
24
|
+
*
|
|
25
|
+
* This function is not compatible with standard Web Crypto API Ed25519 implementations in other environments. The legacy function `generateSigningKeyPairLegacy` is also available for backwards compatibility, which returns the private key as a JSON stringified JWK. However, it is recommended to use this structured version for new code.
|
|
26
|
+
*
|
|
27
|
+
* @returns An object containing the `publicKey` as a base64 string, the `privateKeyJwk` as a JWK object, and a `keyId` derived from the public key.
|
|
28
|
+
* @throws {@link DOMException} If key generation or export fails in the Web Crypto API.
|
|
29
|
+
*/
|
|
30
|
+
declare function generateSigningKeyPair(): Promise<{
|
|
31
|
+
publicKey: string;
|
|
32
|
+
privateKeyJwk: JsonWebKey;
|
|
33
|
+
keyId: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Generates an Ed25519 key pair and returns the public key as a base64 string, the private key as a JSON stringified JWK, and a key ID derived from the public key. The private key is returned in a legacy format for compatibility with existing code that expects a JSON string.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Legacy function for backwards compatibility during migration. Returns the old format but with a proper key.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated Use `generateSigningKeyPair` instead, which returns a structured key object and separate key ID. This legacy function is retained for backwards compatibility but may be removed in future releases.
|
|
42
|
+
*
|
|
43
|
+
* @returns An object containing the `publicKey` as a base64 string, the `privateKey` as a JSON stringified JWK, and a `keyId` derived from the public key.
|
|
44
|
+
* @throws {@link SyntaxError} If the generated private key cannot be stringified to JSON (should not occur under normal circumstances).
|
|
45
|
+
*/
|
|
46
|
+
declare function generateSigningKeyPairLegacy(): Promise<{
|
|
47
|
+
publicKey: string;
|
|
48
|
+
privateKey: string;
|
|
49
|
+
keyId: string;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Creates and attaches an [Ed25519 signature](https://matrix.org/docs/spec/client_server/latest#signing-json-objects) for a JSON object using [Matrix-style](https://matrix.org/docs/spec/client_server/latest#signing-json-objects) signing rules.
|
|
53
|
+
*
|
|
54
|
+
* @see https://matrix.org/docs/spec/client_server/latest#signing-json-objects
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* - Signature output is encoded as un-padded base64url.
|
|
58
|
+
* - The original `obj` is not mutated.
|
|
59
|
+
* - Uses `NODE-ED25519` algorithm parameters for key import/sign operations.
|
|
60
|
+
*
|
|
61
|
+
* The function canonicalizes a copy of the input object after removing the `signatures`
|
|
62
|
+
* and `unsigned` properties, signs that canonical JSON payload with the provided private key,
|
|
63
|
+
* and returns a new object with the generated signature merged into `obj.signatures`.
|
|
64
|
+
*
|
|
65
|
+
* Existing signatures are preserved, including other keys under the same `serverName`.
|
|
66
|
+
*
|
|
67
|
+
* @param obj - The JSON object to sign.
|
|
68
|
+
* @param serverName - The signing entity name used as the top-level key in `signatures`.
|
|
69
|
+
* @param keyId - The key identifier used under `signatures[serverName]`.
|
|
70
|
+
* @param privateKeyJwk - The Ed25519 private key as a JWK object, or a JSON stringified JWK (legacy compatibility).
|
|
71
|
+
* @returns A new object containing all original fields plus an updated `signatures` map with the new signature.
|
|
72
|
+
* @throws {@link SyntaxError} If `privateKeyJwk` is a string that is not valid JSON.
|
|
73
|
+
* @throws {@link DOMException} If key import or signing fails in the Web Crypto API.
|
|
74
|
+
*/
|
|
75
|
+
declare function signJson(obj: Record<string, unknown>, serverName: string, keyId: string, privateKeyJwk: JsonWebKey | string): Promise<Record<string, unknown>>;
|
|
76
|
+
/**
|
|
77
|
+
* Verifies an Ed25519 signature on a JSON object using [Matrix-style signing rules](https://matrix.org/docs/spec/client_server/latest#signing-json-objects). The function extracts the relevant signature from the `signatures` property of the input object, removes the `signatures` and `unsigned` properties to create a canonical JSON payload, and then verifies the signature against the provided public key. The public key is expected to be a base64url-encoded string of the raw public key bytes (the 'x' parameter from the JWK). The function returns `true` if the signature is valid and `false` otherwise. Any errors during the verification process are caught and logged, with a return value of `false` in case of failure.
|
|
78
|
+
*
|
|
79
|
+
* @see https://matrix.org/docs/spec/client_server/latest#signing-json-objects
|
|
80
|
+
*
|
|
81
|
+
* @remarks
|
|
82
|
+
* - Signature input is expected to be un-padded base64url.
|
|
83
|
+
* - The original `obj` is not mutated.
|
|
84
|
+
* - Uses `NODE-ED25519` algorithm parameters for key import/verify operations.
|
|
85
|
+
* - The function does not throw on verification failure; it returns `false` instead. Errors during key import or verification are logged to the console for debugging purposes.
|
|
86
|
+
*
|
|
87
|
+
* @param obj - The JSON object containing the signature to verify.
|
|
88
|
+
* @param serverName - The signing entity name used as the top-level key in `signatures`.
|
|
89
|
+
* @param keyId - The key identifier used under `signatures[serverName]` to locate the specific signature to verify.
|
|
90
|
+
* @param publicKeyB64 - The Ed25519 public key as a base64url-encoded string of the raw public key bytes (the 'x' parameter from the JWK).
|
|
91
|
+
* @returns A boolean indicating whether the signature is valid (`true`) or not (`false`). Returns `false` if the signature is missing, invalid, or if any errors occur during the verification process.
|
|
92
|
+
*/
|
|
93
|
+
declare function verifySignature(obj: Record<string, unknown>, serverName: string, keyId: string, publicKeyB64: string): Promise<boolean>;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/base-64.d.ts
|
|
96
|
+
/**
|
|
97
|
+
* Encodes a Uint8Array into a Base64 encoded Uint8Array.
|
|
98
|
+
*
|
|
99
|
+
* @credit https://github.com/hi-ogawa/js-utils
|
|
100
|
+
*
|
|
101
|
+
* @param input - The input Uint8Array or string to encode.
|
|
102
|
+
* @returns The Base64 encoded Uint8Array.
|
|
103
|
+
*/
|
|
104
|
+
declare function encodeBase64(input: Uint8Array | string): string;
|
|
105
|
+
/**
|
|
106
|
+
* Decodes a Base64 encoded Uint8Array into a Uint8Array.
|
|
107
|
+
*
|
|
108
|
+
* @credit https://github.com/hi-ogawa/js-utils
|
|
109
|
+
*
|
|
110
|
+
* @param input - The Base64 encoded Uint8Array or string to decode.
|
|
111
|
+
* @returns The decoded Uint8Array.
|
|
112
|
+
*/
|
|
113
|
+
declare function decodeBase64(input: Uint8Array | string): Uint8Array;
|
|
114
|
+
/**
|
|
115
|
+
* Converts a Base64 encoded string to a [Base64url](https://datatracker.ietf.org/doc/html/rfc7515#appendix-C) encoded string.
|
|
116
|
+
*
|
|
117
|
+
* @see https://datatracker.ietf.org/doc/html/rfc7515#appendix-C
|
|
118
|
+
*
|
|
119
|
+
* @param base64 - The Base64 encoded string to convert.
|
|
120
|
+
* @returns The Base64url encoded string.
|
|
121
|
+
*/
|
|
122
|
+
declare function base64UrlEncode(base64: Uint8Array): string;
|
|
123
|
+
/**
|
|
124
|
+
* Converts a [Base64url](https://datatracker.ietf.org/doc/html/rfc7515#appendix-C) encoded string to a Base64 encoded string.
|
|
125
|
+
*
|
|
126
|
+
* @see https://datatracker.ietf.org/doc/html/rfc7515#appendix-C
|
|
127
|
+
*
|
|
128
|
+
* @param base64url - The Base64url encoded string to convert.
|
|
129
|
+
* @returns The Base64 encoded string.
|
|
130
|
+
*/
|
|
131
|
+
declare function base64UrlDecode(base64url: string): Uint8Array;
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/encryption.d.ts
|
|
134
|
+
/**
|
|
135
|
+
* Creates a CryptoKey object that can be used to encrypt any string.
|
|
136
|
+
*
|
|
137
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey
|
|
138
|
+
*
|
|
139
|
+
* @returns A promise that resolves to a CryptoKey object that can be used to encrypt and decrypt strings.
|
|
140
|
+
*/
|
|
141
|
+
declare function createKey(): Promise<CryptoKey>;
|
|
142
|
+
/**
|
|
143
|
+
* Encodes a CryptoKey to base64 string, so that it can be embedded in JSON / JavaScript
|
|
144
|
+
*
|
|
145
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/exportKey
|
|
146
|
+
*
|
|
147
|
+
* @param key - The CryptoKey to encode
|
|
148
|
+
* @returns A promise that resolves to a base64 string representing the key
|
|
149
|
+
*/
|
|
150
|
+
declare function encodeKey(key: CryptoKey): Promise<string>;
|
|
151
|
+
/**
|
|
152
|
+
* Decodes a base64 string into bytes and then imports the key.
|
|
153
|
+
*
|
|
154
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey
|
|
155
|
+
*
|
|
156
|
+
* @param encoded - The base64 encoded key
|
|
157
|
+
* @returns A promise that resolves to a CryptoKey object that can be used to encrypt and decrypt strings
|
|
158
|
+
*/
|
|
159
|
+
declare function decodeKey(encoded: string): Promise<CryptoKey>;
|
|
160
|
+
/**
|
|
161
|
+
* Using a CryptoKey, use AES-GCM to encrypt a string into a base64 string.
|
|
162
|
+
*
|
|
163
|
+
* @remarks
|
|
164
|
+
* The initialization vector is randomly generated and prepended to the encrypted string. The IV is required for decryption, so it must be stored alongside the encrypted data.
|
|
165
|
+
*
|
|
166
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt
|
|
167
|
+
*
|
|
168
|
+
* @param key - The CryptoKey to use for encryption
|
|
169
|
+
* @param plaintext - The plaintext string to encrypt
|
|
170
|
+
* @returns A promise that resolves to a base64 string representing the encrypted data
|
|
171
|
+
*/
|
|
172
|
+
declare function encrypt(key: CryptoKey, plaintext: string): Promise<string>;
|
|
173
|
+
/**
|
|
174
|
+
* Takes a base64 encoded string, decodes it and returns the AES-GCM decrypted text.
|
|
175
|
+
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* The initialization vector is expected to be prepended to the encrypted string. The IV is required for decryption, so it must be extracted from the start of the string.
|
|
178
|
+
*
|
|
179
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/decrypt
|
|
180
|
+
*
|
|
181
|
+
* @param key - The CryptoKey to use for decryption
|
|
182
|
+
* @param encrypted - The encrypted base64 encoded string to decrypt
|
|
183
|
+
* @returns A promise that resolves to the decrypted string
|
|
184
|
+
*/
|
|
185
|
+
declare function decrypt(key: CryptoKey, encrypted: string): Promise<string>;
|
|
186
|
+
/**
|
|
187
|
+
* Encrypts a buffer using AES-GCM with a given CryptoKey.
|
|
188
|
+
*
|
|
189
|
+
* @remarks
|
|
190
|
+
* The initialization vector (IV) is randomly generated and prepended to the encrypted data. The resulting data is then encoded as a base64 string for easy storage/transmission.
|
|
191
|
+
*
|
|
192
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt
|
|
193
|
+
*
|
|
194
|
+
* @param key - The CryptoKey to use for encryption
|
|
195
|
+
* @param buffer - The buffer to encrypt
|
|
196
|
+
* @returns A promise that resolves to a base64 string representing the encrypted data
|
|
197
|
+
*/
|
|
198
|
+
declare function encryptBuffer(key: CryptoKey, buffer: BufferSource): Promise<string>;
|
|
199
|
+
/**
|
|
200
|
+
* Decrypts a buffer using AES-GCM with a given CryptoKey.
|
|
201
|
+
*
|
|
202
|
+
* @remarks
|
|
203
|
+
* The initialization vector (IV) is expected to be prepended to the encrypted data. The IV is required for decryption, so it must be extracted from the start of the buffer.
|
|
204
|
+
*
|
|
205
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/decrypt
|
|
206
|
+
*
|
|
207
|
+
* @param key - The CryptoKey to use for decryption
|
|
208
|
+
* @param encrypted - The encrypted base64 encoded string to decrypt
|
|
209
|
+
* @returns A promise that resolves to the decrypted string
|
|
210
|
+
*/
|
|
211
|
+
declare function decryptBuffer(key: CryptoKey, encrypted: string): Promise<ArrayBuffer>;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/hex.d.ts
|
|
214
|
+
/**
|
|
215
|
+
* Encodes a Uint8Array into a hexadecimal string.
|
|
216
|
+
*
|
|
217
|
+
* @param input - The input Uint8Array.
|
|
218
|
+
* @returns The hexadecimal string.
|
|
219
|
+
*/
|
|
220
|
+
declare function encodeHex(input: Uint8Array): string;
|
|
221
|
+
/**
|
|
222
|
+
* Encodes a Uint8Array into an uppercase hexadecimal string.
|
|
223
|
+
*
|
|
224
|
+
* @param input - The input Uint8Array.
|
|
225
|
+
* @returns The uppercase hexadecimal string.
|
|
226
|
+
*/
|
|
227
|
+
declare function decodeHex(input: string): Uint8Array;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/random.d.ts
|
|
230
|
+
/**
|
|
231
|
+
* Generate a random byte array of the specified length using the Web Crypto API.
|
|
232
|
+
*
|
|
233
|
+
* @param length - The length of the random byte array to generate (default is 32 bytes)
|
|
234
|
+
* @returns A Uint8Array containing random bytes of the specified length
|
|
235
|
+
*/
|
|
236
|
+
declare function generateRandomBytes(length?: number): Uint8Array;
|
|
237
|
+
/**
|
|
238
|
+
* Generate a random string of the specified length using characters A-Z, a-z, and 0-9 for CSRF tokens, etc.
|
|
239
|
+
*
|
|
240
|
+
* @remarks
|
|
241
|
+
* This function uses the Web Crypto API's `crypto.getRandomValues` to generate secure random bytes,
|
|
242
|
+
* and then maps those bytes to characters in the specified character set. It uses rejection sampling
|
|
243
|
+
* to ensure a uniform distribution of characters without modulo bias.
|
|
244
|
+
*
|
|
245
|
+
* @param length - The length of the random string to generate (default is 32 characters)
|
|
246
|
+
* @returns A random string of the specified length
|
|
247
|
+
*/
|
|
248
|
+
declare function generateRandomString(length?: number): string;
|
|
249
|
+
//#endregion
|
|
250
|
+
export { Ed25519KeyPair, Ed25519Params, base64UrlDecode, base64UrlEncode, createKey, decodeBase64, decodeHex, decodeKey, decrypt, decryptBuffer, encodeBase64, encodeHex, encodeKey, encrypt, encryptBuffer, generateRandomBytes, generateRandomString, generateSigningKeyPair, generateSigningKeyPairLegacy, signJson, verifySignature };
|
|
251
|
+
//# sourceMappingURL=cloudflare.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare.d.mts","names":[],"sources":["../src/ed25519.ts","../src/base-64.ts","../src/encryption.ts","../src/hex.ts","../src/random.ts"],"sourcesContent":[],"mappings":";;AAwBA;AAQA;AAmBsB,UA3BL,aAAA,CA2B2B;EAgDtB,IAAA,EAAA,cAAA;EAsCA,UAAA,EAAQ,cAAA;;;;;AAKpB,UA9GO,cAAA,CA8GP;EAmEY,SAAA,EAhLT,SAgLwB;cA/KvB;;;ACkCd;AAmDA;AAkFA;AAeA;;;;ACrLA;AAmBA;AAcA;AA4BA;AA8BA;AA4BA;AACO,iBFxGe,sBAAA,CAAA,CEwGf,EFxGyC,OEwGzC,CAAA;EACG,SAAA,EAAA,MAAA;EACP,aAAA,EFxGc,UEwGd;EAAO,KAAA,EAAA,MAAA;AA0BV,CAAA,CAAA;;;;;;;;ACrIA;AAeA;;;iBHkCsB,4BAAA,CAAA,GAAgC;EI3EtC,SAAA,EAAA,MAAA;EAeA,UAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;iBJkGM,QAAA,MACf,2EAGU,sBACd,QAAQ;;;;;;;;;;;;;;;;;;iBAmEW,eAAA,MACf,mFAIJ;;;;AA9LH;AAQA;AAmBA;AAgDA;AAsCA;;;AAKW,iBC1EK,YAAA,CD0EL,KAAA,EC1EyB,UD0EzB,GAAA,MAAA,CAAA,EAAA,MAAA;;;AAmEX;;;;AC7IA;AAmDA;AAkFgB,iBAlFA,YAAA,CAkFwB,KAAA,EAlFJ,UAkFc,GAAA,MAAA,CAAA,EAlFQ,UAkFR;AAelD;;;;ACrLA;AAmBA;AAcA;AA4BA;AA8BsB,iBD2EN,eAAA,CCxEb,MAAO,EDwE8B,UCxE9B,CAAA,EAAA,MAAA;AAyBV;;;;;AA6BA;;;AAGG,iBD8Ba,eAAA,CC9Bb,SAAA,EAAA,MAAA,CAAA,ED8BiD,UC9BjD;;;;AFlKH;AAQA;AAmBA;AAgDA;AAsCA;;AAIiB,iBE1GK,SAAA,CAAA,CF0GL,EE1GkB,OF0GlB,CE1G0B,SF0G1B,CAAA;;;;AAoEjB;;;;AC7IA;AAmDgB,iBCjEM,SAAA,CDiEc,GAAA,ECjEC,SDiEqB,CAAA,ECjET,ODiEmB,CAAA,MAAA,CAAA;AAkFpE;AAeA;;;;ACrLA;AAmBA;AAcA;AA4BsB,iBA5BA,SAAA,CA6Bf,OAEJ,EAAA,MAAO,CAAA,EA/BwC,OA+BxC,CA/BgD,SA+BhD,CAAA;AA2BV;AA4BA;;;;;AA6BA;;;;;;iBAvFsB,OAAA,MACf,+BAEJ;;ACjDH;AAeA;;;;ACzCA;AAeA;;;;;iBFuFsB,OAAA,MACf,+BAEJ;;;;;;;;;;;;;iBAyBmB,aAAA,MACf,mBACG,eACP;;;;;;;;;;;;;iBA0BmB,aAAA,MACf,+BAEJ,QAAQ;;;;AFlKX;AAQA;AAmBA;AAgDA;AAsCA;AACO,iBGxFS,SAAA,CHwFT,KAAA,EGxF0B,UHwF1B,CAAA,EAAA,MAAA;;;;;AAuEP;;iBGhJgB,SAAA,iBAA0B;;;;AHzC1C;AAQA;AAmBA;AAgDA;AAsCA;AACO,iBIlHS,mBAAA,CJkHT,MAAA,CAAA,EAAA,MAAA,CAAA,EIlHmD,UJkHnD;;;;;AAuEP;;;;AC7IA;AAmDA;AAkFA;AAegB,iBGjLA,oBAAA,CHiL8C,MAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA"}
|