cipher-kit 2.1.0 → 2.1.2

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 (40) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-UVEMRK5F.cjs → chunk-66WIL32E.cjs} +149 -154
  3. package/dist/chunk-66WIL32E.cjs.map +1 -0
  4. package/dist/{chunk-BHG5RSUV.cjs → chunk-HTRGOBZF.cjs} +17 -8
  5. package/dist/chunk-HTRGOBZF.cjs.map +1 -0
  6. package/dist/{chunk-CRTOKS3Q.js → chunk-JLFVTZY4.js} +8 -12
  7. package/dist/chunk-JLFVTZY4.js.map +1 -0
  8. package/dist/{chunk-RUTGDMVR.js → chunk-LU7QOSQH.js} +16 -9
  9. package/dist/chunk-LU7QOSQH.js.map +1 -0
  10. package/dist/{chunk-RAEBT46G.js → chunk-S6SNCTU6.js} +8 -12
  11. package/dist/chunk-S6SNCTU6.js.map +1 -0
  12. package/dist/{chunk-HMTHK2IY.cjs → chunk-ZNM5M6RD.cjs} +144 -149
  13. package/dist/chunk-ZNM5M6RD.cjs.map +1 -0
  14. package/dist/{export-BF9wW56f.d.ts → export-BaM_OTFk.d.ts} +17 -35
  15. package/dist/{export-w8sBcKXw.d.ts → export-CCTGAosO.d.ts} +17 -35
  16. package/dist/{export-DVERZibl.d.cts → export-FYHgb-8E.d.cts} +17 -35
  17. package/dist/{export-5hmOiU0J.d.cts → export-KFT0YyMg.d.cts} +17 -35
  18. package/dist/index.cjs +19 -11
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +3 -3
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +3 -3
  23. package/dist/index.js.map +1 -1
  24. package/dist/node.cjs +35 -35
  25. package/dist/node.d.cts +2 -2
  26. package/dist/node.d.ts +2 -2
  27. package/dist/node.js +2 -2
  28. package/dist/{validate-B3uHoP8n.d.cts → validate-lkJAHCeJ.d.cts} +73 -46
  29. package/dist/{validate-B3uHoP8n.d.ts → validate-lkJAHCeJ.d.ts} +73 -46
  30. package/dist/web-api.cjs +35 -35
  31. package/dist/web-api.d.cts +2 -2
  32. package/dist/web-api.d.ts +2 -2
  33. package/dist/web-api.js +2 -2
  34. package/package.json +1 -1
  35. package/dist/chunk-BHG5RSUV.cjs.map +0 -1
  36. package/dist/chunk-CRTOKS3Q.js.map +0 -1
  37. package/dist/chunk-HMTHK2IY.cjs.map +0 -1
  38. package/dist/chunk-RAEBT46G.js.map +0 -1
  39. package/dist/chunk-RUTGDMVR.js.map +0 -1
  40. package/dist/chunk-UVEMRK5F.cjs.map +0 -1
@@ -1,22 +1,5 @@
1
- import { S as SecretKey, R as Result, d as CreateSecretKeyOptions, e as EncryptOptions, f as DecryptOptions, H as HashOptions, g as HashPasswordOptions, V as VerifyPasswordOptions, b as Encoding } from './validate-B3uHoP8n.cjs';
1
+ import { R as Result, e as CreateSecretKeyOptions, W as WebSecretKey, f as EncryptOptions, g as DecryptOptions, H as HashOptions, h as HashPasswordOptions, V as VerifyPasswordOptions, c as Encoding } from './validate-lkJAHCeJ.cjs';
2
2
 
3
- /**
4
- * Type guard to check if the provided value is a SecretKey object for Web (Deno, Bun, Cloudflare included) environment.
5
- *
6
- * ### 🍼 Explain Like I'm Five
7
- * Checking if the key in your hand is the right kind of key for the lock.
8
- *
9
- * @param x - The value to check.
10
- * @returns True if the value is a SecretKey object for Web, false otherwise.
11
- *
12
- * @example
13
- * ```ts
14
- * isWebSecretKey(webKey); // true
15
- * isWebSecretKey(nodeKey); // false
16
- * isWebSecretKey({}); // false
17
- * ```
18
- */
19
- declare function isWebSecretKey(x: unknown): x is SecretKey<"web">;
20
3
  /**
21
4
  * Safely generates a UUID (v4) (non-throwing).
22
5
  *
@@ -76,7 +59,7 @@ declare function generateUuid(): string;
76
59
  * ```
77
60
  */
78
61
  declare function tryCreateSecretKey(secret: string, options?: CreateSecretKeyOptions): Promise<Result<{
79
- result: SecretKey<"web">;
62
+ result: WebSecretKey;
80
63
  }>>;
81
64
  /**
82
65
  * Derives a `SecretKey` from the provided string for encryption/decryption (throwing).
@@ -100,7 +83,7 @@ declare function tryCreateSecretKey(secret: string, options?: CreateSecretKeyOpt
100
83
  * const secretKey = await createSecretKey("my-secret"); // SecretKey object
101
84
  * ```
102
85
  */
103
- declare function createSecretKey(secret: string, options?: CreateSecretKeyOptions): Promise<SecretKey<"web">>;
86
+ declare function createSecretKey(secret: string, options?: CreateSecretKeyOptions): Promise<WebSecretKey>;
104
87
  /**
105
88
  * Safely encrypts a UTF-8 string using the provided `SecretKey` (non-throwing).
106
89
  *
@@ -124,7 +107,7 @@ declare function createSecretKey(secret: string, options?: CreateSecretKeyOption
124
107
  * else console.error(error); // { message: "...", description: "..." }
125
108
  * ```
126
109
  */
127
- declare function tryEncrypt(data: string, secretKey: SecretKey<"web">, options?: EncryptOptions): Promise<Result<string>>;
110
+ declare function tryEncrypt(data: string, secretKey: WebSecretKey, options?: EncryptOptions): Promise<Result<string>>;
128
111
  /**
129
112
  * Encrypts a UTF-8 string using the provided `SecretKey` (throwing).
130
113
  *
@@ -146,7 +129,7 @@ declare function tryEncrypt(data: string, secretKey: SecretKey<"web">, options?:
146
129
  * const encrypted = await encrypt("Hello, World!", secretKey); // "iv.cipherWithTag." (Encrypted string)
147
130
  * ```
148
131
  */
149
- declare function encrypt(data: string, secretKey: SecretKey<"web">, options?: EncryptOptions): Promise<string>;
132
+ declare function encrypt(data: string, secretKey: WebSecretKey, options?: EncryptOptions): Promise<string>;
150
133
  /**
151
134
  * Safely decrypts the input string using the provided `SecretKey` (non-throwing).
152
135
  *
@@ -171,7 +154,7 @@ declare function encrypt(data: string, secretKey: SecretKey<"web">, options?: En
171
154
  * else console.error(error); // { message: "...", description: "..." }
172
155
  * ```
173
156
  */
174
- declare function tryDecrypt(encrypted: string, secretKey: SecretKey<"web">, options?: DecryptOptions): Promise<Result<string>>;
157
+ declare function tryDecrypt(encrypted: string, secretKey: WebSecretKey, options?: DecryptOptions): Promise<Result<string>>;
175
158
  /**
176
159
  * Decrypts the input string using the provided `SecretKey` (throwing).
177
160
  *
@@ -194,7 +177,7 @@ declare function tryDecrypt(encrypted: string, secretKey: SecretKey<"web">, opti
194
177
  * const decrypted = await decrypt(encrypted, secretKey); // "Hello, World!"
195
178
  * ```
196
179
  */
197
- declare function decrypt(encrypted: string, secretKey: SecretKey<"web">, options?: DecryptOptions): Promise<string>;
180
+ declare function decrypt(encrypted: string, secretKey: WebSecretKey, options?: DecryptOptions): Promise<string>;
198
181
  /**
199
182
  * Safely encrypts a plain object using the provided `SecretKey` (non-throwing).
200
183
  *
@@ -208,7 +191,7 @@ declare function decrypt(encrypted: string, secretKey: SecretKey<"web">, options
208
191
  * your special key, creating a jumbled code that only someone with the right key can read.
209
192
  *
210
193
  * @template T - The type of the plain object to encrypt.
211
- * @param data - A plain object to encrypt.
194
+ * @param obj - A plain object to encrypt.
212
195
  * @param secretKey - The `SecretKey` object used for encryption.
213
196
  * @param options.outputEncoding - The encoding format for the output ciphertext (default: `'base64url'`).
214
197
  * @returns A `Result` promise containing the encrypted string in the specified format or an error.
@@ -222,7 +205,7 @@ declare function decrypt(encrypted: string, secretKey: SecretKey<"web">, options
222
205
  * else console.error(error); // { message: "...", description: "..." }
223
206
  * ```
224
207
  */
