cipher-kit 2.1.0 → 2.1.1

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 (38) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-HMTHK2IY.cjs → chunk-56PVVFVM.cjs} +145 -145
  3. package/dist/chunk-56PVVFVM.cjs.map +1 -0
  4. package/dist/{chunk-RUTGDMVR.js → chunk-6C4NIWQ4.js} +9 -8
  5. package/dist/chunk-6C4NIWQ4.js.map +1 -0
  6. package/dist/{chunk-CRTOKS3Q.js → chunk-FSEA3UXJ.js} +7 -7
  7. package/dist/chunk-FSEA3UXJ.js.map +1 -0
  8. package/dist/{chunk-UVEMRK5F.cjs → chunk-LTVOIZP5.cjs} +150 -150
  9. package/dist/chunk-LTVOIZP5.cjs.map +1 -0
  10. package/dist/{chunk-RAEBT46G.js → chunk-PWTFVMW6.js} +7 -7
  11. package/dist/chunk-PWTFVMW6.js.map +1 -0
  12. package/dist/{chunk-BHG5RSUV.cjs → chunk-X4CS7UXE.cjs} +9 -8
  13. package/dist/chunk-X4CS7UXE.cjs.map +1 -0
  14. package/dist/{export-w8sBcKXw.d.ts → export-C4DbO5zM.d.ts} +7 -7
  15. package/dist/{export-DVERZibl.d.cts → export-CpZ7s25O.d.cts} +7 -7
  16. package/dist/{export-5hmOiU0J.d.cts → export-DO9n7Np-.d.cts} +7 -7
  17. package/dist/{export-BF9wW56f.d.ts → export-DUgIcobC.d.ts} +7 -7
  18. package/dist/index.cjs +11 -11
  19. package/dist/index.d.cts +3 -3
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +3 -3
  22. package/dist/node.cjs +32 -32
  23. package/dist/node.d.cts +2 -2
  24. package/dist/node.d.ts +2 -2
  25. package/dist/node.js +2 -2
  26. package/dist/{validate-B3uHoP8n.d.cts → validate-cJEdGlj1.d.cts} +34 -35
  27. package/dist/{validate-B3uHoP8n.d.ts → validate-cJEdGlj1.d.ts} +34 -35
  28. package/dist/web-api.cjs +32 -32
  29. package/dist/web-api.d.cts +2 -2
  30. package/dist/web-api.d.ts +2 -2
  31. package/dist/web-api.js +2 -2
  32. package/package.json +1 -1
  33. package/dist/chunk-BHG5RSUV.cjs.map +0 -1
  34. package/dist/chunk-CRTOKS3Q.js.map +0 -1
  35. package/dist/chunk-HMTHK2IY.cjs.map +0 -1
  36. package/dist/chunk-RAEBT46G.js.map +0 -1
  37. package/dist/chunk-RUTGDMVR.js.map +0 -1
  38. package/dist/chunk-UVEMRK5F.cjs.map +0 -1