225
- declare function tryEncryptObj<T extends object = Record<string, unknown>>(data: T, secretKey: SecretKey<"web">, options?: EncryptOptions): Promise<Result<string>>;
208
+ declare function tryEncryptObj<T extends object = Record<string, unknown>>(obj: T, secretKey: WebSecretKey, options?: EncryptOptions): Promise<Result<string>>;
226
209
  /**
227
210
  * Encrypts a plain object using the provided `SecretKey` (throwing).
228
211
  *
@@ -236,7 +219,7 @@ declare function tryEncryptObj<T extends object = Record<string, unknown>>(data:
236
219
  * your special key, creating a jumbled code that only someone with the right key can read.
237
220
  *
238
221
  * @template T - The type of the plain object to encrypt.
239
- * @param data - A plain object to encrypt.
222
+ * @param obj - A plain object to encrypt.
240
223
  * @param secretKey - The `SecretKey` object used for encryption.
241
224
  * @param options.outputEncoding - The encoding format for the output ciphertext (default: `'base64url'`).
242
225
  * @returns A promise with the encrypted string in the specified format.
@@ -248,9 +231,9 @@ declare function tryEncryptObj<T extends object = Record<string, unknown>>(data:
248
231
  * const encrypted = await encryptObj({ a: 1 }, secretKey); // "iv.cipherWithTag." (Encrypted string)
249
232
  * ```
250
233
  */
251
- declare function encryptObj<T extends object = Record<string, unknown>>(data: T, secretKey: SecretKey<"web">, options?: EncryptOptions): Promise<string>;
234
+ declare function encryptObj<T extends object = Record<string, unknown>>(obj: T, secretKey: WebSecretKey, options?: EncryptOptions): Promise<string>;
252
235
  /**
253
- * Safely decrypts an encrypted JSON string into an object (non-throwing).
236
+ * Safely decrypts an encrypted JSON string into a plain object (non-throwing).
254
237
  *
255
238
  * Expects input in the format `"iv.cipherWithTag."` and returns a plain object.
256
239
  *
@@ -274,11 +257,11 @@ declare function encryptObj<T extends object = Record<string, unknown>>(data: T,
274
257
  * else console.error(error); // { message: "...", description: "..." }
275
258
  * ```
276
259
  */
277
- declare function tryDecryptObj<T extends object = Record<string, unknown>>(encrypted: string, secretKey: SecretKey<"web">, options?: DecryptOptions): Promise<Result<{
260
+ declare function tryDecryptObj<T extends object = Record<string, unknown>>(encrypted: string, secretKey: WebSecretKey, options?: DecryptOptions): Promise<Result<{
278
261
  result: T;
279
262
  }>>;
280
263
  /**
281
- * Decrypts an encrypted JSON string into an object (throwing).
264
+ * Decrypts an encrypted JSON string into a plain object (throwing).
282
265
  *
283
266
  * Expects input in the format `"iv.cipherWithTag."` and returns a plain object.
284
267
  *
@@ -300,7 +283,7 @@ declare function tryDecryptObj<T extends object = Record<string, unknown>>(encry
300
283
  * const obj = await decryptObj<{ a: number }>(encrypted, secretKey); // obj.a === 1
301
284
  * ```
302
285
  */
303
- declare function decryptObj<T extends object = Record<string, unknown>>(encrypted: string, secretKey: SecretKey<"web">, options?: DecryptOptions): Promise<T>;
286
+ declare function decryptObj<T extends object = Record<string, unknown>>(encrypted: string, secretKey: WebSecretKey, options?: DecryptOptions): Promise<T>;
304
287
  /**
305
288
  * Safely hashes a UTF-8 string (non-throwing).
306
289
  *
@@ -570,7 +553,6 @@ declare const webCryptoKit_encryptObj: typeof encryptObj;
570
553
  declare const webCryptoKit_generateUuid: typeof generateUuid;
571
554
  declare const webCryptoKit_hash: typeof hash;
572
555
  declare const webCryptoKit_hashPassword: typeof hashPassword;
573
- declare const webCryptoKit_isWebSecretKey: typeof isWebSecretKey;
574
556
  declare const webCryptoKit_tryConvertBytesToStr: typeof tryConvertBytesToStr;
575
557
  declare const webCryptoKit_tryConvertEncoding: typeof tryConvertEncoding;
576
558
  declare const webCryptoKit_tryConvertStrToBytes: typeof tryConvertStrToBytes;
@@ -584,7 +566,7 @@ declare const webCryptoKit_tryHash: typeof tryHash;
584
566
  declare const webCryptoKit_tryHashPassword: typeof tryHashPassword;
585
567
  declare const webCryptoKit_verifyPassword: typeof verifyPassword;
586
568
  declare namespace webCryptoKit {
587
- export { webCryptoKit_convertBytesToStr as convertBytesToStr, webCryptoKit_convertEncoding as convertEncoding, webCryptoKit_convertStrToBytes as convertStrToBytes, webCryptoKit_createSecretKey as createSecretKey, webCryptoKit_decrypt as decrypt, webCryptoKit_decryptObj as decryptObj, webCryptoKit_encrypt as encrypt, webCryptoKit_encryptObj as encryptObj, webCryptoKit_generateUuid as generateUuid, webCryptoKit_hash as hash, webCryptoKit_hashPassword as hashPassword, webCryptoKit_isWebSecretKey as isWebSecretKey, webCryptoKit_tryConvertBytesToStr as tryConvertBytesToStr, webCryptoKit_tryConvertEncoding as tryConvertEncoding, webCryptoKit_tryConvertStrToBytes as tryConvertStrToBytes, webCryptoKit_tryCreateSecretKey as tryCreateSecretKey, webCryptoKit_tryDecrypt as tryDecrypt, webCryptoKit_tryDecryptObj as tryDecryptObj, webCryptoKit_tryEncrypt as tryEncrypt, webCryptoKit_tryEncryptObj as tryEncryptObj, webCryptoKit_tryGenerateUuid as tryGenerateUuid, webCryptoKit_tryHash as tryHash, webCryptoKit_tryHashPassword as tryHashPassword, webCryptoKit_verifyPassword as verifyPassword };
569
+ export { webCryptoKit_convertBytesToStr as convertBytesToStr, webCryptoKit_convertEncoding as convertEncoding, webCryptoKit_convertStrToBytes as convertStrToBytes, webCryptoKit_createSecretKey as createSecretKey, webCryptoKit_decrypt as decrypt, webCryptoKit_decryptObj as decryptObj, webCryptoKit_encrypt as encrypt, webCryptoKit_encryptObj as encryptObj, webCryptoKit_generateUuid as generateUuid, webCryptoKit_hash as hash, webCryptoKit_hashPassword as hashPassword, webCryptoKit_tryConvertBytesToStr as tryConvertBytesToStr, webCryptoKit_tryConvertEncoding as tryConvertEncoding, webCryptoKit_tryConvertStrToBytes as tryConvertStrToBytes, webCryptoKit_tryCreateSecretKey as tryCreateSecretKey, webCryptoKit_tryDecrypt as tryDecrypt, webCryptoKit_tryDecryptObj as tryDecryptObj, webCryptoKit_tryEncrypt as tryEncrypt, webCryptoKit_tryEncryptObj as tryEncryptObj, webCryptoKit_tryGenerateUuid as tryGenerateUuid, webCryptoKit_tryHash as tryHash, webCryptoKit_tryHashPassword as tryHashPassword, webCryptoKit_verifyPassword as verifyPassword };
588
570
  }
589
571
 
590
- export { tryCreateSecretKey as a, tryEncrypt as b, createSecretKey as c, tryDecrypt as d, encrypt as e, decrypt as f, generateUuid as g, tryEncryptObj as h, isWebSecretKey as i, encryptObj as j, tryDecryptObj as k, decryptObj as l, tryHash as m, hash as n, tryHashPassword as o, hashPassword as p, tryConvertStrToBytes as q, convertStrToBytes as r, tryConvertBytesToStr as s, tryGenerateUuid as t, convertBytesToStr as u, verifyPassword as v, webCryptoKit as w, tryConvertEncoding as x, convertEncoding as y };
572
+ export { tryCreateSecretKey as a, tryEncrypt as b, createSecretKey as c, tryDecrypt as d, encrypt as e, decrypt as f, generateUuid as g, tryEncryptObj as h, encryptObj as i, tryDecryptObj as j, decryptObj as k, tryHash as l, hash as m, tryHashPassword as n, hashPassword as o, tryConvertStrToBytes as p, convertStrToBytes as q, tryConvertBytesToStr as r, convertBytesToStr as s, tryGenerateUuid as t, tryConvertEncoding as u, verifyPassword as v, webCryptoKit as w, convertEncoding as x };
@@ -1,23 +1,6 @@
1
- import { S as SecretKey, R as Result, d as CreateSecretKeyOptions, e as EncryptOptions, f as DecryptOptions, H as HashOptions, g as HashPasswordOptions, V as VerifyPasswordOptions, b as Encoding } from './validate-B3uHoP8n.cjs';
1
+ import { R as Result, e as CreateSecretKeyOptions, N as NodeSecretKey, f as EncryptOptions, g as DecryptOptions, H as HashOptions, h as HashPasswordOptions, V as VerifyPasswordOptions, c as Encoding } from './validate-lkJAHCeJ.cjs';
2
2
  import { Buffer } from 'node:buffer';
3
3
 
4
- /**
5
- * Type guard to check if the provided value is a SecretKey object for Node.js environment.
6
- *
7
- * ### 🍼 Explain Like I'm Five
8
- * Checking if the key in your hand is the right kind of key for the lock.
9
- *
10
- * @param x - The value to check.
11
- * @returns True if the value is a SecretKey object for Node.js, false otherwise.
12
- *
13
- * @example
14
- * ```ts
15
- * isNodeSecretKey(nodeKey); // true
16
- * isNodeSecretKey(webKey); // false
17
- * isNodeSecretKey({}); // false
18
- * ```
19
- */
20
- declare function isNodeSecretKey(x: unknown): x is SecretKey<"node">;
21
4
  /**
22
5
  * Safely generates a UUID (v4) (non-throwing).
23
6
  *
@@ -77,7 +60,7 @@ declare function generateUuid(): string;
77
60
  * ```
78
61
  */
79
62
  declare function tryCreateSecretKey(secret: string, options?: CreateSecretKeyOptions): Result<{
80
- result: SecretKey<"node">;
63
+ result: NodeSecretKey;
81
64
  }>;
82
65
  /**
83
66
  * Derives a `SecretKey` from the provided string for encryption/decryption (throwing).
@@ -101,7 +84,7 @@ declare function tryCreateSecretKey(secret: string, options?: CreateSecretKeyOpt
101
84
  * const secretKey = createSecretKey("my-secret"); // SecretKey object
102
85
  * ```
103
86
  */
104
- declare function createSecretKey(secret: string, options?: CreateSecretKeyOptions): SecretKey<"node">;
87
+ declare function createSecretKey(secret: string, options?: CreateSecretKeyOptions): NodeSecretKey;
105
88
  /**
106
89
  * Safely encrypts a UTF-8 string using the provided `SecretKey` (non-throwing).
107
90
  *
@@ -125,7 +108,7 @@ declare function createSecretKey(secret: string, options?: CreateSecretKeyOption
125
108
  * else console.error(error); // { message: "...", description: "..." }
126
109
  * ```
127
110
  */
128
- declare function tryEncrypt(data: string, secretKey: SecretKey<"node">, options?: EncryptOptions): Result<string>;
111
+ declare function tryEncrypt(data: string, secretKey: NodeSecretKey, options?: EncryptOptions): Result<string>;
129
112
  /**
130
113
  * Encrypts a UTF-8 string using the provided `SecretKey` (throwing).
131
114
  *
@@ -147,7 +130,7 @@ declare function tryEncrypt(data: string, secretKey: SecretKey<"node">, options?
147
130
  * const encrypted = encrypt("Hello, World!", secretKey); // "iv.cipher.tag." (Encrypted string)
148
131
  * ```
149
132
  */
150
- declare function encrypt(data: string, secretKey: SecretKey<"node">, options?: EncryptOptions): string;
133
+ declare function encrypt(data: string, secretKey: NodeSecretKey, options?: EncryptOptions): string;
151
134
  /**
152
135
  * Safely decrypts the input string using the provided `SecretKey` (non-throwing).
153
136
  *
@@ -172,7 +155,7 @@ declare function encrypt(data: string, secretKey: SecretKey<"node">, options?: E
172
155
  * else console.error(error); // { message: "...", description: "..." }
173
156
  * ```
174
157
  */
175
- declare function tryDecrypt(encrypted: string, secretKey: SecretKey<"node">, options?: DecryptOptions): Result<string>;
158
+ declare function tryDecrypt(encrypted: string, secretKey: NodeSecretKey, options?: DecryptOptions): Result<string>;
176
159
  /**
177
160
  * Decrypts the input string using the provided `SecretKey` (throwing).
178
161
  *
@@ -195,7 +178,7 @@ declare function tryDecrypt(encrypted: string, secretKey: SecretKey<"node">, opt
195
178
  * const decrypted = decrypt(encrypted, secretKey); // "Hello, World!" (Decrypted string)
196
179
  * ```
197
180
  */
198
- declare function decrypt(encrypted: string, secretKey: SecretKey<"node">, options?: DecryptOptions): string;
181
+ declare function decrypt(encrypted: string, secretKey: NodeSecretKey, options?: DecryptOptions): string;
199
182
  /**
200
183
  * Safely encrypts a plain object using the provided `SecretKey` (non-throwing).
201
184
  *
@@ -209,7 +192,7 @@ declare function decrypt(encrypted: string, secretKey: SecretKey<"node">, option
209
192
  * your special key, creating a jumbled code that only someone with the right key can read.
210
193
  *
211
194
  * @template T - The type of the plain object to encrypt.
212
- * @param data - A plain object to encrypt.
195
+ * @param obj - A plain object to encrypt.
213
196
  * @param secretKey - The `SecretKey` object used for encryption.
214
197
  * @param options.outputEncoding - The encoding format for the output ciphertext (default: `'base64url'`).
215
198
  * @returns A `Result` containing the encrypted string in the specified format or an error.
@@ -223,7 +206,7 @@ declare function decrypt(encrypted: string, secretKey: SecretKey<"node">, option
223
206
  * else console.error(error); // { message: "...", description: "..." }
224
207
  * ```
225
208
  */
226
- declare function tryEncryptObj<T extends object = Record<string, unknown>>(data: T, secretKey: SecretKey<"node">, options?: EncryptOptions): Result<string>;
209
+ declare function tryEncryptObj<T extends object = Record<string, unknown>>(obj: T, secretKey: NodeSecretKey, options?: EncryptOptions): Result<string>;
227
210
  /**
228
211
  * Encrypts a plain object using the provided `SecretKey` (throwing).
229
212
  *
@@ -237,7 +220,7 @@ declare function tryEncryptObj<T extends object = Record<string, unknown>>(data:
237
220
  * your special key, creating a jumbled code that only someone with the right key can read.
238
221
  *
239
222
  * @template T - The type of the plain object to encrypt.
240
- * @param data - A plain object to encrypt.
223
+ * @param obj - A plain object to encrypt.
241
224
  * @param secretKey - The `SecretKey` object used for encryption.
242
225
  * @param options.outputEncoding - The encoding format for the output ciphertext (default: `'base64url'`).
243
226
  * @returns The encrypted string in the specified format.
@@ -249,9 +232,9 @@ declare function tryEncryptObj<T extends object = Record<string, unknown>>(data:
249
232
  * const encrypted = encryptObj({ a: 1 }, secretKey); // "iv.cipher.tag." (Encrypted string)
250
233
  * ```
251
234
  */
252
- declare function encryptObj<T extends object = Record<string, unknown>>(data: T, secretKey: SecretKey<"node">, options?: EncryptOptions): string;
235
+ declare function encryptObj<T extends object = Record<string, unknown>>(obj: T, secretKey: NodeSecretKey, options?: EncryptOptions): string;
253
236
  /**
254
- * Safely decrypts an encrypted JSON string into an object (non-throwing).
237
+ * Safely decrypts an encrypted JSON string into a plain object (non-throwing).
255
238
  *
256
239
  * Expects input in the format `"iv.cipher.tag."` and returns a plain object.
257
240
  *
@@ -275,11 +258,11 @@ declare function encryptObj<T extends object = Record<string, unknown>>(data: T,
275
258
  * else console.error(error); // { message: "...", description: "..." }
276
259
  * ```
277
260
  */
278
- declare function tryDecryptObj<T extends object = Record<string, unknown>>(encrypted: string, secretKey: SecretKey<"node">, options?: DecryptOptions): Result<{
261
+ declare function tryDecryptObj<T extends object = Record<string, unknown>>(encrypted: string, secretKey: NodeSecretKey, options?: DecryptOptions): Result<{
279
262
  result: T;
280
263
  }>;
281
264
  /**
282
- * Decrypts an encrypted JSON string into an object (throwing).
265
+ * Decrypts an encrypted JSON string into a plain object (throwing).
283
266
  *
284
267
  * Expects input in the format `"iv.cipher.tag."` and returns a plain object.
285
268
  *
@@ -301,7 +284,7 @@ declare function tryDecryptObj<T extends object = Record<string, unknown>>(encry
301
284
  * const obj = decryptObj<{ a: number }>(encrypted, secretKey); // obj.a === 1
302
285
  * ```
303
286
  */
304
- declare function decryptObj<T extends object = Record<string, unknown>>(encrypted: string, secretKey: SecretKey<"node">, options?: DecryptOptions): T;
287
+ declare function decryptObj<T extends object = Record<string, unknown>>(encrypted: string, secretKey: NodeSecretKey, options?: DecryptOptions): T;
305
288
  /**
306
289
  * Safely hashes a UTF-8 string (non-throwing).
307
290
  *
@@ -571,7 +554,6 @@ declare const nodeCryptoKit_encryptObj: typeof encryptObj;
571
554
  declare const nodeCryptoKit_generateUuid: typeof generateUuid;
572
555
  declare const nodeCryptoKit_hash: typeof hash;
573
556
  declare const nodeCryptoKit_hashPassword: typeof hashPassword;
574
- declare const nodeCryptoKit_isNodeSecretKey: typeof isNodeSecretKey;
575
557
  declare const nodeCryptoKit_tryConvertBytesToStr: typeof tryConvertBytesToStr;
576
558
  declare const nodeCryptoKit_tryConvertEncoding: typeof tryConvertEncoding;
577
559
  declare const nodeCryptoKit_tryConvertStrToBytes: typeof tryConvertStrToBytes;
@@ -585,7 +567,7 @@ declare const nodeCryptoKit_tryHash: typeof tryHash;
585
567
  declare const nodeCryptoKit_tryHashPassword: typeof tryHashPassword;
586
568
  declare const nodeCryptoKit_verifyPassword: typeof verifyPassword;
587
569
  declare namespace nodeCryptoKit {
588
- export { nodeCryptoKit_convertBytesToStr as convertBytesToStr, nodeCryptoKit_convertEncoding as convertEncoding, nodeCryptoKit_convertStrToBytes as convertStrToBytes, nodeCryptoKit_createSecretKey as createSecretKey, nodeCryptoKit_decrypt as decrypt, nodeCryptoKit_decryptObj as decryptObj, nodeCryptoKit_encrypt as encrypt, nodeCryptoKit_encryptObj as encryptObj, nodeCryptoKit_generateUuid as generateUuid, nodeCryptoKit_hash as hash, nodeCryptoKit_hashPassword as hashPassword, nodeCryptoKit_isNodeSecretKey as isNodeSecretKey, nodeCryptoKit_tryConvertBytesToStr as tryConvertBytesToStr, nodeCryptoKit_tryConvertEncoding as tryConvertEncoding, nodeCryptoKit_tryConvertStrToBytes as tryConvertStrToBytes, nodeCryptoKit_tryCreateSecretKey as tryCreateSecretKey, nodeCryptoKit_tryDecrypt as tryDecrypt, nodeCryptoKit_tryDecryptObj as tryDecryptObj, nodeCryptoKit_tryEncrypt as tryEncrypt, nodeCryptoKit_tryEncryptObj as tryEncryptObj, nodeCryptoKit_tryGenerateUuid as tryGenerateUuid, nodeCryptoKit_tryHash as tryHash, nodeCryptoKit_tryHashPassword as tryHashPassword, nodeCryptoKit_verifyPassword as verifyPassword };
570
+ export { nodeCryptoKit_convertBytesToStr as convertBytesToStr, nodeCryptoKit_convertEncoding as convertEncoding, nodeCryptoKit_convertStrToBytes as convertStrToBytes, nodeCryptoKit_createSecretKey as createSecretKey, nodeCryptoKit_decrypt as decrypt, nodeCryptoKit_decryptObj as decryptObj, nodeCryptoKit_encrypt as encrypt, nodeCryptoKit_encryptObj as encryptObj, nodeCryptoKit_generateUuid as generateUuid, nodeCryptoKit_hash as hash, nodeCryptoKit_hashPassword as hashPassword, nodeCryptoKit_tryConvertBytesToStr as tryConvertBytesToStr, nodeCryptoKit_tryConvertEncoding as tryConvertEncoding, nodeCryptoKit_tryConvertStrToBytes as tryConvertStrToBytes, nodeCryptoKit_tryCreateSecretKey as tryCreateSecretKey, nodeCryptoKit_tryDecrypt as tryDecrypt, nodeCryptoKit_tryDecryptObj as tryDecryptObj, nodeCryptoKit_tryEncrypt as tryEncrypt, nodeCryptoKit_tryEncryptObj as tryEncryptObj, nodeCryptoKit_tryGenerateUuid as tryGenerateUuid, nodeCryptoKit_tryHash as tryHash, nodeCryptoKit_tryHashPassword as tryHashPassword, nodeCryptoKit_verifyPassword as verifyPassword };
589
571
  }
590
572
 
591
- export { tryCreateSecretKey as a, tryEncrypt as b, createSecretKey as c, tryDecrypt as d, encrypt as e, decrypt as f, generateUuid as g, tryEncryptObj as h, isNodeSecretKey as i, encryptObj as j, tryDecryptObj as k, decryptObj as l, tryHash as m, nodeCryptoKit as n, hash as o, tryHashPassword as p, hashPassword as q, tryConvertStrToBytes as r, convertStrToBytes as s, tryGenerateUuid as t, tryConvertBytesToStr as u, verifyPassword as v, convertBytesToStr as w, tryConvertEncoding as x, convertEncoding as y };
573
+ export { tryCreateSecretKey as a, tryEncrypt as b, createSecretKey as c, tryDecrypt as d, encrypt as e, decrypt as f, generateUuid as g, tryEncryptObj as h, encryptObj as i, tryDecryptObj as j, decryptObj as k, tryHash as l, hash as m, nodeCryptoKit as n, tryHashPassword as o, hashPassword as p, tryConvertStrToBytes as q, convertStrToBytes as r, tryConvertBytesToStr as s, tryGenerateUuid as t, convertBytesToStr as u, verifyPassword as v, tryConvertEncoding as w, convertEncoding as x };
package/dist/index.cjs CHANGED
@@ -1,36 +1,44 @@
1
1
  'use strict';
2
2
 
3
- var chunkHMTHK2IY_cjs = require('./chunk-HMTHK2IY.cjs');
4
- var chunkUVEMRK5F_cjs = require('./chunk-UVEMRK5F.cjs');
5
- var chunkBHG5RSUV_cjs = require('./chunk-BHG5RSUV.cjs');
3
+ var chunkZNM5M6RD_cjs = require('./chunk-ZNM5M6RD.cjs');
4
+ var chunk66WIL32E_cjs = require('./chunk-66WIL32E.cjs');
5
+ var chunkHTRGOBZF_cjs = require('./chunk-HTRGOBZF.cjs');
6
6
 
7
7
  // src/export.ts
8
- var nodeKit = chunkHMTHK2IY_cjs.kit_exports;
9
- var webKit = chunkUVEMRK5F_cjs.kit_exports;
8
+ var nodeKit = chunkZNM5M6RD_cjs.kit_exports;
9
+ var webKit = chunk66WIL32E_cjs.kit_exports;
10
10
 
11
11
  Object.defineProperty(exports, "ENCRYPTED_REGEX", {
12
12
  enumerable: true,
13
- get: function () { return chunkBHG5RSUV_cjs.ENCRYPTED_REGEX; }
13
+ get: function () { return chunkHTRGOBZF_cjs.ENCRYPTED_REGEX; }
14
+ });
15
+ Object.defineProperty(exports, "isNodeSecretKey", {
16
+ enumerable: true,
17
+ get: function () { return chunkHTRGOBZF_cjs.isNodeSecretKey; }
18
+ });
19
+ Object.defineProperty(exports, "isWebSecretKey", {
20
+ enumerable: true,
21
+ get: function () { return chunkHTRGOBZF_cjs.isWebSecretKey; }
14
22
  });
15
23
  Object.defineProperty(exports, "matchEncryptedPattern", {
16
24
  enumerable: true,
17
- get: function () { return chunkBHG5RSUV_cjs.matchEncryptedPattern; }
25
+ get: function () { return chunkHTRGOBZF_cjs.matchEncryptedPattern; }
18
26
  });
19
27
  Object.defineProperty(exports, "parseToObj", {
20
28
  enumerable: true,
21
- get: function () { return chunkBHG5RSUV_cjs.parseToObj; }
29
+ get: function () { return chunkHTRGOBZF_cjs.parseToObj; }
22
30
  });
23
31
  Object.defineProperty(exports, "stringifyObj", {
24
32
  enumerable: true,
25
- get: function () { return chunkBHG5RSUV_cjs.stringifyObj; }
33
+ get: function () { return chunkHTRGOBZF_cjs.stringifyObj; }
26
34
  });
27
35
  Object.defineProperty(exports, "tryParseToObj", {
28
36
  enumerable: true,
29
- get: function () { return chunkBHG5RSUV_cjs.tryParseToObj; }
37
+ get: function () { return chunkHTRGOBZF_cjs.tryParseToObj; }
30
38
  });
31
39
  Object.defineProperty(exports, "tryStringifyObj", {
32
40
  enumerable: true,
33
- get: function () { return chunkBHG5RSUV_cjs.tryStringifyObj; }
41
+ get: function () { return chunkHTRGOBZF_cjs.tryStringifyObj; }
34
42
  });
35
43
  exports.nodeKit = nodeKit;
36
44
  exports.webKit = webKit;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/export.ts"],"names":["kit_exports"],"mappings":";;;;;;;AAoCO,IAAM,OAAA,GAAUA;AAwBhB,IAAM,MAAA,GAASA","file":"index.cjs","sourcesContent":["import * as nodeCryptoKit from \"./node/kit\";\r\nimport * as webCryptoKit from \"./web/kit\";\r\n\r\nexport {\r\n parseToObj,\r\n stringifyObj,\r\n tryParseToObj,\r\n tryStringifyObj,\r\n} from \"~/helpers/object\";\r\nexport {\r\n ENCRYPTED_REGEX,\r\n matchEncryptedPattern,\r\n} from \"~/helpers/validate\";\r\nexport type * from \"./helpers/types\";\r\n\r\n/**\r\n * Node.js cryptography kit (Crypto Node.js API).\r\n *\r\n * Can be imported directly from 'cipher-kit/node' for smaller bundle size.\r\n *\r\n * - Uses Node's `crypto` module.\r\n * - Synchronous API (throwing) + safe wrappers that return `Result` (non-throwing).\r\n * - JSDoc comments with `Explain Like I'm Five` sections.\r\n *\r\n * #### Contains:\r\n * - Secret key creation from passphrase.\r\n * - Data encryption and decryption.\r\n * - Object encryption and decryption.\r\n * - Data hashing (digest).\r\n * - Password hashing and verification with time-safe comparison.\r\n * - Object serialization and deserialization (to/from JSON).\r\n * - Pattern matching to validate encrypted data format.\r\n *\r\n * ### 🍼 Explain Like I'm Five\r\n * It's like a toolkit that helps you keep your and your users' secrets safe when using Node.js.\r\n */\r\nexport const nodeKit = nodeCryptoKit;\r\n\r\n/**\r\n * Web, Deno, Bun and Cloudflare Workers cryptography kit (Crypto Web API).\r\n *\r\n * Can be imported directly from 'cipher-kit/web-api' for smaller bundle size.\r\n *\r\n * - Uses the Web Crypto API (`crypto.subtle`).\r\n * - Async API (Promise) + safe wrappers that return `Result`.\r\n * - JSDoc comments with `Explain Like I'm Five` sections.\r\n *\r\n * #### Contains:\r\n * - Secret key creation from passphrase.\r\n * - Data encryption and decryption.\r\n * - Object encryption and decryption.\r\n * - Data hashing (digest).\r\n * - Password hashing and verification with time-safe comparison.\r\n * - Object serialization and deserialization (to/from JSON).\r\n * - Pattern matching to validate encrypted data format.\r\n *\r\n * ### 🍼 Explain Like I'm Five\r\n * It's like a toolkit that helps you keep your and your users' secrets safe when using the web\r\n * or other Node.js alternatives like Deno, Bun, or Cloudflare Workers.\r\n */\r\nexport const webKit = webCryptoKit;\r\n"]}
1
+ {"version":3,"sources":["../src/export.ts"],"names":["kit_exports"],"mappings":";;;;;;;AAsCO,IAAM,OAAA,GAAUA;AAwBhB,IAAM,MAAA,GAASA","file":"index.cjs","sourcesContent":["import * as nodeCryptoKit from \"./node/kit\";\r\nimport * as webCryptoKit from \"./web/kit\";\r\n\r\nexport {\r\n parseToObj,\r\n stringifyObj,\r\n tryParseToObj,\r\n tryStringifyObj,\r\n} from \"~/helpers/object\";\r\nexport {\r\n ENCRYPTED_REGEX,\r\n isNodeSecretKey,\r\n isWebSecretKey,\r\n matchEncryptedPattern,\r\n} from \"~/helpers/validate\";\r\nexport type * from \"./helpers/types\";\r\n\r\n/**\r\n * Node.js cryptography kit (Crypto Node.js API).\r\n *\r\n * Can be imported directly from 'cipher-kit/node' for smaller bundle size.\r\n *\r\n * - Uses Node's `crypto` module.\r\n * - Synchronous API (throwing) + safe wrappers that return `Result` (non-throwing).\r\n * - JSDoc comments with `Explain Like I'm Five` sections.\r\n *\r\n * #### Contains:\r\n * - Secret key creation from passphrase.\r\n * - Data encryption and decryption.\r\n * - Object encryption and decryption.\r\n * - Data hashing (digest).\r\n * - Password hashing and verification with time-safe comparison.\r\n * - Object serialization and deserialization (to/from JSON).\r\n * - Pattern matching to validate encrypted data format.\r\n *\r\n * ### 🍼 Explain Like I'm Five\r\n * It's like a toolkit that helps you keep your and your users' secrets safe when using Node.js.\r\n */\r\nexport const nodeKit = nodeCryptoKit;\r\n\r\n/**\r\n * Web, Deno, Bun and Cloudflare Workers cryptography kit (Crypto Web API).\r\n *\r\n * Can be imported directly from 'cipher-kit/web-api' for smaller bundle size.\r\n *\r\n * - Uses the Web Crypto API (`crypto.subtle`).\r\n * - Async API (Promise) + safe wrappers that return `Result`.\r\n * - JSDoc comments with `Explain Like I'm Five` sections.\r\n *\r\n * #### Contains:\r\n * - Secret key creation from passphrase.\r\n * - Data encryption and decryption.\r\n * - Object encryption and decryption.\r\n * - Data hashing (digest).\r\n * - Password hashing and verification with time-safe comparison.\r\n * - Object serialization and deserialization (to/from JSON).\r\n * - Pattern matching to validate encrypted data format.\r\n *\r\n * ### 🍼 Explain Like I'm Five\r\n * It's like a toolkit that helps you keep your and your users' secrets safe when using the web\r\n * or other Node.js alternatives like Deno, Bun, or Cloudflare Workers.\r\n */\r\nexport const webKit = webCryptoKit;\r\n"]}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { n as nodeCryptoKit } from './export-5hmOiU0J.cjs';
2
- import { w as webCryptoKit } from './export-DVERZibl.cjs';
3
- export { C as CipherEncoding, d as CreateSecretKeyOptions, f as DecryptOptions, D as DigestAlgorithm, E as ENCRYPTED_REGEX, b as Encoding, e as EncryptOptions, c as EncryptionAlgorithm, H as HashOptions, g as HashPasswordOptions, S as SecretKey, V as VerifyPasswordOptions, m as matchEncryptedPattern, p as parseToObj, s as stringifyObj, t as tryParseToObj, a as tryStringifyObj } from './validate-B3uHoP8n.cjs';
1
+ import { n as nodeCryptoKit } from './export-KFT0YyMg.cjs';
2
+ import { w as webCryptoKit } from './export-FYHgb-8E.cjs';
3
+ export { C as CipherEncoding, e as CreateSecretKeyOptions, g as DecryptOptions, D as DigestAlgorithm, E as ENCRYPTED_REGEX, c as Encoding, f as EncryptOptions, d as EncryptionAlgorithm, H as HashOptions, h as HashPasswordOptions, N as NodeSecretKey, V as VerifyPasswordOptions, W as WebSecretKey, i as isNodeSecretKey, b as isWebSecretKey, m as matchEncryptedPattern, p as parseToObj, s as stringifyObj, t as tryParseToObj, a as tryStringifyObj } from './validate-lkJAHCeJ.cjs';
4
4
  import 'node:buffer';
5
5
  import 'node:crypto';
6
6
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { n as nodeCryptoKit } from './export-BF9wW56f.js';
2
- import { w as webCryptoKit } from './export-w8sBcKXw.js';
3
- export { C as CipherEncoding, d as CreateSecretKeyOptions, f as DecryptOptions, D as DigestAlgorithm, E as ENCRYPTED_REGEX, b as Encoding, e as EncryptOptions, c as EncryptionAlgorithm, H as HashOptions, g as HashPasswordOptions, S as SecretKey, V as VerifyPasswordOptions, m as matchEncryptedPattern, p as parseToObj, s as stringifyObj, t as tryParseToObj, a as tryStringifyObj } from './validate-B3uHoP8n.js';
1
+ import { n as nodeCryptoKit } from './export-BaM_OTFk.js';
2
+ import { w as webCryptoKit } from './export-CCTGAosO.js';
3
+ export { C as CipherEncoding, e as CreateSecretKeyOptions, g as DecryptOptions, D as DigestAlgorithm, E as ENCRYPTED_REGEX, c as Encoding, f as EncryptOptions, d as EncryptionAlgorithm, H as HashOptions, h as HashPasswordOptions, N as NodeSecretKey, V as VerifyPasswordOptions, W as WebSecretKey, i as isNodeSecretKey, b as isWebSecretKey, m as matchEncryptedPattern, p as parseToObj, s as stringifyObj, t as tryParseToObj, a as tryStringifyObj } from './validate-lkJAHCeJ.js';
4
4
  import 'node:buffer';
5
5
  import 'node:crypto';
6
6
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { kit_exports } from './chunk-RAEBT46G.js';
2
- import { kit_exports as kit_exports$1 } from './chunk-CRTOKS3Q.js';
3
- export { ENCRYPTED_REGEX, matchEncryptedPattern, parseToObj, stringifyObj, tryParseToObj, tryStringifyObj } from './chunk-RUTGDMVR.js';
1
+ import { kit_exports } from './chunk-S6SNCTU6.js';
2
+ import { kit_exports as kit_exports$1 } from './chunk-JLFVTZY4.js';
3
+ export { ENCRYPTED_REGEX, isNodeSecretKey, isWebSecretKey, matchEncryptedPattern, parseToObj, stringifyObj, tryParseToObj, tryStringifyObj } from './chunk-LU7QOSQH.js';
4
4
 
5
5
  // src/export.ts
6
6
  var nodeKit = kit_exports;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/export.ts"],"names":["kit_exports"],"mappings":";;;;;AAoCO,IAAM,OAAA,GAAU;AAwBhB,IAAM,MAAA,GAASA","file":"index.js","sourcesContent":["import * as nodeCryptoKit from \"./node/kit\";\r\nimport * as webCryptoKit from \"./web/kit\";\r\n\r\nexport {\r\n parseToObj,\r\n stringifyObj,\r\n tryParseToObj,\r\n tryStringifyObj,\r\n} from \"~/helpers/object\";\r\nexport {\r\n ENCRYPTED_REGEX,\r\n matchEncryptedPattern,\r\n} from \"~/helpers/validate\";\r\nexport type * from \"./helpers/types\";\r\n\r\n/**\r\n * Node.js cryptography kit (Crypto Node.js API).\r\n *\r\n * Can be imported directly from 'cipher-kit/node' for smaller bundle size.\r\n *\r\n * - Uses Node's `crypto` module.\r\n * - Synchronous API (throwing) + safe wrappers that return `Result` (non-throwing).\r\n * - JSDoc comments with `Explain Like I'm Five` sections.\r\n *\r\n * #### Contains:\r\n * - Secret key creation from passphrase.\r\n * - Data encryption and decryption.\r\n * - Object encryption and decryption.\r\n * - Data hashing (digest).\r\n * - Password hashing and verification with time-safe comparison.\r\n * - Object serialization and deserialization (to/from JSON).\r\n * - Pattern matching to validate encrypted data format.\r\n *\r\n * ### 🍼 Explain Like I'm Five\r\n * It's like a toolkit that helps you keep your and your users' secrets safe when using Node.js.\r\n */\r\nexport const nodeKit = nodeCryptoKit;\r\n\r\n/**\r\n * Web, Deno, Bun and Cloudflare Workers cryptography kit (Crypto Web API).\r\n *\r\n * Can be imported directly from 'cipher-kit/web-api' for smaller bundle size.\r\n *\r\n * - Uses the Web Crypto API (`crypto.subtle`).\r\n * - Async API (Promise) + safe wrappers that return `Result`.\r\n * - JSDoc comments with `Explain Like I'm Five` sections.\r\n *\r\n * #### Contains:\r\n * - Secret key creation from passphrase.\r\n * - Data encryption and decryption.\r\n * - Object encryption and decryption.\r\n * - Data hashing (digest).\r\n * - Password hashing and verification with time-safe comparison.\r\n * - Object serialization and deserialization (to/from JSON).\r\n * - Pattern matching to validate encrypted data format.\r\n *\r\n * ### 🍼 Explain Like I'm Five\r\n * It's like a toolkit that helps you keep your and your users' secrets safe when using the web\r\n * or other Node.js alternatives like Deno, Bun, or Cloudflare Workers.\r\n */\r\nexport const webKit = webCryptoKit;\r\n"]}