@@ -1,4 +1,4 @@
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 { 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-cJEdGlj1.cjs';
2
2
  import { Buffer } from 'node:buffer';
3
3
 
4
4
  /**
@@ -209,7 +209,7 @@ declare function decrypt(encrypted: string, secretKey: SecretKey<"node">, option
209
209
  * your special key, creating a jumbled code that only someone with the right key can read.
210
210
  *
211
211
  * @template T - The type of the plain object to encrypt.
212
- * @param data - A plain object to encrypt.
212
+ * @param obj - A plain object to encrypt.
213
213
  * @param secretKey - The `SecretKey` object used for encryption.
214
214
  * @param options.outputEncoding - The encoding format for the output ciphertext (default: `'base64url'`).
215
215
  * @returns A `Result` containing the encrypted string in the specified format or an error.
@@ -223,7 +223,7 @@ declare function decrypt(encrypted: string, secretKey: SecretKey<"node">, option
223
223
  * else console.error(error); // { message: "...", description: "..." }
224
224
  * ```
225
225
  */
226
- declare function tryEncryptObj<T extends object = Record<string, unknown>>(data: T, secretKey: SecretKey<"node">, options?: EncryptOptions): Result<string>;
226
+ declare function tryEncryptObj<T extends object = Record<string, unknown>>(obj: T, secretKey: SecretKey<"node">, options?: EncryptOptions): Result<string>;
227
227
  /**
228
228
  * Encrypts a plain object using the provided `SecretKey` (throwing).
229
229
  *
@@ -237,7 +237,7 @@ declare function tryEncryptObj<T extends object = Record<string, unknown>>(data:
237
237
  * your special key, creating a jumbled code that only someone with the right key can read.
238
238
  *
239
239
  * @template T - The type of the plain object to encrypt.
240
- * @param data - A plain object to encrypt.
240
+ * @param obj - A plain object to encrypt.
241
241
  * @param secretKey - The `SecretKey` object used for encryption.
242
242
  * @param options.outputEncoding - The encoding format for the output ciphertext (default: `'base64url'`).
243
243
  * @returns The encrypted string in the specified format.
@@ -249,9 +249,9 @@ declare function tryEncryptObj<T extends object = Record<string, unknown>>(data:
249
249
  * const encrypted = encryptObj({ a: 1 }, secretKey); // "iv.cipher.tag." (Encrypted string)
250
250
  * ```
251
251
  */
252
- declare function encryptObj<T extends object = Record<string, unknown>>(data: T, secretKey: SecretKey<"node">, options?: EncryptOptions): string;
252
+ declare function encryptObj<T extends object = Record<string, unknown>>(obj: T, secretKey: SecretKey<"node">, options?: EncryptOptions): string;
253
253
  /**
254
- * Safely decrypts an encrypted JSON string into an object (non-throwing).
254
+ * Safely decrypts an encrypted JSON string into a plain object (non-throwing).
255
255
  *
256
256
  * Expects input in the format `"iv.cipher.tag."` and returns a plain object.
257
257
  *
@@ -279,7 +279,7 @@ declare function tryDecryptObj<T extends object = Record<string, unknown>>(encry
279
279
  result: T;
280
280
  }>;
281
281
  /**
282
- * Decrypts an encrypted JSON string into an object (throwing).
282
+ * Decrypts an encrypted JSON string into a plain object (throwing).
283
283
  *
284
284
  * Expects input in the format `"iv.cipher.tag."` and returns a plain object.
285
285
  *
@@ -1,4 +1,4 @@
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.js';
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-cJEdGlj1.js';
2
2
  import { Buffer } from 'node:buffer';
3
3
 
4
4
  /**
@@ -209,7 +209,7 @@ declare function decrypt(encrypted: string, secretKey: SecretKey<"node">, option
209
209
  * your special key, creating a jumbled code that only someone with the right key can read.
210
210
  *
211
211
  * @template T - The type of the plain object to encrypt.
212
- * @param data - A plain object to encrypt.
212
+ * @param obj - A plain object to encrypt.
213
213
  * @param secretKey - The `SecretKey` object used for encryption.
214
214
  * @param options.outputEncoding - The encoding format for the output ciphertext (default: `'base64url'`).
215
215
  * @returns A `Result` containing the encrypted string in the specified format or an error.
@@ -223,7 +223,7 @@ declare function decrypt(encrypted: string, secretKey: SecretKey<"node">, option
223
223
  * else console.error(error); // { message: "...", description: "..." }
224
224
  * ```
225
225
  */
226
- declare function tryEncryptObj<T extends object = Record<string, unknown>>(data: T, secretKey: SecretKey<"node">, options?: EncryptOptions): Result<string>;
226
+ declare function tryEncryptObj<T extends object = Record<string, unknown>>(obj: T, secretKey: SecretKey<"node">, options?: EncryptOptions): Result<string>;
227
227
  /**
228
228
  * Encrypts a plain object using the provided `SecretKey` (throwing).
229
229
  *
@@ -237,7 +237,7 @@ declare function tryEncryptObj<T extends object = Record<string, unknown>>(data:
237
237
  * your special key, creating a jumbled code that only someone with the right key can read.
238
238
  *
239
239
  * @template T - The type of the plain object to encrypt.
240
- * @param data - A plain object to encrypt.
240
+ * @param obj - A plain object to encrypt.
241
241
  * @param secretKey - The `SecretKey` object used for encryption.
242
242
  * @param options.outputEncoding - The encoding format for the output ciphertext (default: `'base64url'`).
243
243
  * @returns The encrypted string in the specified format.
@@ -249,9 +249,9 @@ declare function tryEncryptObj<T extends object = Record<string, unknown>>(data:
249
249
  * const encrypted = encryptObj({ a: 1 }, secretKey); // "iv.cipher.tag." (Encrypted string)
250
250
  * ```
251
251
  */
252
- declare function encryptObj<T extends object = Record<string, unknown>>(data: T, secretKey: SecretKey<"node">, options?: EncryptOptions): string;
252
+ declare function encryptObj<T extends object = Record<string, unknown>>(obj: T, secretKey: SecretKey<"node">, options?: EncryptOptions): string;
253
253
  /**
254
- * Safely decrypts an encrypted JSON string into an object (non-throwing).
254
+ * Safely decrypts an encrypted JSON string into a plain object (non-throwing).
255
255
  *
256
256
  * Expects input in the format `"iv.cipher.tag."` and returns a plain object.
257
257
  *
@@ -279,7 +279,7 @@ declare function tryDecryptObj<T extends object = Record<string, unknown>>(encry
279
279
  result: T;
280
280
  }>;
281
281
  /**
282
- * Decrypts an encrypted JSON string into an object (throwing).
282
+ * Decrypts an encrypted JSON string into a plain object (throwing).
283
283
  *
284
284
  * Expects input in the format `"iv.cipher.tag."` and returns a plain object.
285
285
  *
package/dist/index.cjs CHANGED
@@ -1,36 +1,36 @@
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 chunk56PVVFVM_cjs = require('./chunk-56PVVFVM.cjs');
4
+ var chunkLTVOIZP5_cjs = require('./chunk-LTVOIZP5.cjs');
5
+ var chunkX4CS7UXE_cjs = require('./chunk-X4CS7UXE.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 = chunk56PVVFVM_cjs.kit_exports;
9
+ var webKit = chunkLTVOIZP5_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 chunkX4CS7UXE_cjs.ENCRYPTED_REGEX; }
14
14
  });
15
15
  Object.defineProperty(exports, "matchEncryptedPattern", {
16
16
  enumerable: true,
17
- get: function () { return chunkBHG5RSUV_cjs.matchEncryptedPattern; }
17
+ get: function () { return chunkX4CS7UXE_cjs.matchEncryptedPattern; }
18
18
  });
19
19
  Object.defineProperty(exports, "parseToObj", {
20
20
  enumerable: true,
21
- get: function () { return chunkBHG5RSUV_cjs.parseToObj; }
21
+ get: function () { return chunkX4CS7UXE_cjs.parseToObj; }
22
22
  });
23
23
  Object.defineProperty(exports, "stringifyObj", {
24
24
  enumerable: true,
25
- get: function () { return chunkBHG5RSUV_cjs.stringifyObj; }
25
+ get: function () { return chunkX4CS7UXE_cjs.stringifyObj; }
26
26
  });
27
27
  Object.defineProperty(exports, "tryParseToObj", {
28
28
  enumerable: true,
29
- get: function () { return chunkBHG5RSUV_cjs.tryParseToObj; }
29
+ get: function () { return chunkX4CS7UXE_cjs.tryParseToObj; }
30
30
  });
31
31
  Object.defineProperty(exports, "tryStringifyObj", {
32
32
  enumerable: true,
33
- get: function () { return chunkBHG5RSUV_cjs.tryStringifyObj; }
33
+ get: function () { return chunkX4CS7UXE_cjs.tryStringifyObj; }
34
34
  });
35
35
  exports.nodeKit = nodeKit;
36
36
  exports.webKit = webKit;
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-DO9n7Np-.cjs';
2
+ import { w as webCryptoKit } from './export-CpZ7s25O.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-cJEdGlj1.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-DUgIcobC.js';
2
+ import { w as webCryptoKit } from './export-C4DbO5zM.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-cJEdGlj1.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-PWTFVMW6.js';
2
+ import { kit_exports as kit_exports$1 } from './chunk-FSEA3UXJ.js';
3
+ export { ENCRYPTED_REGEX, matchEncryptedPattern, parseToObj, stringifyObj, tryParseToObj, tryStringifyObj } from './chunk-6C4NIWQ4.js';
4
4
 
5
5
  // src/export.ts
6
6
  var nodeKit = kit_exports;
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 chunk56PVVFVM_cjs = require('./chunk-56PVVFVM.cjs');
4
+ var chunkX4CS7UXE_cjs = require('./chunk-X4CS7UXE.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 chunk56PVVFVM_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 chunk56PVVFVM_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 chunk56PVVFVM_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 chunk56PVVFVM_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 chunk56PVVFVM_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 chunk56PVVFVM_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 chunk56PVVFVM_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 chunk56PVVFVM_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 chunk56PVVFVM_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 chunk56PVVFVM_cjs.hash; }
47
47
  });
48
48
  Object.defineProperty(exports, "hashPassword", {
49
49
  enumerable: true,
50
- get: function () { return chunkHMTHK2IY_cjs.hashPassword; }
50
+ get: function () { return chunk56PVVFVM_cjs.hashPassword; }
51
51
  });
52
52
  Object.defineProperty(exports, "isNodeSecretKey", {
53
53
  enumerable: true,
54
- get: function () { return chunkHMTHK2IY_cjs.isNodeSecretKey; }
54
+ get: function () { return chunk56PVVFVM_cjs.isNodeSecretKey; }
55
55
  });
56
56
  Object.defineProperty(exports, "tryConvertBytesToStr", {
57
57
  enumerable: true,
58
- get: function () { return chunkHMTHK2IY_cjs.tryConvertBytesToStr; }
58
+ get: function () { return chunk56PVVFVM_cjs.tryConvertBytesToStr; }
59
59
  });
60
60
  Object.defineProperty(exports, "tryConvertEncoding", {
61
61
  enumerable: true,
62
- get: function () { return chunkHMTHK2IY_cjs.tryConvertEncoding; }
62
+ get: function () { return chunk56PVVFVM_cjs.tryConvertEncoding; }
63
63
  });
64
64
  Object.defineProperty(exports, "tryConvertStrToBytes", {
65
65
  enumerable: true,
66
- get: function () { return chunkHMTHK2IY_cjs.tryConvertStrToBytes; }
66
+ get: function () { return chunk56PVVFVM_cjs.tryConvertStrToBytes; }
67
67
  });
68
68
  Object.defineProperty(exports, "tryCreateSecretKey", {
69
69
  enumerable: true,
70
- get: function () { return chunkHMTHK2IY_cjs.tryCreateSecretKey; }
70
+ get: function () { return chunk56PVVFVM_cjs.tryCreateSecretKey; }
71
71
  });
72
72
  Object.defineProperty(exports, "tryDecrypt", {
73
73
  enumerable: true,
74
- get: function () { return chunkHMTHK2IY_cjs.tryDecrypt; }
74
+ get: function () { return chunk56PVVFVM_cjs.tryDecrypt; }
75
75
  });
76
76
  Object.defineProperty(exports, "tryDecryptObj", {
77
77
  enumerable: true,
78
- get: function () { return chunkHMTHK2IY_cjs.tryDecryptObj; }
78
+ get: function () { return chunk56PVVFVM_cjs.tryDecryptObj; }
79
79
  });
80
80
  Object.defineProperty(exports, "tryEncrypt", {
81
81
  enumerable: true,
82
- get: function () { return chunkHMTHK2IY_cjs.tryEncrypt; }
82
+ get: function () { return chunk56PVVFVM_cjs.tryEncrypt; }
83
83
  });
84
84
  Object.defineProperty(exports, "tryEncryptObj", {
85
85
  enumerable: true,
86
- get: function () { return chunkHMTHK2IY_cjs.tryEncryptObj; }
86
+ get: function () { return chunk56PVVFVM_cjs.tryEncryptObj; }
87
87
  });
88
88
  Object.defineProperty(exports, "tryGenerateUuid", {
89
89
  enumerable: true,
90
- get: function () { return chunkHMTHK2IY_cjs.tryGenerateUuid; }
90
+ get: function () { return chunk56PVVFVM_cjs.tryGenerateUuid; }
91
91
  });
92
92
  Object.defineProperty(exports, "tryHash", {
93
93
  enumerable: true,
94
- get: function () { return chunkHMTHK2IY_cjs.tryHash; }
94
+ get: function () { return chunk56PVVFVM_cjs.tryHash; }
95
95
  });
96
96
  Object.defineProperty(exports, "tryHashPassword", {
97
97
  enumerable: true,
98
- get: function () { return chunkHMTHK2IY_cjs.tryHashPassword; }
98
+ get: function () { return chunk56PVVFVM_cjs.tryHashPassword; }
99
99
  });
100
100
  Object.defineProperty(exports, "verifyPassword", {
101
101
  enumerable: true,
102
- get: function () { return chunkHMTHK2IY_cjs.verifyPassword; }
102
+ get: function () { return chunk56PVVFVM_cjs.verifyPassword; }
103
103
  });
104
104
  Object.defineProperty(exports, "ENCRYPTED_REGEX", {
105
105
  enumerable: true,
106
- get: function () { return chunkBHG5RSUV_cjs.ENCRYPTED_REGEX; }
106
+ get: function () { return chunkX4CS7UXE_cjs.ENCRYPTED_REGEX; }
107
107
  });
108
108
  Object.defineProperty(exports, "matchEncryptedPattern", {
109
109
  enumerable: true,
110
- get: function () { return chunkBHG5RSUV_cjs.matchEncryptedPattern; }
110
+ get: function () { return chunkX4CS7UXE_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 chunkX4CS7UXE_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 chunkX4CS7UXE_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 chunkX4CS7UXE_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 chunkX4CS7UXE_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, 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-cJEdGlj1.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-DO9n7Np-.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, 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-cJEdGlj1.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-DUgIcobC.js';
3
3
  import 'node:crypto';
4
4
  import 'node:buffer';
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- export { convertBytesToStr, convertEncoding, convertStrToBytes, createSecretKey, decrypt, decryptObj, encrypt, encryptObj, generateUuid, hash, hashPassword, isNodeSecretKey, tryConvertBytesToStr, tryConvertEncoding, tryConvertStrToBytes, tryCreateSecretKey, tryDecrypt, tryDecryptObj, tryEncrypt, tryEncryptObj, tryGenerateUuid, tryHash, tryHashPassword, verifyPassword } from './chunk-RAEBT46G.js';
2
- export { ENCRYPTED_REGEX, matchEncryptedPattern, parseToObj, stringifyObj, tryParseToObj, tryStringifyObj } from './chunk-RUTGDMVR.js';
1
+ export { convertBytesToStr, convertEncoding, convertStrToBytes, createSecretKey, decrypt, decryptObj, encrypt, encryptObj, generateUuid, hash, hashPassword, isNodeSecretKey, tryConvertBytesToStr, tryConvertEncoding, tryConvertStrToBytes, tryCreateSecretKey, tryDecrypt, tryDecryptObj, tryEncrypt, tryEncryptObj, tryGenerateUuid, tryHash, tryHashPassword, verifyPassword } from './chunk-PWTFVMW6.js';
2
+ export { ENCRYPTED_REGEX, matchEncryptedPattern, parseToObj, stringifyObj, tryParseToObj, tryStringifyObj } from './chunk-6C4NIWQ4.js';
3
3
  //# sourceMappingURL=node.js.map
4
4
  //# sourceMappingURL=node.js.map
@@ -4,10 +4,27 @@ import nodeCrypto, { webcrypto } from 'node:crypto';
4
4
  * Standardized error object for the `Result` type.
5
5
  * Always has a brief `message` and a more detailed `description`.
6
6
  */
7
- interface ResultErr {
7
+ interface ErrorStruct {
8
8
  readonly message: string;
9
9
  readonly description: string;
10
10
  }
11
+ type ReservedWords<Obj extends object> = "success" extends keyof Obj ? never : "error" extends keyof Obj ? never : Obj;
12
+ type OkType<T> = {
13
+ readonly success: true;
14
+ readonly error?: undefined;
15
+ } & (T extends object ? ReservedWords<{
16
+ readonly [K in keyof T]: T[K];
17
+ }> : {
18
+ readonly result: T;
19
+ });
20
+ type ErrType<T> = {
21
+ readonly success: false;
22
+ readonly error: ErrorStruct;
23
+ } & (T extends object ? ReservedWords<{
24
+ readonly [K in keyof T]?: undefined;
25
+ }> : {
26
+ readonly result?: undefined;
27
+ });
11
28
  /**
12
29
  * Discriminated union for functions that can succeed or fail.
13
30
  *
@@ -34,25 +51,7 @@ interface ResultErr {
34
51
  * if (r2.success) console.log(r2.name, r2.age); // 'Alice' 30
35
52
  * ```
36
53
  */
37
- type Result<T, E = ResultErr> = T extends object ? ({
38
- readonly [K in keyof T]: T[K];
39
- } & {
40
- readonly success: true;
41
- readonly error?: undefined;
42
- }) | ({
43
- readonly [K in keyof T]?: undefined;
44
- } & {
45
- readonly success: false;
46
- readonly error: E;
47
- }) : {
48
- readonly success: true;
49
- readonly result: T;
50
- readonly error?: undefined;
51
- } | {
52
- readonly success: false;
53
- readonly error: E;
54
- readonly result?: undefined;
55
- };
54
+ type Result<T> = OkType<T> | ErrType<T>;
56
55
 
57
56
  declare const ENCODING: readonly ["base64", "base64url", "hex", "utf8", "latin1"];
58
57
  declare const CIPHER_ENCODING: readonly ["base64", "base64url", "hex"];
@@ -131,10 +130,10 @@ type DigestAlgorithm = keyof typeof DIGEST_ALGORITHMS;
131
130
  * You can choose how strong the lock is (algorithm), how to make the key (digest),
132
131
  * and add some extra secret stuff (salt and info) to make your key unique.
133
132
  *
134
- * - `algorithm` (default: `'aes256gcm'`)
135
- * - `digest` (HKDF hash; default: `'sha256'`)
136
- * - `salt` (default: `'cipher-kit-salt'`, must be ≥ 8 chars)
137
- * - `info` (default: `'cipher-kit'`)
133
+ * - `algorithm`: Encryption algorithm to use (default: `'aes256gcm'`)
134
+ * - `digest`: Digest algorithm for HKDF (default: `'sha256'`)
135
+ * - `salt`: Salt for HKDF (default: `'cipher-kit-salt'`, must be ≥ 8 chars)
136
+ * - `info`: Added context for HKDF (default: `'cipher-kit'`)
138
137
  */
139
138
  interface CreateSecretKeyOptions {
140
139
  /** Encryption algorithm to use (default: `'aes256gcm'`). */
@@ -152,7 +151,7 @@ interface CreateSecretKeyOptions {
152
151
  * ### 🍼 Explain Like I'm Five
153
152
  * After locking your message, how should we write the locked message down?
154
153
  *
155
- * - `outputEncoding`: output ciphertext encoding (`'base64' | 'base64url' | 'hex'`) (default: `'base64url'`)
154
+ * - `outputEncoding`: Output ciphertext encoding (`'base64' | 'base64url' | 'hex'`) (default: `'base64url'`)
156
155
  */
157
156
  interface EncryptOptions {
158
157
  /** Encoding format for the output ciphertext (default: `'base64url'`). */
@@ -164,7 +163,7 @@ interface EncryptOptions {
164
163
  * ### 🍼 Explain Like I'm Five
165
164
  * To unlock the message, we must know how it was written down.
166
165
  *
167
- * - `inputEncoding`: input ciphertext encoding (`'base64' | 'base64url' | 'hex'`) (default: `'base64url'`)
166
+ * - `inputEncoding`: Input ciphertext encoding (`'base64' | 'base64url' | 'hex'`) (default: `'base64url'`)
168
167
  */
169
168
  interface DecryptOptions {
170
169
  /** Encoding format for the input ciphertext (default: `'base64url'`). */
@@ -178,7 +177,7 @@ interface DecryptOptions {
178
177
  * You can choose how to create the fingerprint (digest) and how to write it down (encoding).
179
178
  *
180
179
  * - `digest`: `'sha256' | 'sha384' | 'sha512'` (default: `'sha256'`)
181
- * - `outputEncoding`: output ciphertext encoding for the hash (`'base64' | 'base64url' | 'hex'`; default: `'base64url'`)
180
+ * - `outputEncoding`: Output ciphertext encoding for the hash (`'base64' | 'base64url' | 'hex'`; default: `'base64url'`)
182
181
  */
183
182
  interface HashOptions {
184
183
  /** Digest algorithm to use (default: `'sha256'`). */
@@ -194,10 +193,10 @@ interface HashOptions {
194
193
  * stirring many times (iterations), and making a long result (keyLength).
195
194
  *
196
195
  * - `digest`: `'sha256' | 'sha384' | 'sha512'` (default: `'sha512'`)
197
- * - `outputEncoding`: output ciphertext encoding for the hash (`'base64' | 'base64url' | 'hex'`; default: `'base64url'`)
198
- * - `saltLength`: size of the random salt in bytes (default: `16` bytes)
199
- * - `iterations`: number of iterations (default: `320000`)
200
- * - `keyLength`: length of the derived key in bytes (default: `64` bytes)
196
+ * - `outputEncoding`: Output ciphertext encoding for the hash (`'base64' | 'base64url' | 'hex'`; default: `'base64url'`)
197
+ * - `saltLength`: Size of the random salt in bytes (default: `16` bytes)
198
+ * - `iterations`: Number of iterations (default: `320000`)
199
+ * - `keyLength`: Length of the derived key in bytes (default: `64` bytes)
201
200
  */
202
201
  interface HashPasswordOptions {
203
202
  /** Digest algorithm to use (default: `'sha512'`). */
@@ -219,9 +218,9 @@ interface HashPasswordOptions {
219
218
  * same size—so the new result matches the old one.
220
219
  *
221
220
  * - `digest`: `'sha256' | 'sha384' | 'sha512'` (default: `'sha512'`)
222
- * - `inputEncoding`: input ciphertext encoding for the hash (`'base64' | 'base64url' | 'hex'`; default: `'base64url'`)
223
- * - `iterations`: number of iterations (default: `320000`)
224
- * - `keyLength`: length of the derived key in bytes (default: `64` bytes)
221
+ * - `inputEncoding`: Input ciphertext encoding for the hash (`'base64' | 'base64url' | 'hex'`; default: `'base64url'`)
222
+ * - `iterations`: Number of iterations (default: `320000`)
223
+ * - `keyLength`: Length of the derived key in bytes (default: `64` bytes)
225
224
  */
226
225
  interface VerifyPasswordOptions {
227
226
  /** Digest algorithm to use (default: `'sha512'`). */
@@ -367,6 +366,6 @@ declare const ENCRYPTED_REGEX: Readonly<{
367
366
  * matchEncryptedPattern("abc.def.ghi.", "general"); // true
368
367
  * ```
369
368
  */
370
- declare function matchEncryptedPattern(data: string, format: "general" | "node" | "web"): boolean;
369
+ declare function matchEncryptedPattern(data: string, format: "node" | "web" | "general"): boolean;
371
370
 
372
371
  export { type CipherEncoding as C, type DigestAlgorithm as D, ENCRYPTED_REGEX as E, type HashOptions as H, type Result as R, type SecretKey as S, type VerifyPasswordOptions as V, tryStringifyObj as a, type Encoding as b, type EncryptionAlgorithm as c, type CreateSecretKeyOptions as d, type EncryptOptions as e, type DecryptOptions as f, type HashPasswordOptions as g, matchEncryptedPattern as m, parseToObj as p, stringifyObj as s, tryParseToObj as t };