1
+ {"version":3,"sources":["../src/export.ts"],"names":["kit_exports"],"mappings":";;;;;AAsCO,IAAM,OAAA,GAAU;AAwBhB,IAAM,MAAA,GAASA","file":"index.js","sourcesContent":["import * as nodeCryptoKit from \"./node/kit\";\r\nimport * as webCryptoKit from \"./web/kit\";\r\n\r\nexport {\r\n parseToObj,\r\n stringifyObj,\r\n tryParseToObj,\r\n tryStringifyObj,\r\n} from \"~/helpers/object\";\r\nexport {\r\n ENCRYPTED_REGEX,\r\n isNodeSecretKey,\r\n isWebSecretKey,\r\n matchEncryptedPattern,\r\n} from \"~/helpers/validate\";\r\nexport type * from \"./helpers/types\";\r\n\r\n/**\r\n * Node.js cryptography kit (Crypto Node.js API).\r\n *\r\n * Can be imported directly from 'cipher-kit/node' for smaller bundle size.\r\n *\r\n * - Uses Node's `crypto` module.\r\n * - Synchronous API (throwing) + safe wrappers that return `Result` (non-throwing).\r\n * - JSDoc comments with `Explain Like I'm Five` sections.\r\n *\r\n * #### Contains:\r\n * - Secret key creation from passphrase.\r\n * - Data encryption and decryption.\r\n * - Object encryption and decryption.\r\n * - Data hashing (digest).\r\n * - Password hashing and verification with time-safe comparison.\r\n * - Object serialization and deserialization (to/from JSON).\r\n * - Pattern matching to validate encrypted data format.\r\n *\r\n * ### 🍼 Explain Like I'm Five\r\n * It's like a toolkit that helps you keep your and your users' secrets safe when using Node.js.\r\n */\r\nexport const nodeKit = nodeCryptoKit;\r\n\r\n/**\r\n * Web, Deno, Bun and Cloudflare Workers cryptography kit (Crypto Web API).\r\n *\r\n * Can be imported directly from 'cipher-kit/web-api' for smaller bundle size.\r\n *\r\n * - Uses the Web Crypto API (`crypto.subtle`).\r\n * - Async API (Promise) + safe wrappers that return `Result`.\r\n * - JSDoc comments with `Explain Like I'm Five` sections.\r\n *\r\n * #### Contains:\r\n * - Secret key creation from passphrase.\r\n * - Data encryption and decryption.\r\n * - Object encryption and decryption.\r\n * - Data hashing (digest).\r\n * - Password hashing and verification with time-safe comparison.\r\n * - Object serialization and deserialization (to/from JSON).\r\n * - Pattern matching to validate encrypted data format.\r\n *\r\n * ### 🍼 Explain Like I'm Five\r\n * It's like a toolkit that helps you keep your and your users' secrets safe when using the web\r\n * or other Node.js alternatives like Deno, Bun, or Cloudflare Workers.\r\n */\r\nexport const webKit = webCryptoKit;\r\n"]}
package/dist/node.cjs CHANGED
@@ -1,129 +1,129 @@
1
1
  'use strict';
2
2
 
3
- var chunkHMTHK2IY_cjs = require('./chunk-HMTHK2IY.cjs');
4
- var chunkBHG5RSUV_cjs = require('./chunk-BHG5RSUV.cjs');
3
+ var chunkZNM5M6RD_cjs = require('./chunk-ZNM5M6RD.cjs');
4
+ var chunkHTRGOBZF_cjs = require('./chunk-HTRGOBZF.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "convertBytesToStr", {
9
9
  enumerable: true,
10
- get: function () { return chunkHMTHK2IY_cjs.convertBytesToStr; }
10
+ get: function () { return chunkZNM5M6RD_cjs.convertBytesToStr; }
11
11
  });
12
12
  Object.defineProperty(exports, "convertEncoding", {
13
13
  enumerable: true,
14
- get: function () { return chunkHMTHK2IY_cjs.convertEncoding; }
14
+ get: function () { return chunkZNM5M6RD_cjs.convertEncoding; }
15
15
  });
16
16
  Object.defineProperty(exports, "convertStrToBytes", {
17
17
  enumerable: true,
18
- get: function () { return chunkHMTHK2IY_cjs.convertStrToBytes; }
18
+ get: function () { return chunkZNM5M6RD_cjs.convertStrToBytes; }
19
19
  });
20
20
  Object.defineProperty(exports, "createSecretKey", {
21
21
  enumerable: true,
22
- get: function () { return chunkHMTHK2IY_cjs.createSecretKey; }
22
+ get: function () { return chunkZNM5M6RD_cjs.createSecretKey; }
23
23
  });
24
24
  Object.defineProperty(exports, "decrypt", {
25
25
  enumerable: true,
26
- get: function () { return chunkHMTHK2IY_cjs.decrypt; }
26
+ get: function () { return chunkZNM5M6RD_cjs.decrypt; }
27
27
  });
28
28
  Object.defineProperty(exports, "decryptObj", {
29
29
  enumerable: true,
30
- get: function () { return chunkHMTHK2IY_cjs.decryptObj; }
30
+ get: function () { return chunkZNM5M6RD_cjs.decryptObj; }
31
31
  });
32
32
  Object.defineProperty(exports, "encrypt", {
33
33
  enumerable: true,
34
- get: function () { return chunkHMTHK2IY_cjs.encrypt; }
34
+ get: function () { return chunkZNM5M6RD_cjs.encrypt; }
35
35
  });
36
36
  Object.defineProperty(exports, "encryptObj", {
37
37
  enumerable: true,
38
- get: function () { return chunkHMTHK2IY_cjs.encryptObj; }
38
+ get: function () { return chunkZNM5M6RD_cjs.encryptObj; }
39
39
  });
40
40
  Object.defineProperty(exports, "generateUuid", {
41
41
  enumerable: true,
42
- get: function () { return chunkHMTHK2IY_cjs.generateUuid; }
42
+ get: function () { return chunkZNM5M6RD_cjs.generateUuid; }
43
43
  });
44
44
  Object.defineProperty(exports, "hash", {
45
45
  enumerable: true,
46
- get: function () { return chunkHMTHK2IY_cjs.hash; }
46
+ get: function () { return chunkZNM5M6RD_cjs.hash; }
47
47
  });
48
48
  Object.defineProperty(exports, "hashPassword", {
49
49
  enumerable: true,
50
- get: function () { return chunkHMTHK2IY_cjs.hashPassword; }
51
- });
52
- Object.defineProperty(exports, "isNodeSecretKey", {
53
- enumerable: true,
54
- get: function () { return chunkHMTHK2IY_cjs.isNodeSecretKey; }
50
+ get: function () { return chunkZNM5M6RD_cjs.hashPassword; }
55
51
  });
56
52
  Object.defineProperty(exports, "tryConvertBytesToStr", {
57
53
  enumerable: true,
58
- get: function () { return chunkHMTHK2IY_cjs.tryConvertBytesToStr; }
54
+ get: function () { return chunkZNM5M6RD_cjs.tryConvertBytesToStr; }
59
55
  });
60
56
  Object.defineProperty(exports, "tryConvertEncoding", {
61
57
  enumerable: true,
62
- get: function () { return chunkHMTHK2IY_cjs.tryConvertEncoding; }
58
+ get: function () { return chunkZNM5M6RD_cjs.tryConvertEncoding; }
63
59
  });
64
60
  Object.defineProperty(exports, "tryConvertStrToBytes", {
65
61
  enumerable: true,
66
- get: function () { return chunkHMTHK2IY_cjs.tryConvertStrToBytes; }
62
+ get: function () { return chunkZNM5M6RD_cjs.tryConvertStrToBytes; }
67
63
  });
68
64
  Object.defineProperty(exports, "tryCreateSecretKey", {
69
65
  enumerable: true,
70
- get: function () { return chunkHMTHK2IY_cjs.tryCreateSecretKey; }
66
+ get: function () { return chunkZNM5M6RD_cjs.tryCreateSecretKey; }
71
67
  });
72
68
  Object.defineProperty(exports, "tryDecrypt", {
73
69
  enumerable: true,
74
- get: function () { return chunkHMTHK2IY_cjs.tryDecrypt; }
70
+ get: function () { return chunkZNM5M6RD_cjs.tryDecrypt; }
75
71
  });
76
72
  Object.defineProperty(exports, "tryDecryptObj", {
77
73
  enumerable: true,
78
- get: function () { return chunkHMTHK2IY_cjs.tryDecryptObj; }
74
+ get: function () { return chunkZNM5M6RD_cjs.tryDecryptObj; }
79
75
  });
80
76
  Object.defineProperty(exports, "tryEncrypt", {
81
77
  enumerable: true,
82
- get: function () { return chunkHMTHK2IY_cjs.tryEncrypt; }
78
+ get: function () { return chunkZNM5M6RD_cjs.tryEncrypt; }
83
79
  });
84
80
  Object.defineProperty(exports, "tryEncryptObj", {
85
81
  enumerable: true,
86
- get: function () { return chunkHMTHK2IY_cjs.tryEncryptObj; }
82
+ get: function () { return chunkZNM5M6RD_cjs.tryEncryptObj; }
87
83
  });
88
84
  Object.defineProperty(exports, "tryGenerateUuid", {
89
85
  enumerable: true,
90
- get: function () { return chunkHMTHK2IY_cjs.tryGenerateUuid; }
86
+ get: function () { return chunkZNM5M6RD_cjs.tryGenerateUuid; }
91
87
  });
92
88
  Object.defineProperty(exports, "tryHash", {
93
89
  enumerable: true,
94
- get: function () { return chunkHMTHK2IY_cjs.tryHash; }
90
+ get: function () { return chunkZNM5M6RD_cjs.tryHash; }
95
91
  });
96
92
  Object.defineProperty(exports, "tryHashPassword", {
97
93
  enumerable: true,
98
- get: function () { return chunkHMTHK2IY_cjs.tryHashPassword; }
94
+ get: function () { return chunkZNM5M6RD_cjs.tryHashPassword; }
99
95
  });
100
96
  Object.defineProperty(exports, "verifyPassword", {
101
97
  enumerable: true,
102
- get: function () { return chunkHMTHK2IY_cjs.verifyPassword; }
98
+ get: function () { return chunkZNM5M6RD_cjs.verifyPassword; }
103
99
  });
104
100
  Object.defineProperty(exports, "ENCRYPTED_REGEX", {
105
101
  enumerable: true,
106
- get: function () { return chunkBHG5RSUV_cjs.ENCRYPTED_REGEX; }
102
+ get: function () { return chunkHTRGOBZF_cjs.ENCRYPTED_REGEX; }
103
+ });
104
+ Object.defineProperty(exports, "isNodeSecretKey", {
105
+ enumerable: true,
106
+ get: function () { return chunkHTRGOBZF_cjs.isNodeSecretKey; }
107
107
  });
108
108
  Object.defineProperty(exports, "matchEncryptedPattern", {
109
109
  enumerable: true,
110
- get: function () { return chunkBHG5RSUV_cjs.matchEncryptedPattern; }
110
+ get: function () { return chunkHTRGOBZF_cjs.matchEncryptedPattern; }
111
111
  });
112
112
  Object.defineProperty(exports, "parseToObj", {
113
113
  enumerable: true,
114
- get: function () { return chunkBHG5RSUV_cjs.parseToObj; }
114
+ get: function () { return chunkHTRGOBZF_cjs.parseToObj; }
115
115
  });
116
116
  Object.defineProperty(exports, "stringifyObj", {
117
117
  enumerable: true,
118
- get: function () { return chunkBHG5RSUV_cjs.stringifyObj; }
118
+ get: function () { return chunkHTRGOBZF_cjs.stringifyObj; }
119
119
  });
120
120
  Object.defineProperty(exports, "tryParseToObj", {
121
121
  enumerable: true,
122
- get: function () { return chunkBHG5RSUV_cjs.tryParseToObj; }
122
+ get: function () { return chunkHTRGOBZF_cjs.tryParseToObj; }
123
123
  });
124
124
  Object.defineProperty(exports, "tryStringifyObj", {
125
125
  enumerable: true,
126
- get: function () { return chunkBHG5RSUV_cjs.tryStringifyObj; }
126
+ get: function () { return chunkHTRGOBZF_cjs.tryStringifyObj; }
127
127
  });
128
128
  //# sourceMappingURL=node.cjs.map
129
129
  //# sourceMappingURL=node.cjs.map
package/dist/node.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CipherEncoding, d as CreateSecretKeyOptions, f as DecryptOptions, D as DigestAlgorithm, E as ENCRYPTED_REGEX, b as Encoding, e as EncryptOptions, c as EncryptionAlgorithm, H as HashOptions, g as HashPasswordOptions, S as SecretKey, V as VerifyPasswordOptions, m as matchEncryptedPattern, p as parseToObj, s as stringifyObj, t as tryParseToObj, a as tryStringifyObj } from './validate-B3uHoP8n.cjs';
2
- export { w as convertBytesToStr, y as convertEncoding, s as convertStrToBytes, c as createSecretKey, f as decrypt, l as decryptObj, e as encrypt, j as encryptObj, g as generateUuid, o as hash, q as hashPassword, i as isNodeSecretKey, u as tryConvertBytesToStr, x as tryConvertEncoding, r as tryConvertStrToBytes, a as tryCreateSecretKey, d as tryDecrypt, k as tryDecryptObj, b as tryEncrypt, h as tryEncryptObj, t as tryGenerateUuid, m as tryHash, p as tryHashPassword, v as verifyPassword } from './export-5hmOiU0J.cjs';
1
+ export { C as CipherEncoding, e as CreateSecretKeyOptions, g as DecryptOptions, D as DigestAlgorithm, E as ENCRYPTED_REGEX, c as Encoding, f as EncryptOptions, d as EncryptionAlgorithm, H as HashOptions, h as HashPasswordOptions, N as NodeSecretKey, V as VerifyPasswordOptions, W as WebSecretKey, i as isNodeSecretKey, m as matchEncryptedPattern, p as parseToObj, s as stringifyObj, t as tryParseToObj, a as tryStringifyObj } from './validate-lkJAHCeJ.cjs';
2
+ export { u as convertBytesToStr, x as convertEncoding, r as convertStrToBytes, c as createSecretKey, f as decrypt, k as decryptObj, e as encrypt, i as encryptObj, g as generateUuid, m as hash, p as hashPassword, s as tryConvertBytesToStr, w as tryConvertEncoding, q as tryConvertStrToBytes, a as tryCreateSecretKey, d as tryDecrypt, j as tryDecryptObj, b as tryEncrypt, h as tryEncryptObj, t as tryGenerateUuid, l as tryHash, o as tryHashPassword, v as verifyPassword } from './export-KFT0YyMg.cjs';
3
3
  import 'node:crypto';
4
4
  import 'node:buffer';
package/dist/node.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CipherEncoding, d as CreateSecretKeyOptions, f as DecryptOptions, D as DigestAlgorithm, E as ENCRYPTED_REGEX, b as Encoding, e as EncryptOptions, c as EncryptionAlgorithm, H as HashOptions, g as HashPasswordOptions, S as SecretKey, V as VerifyPasswordOptions, m as matchEncryptedPattern, p as parseToObj, s as stringifyObj, t as tryParseToObj, a as tryStringifyObj } from './validate-B3uHoP8n.js';
2
- export { w as convertBytesToStr, y as convertEncoding, s as convertStrToBytes, c as createSecretKey, f as decrypt, l as decryptObj, e as encrypt, j as encryptObj, g as generateUuid, o as hash, q as hashPassword, i as isNodeSecretKey, u as tryConvertBytesToStr, x as tryConvertEncoding, r as tryConvertStrToBytes, a as tryCreateSecretKey, d as tryDecrypt, k as tryDecryptObj, b as tryEncrypt, h as tryEncryptObj, t as tryGenerateUuid, m as tryHash, p as tryHashPassword, v as verifyPassword } from './export-BF9wW56f.js';
1
+ export { C as CipherEncoding, e as CreateSecretKeyOptions, g as DecryptOptions, D as DigestAlgorithm, E as ENCRYPTED_REGEX, c as Encoding, f as EncryptOptions, d as EncryptionAlgorithm, H as HashOptions, h as HashPasswordOptions, N as NodeSecretKey, V as VerifyPasswordOptions, W as WebSecretKey, i as isNodeSecretKey, m as matchEncryptedPattern, p as parseToObj, s as stringifyObj, t as tryParseToObj, a as tryStringifyObj } from './validate-lkJAHCeJ.js';
2
+ export { u as convertBytesToStr, x as convertEncoding, r as convertStrToBytes, c as createSecretKey, f as decrypt, k as decryptObj, e as encrypt, i as encryptObj, g as generateUuid, m as hash, p as hashPassword, s as tryConvertBytesToStr, w as tryConvertEncoding, q as tryConvertStrToBytes, a as tryCreateSecretKey, d as tryDecrypt, j as tryDecryptObj, b as tryEncrypt, h as tryEncryptObj, t as tryGenerateUuid, l as tryHash, o as tryHashPassword, v as verifyPassword } from './export-BaM_OTFk.js';
3
3
  import 'node:crypto';
4
4
  import 'node:buffer';