internxt-crypto 1.0.1 → 1.1.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.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/derive-key.d.mts +8 -1
  3. package/dist/derive-key.d.mts.map +1 -1
  4. package/dist/derive-key.d.ts +8 -1
  5. package/dist/derive-key.d.ts.map +1 -1
  6. package/dist/derive-key.js +2 -1
  7. package/dist/derive-key.mjs +2 -2
  8. package/dist/{deriveKeysFromKey-DPU_h7wr.mjs → deriveKeysFromKey-CseBjg0n.mjs} +12 -3
  9. package/dist/deriveKeysFromKey-CseBjg0n.mjs.map +1 -0
  10. package/dist/{deriveKeysFromKey-C4McqO6_.js → deriveKeysFromKey-GTRMuxDj.js} +16 -1
  11. package/dist/deriveKeysFromKey-GTRMuxDj.js.map +1 -0
  12. package/dist/email-crypto.d.mts +65 -2
  13. package/dist/email-crypto.d.mts.map +1 -1
  14. package/dist/email-crypto.d.ts +65 -2
  15. package/dist/email-crypto.d.ts.map +1 -1
  16. package/dist/email-crypto.js +14 -120
  17. package/dist/email-crypto.mjs +2 -115
  18. package/dist/{emailEncryptionKey-C4X1Bwy4.js → emailEncryptionKey-F_YuJu1H.js} +2 -2
  19. package/dist/{emailEncryptionKey-C4X1Bwy4.js.map → emailEncryptionKey-F_YuJu1H.js.map} +1 -1
  20. package/dist/{emailEncryptionKey-BtSPYd9M.mjs → emailEncryptionKey-kIsseFo6.mjs} +2 -2
  21. package/dist/{emailEncryptionKey-BtSPYd9M.mjs.map → emailEncryptionKey-kIsseFo6.mjs.map} +1 -1
  22. package/dist/{core-Bj26rNdA.js → emailKeys-DWvKANTZ.js} +148 -1
  23. package/dist/emailKeys-DWvKANTZ.js.map +1 -0
  24. package/dist/{core-pEGygy6S.mjs → emailKeys-nzn7U7HQ.mjs} +114 -3
  25. package/dist/emailKeys-nzn7U7HQ.mjs.map +1 -0
  26. package/dist/index.d.mts +3 -4
  27. package/dist/index.d.mts.map +1 -1
  28. package/dist/index.d.ts +3 -4
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +12 -36
  31. package/dist/index.mjs +4 -6
  32. package/dist/keystore-crypto.js +1 -1
  33. package/dist/keystore-crypto.mjs +1 -1
  34. package/dist/types.d.mts +1 -33
  35. package/dist/types.d.mts.map +1 -1
  36. package/dist/types.d.ts +1 -33
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js.map +1 -1
  39. package/dist/types.mjs.map +1 -1
  40. package/package.json +2 -4
  41. package/dist/core-Bj26rNdA.js.map +0 -1
  42. package/dist/core-pEGygy6S.mjs.map +0 -1
  43. package/dist/deriveKeysFromKey-C4McqO6_.js.map +0 -1
  44. package/dist/deriveKeysFromKey-DPU_h7wr.mjs.map +0 -1
  45. package/dist/email-crypto.js.map +0 -1
  46. package/dist/email-crypto.mjs.map +0 -1
  47. package/dist/email-search.d.mts +0 -232
  48. package/dist/email-search.d.mts.map +0 -1
  49. package/dist/email-search.d.ts +0 -232
  50. package/dist/email-search.d.ts.map +0 -1
  51. package/dist/email-search.js +0 -27
  52. package/dist/email-search.mjs +0 -3
  53. package/dist/search-B9YM3XAA.mjs +0 -587
  54. package/dist/search-B9YM3XAA.mjs.map +0 -1
  55. package/dist/search-DUTm4-rN.js +0 -731
  56. package/dist/search-DUTm4-rN.js.map +0 -1
package/README.md CHANGED
@@ -153,7 +153,7 @@ const userID = 'user ID';
153
153
  const db = await openDatabase(userID);
154
154
 
155
155
  // Derive database key
156
- const key = await deriveIndexKey(baseKey);
156
+ const key = await deriveDatabaseKey(baseKey);
157
157
 
158
158
  // Encrypt and store one or several emails
159
159
  await encryptAndStoreEmail(email, key, db);
@@ -16,6 +16,13 @@ declare function deriveSymmetricKeyFromContext(context: string, baseKey: Uint8Ar
16
16
  * @returns The derived secret key
17
17
  */
18
18
  declare function deriveSymmetricKeyFromTwoKeys(key1: Uint8Array, key2: Uint8Array): Uint8Array;
19
+ /**
20
+ * Derives database encryption key for the given user
21
+ *
22
+ * @param baseKey - The base key (NOT PASSWORD!)
23
+ * @returns The symmetric key for protecting database
24
+ */
25
+ declare const deriveDatabaseKey: (baseKey: Uint8Array) => Promise<Uint8Array>;
19
26
  //#endregion
20
- export { deriveSymmetricKeyFromContext, deriveSymmetricKeyFromTwoKeys };
27
+ export { deriveDatabaseKey, deriveSymmetricKeyFromContext, deriveSymmetricKeyFromTwoKeys };
21
28
  //# sourceMappingURL=derive-key.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"derive-key.d.mts","names":[],"sources":["../src/derive-key/deriveKeysFromKey.ts"],"mappings":";;AAYA;;;;;;;iBAAgB,6BAAA,CAA8B,OAAA,UAAiB,OAAA,EAAS,UAAA,GAAa,UAAA;;;AAWrF;;;;;iBAAgB,6BAAA,CAA8B,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,UAAA,GAAa,UAAA"}
1
+ {"version":3,"file":"derive-key.d.mts","names":[],"sources":["../src/derive-key/deriveKeysFromKey.ts"],"mappings":";;AAYA;;;;;;;iBAAgB,6BAAA,CAA8B,OAAA,UAAiB,OAAA,EAAS,UAAA,GAAa,UAAA;;;AAWrF;;;;;iBAAgB,6BAAA,CAA8B,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,UAAA,GAAa,UAAA;;;;;;;cAkBtE,iBAAA,GAA2B,OAAA,EAAS,UAAA,KAAa,OAAA,CAAQ,UAAA"}
@@ -16,6 +16,13 @@ declare function deriveSymmetricKeyFromContext(context: string, baseKey: Uint8Ar
16
16
  * @returns The derived secret key
17
17
  */
18
18
  declare function deriveSymmetricKeyFromTwoKeys(key1: Uint8Array, key2: Uint8Array): Uint8Array;
19
+ /**
20
+ * Derives database encryption key for the given user
21
+ *
22
+ * @param baseKey - The base key (NOT PASSWORD!)
23
+ * @returns The symmetric key for protecting database
24
+ */
25
+ declare const deriveDatabaseKey: (baseKey: Uint8Array) => Promise<Uint8Array>;
19
26
  //#endregion
20
- export { deriveSymmetricKeyFromContext, deriveSymmetricKeyFromTwoKeys };
27
+ export { deriveDatabaseKey, deriveSymmetricKeyFromContext, deriveSymmetricKeyFromTwoKeys };
21
28
  //# sourceMappingURL=derive-key.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"derive-key.d.ts","names":[],"sources":["../src/derive-key/deriveKeysFromKey.ts"],"mappings":";;AAYA;;;;;;;iBAAgB,6BAAA,CAA8B,OAAA,UAAiB,OAAA,EAAS,UAAA,GAAa,UAAA;;;AAWrF;;;;;iBAAgB,6BAAA,CAA8B,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,UAAA,GAAa,UAAA"}
1
+ {"version":3,"file":"derive-key.d.ts","names":[],"sources":["../src/derive-key/deriveKeysFromKey.ts"],"mappings":";;AAYA;;;;;;;iBAAgB,6BAAA,CAA8B,OAAA,UAAiB,OAAA,EAAS,UAAA,GAAa,UAAA;;;AAWrF;;;;;iBAAgB,6BAAA,CAA8B,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,UAAA,GAAa,UAAA;;;;;;;cAkBtE,iBAAA,GAA2B,OAAA,EAAS,UAAA,KAAa,OAAA,CAAQ,UAAA"}
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_deriveKeysFromKey = require('./deriveKeysFromKey-C4McqO6_.js');
2
+ const require_deriveKeysFromKey = require('./deriveKeysFromKey-GTRMuxDj.js');
3
3
 
4
+ exports.deriveDatabaseKey = require_deriveKeysFromKey.deriveDatabaseKey;
4
5
  exports.deriveSymmetricKeyFromContext = require_deriveKeysFromKey.deriveSymmetricKeyFromContext;
5
6
  exports.deriveSymmetricKeyFromTwoKeys = require_deriveKeysFromKey.deriveSymmetricKeyFromTwoKeys;
@@ -1,3 +1,3 @@
1
- import { n as deriveSymmetricKeyFromTwoKeys, t as deriveSymmetricKeyFromContext } from "./deriveKeysFromKey-DPU_h7wr.mjs";
1
+ import { n as deriveSymmetricKeyFromContext, r as deriveSymmetricKeyFromTwoKeys, t as deriveDatabaseKey } from "./deriveKeysFromKey-CseBjg0n.mjs";
2
2
 
3
- export { deriveSymmetricKeyFromContext, deriveSymmetricKeyFromTwoKeys };
3
+ export { deriveDatabaseKey, deriveSymmetricKeyFromContext, deriveSymmetricKeyFromTwoKeys };
@@ -1,4 +1,4 @@
1
- import { AES_KEY_BYTE_LENGTH, CONTEXT_DERIVE } from "./constants.mjs";
1
+ import { AES_KEY_BYTE_LENGTH, CONTEXT_DERIVE, CONTEXT_INDEX } from "./constants.mjs";
2
2
  import { s as UTF8ToUint8 } from "./genID-D08K7JPr.mjs";
3
3
  import { blake3 } from "@noble/hashes/blake3.js";
4
4
 
@@ -29,7 +29,16 @@ function deriveSymmetricKeyFromTwoKeys(key1, key2) {
29
29
  throw new Error("Failed to derive symmetric key from two keys and context", { cause: error });
30
30
  }
31
31
  }
32
+ /**
33
+ * Derives database encryption key for the given user
34
+ *
35
+ * @param baseKey - The base key (NOT PASSWORD!)
36
+ * @returns The symmetric key for protecting database
37
+ */
38
+ const deriveDatabaseKey = async (baseKey) => {
39
+ return deriveSymmetricKeyFromContext(CONTEXT_INDEX, baseKey);
40
+ };
32
41
 
33
42
  //#endregion
34
- export { deriveSymmetricKeyFromTwoKeys as n, deriveSymmetricKeyFromContext as t };
35
- //# sourceMappingURL=deriveKeysFromKey-DPU_h7wr.mjs.map
43
+ export { deriveSymmetricKeyFromContext as n, deriveSymmetricKeyFromTwoKeys as r, deriveDatabaseKey as t };
44
+ //# sourceMappingURL=deriveKeysFromKey-CseBjg0n.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deriveKeysFromKey-CseBjg0n.mjs","names":[],"sources":["../src/derive-key/deriveKeysFromKey.ts"],"sourcesContent":["import { blake3 } from '@noble/hashes/blake3.js';\nimport { AES_KEY_BYTE_LENGTH, CONTEXT_DERIVE, CONTEXT_INDEX } from '../constants';\nimport { UTF8ToUint8 } from '../utils';\n\n/**\n * Derives a symmetric key from the base key and context string\n *\n * @param context - The context string.\n * The context string should be hardcoded, globally unique, and application-specific.\n * @param baseKey - The base key (NOT PASSWORD!)\n * @returns The derived secret key\n */\nexport function deriveSymmetricKeyFromContext(context: string, baseKey: Uint8Array): Uint8Array {\n return blake3(baseKey, { context: UTF8ToUint8(context) });\n}\n\n/**\n * Derives a symmetric key from two keys\n *\n * @param key1 - The 32-bytes key\n * @param key2 - The 32-bytes key\n * @returns The derived secret key\n */\nexport function deriveSymmetricKeyFromTwoKeys(key1: Uint8Array, key2: Uint8Array): Uint8Array {\n try {\n if (key2.length != AES_KEY_BYTE_LENGTH || key1.length != AES_KEY_BYTE_LENGTH) {\n throw new Error(`Input key length must be exactly ${AES_KEY_BYTE_LENGTH} bytes`);\n }\n const key = blake3(key1, { key: key2 });\n return deriveSymmetricKeyFromContext(CONTEXT_DERIVE, key);\n } catch (error) {\n throw new Error('Failed to derive symmetric key from two keys and context', { cause: error });\n }\n}\n\n/**\n * Derives database encryption key for the given user\n *\n * @param baseKey - The base key (NOT PASSWORD!)\n * @returns The symmetric key for protecting database\n */\nexport const deriveDatabaseKey = async (baseKey: Uint8Array): Promise<Uint8Array> => {\n return deriveSymmetricKeyFromContext(CONTEXT_INDEX, baseKey);\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,8BAA8B,SAAiB,SAAiC;AAC9F,QAAO,OAAO,SAAS,EAAE,SAAS,YAAY,QAAQ,EAAE,CAAC;;;;;;;;;AAU3D,SAAgB,8BAA8B,MAAkB,MAA8B;AAC5F,KAAI;AACF,MAAI,KAAK,UAAU,uBAAuB,KAAK,UAAU,oBACvD,OAAM,IAAI,MAAM,oCAAoC,oBAAoB,QAAQ;AAGlF,SAAO,8BAA8B,gBADzB,OAAO,MAAM,EAAE,KAAK,MAAM,CAAC,CACkB;UAClD,OAAO;AACd,QAAM,IAAI,MAAM,4DAA4D,EAAE,OAAO,OAAO,CAAC;;;;;;;;;AAUjG,MAAa,oBAAoB,OAAO,YAA6C;AACnF,QAAO,8BAA8B,eAAe,QAAQ"}
@@ -30,8 +30,23 @@ function deriveSymmetricKeyFromTwoKeys(key1, key2) {
30
30
  throw new Error("Failed to derive symmetric key from two keys and context", { cause: error });
31
31
  }
32
32
  }
33
+ /**
34
+ * Derives database encryption key for the given user
35
+ *
36
+ * @param baseKey - The base key (NOT PASSWORD!)
37
+ * @returns The symmetric key for protecting database
38
+ */
39
+ const deriveDatabaseKey = async (baseKey) => {
40
+ return deriveSymmetricKeyFromContext(require_constants.CONTEXT_INDEX, baseKey);
41
+ };
33
42
 
34
43
  //#endregion
44
+ Object.defineProperty(exports, 'deriveDatabaseKey', {
45
+ enumerable: true,
46
+ get: function () {
47
+ return deriveDatabaseKey;
48
+ }
49
+ });
35
50
  Object.defineProperty(exports, 'deriveSymmetricKeyFromContext', {
36
51
  enumerable: true,
37
52
  get: function () {
@@ -44,4 +59,4 @@ Object.defineProperty(exports, 'deriveSymmetricKeyFromTwoKeys', {
44
59
  return deriveSymmetricKeyFromTwoKeys;
45
60
  }
46
61
  });
47
- //# sourceMappingURL=deriveKeysFromKey-C4McqO6_.js.map
62
+ //# sourceMappingURL=deriveKeysFromKey-GTRMuxDj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deriveKeysFromKey-GTRMuxDj.js","names":["UTF8ToUint8","AES_KEY_BYTE_LENGTH","CONTEXT_DERIVE","CONTEXT_INDEX"],"sources":["../src/derive-key/deriveKeysFromKey.ts"],"sourcesContent":["import { blake3 } from '@noble/hashes/blake3.js';\nimport { AES_KEY_BYTE_LENGTH, CONTEXT_DERIVE, CONTEXT_INDEX } from '../constants';\nimport { UTF8ToUint8 } from '../utils';\n\n/**\n * Derives a symmetric key from the base key and context string\n *\n * @param context - The context string.\n * The context string should be hardcoded, globally unique, and application-specific.\n * @param baseKey - The base key (NOT PASSWORD!)\n * @returns The derived secret key\n */\nexport function deriveSymmetricKeyFromContext(context: string, baseKey: Uint8Array): Uint8Array {\n return blake3(baseKey, { context: UTF8ToUint8(context) });\n}\n\n/**\n * Derives a symmetric key from two keys\n *\n * @param key1 - The 32-bytes key\n * @param key2 - The 32-bytes key\n * @returns The derived secret key\n */\nexport function deriveSymmetricKeyFromTwoKeys(key1: Uint8Array, key2: Uint8Array): Uint8Array {\n try {\n if (key2.length != AES_KEY_BYTE_LENGTH || key1.length != AES_KEY_BYTE_LENGTH) {\n throw new Error(`Input key length must be exactly ${AES_KEY_BYTE_LENGTH} bytes`);\n }\n const key = blake3(key1, { key: key2 });\n return deriveSymmetricKeyFromContext(CONTEXT_DERIVE, key);\n } catch (error) {\n throw new Error('Failed to derive symmetric key from two keys and context', { cause: error });\n }\n}\n\n/**\n * Derives database encryption key for the given user\n *\n * @param baseKey - The base key (NOT PASSWORD!)\n * @returns The symmetric key for protecting database\n */\nexport const deriveDatabaseKey = async (baseKey: Uint8Array): Promise<Uint8Array> => {\n return deriveSymmetricKeyFromContext(CONTEXT_INDEX, baseKey);\n};\n"],"mappings":";;;;;;;;;;;;;;AAYA,SAAgB,8BAA8B,SAAiB,SAAiC;AAC9F,4CAAc,SAAS,EAAE,SAASA,0BAAY,QAAQ,EAAE,CAAC;;;;;;;;;AAU3D,SAAgB,8BAA8B,MAAkB,MAA8B;AAC5F,KAAI;AACF,MAAI,KAAK,UAAUC,yCAAuB,KAAK,UAAUA,sCACvD,OAAM,IAAI,MAAM,oCAAoCA,sCAAoB,QAAQ;AAGlF,SAAO,8BAA8BC,sEADlB,MAAM,EAAE,KAAK,MAAM,CAAC,CACkB;UAClD,OAAO;AACd,QAAM,IAAI,MAAM,4DAA4D,EAAE,OAAO,OAAO,CAAC;;;;;;;;;AAUjG,MAAa,oBAAoB,OAAO,YAA6C;AACnF,QAAO,8BAA8BC,iCAAe,QAAQ"}
@@ -1,4 +1,4 @@
1
- import { EmailBody, HybridEncryptedEmail, HybridKeyPair, PwdProtectedEmail, RecipientWithPublicKey } from "./types.mjs";
1
+ import { EmailBody, EmailBodyEncrypted, HybridEncKey, HybridEncryptedEmail, HybridKeyPair, PwdProtectedEmail, PwdProtectedKey, RecipientWithPublicKey } from "./types.mjs";
2
2
 
3
3
  //#region src/email-crypto/hybridEncyptedEmail.d.ts
4
4
  /**
@@ -57,5 +57,68 @@ declare function decryptPwdProtectedEmail(encryptedEmail: PwdProtectedEmail, pas
57
57
  */
58
58
  declare function generateEmailKeys(): Promise<HybridKeyPair>;
59
59
  //#endregion
60
- export { createPwdProtectedEmail, decryptEmailHybrid, decryptPwdProtectedEmail, encryptEmailHybrid, encryptEmailHybridForMultipleRecipients, generateEmailKeys };
60
+ //#region src/email-crypto/core.d.ts
61
+ /**
62
+ * Symmetrically encrypts email body.
63
+ *
64
+ * @param body - The email body to encrypt.
65
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
66
+ * @returns The resulting encrypted email body and symmetric key used for encryption
67
+ */
68
+ declare function encryptEmailBody(body: EmailBody, aux?: Uint8Array): Promise<{
69
+ encEmailBody: EmailBodyEncrypted;
70
+ encryptionKey: Uint8Array;
71
+ }>;
72
+ /**
73
+ * Symmetrically encrypts email body with the given key.
74
+ *
75
+ * @param body - The email body to encrypt.
76
+ * @param encryptionKey - The symmetric key to encrypt the email.
77
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
78
+ * @returns The resulting encrypted email body and symmetric key used for encryption
79
+ */
80
+ declare function encryptEmailBodyWithKey(body: EmailBody, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailBodyEncrypted>;
81
+ /**
82
+ * Decrypts symmetrically encrypted email body.
83
+ *
84
+ * @param encEmailBody - The email body to decrypt.
85
+ * @param encryptionKey - The symmetric key to decrypt the email.
86
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
87
+ * @returns The resulting decrypted email body
88
+ */
89
+ declare function decryptEmailBody(encEmailBody: EmailBodyEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailBody>;
90
+ /**
91
+ * Encrypts the email symmetric key using hybrid encryption.
92
+ *
93
+ * @param emailEncryptionKey - The symmetric key used for email encryption.
94
+ * @param recipient - The recipient with a public hybrid key.
95
+ * @returns The encrypted email symmetric key
96
+ */
97
+ declare function encryptKeysHybrid(emailEncryptionKey: Uint8Array, recipient: RecipientWithPublicKey): Promise<HybridEncKey>;
98
+ /**
99
+ * Decrypts the email symmetric key encrypted via hybrid encryption.
100
+ *
101
+ * @param encryptedKey - The encrypted email key.
102
+ * @param recipientPrivateKey - The private key of the recipient.
103
+ * @returns The email encryption key
104
+ */
105
+ declare function decryptKeysHybrid(encryptedKey: HybridEncKey, recipientPrivateKey: Uint8Array): Promise<Uint8Array>;
106
+ /**
107
+ * Password-protects the email symmetric key.
108
+ *
109
+ * @param emailEncryptionKey - The symmetric key used for email encryption.
110
+ * @param password - The secret password for key protection.
111
+ * @returns The password-protected email symmetric key
112
+ */
113
+ declare function passwordProtectKey(emailEncryptionKey: Uint8Array, password: string): Promise<PwdProtectedKey>;
114
+ /**
115
+ * Removes passoword-protection and exposes the email symmetric key.
116
+ *
117
+ * @param emailEncryptionKey - The password-protected email key.
118
+ * @param password - The secret password for key protection.
119
+ * @returns The email encryption key
120
+ */
121
+ declare function removePasswordProtection(emailEncryptionKey: PwdProtectedKey, password: string): Promise<Uint8Array>;
122
+ //#endregion
123
+ export { createPwdProtectedEmail, decryptEmailBody, decryptEmailHybrid, decryptKeysHybrid, decryptPwdProtectedEmail, encryptEmailBody, encryptEmailBodyWithKey, encryptEmailHybrid, encryptEmailHybridForMultipleRecipients, encryptKeysHybrid, generateEmailKeys, passwordProtectKey, removePasswordProtection };
61
124
  //# sourceMappingURL=email-crypto.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"email-crypto.d.mts","names":[],"sources":["../src/email-crypto/hybridEncyptedEmail.ts","../src/email-crypto/pwdProtectedEmail.ts","../src/email-crypto/emailKeys.ts"],"mappings":";;;;;AAWA;;;;;;iBAAsB,kBAAA,CACpB,IAAA,EAAM,SAAA,EACN,SAAA,EAAW,sBAAA,EACX,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;;;;;;iBAkBW,uCAAA,CACpB,IAAA,EAAM,SAAA,EACN,UAAA,EAAY,sBAAA,IACZ,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;;AAJX;;;;iBA8BsB,kBAAA,CACpB,YAAA,EAAc,oBAAA,EACd,0BAAA,EAA4B,UAAA,EAC5B,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,SAAA;;;;;AAxDX;;;;;;iBCAsB,uBAAA,CACpB,SAAA,EAAW,SAAA,EACX,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,iBAAA;;;;;;;;;iBAmBW,wBAAA,CACpB,cAAA,EAAgB,iBAAA,EAChB,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,SAAA;;;;;AD3BX;;;iBEHsB,iBAAA,CAAA,GAAqB,OAAA,CAAQ,aAAA"}
1
+ {"version":3,"file":"email-crypto.d.mts","names":[],"sources":["../src/email-crypto/hybridEncyptedEmail.ts","../src/email-crypto/pwdProtectedEmail.ts","../src/email-crypto/emailKeys.ts","../src/email-crypto/core.ts"],"mappings":";;;;;AAWA;;;;;;iBAAsB,kBAAA,CACpB,IAAA,EAAM,SAAA,EACN,SAAA,EAAW,sBAAA,EACX,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;;;;;;iBAkBW,uCAAA,CACpB,IAAA,EAAM,SAAA,EACN,UAAA,EAAY,sBAAA,IACZ,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;;AAJX;;;;iBA8BsB,kBAAA,CACpB,YAAA,EAAc,oBAAA,EACd,0BAAA,EAA4B,UAAA,EAC5B,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,SAAA;;;;;AAxDX;;;;;;iBCAsB,uBAAA,CACpB,SAAA,EAAW,SAAA,EACX,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,iBAAA;;;;;;;;;iBAmBW,wBAAA,CACpB,cAAA,EAAgB,iBAAA,EAChB,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,SAAA;;;;;AD3BX;;;iBEHsB,iBAAA,CAAA,GAAqB,OAAA,CAAQ,aAAA;;;;;AFGnD;;;;;iBGGsB,gBAAA,CACpB,IAAA,EAAM,SAAA,EACN,GAAA,GAAM,UAAA,GACL,OAAA;EACD,YAAA,EAAc,kBAAA;EACd,aAAA,EAAe,UAAA;AAAA;;;;;;;;;iBAuBK,uBAAA,CACpB,IAAA,EAAM,SAAA,EACN,aAAA,EAAe,UAAA,EACf,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,kBAAA;;;AHbX;;;;;;iBG8CsB,gBAAA,CACpB,YAAA,EAAc,kBAAA,EACd,aAAA,EAAe,UAAA,EACf,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,SAAA;;;;;;;;iBA8BW,iBAAA,CACpB,kBAAA,EAAoB,UAAA,EACpB,SAAA,EAAW,sBAAA,GACV,OAAA,CAAQ,YAAA;;;;;;AHrDX;;iBG6EsB,iBAAA,CACpB,YAAA,EAAc,YAAA,EACd,mBAAA,EAAqB,UAAA,GACpB,OAAA,CAAQ,UAAA;;;;;;;;iBAmBW,kBAAA,CAAmB,kBAAA,EAAoB,UAAA,EAAY,QAAA,WAAmB,OAAA,CAAQ,eAAA;;;;;;;;iBAmB9E,wBAAA,CACpB,kBAAA,EAAoB,eAAA,EACpB,QAAA,WACC,OAAA,CAAQ,UAAA"}
@@ -1,4 +1,4 @@
1
- import { EmailBody, HybridEncryptedEmail, HybridKeyPair, PwdProtectedEmail, RecipientWithPublicKey } from "./types.js";
1
+ import { EmailBody, EmailBodyEncrypted, HybridEncKey, HybridEncryptedEmail, HybridKeyPair, PwdProtectedEmail, PwdProtectedKey, RecipientWithPublicKey } from "./types.js";
2
2
 
3
3
  //#region src/email-crypto/hybridEncyptedEmail.d.ts
4
4
  /**
@@ -57,5 +57,68 @@ declare function decryptPwdProtectedEmail(encryptedEmail: PwdProtectedEmail, pas
57
57
  */
58
58
  declare function generateEmailKeys(): Promise<HybridKeyPair>;
59
59
  //#endregion
60
- export { createPwdProtectedEmail, decryptEmailHybrid, decryptPwdProtectedEmail, encryptEmailHybrid, encryptEmailHybridForMultipleRecipients, generateEmailKeys };
60
+ //#region src/email-crypto/core.d.ts
61
+ /**
62
+ * Symmetrically encrypts email body.
63
+ *
64
+ * @param body - The email body to encrypt.
65
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
66
+ * @returns The resulting encrypted email body and symmetric key used for encryption
67
+ */
68
+ declare function encryptEmailBody(body: EmailBody, aux?: Uint8Array): Promise<{
69
+ encEmailBody: EmailBodyEncrypted;
70
+ encryptionKey: Uint8Array;
71
+ }>;
72
+ /**
73
+ * Symmetrically encrypts email body with the given key.
74
+ *
75
+ * @param body - The email body to encrypt.
76
+ * @param encryptionKey - The symmetric key to encrypt the email.
77
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
78
+ * @returns The resulting encrypted email body and symmetric key used for encryption
79
+ */
80
+ declare function encryptEmailBodyWithKey(body: EmailBody, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailBodyEncrypted>;
81
+ /**
82
+ * Decrypts symmetrically encrypted email body.
83
+ *
84
+ * @param encEmailBody - The email body to decrypt.
85
+ * @param encryptionKey - The symmetric key to decrypt the email.
86
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
87
+ * @returns The resulting decrypted email body
88
+ */
89
+ declare function decryptEmailBody(encEmailBody: EmailBodyEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailBody>;
90
+ /**
91
+ * Encrypts the email symmetric key using hybrid encryption.
92
+ *
93
+ * @param emailEncryptionKey - The symmetric key used for email encryption.
94
+ * @param recipient - The recipient with a public hybrid key.
95
+ * @returns The encrypted email symmetric key
96
+ */
97
+ declare function encryptKeysHybrid(emailEncryptionKey: Uint8Array, recipient: RecipientWithPublicKey): Promise<HybridEncKey>;
98
+ /**
99
+ * Decrypts the email symmetric key encrypted via hybrid encryption.
100
+ *
101
+ * @param encryptedKey - The encrypted email key.
102
+ * @param recipientPrivateKey - The private key of the recipient.
103
+ * @returns The email encryption key
104
+ */
105
+ declare function decryptKeysHybrid(encryptedKey: HybridEncKey, recipientPrivateKey: Uint8Array): Promise<Uint8Array>;
106
+ /**
107
+ * Password-protects the email symmetric key.
108
+ *
109
+ * @param emailEncryptionKey - The symmetric key used for email encryption.
110
+ * @param password - The secret password for key protection.
111
+ * @returns The password-protected email symmetric key
112
+ */
113
+ declare function passwordProtectKey(emailEncryptionKey: Uint8Array, password: string): Promise<PwdProtectedKey>;
114
+ /**
115
+ * Removes passoword-protection and exposes the email symmetric key.
116
+ *
117
+ * @param emailEncryptionKey - The password-protected email key.
118
+ * @param password - The secret password for key protection.
119
+ * @returns The email encryption key
120
+ */
121
+ declare function removePasswordProtection(emailEncryptionKey: PwdProtectedKey, password: string): Promise<Uint8Array>;
122
+ //#endregion
123
+ export { createPwdProtectedEmail, decryptEmailBody, decryptEmailHybrid, decryptKeysHybrid, decryptPwdProtectedEmail, encryptEmailBody, encryptEmailBodyWithKey, encryptEmailHybrid, encryptEmailHybridForMultipleRecipients, encryptKeysHybrid, generateEmailKeys, passwordProtectKey, removePasswordProtection };
61
124
  //# sourceMappingURL=email-crypto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"email-crypto.d.ts","names":[],"sources":["../src/email-crypto/hybridEncyptedEmail.ts","../src/email-crypto/pwdProtectedEmail.ts","../src/email-crypto/emailKeys.ts"],"mappings":";;;;;AAWA;;;;;;iBAAsB,kBAAA,CACpB,IAAA,EAAM,SAAA,EACN,SAAA,EAAW,sBAAA,EACX,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;;;;;;iBAkBW,uCAAA,CACpB,IAAA,EAAM,SAAA,EACN,UAAA,EAAY,sBAAA,IACZ,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;;AAJX;;;;iBA8BsB,kBAAA,CACpB,YAAA,EAAc,oBAAA,EACd,0BAAA,EAA4B,UAAA,EAC5B,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,SAAA;;;;;AAxDX;;;;;;iBCAsB,uBAAA,CACpB,SAAA,EAAW,SAAA,EACX,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,iBAAA;;;;;;;;;iBAmBW,wBAAA,CACpB,cAAA,EAAgB,iBAAA,EAChB,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,SAAA;;;;;AD3BX;;;iBEHsB,iBAAA,CAAA,GAAqB,OAAA,CAAQ,aAAA"}
1
+ {"version":3,"file":"email-crypto.d.ts","names":[],"sources":["../src/email-crypto/hybridEncyptedEmail.ts","../src/email-crypto/pwdProtectedEmail.ts","../src/email-crypto/emailKeys.ts","../src/email-crypto/core.ts"],"mappings":";;;;;AAWA;;;;;;iBAAsB,kBAAA,CACpB,IAAA,EAAM,SAAA,EACN,SAAA,EAAW,sBAAA,EACX,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;;;;;;iBAkBW,uCAAA,CACpB,IAAA,EAAM,SAAA,EACN,UAAA,EAAY,sBAAA,IACZ,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;;AAJX;;;;iBA8BsB,kBAAA,CACpB,YAAA,EAAc,oBAAA,EACd,0BAAA,EAA4B,UAAA,EAC5B,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,SAAA;;;;;AAxDX;;;;;;iBCAsB,uBAAA,CACpB,SAAA,EAAW,SAAA,EACX,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,iBAAA;;;;;;;;;iBAmBW,wBAAA,CACpB,cAAA,EAAgB,iBAAA,EAChB,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,SAAA;;;;;AD3BX;;;iBEHsB,iBAAA,CAAA,GAAqB,OAAA,CAAQ,aAAA;;;;;AFGnD;;;;;iBGGsB,gBAAA,CACpB,IAAA,EAAM,SAAA,EACN,GAAA,GAAM,UAAA,GACL,OAAA;EACD,YAAA,EAAc,kBAAA;EACd,aAAA,EAAe,UAAA;AAAA;;;;;;;;;iBAuBK,uBAAA,CACpB,IAAA,EAAM,SAAA,EACN,aAAA,EAAe,UAAA,EACf,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,kBAAA;;;AHbX;;;;;;iBG8CsB,gBAAA,CACpB,YAAA,EAAc,kBAAA,EACd,aAAA,EAAe,UAAA,EACf,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,SAAA;;;;;;;;iBA8BW,iBAAA,CACpB,kBAAA,EAAoB,UAAA,EACpB,SAAA,EAAW,sBAAA,GACV,OAAA,CAAQ,YAAA;;;;;;AHrDX;;iBG6EsB,iBAAA,CACpB,YAAA,EAAc,YAAA,EACd,mBAAA,EAAqB,UAAA,GACpB,OAAA,CAAQ,UAAA;;;;;;;;iBAmBW,kBAAA,CAAmB,kBAAA,EAAoB,UAAA,EAAY,QAAA,WAAmB,OAAA,CAAQ,eAAA;;;;;;;;iBAmB9E,wBAAA,CACpB,kBAAA,EAAoB,eAAA,EACpB,QAAA,WACC,OAAA,CAAQ,UAAA"}
@@ -1,122 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_xwing = require('./xwing-iRWVRtNE.js');
3
- const require_core = require('./core-Bj26rNdA.js');
2
+ const require_emailKeys = require('./emailKeys-DWvKANTZ.js');
4
3
 
5
- //#region src/email-crypto/hybridEncyptedEmail.ts
6
- /**
7
- * Encrypts the email body using hybrid encryption.
8
- *
9
- * @param body - The email body to encrypt.
10
- * @param recipientPublicKeys - The public keys of the recipient.
11
- * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
12
- * @returns The encrypted email body
13
- */
14
- async function encryptEmailHybrid(body, recipient, aux) {
15
- try {
16
- const { encryptionKey, encEmailBody } = await require_core.encryptEmailBody(body, aux);
17
- return {
18
- encEmailBody,
19
- encryptedKey: await require_core.encryptKeysHybrid(encryptionKey, recipient)
20
- };
21
- } catch (error) {
22
- throw new Error("Failed to encrypt email body with hybrid encryption", { cause: error });
23
- }
24
- }
25
- /**
26
- * Encrypts the email body using hybrid encryption for multiple recipients.
27
- *
28
- * @param body - The email body to encrypt for multiple recipients.
29
- * @param recipients - The recipients with corresponding public keys.
30
- * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
31
- * @returns The set of encrypted email bodies
32
- */
33
- async function encryptEmailHybridForMultipleRecipients(body, recipients, aux) {
34
- try {
35
- const { encryptionKey, encEmailBody } = await require_core.encryptEmailBody(body, aux);
36
- const encryptedEmails = [];
37
- for (const recipient of recipients) {
38
- const encryptedKey = await require_core.encryptKeysHybrid(encryptionKey, recipient);
39
- encryptedEmails.push({
40
- encEmailBody,
41
- encryptedKey
42
- });
43
- }
44
- return encryptedEmails;
45
- } catch (error) {
46
- throw new Error("Failed to encrypt email to multiple recipients with hybrid encryption", { cause: error });
47
- }
48
- }
49
- /**
50
- * Decrypts the email using hybrid encryption.
51
- *
52
- * @param encEmailBody - The encrypted email.
53
- * @param recipientPrivateHybridKeys - The private key of the recipient.
54
- * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
55
- * @returns The decrypted email body
56
- */
57
- async function decryptEmailHybrid(encEmailBody, recipientPrivateHybridKeys, aux) {
58
- try {
59
- const encryptionKey = await require_core.decryptKeysHybrid(encEmailBody.encryptedKey, recipientPrivateHybridKeys);
60
- return await require_core.decryptEmailBody(encEmailBody.encEmailBody, encryptionKey, aux);
61
- } catch (error) {
62
- throw new Error("Failed to decrypt email with hybrid encryption", { cause: error });
63
- }
64
- }
65
-
66
- //#endregion
67
- //#region src/email-crypto/pwdProtectedEmail.ts
68
- /**
69
- * Creates a password-protected email.
70
- *
71
- * @param email - The email to password-protect
72
- * @param password - The secret password shared among recipients
73
- * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
74
- * @returns The password-protected email
75
- */
76
- async function createPwdProtectedEmail(emailBody, password, aux) {
77
- try {
78
- const { encryptionKey, encEmailBody } = await require_core.encryptEmailBody(emailBody, aux);
79
- return {
80
- encEmailBody,
81
- encryptedKey: await require_core.passwordProtectKey(encryptionKey, password)
82
- };
83
- } catch (error) {
84
- throw new Error("Failed to password-protect email", { cause: error });
85
- }
86
- }
87
- /**
88
- * Opens a password-protected email.
89
- *
90
- * @param encryptedEmail - The encrypted email
91
- * @param password - The secret password shared among recipients.
92
- * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
93
- * @returns The decrypted email body
94
- */
95
- async function decryptPwdProtectedEmail(encryptedEmail, password, aux) {
96
- try {
97
- const encryptionKey = await require_core.removePasswordProtection(encryptedEmail.encryptedKey, password);
98
- return await require_core.decryptEmailBody(encryptedEmail.encEmailBody, encryptionKey, aux);
99
- } catch (error) {
100
- throw new Error("Failed to decrypt password-protect email", { cause: error });
101
- }
102
- }
103
-
104
- //#endregion
105
- //#region src/email-crypto/emailKeys.ts
106
- /**
107
- * Generates public and private keys for email encryption.
108
- *
109
- * @returns The user's private and public keys
110
- */
111
- async function generateEmailKeys() {
112
- return require_xwing.genHybridKeys();
113
- }
114
-
115
- //#endregion
116
- exports.createPwdProtectedEmail = createPwdProtectedEmail;
117
- exports.decryptEmailHybrid = decryptEmailHybrid;
118
- exports.decryptPwdProtectedEmail = decryptPwdProtectedEmail;
119
- exports.encryptEmailHybrid = encryptEmailHybrid;
120
- exports.encryptEmailHybridForMultipleRecipients = encryptEmailHybridForMultipleRecipients;
121
- exports.generateEmailKeys = generateEmailKeys;
122
- //# sourceMappingURL=email-crypto.js.map
4
+ exports.createPwdProtectedEmail = require_emailKeys.createPwdProtectedEmail;
5
+ exports.decryptEmailBody = require_emailKeys.decryptEmailBody;
6
+ exports.decryptEmailHybrid = require_emailKeys.decryptEmailHybrid;
7
+ exports.decryptKeysHybrid = require_emailKeys.decryptKeysHybrid;
8
+ exports.decryptPwdProtectedEmail = require_emailKeys.decryptPwdProtectedEmail;
9
+ exports.encryptEmailBody = require_emailKeys.encryptEmailBody;
10
+ exports.encryptEmailBodyWithKey = require_emailKeys.encryptEmailBodyWithKey;
11
+ exports.encryptEmailHybrid = require_emailKeys.encryptEmailHybrid;
12
+ exports.encryptEmailHybridForMultipleRecipients = require_emailKeys.encryptEmailHybridForMultipleRecipients;
13
+ exports.encryptKeysHybrid = require_emailKeys.encryptKeysHybrid;
14
+ exports.generateEmailKeys = require_emailKeys.generateEmailKeys;
15
+ exports.passwordProtectKey = require_emailKeys.passwordProtectKey;
16
+ exports.removePasswordProtection = require_emailKeys.removePasswordProtection;
@@ -1,116 +1,3 @@
1
- import { r as genHybridKeys } from "./xwing-CQmQX6hn.mjs";
2
- import { a as encryptKeysHybrid, n as decryptKeysHybrid, o as passwordProtectKey, r as encryptEmailBody, s as removePasswordProtection, t as decryptEmailBody } from "./core-pEGygy6S.mjs";
1
+ import { a as encryptEmailHybrid, c as decryptKeysHybrid, d as encryptKeysHybrid, f as passwordProtectKey, i as decryptEmailHybrid, l as encryptEmailBody, n as createPwdProtectedEmail, o as encryptEmailHybridForMultipleRecipients, p as removePasswordProtection, r as decryptPwdProtectedEmail, s as decryptEmailBody, t as generateEmailKeys, u as encryptEmailBodyWithKey } from "./emailKeys-nzn7U7HQ.mjs";
3
2
 
4
- //#region src/email-crypto/hybridEncyptedEmail.ts
5
- /**
6
- * Encrypts the email body using hybrid encryption.
7
- *
8
- * @param body - The email body to encrypt.
9
- * @param recipientPublicKeys - The public keys of the recipient.
10
- * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
11
- * @returns The encrypted email body
12
- */
13
- async function encryptEmailHybrid(body, recipient, aux) {
14
- try {
15
- const { encryptionKey, encEmailBody } = await encryptEmailBody(body, aux);
16
- return {
17
- encEmailBody,
18
- encryptedKey: await encryptKeysHybrid(encryptionKey, recipient)
19
- };
20
- } catch (error) {
21
- throw new Error("Failed to encrypt email body with hybrid encryption", { cause: error });
22
- }
23
- }
24
- /**
25
- * Encrypts the email body using hybrid encryption for multiple recipients.
26
- *
27
- * @param body - The email body to encrypt for multiple recipients.
28
- * @param recipients - The recipients with corresponding public keys.
29
- * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
30
- * @returns The set of encrypted email bodies
31
- */
32
- async function encryptEmailHybridForMultipleRecipients(body, recipients, aux) {
33
- try {
34
- const { encryptionKey, encEmailBody } = await encryptEmailBody(body, aux);
35
- const encryptedEmails = [];
36
- for (const recipient of recipients) {
37
- const encryptedKey = await encryptKeysHybrid(encryptionKey, recipient);
38
- encryptedEmails.push({
39
- encEmailBody,
40
- encryptedKey
41
- });
42
- }
43
- return encryptedEmails;
44
- } catch (error) {
45
- throw new Error("Failed to encrypt email to multiple recipients with hybrid encryption", { cause: error });
46
- }
47
- }
48
- /**
49
- * Decrypts the email using hybrid encryption.
50
- *
51
- * @param encEmailBody - The encrypted email.
52
- * @param recipientPrivateHybridKeys - The private key of the recipient.
53
- * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
54
- * @returns The decrypted email body
55
- */
56
- async function decryptEmailHybrid(encEmailBody, recipientPrivateHybridKeys, aux) {
57
- try {
58
- const encryptionKey = await decryptKeysHybrid(encEmailBody.encryptedKey, recipientPrivateHybridKeys);
59
- return await decryptEmailBody(encEmailBody.encEmailBody, encryptionKey, aux);
60
- } catch (error) {
61
- throw new Error("Failed to decrypt email with hybrid encryption", { cause: error });
62
- }
63
- }
64
-
65
- //#endregion
66
- //#region src/email-crypto/pwdProtectedEmail.ts
67
- /**
68
- * Creates a password-protected email.
69
- *
70
- * @param email - The email to password-protect
71
- * @param password - The secret password shared among recipients
72
- * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
73
- * @returns The password-protected email
74
- */
75
- async function createPwdProtectedEmail(emailBody, password, aux) {
76
- try {
77
- const { encryptionKey, encEmailBody } = await encryptEmailBody(emailBody, aux);
78
- return {
79
- encEmailBody,
80
- encryptedKey: await passwordProtectKey(encryptionKey, password)
81
- };
82
- } catch (error) {
83
- throw new Error("Failed to password-protect email", { cause: error });
84
- }
85
- }
86
- /**
87
- * Opens a password-protected email.
88
- *
89
- * @param encryptedEmail - The encrypted email
90
- * @param password - The secret password shared among recipients.
91
- * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
92
- * @returns The decrypted email body
93
- */
94
- async function decryptPwdProtectedEmail(encryptedEmail, password, aux) {
95
- try {
96
- const encryptionKey = await removePasswordProtection(encryptedEmail.encryptedKey, password);
97
- return await decryptEmailBody(encryptedEmail.encEmailBody, encryptionKey, aux);
98
- } catch (error) {
99
- throw new Error("Failed to decrypt password-protect email", { cause: error });
100
- }
101
- }
102
-
103
- //#endregion
104
- //#region src/email-crypto/emailKeys.ts
105
- /**
106
- * Generates public and private keys for email encryption.
107
- *
108
- * @returns The user's private and public keys
109
- */
110
- async function generateEmailKeys() {
111
- return genHybridKeys();
112
- }
113
-
114
- //#endregion
115
- export { createPwdProtectedEmail, decryptEmailHybrid, decryptPwdProtectedEmail, encryptEmailHybrid, encryptEmailHybridForMultipleRecipients, generateEmailKeys };
116
- //# sourceMappingURL=email-crypto.mjs.map
3
+ export { createPwdProtectedEmail, decryptEmailBody, decryptEmailHybrid, decryptKeysHybrid, decryptPwdProtectedEmail, encryptEmailBody, encryptEmailBodyWithKey, encryptEmailHybrid, encryptEmailHybridForMultipleRecipients, encryptKeysHybrid, generateEmailKeys, passwordProtectKey, removePasswordProtection };
@@ -1,6 +1,6 @@
1
1
  const require_constants = require('./constants.js');
2
2
  const require_genID = require('./genID-cWOPmspk.js');
3
- const require_deriveKeysFromKey = require('./deriveKeysFromKey-C4McqO6_.js');
3
+ const require_deriveKeysFromKey = require('./deriveKeysFromKey-GTRMuxDj.js');
4
4
  const require_aes = require('./aes-CuW_SPl-.js');
5
5
  const require_xwing = require('./xwing-iRWVRtNE.js');
6
6
  const require_types = require('./types.js');
@@ -141,4 +141,4 @@ Object.defineProperty(exports, 'openRecoveryKeystore', {
141
141
  return openRecoveryKeystore;
142
142
  }
143
143
  });
144
- //# sourceMappingURL=emailEncryptionKey-C4X1Bwy4.js.map
144
+ //# sourceMappingURL=emailEncryptionKey-F_YuJu1H.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"emailEncryptionKey-C4X1Bwy4.js","names":["UTF8ToUint8","uint8ArrayToBase64","encryptSymmetrically","base64ToUint8Array","decryptSymmetrically","deriveSymmetricKeyFromContext","CONTEXT_RECOVERY","mnemonicToBytes","CONTEXT_ENC_KEYSTORE","genHybridKeys","KeystoreType","genMnemonic"],"sources":["../src/keystore-crypto/core.ts","../src/keystore-crypto/emailEncryptionKey.ts"],"sourcesContent":["import { encryptSymmetrically, decryptSymmetrically } from '../symmetric-crypto';\nimport { base64ToUint8Array, uint8ArrayToBase64, UTF8ToUint8, mnemonicToBytes } from '../utils';\nimport { deriveSymmetricKeyFromContext } from '../derive-key';\nimport { CONTEXT_ENC_KEYSTORE, CONTEXT_RECOVERY } from '../constants';\nimport { EncryptedKeystore, HybridKeyPair, KeystoreType } from '../types';\n\n/**\n * Encrypts the user's hybrid key using symmetric encryption to get a keystore\n *\n * @param secretKey - The symmetric key to encrypt the keystore content\n * @param key - The hybrid key pair\n * @param userEmail - The email of the user\n * @param type - The keystore type\n * @returns The encrypted keystore\n */\nexport async function encryptKeystoreContent(\n secretKey: Uint8Array,\n keys: HybridKeyPair,\n userEmail: string,\n type: KeystoreType,\n): Promise<EncryptedKeystore> {\n try {\n const aux = UTF8ToUint8(userEmail + type);\n const publicKey = uint8ArrayToBase64(keys.publicKey);\n const secretKeyEncrypted = await encryptSymmetrically(secretKey, keys.secretKey, aux);\n\n const keystore: EncryptedKeystore = {\n userEmail,\n type,\n publicKey,\n privateKeyEncrypted: uint8ArrayToBase64(secretKeyEncrypted),\n };\n return keystore;\n } catch (error) {\n throw new Error('Failed to encrypt keystore content', { cause: error });\n }\n}\n\n/**\n * Decrypts the keystore content using symmetric encryption\n *\n * @param kesytoreOpeningKey - The symmetric key to decrypt the keystore content\n * @param encryptedKeys - The encrypted keystore content\n * @returns The decrypted hybrid key pair contained in the keystore\n */\nexport async function decryptKeystoreContent(\n kesytoreOpeningKey: Uint8Array,\n encryptedKeystore: EncryptedKeystore,\n): Promise<HybridKeyPair> {\n try {\n const aux = UTF8ToUint8(encryptedKeystore.userEmail + encryptedKeystore.type);\n const publicKey = base64ToUint8Array(encryptedKeystore.publicKey);\n const ciphertext = base64ToUint8Array(encryptedKeystore.privateKeyEncrypted);\n const secretKey = await decryptSymmetrically(kesytoreOpeningKey, ciphertext, aux);\n return {\n publicKey,\n secretKey,\n };\n } catch (error) {\n throw new Error('Failed to decrypt keystore content', { cause: error });\n }\n}\n\n/**\n * Derives a secret key for protecting the recovery keystore\n *\n * @param recoveryCodes - The recovery codes\n * @returns The derived secret key for protecting the recovery keystore\n */\nexport async function deriveRecoveryKey(recoveryCodes: string): Promise<Uint8Array> {\n const recoverCodesArray = mnemonicToBytes(recoveryCodes);\n return deriveSymmetricKeyFromContext(CONTEXT_RECOVERY, recoverCodesArray);\n}\n\n/**\n * Derives a secret key for protecting the encryption keystore\n *\n * @param baseKey - The base secret key from which a new key secret will be derived\n * @returns The derived secret key for protecting the encryption keystore\n */\nexport async function deriveEncryptionKeystoreKey(baseKey: Uint8Array): Promise<Uint8Array> {\n return deriveSymmetricKeyFromContext(CONTEXT_ENC_KEYSTORE, baseKey);\n}\n","import { EncryptedKeystore, KeystoreType, HybridKeyPair } from '../types';\nimport { genMnemonic } from '../utils';\nimport { encryptKeystoreContent, decryptKeystoreContent, deriveEncryptionKeystoreKey, deriveRecoveryKey } from './core';\nimport { genHybridKeys } from '../hybrid-crypto';\n\n/**\n * Generates hybrid keys and creates encrypted main and recovery keystores\n * The main keystore encryption key is derived from the base key (stored in session storage)\n * The recovery keystore encryption key is derived from the recovery codes\n *\n * @returns The encryption and recovery keystores, recovery codes and hybrid keys\n */\nexport async function createEncryptionAndRecoveryKeystores(\n userEmail: string,\n baseKey: Uint8Array,\n): Promise<{\n encryptionKeystore: EncryptedKeystore;\n recoveryKeystore: EncryptedKeystore;\n recoveryCodes: string;\n keys: HybridKeyPair;\n}> {\n try {\n const keys = genHybridKeys();\n\n const secretKey = await deriveEncryptionKeystoreKey(baseKey);\n const encryptionKeystore = await encryptKeystoreContent(secretKey, keys, userEmail, KeystoreType.ENCRYPTION);\n\n const recoveryCodes = genMnemonic();\n const recoveryKey = await deriveRecoveryKey(recoveryCodes);\n const recoveryKeystore = await encryptKeystoreContent(recoveryKey, keys, userEmail, KeystoreType.RECOVERY);\n\n return { encryptionKeystore, recoveryKeystore, recoveryCodes, keys };\n } catch (error) {\n throw new Error('Failed to create encryption and recovery keystores', { cause: error });\n }\n}\n\n/**\n * Opens the encryption keystore and returns the email encryption keys\n * The decryption key is derived from the base key (stored in session storage)\n *\n * @param encryptedKeystore - The encrypted keystore containing encryption keys\n * @param baseKey - The base key from which the decryption key will be derived\n * @returns The encryption keys\n */\nexport async function openEncryptionKeystore(\n encryptedKeystore: EncryptedKeystore,\n baseKey: Uint8Array,\n): Promise<HybridKeyPair> {\n try {\n if (encryptedKeystore.type != KeystoreType.ENCRYPTION) {\n throw new Error('Input is invalid');\n }\n const secretKey = await deriveEncryptionKeystoreKey(baseKey);\n const keys = await decryptKeystoreContent(secretKey, encryptedKeystore);\n return keys;\n } catch (error) {\n throw new Error('Failed to open encryption keystore', { cause: error });\n }\n}\n\n/**\n * Opens the recovery keystore and returns the email encryption keys\n * The decryption key is derived from the base key (stored in session storage)\n *\n * @param recoveryCodes - The user's recovery codes\n * @param encryptedKeystore - The encrypted keystore containing encryption keys\n * @returns The encryption keys\n */\nexport async function openRecoveryKeystore(\n recoveryCodes: string,\n encryptedKeystore: EncryptedKeystore,\n): Promise<HybridKeyPair> {\n try {\n if (encryptedKeystore.type != KeystoreType.RECOVERY) {\n throw new Error('Input is invalid');\n }\n const recoveryKey = await deriveRecoveryKey(recoveryCodes);\n const keys = await decryptKeystoreContent(recoveryKey, encryptedKeystore);\n return keys;\n } catch (error) {\n throw new Error('Failed to open recovery keystore', { cause: error });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,eAAsB,uBACpB,WACA,MACA,WACA,MAC4B;AAC5B,KAAI;EACF,MAAM,MAAMA,0BAAY,YAAY,KAAK;AAUzC,SANoC;GAClC;GACA;GACA,WANgBC,iCAAmB,KAAK,UAAU;GAOlD,qBAAqBA,iCANI,MAAMC,iCAAqB,WAAW,KAAK,WAAW,IAAI,CAMxB;GAC5D;UAEM,OAAO;AACd,QAAM,IAAI,MAAM,sCAAsC,EAAE,OAAO,OAAO,CAAC;;;;;;;;;;AAW3E,eAAsB,uBACpB,oBACA,mBACwB;AACxB,KAAI;EACF,MAAM,MAAMF,0BAAY,kBAAkB,YAAY,kBAAkB,KAAK;AAI7E,SAAO;GACL,WAJgBG,iCAAmB,kBAAkB,UAAU;GAK/D,WAHgB,MAAMC,iCAAqB,oBAD1BD,iCAAmB,kBAAkB,oBAAoB,EACC,IAAI;GAIhF;UACM,OAAO;AACd,QAAM,IAAI,MAAM,sCAAsC,EAAE,OAAO,OAAO,CAAC;;;;;;;;;AAU3E,eAAsB,kBAAkB,eAA4C;AAElF,QAAOE,wDAA8BC,oCADXC,8BAAgB,cAAc,CACiB;;;;;;;;AAS3E,eAAsB,4BAA4B,SAA0C;AAC1F,QAAOF,wDAA8BG,wCAAsB,QAAQ;;;;;;;;;;;;ACrErE,eAAsB,qCACpB,WACA,SAMC;AACD,KAAI;EACF,MAAM,OAAOC,6BAAe;EAG5B,MAAM,qBAAqB,MAAM,uBADf,MAAM,4BAA4B,QAAQ,EACO,MAAM,WAAWC,2BAAa,WAAW;EAE5G,MAAM,gBAAgBC,2BAAa;AAInC,SAAO;GAAE;GAAoB,kBAFJ,MAAM,uBADX,MAAM,kBAAkB,cAAc,EACS,MAAM,WAAWD,2BAAa,SAAS;GAE3D;GAAe;GAAM;UAC7D,OAAO;AACd,QAAM,IAAI,MAAM,sDAAsD,EAAE,OAAO,OAAO,CAAC;;;;;;;;;;;AAY3F,eAAsB,uBACpB,mBACA,SACwB;AACxB,KAAI;AACF,MAAI,kBAAkB,QAAQA,2BAAa,WACzC,OAAM,IAAI,MAAM,mBAAmB;AAIrC,SADa,MAAM,uBADD,MAAM,4BAA4B,QAAQ,EACP,kBAAkB;UAEhE,OAAO;AACd,QAAM,IAAI,MAAM,sCAAsC,EAAE,OAAO,OAAO,CAAC;;;;;;;;;;;AAY3E,eAAsB,qBACpB,eACA,mBACwB;AACxB,KAAI;AACF,MAAI,kBAAkB,QAAQA,2BAAa,SACzC,OAAM,IAAI,MAAM,mBAAmB;AAIrC,SADa,MAAM,uBADC,MAAM,kBAAkB,cAAc,EACH,kBAAkB;UAElE,OAAO;AACd,QAAM,IAAI,MAAM,oCAAoC,EAAE,OAAO,OAAO,CAAC"}
1
+ {"version":3,"file":"emailEncryptionKey-F_YuJu1H.js","names":["UTF8ToUint8","uint8ArrayToBase64","encryptSymmetrically","base64ToUint8Array","decryptSymmetrically","deriveSymmetricKeyFromContext","CONTEXT_RECOVERY","mnemonicToBytes","CONTEXT_ENC_KEYSTORE","genHybridKeys","KeystoreType","genMnemonic"],"sources":["../src/keystore-crypto/core.ts","../src/keystore-crypto/emailEncryptionKey.ts"],"sourcesContent":["import { encryptSymmetrically, decryptSymmetrically } from '../symmetric-crypto';\nimport { base64ToUint8Array, uint8ArrayToBase64, UTF8ToUint8, mnemonicToBytes } from '../utils';\nimport { deriveSymmetricKeyFromContext } from '../derive-key';\nimport { CONTEXT_ENC_KEYSTORE, CONTEXT_RECOVERY } from '../constants';\nimport { EncryptedKeystore, HybridKeyPair, KeystoreType } from '../types';\n\n/**\n * Encrypts the user's hybrid key using symmetric encryption to get a keystore\n *\n * @param secretKey - The symmetric key to encrypt the keystore content\n * @param key - The hybrid key pair\n * @param userEmail - The email of the user\n * @param type - The keystore type\n * @returns The encrypted keystore\n */\nexport async function encryptKeystoreContent(\n secretKey: Uint8Array,\n keys: HybridKeyPair,\n userEmail: string,\n type: KeystoreType,\n): Promise<EncryptedKeystore> {\n try {\n const aux = UTF8ToUint8(userEmail + type);\n const publicKey = uint8ArrayToBase64(keys.publicKey);\n const secretKeyEncrypted = await encryptSymmetrically(secretKey, keys.secretKey, aux);\n\n const keystore: EncryptedKeystore = {\n userEmail,\n type,\n publicKey,\n privateKeyEncrypted: uint8ArrayToBase64(secretKeyEncrypted),\n };\n return keystore;\n } catch (error) {\n throw new Error('Failed to encrypt keystore content', { cause: error });\n }\n}\n\n/**\n * Decrypts the keystore content using symmetric encryption\n *\n * @param kesytoreOpeningKey - The symmetric key to decrypt the keystore content\n * @param encryptedKeys - The encrypted keystore content\n * @returns The decrypted hybrid key pair contained in the keystore\n */\nexport async function decryptKeystoreContent(\n kesytoreOpeningKey: Uint8Array,\n encryptedKeystore: EncryptedKeystore,\n): Promise<HybridKeyPair> {\n try {\n const aux = UTF8ToUint8(encryptedKeystore.userEmail + encryptedKeystore.type);\n const publicKey = base64ToUint8Array(encryptedKeystore.publicKey);\n const ciphertext = base64ToUint8Array(encryptedKeystore.privateKeyEncrypted);\n const secretKey = await decryptSymmetrically(kesytoreOpeningKey, ciphertext, aux);\n return {\n publicKey,\n secretKey,\n };\n } catch (error) {\n throw new Error('Failed to decrypt keystore content', { cause: error });\n }\n}\n\n/**\n * Derives a secret key for protecting the recovery keystore\n *\n * @param recoveryCodes - The recovery codes\n * @returns The derived secret key for protecting the recovery keystore\n */\nexport async function deriveRecoveryKey(recoveryCodes: string): Promise<Uint8Array> {\n const recoverCodesArray = mnemonicToBytes(recoveryCodes);\n return deriveSymmetricKeyFromContext(CONTEXT_RECOVERY, recoverCodesArray);\n}\n\n/**\n * Derives a secret key for protecting the encryption keystore\n *\n * @param baseKey - The base secret key from which a new key secret will be derived\n * @returns The derived secret key for protecting the encryption keystore\n */\nexport async function deriveEncryptionKeystoreKey(baseKey: Uint8Array): Promise<Uint8Array> {\n return deriveSymmetricKeyFromContext(CONTEXT_ENC_KEYSTORE, baseKey);\n}\n","import { EncryptedKeystore, KeystoreType, HybridKeyPair } from '../types';\nimport { genMnemonic } from '../utils';\nimport { encryptKeystoreContent, decryptKeystoreContent, deriveEncryptionKeystoreKey, deriveRecoveryKey } from './core';\nimport { genHybridKeys } from '../hybrid-crypto';\n\n/**\n * Generates hybrid keys and creates encrypted main and recovery keystores\n * The main keystore encryption key is derived from the base key (stored in session storage)\n * The recovery keystore encryption key is derived from the recovery codes\n *\n * @returns The encryption and recovery keystores, recovery codes and hybrid keys\n */\nexport async function createEncryptionAndRecoveryKeystores(\n userEmail: string,\n baseKey: Uint8Array,\n): Promise<{\n encryptionKeystore: EncryptedKeystore;\n recoveryKeystore: EncryptedKeystore;\n recoveryCodes: string;\n keys: HybridKeyPair;\n}> {\n try {\n const keys = genHybridKeys();\n\n const secretKey = await deriveEncryptionKeystoreKey(baseKey);\n const encryptionKeystore = await encryptKeystoreContent(secretKey, keys, userEmail, KeystoreType.ENCRYPTION);\n\n const recoveryCodes = genMnemonic();\n const recoveryKey = await deriveRecoveryKey(recoveryCodes);\n const recoveryKeystore = await encryptKeystoreContent(recoveryKey, keys, userEmail, KeystoreType.RECOVERY);\n\n return { encryptionKeystore, recoveryKeystore, recoveryCodes, keys };\n } catch (error) {\n throw new Error('Failed to create encryption and recovery keystores', { cause: error });\n }\n}\n\n/**\n * Opens the encryption keystore and returns the email encryption keys\n * The decryption key is derived from the base key (stored in session storage)\n *\n * @param encryptedKeystore - The encrypted keystore containing encryption keys\n * @param baseKey - The base key from which the decryption key will be derived\n * @returns The encryption keys\n */\nexport async function openEncryptionKeystore(\n encryptedKeystore: EncryptedKeystore,\n baseKey: Uint8Array,\n): Promise<HybridKeyPair> {\n try {\n if (encryptedKeystore.type != KeystoreType.ENCRYPTION) {\n throw new Error('Input is invalid');\n }\n const secretKey = await deriveEncryptionKeystoreKey(baseKey);\n const keys = await decryptKeystoreContent(secretKey, encryptedKeystore);\n return keys;\n } catch (error) {\n throw new Error('Failed to open encryption keystore', { cause: error });\n }\n}\n\n/**\n * Opens the recovery keystore and returns the email encryption keys\n * The decryption key is derived from the base key (stored in session storage)\n *\n * @param recoveryCodes - The user's recovery codes\n * @param encryptedKeystore - The encrypted keystore containing encryption keys\n * @returns The encryption keys\n */\nexport async function openRecoveryKeystore(\n recoveryCodes: string,\n encryptedKeystore: EncryptedKeystore,\n): Promise<HybridKeyPair> {\n try {\n if (encryptedKeystore.type != KeystoreType.RECOVERY) {\n throw new Error('Input is invalid');\n }\n const recoveryKey = await deriveRecoveryKey(recoveryCodes);\n const keys = await decryptKeystoreContent(recoveryKey, encryptedKeystore);\n return keys;\n } catch (error) {\n throw new Error('Failed to open recovery keystore', { cause: error });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,eAAsB,uBACpB,WACA,MACA,WACA,MAC4B;AAC5B,KAAI;EACF,MAAM,MAAMA,0BAAY,YAAY,KAAK;AAUzC,SANoC;GAClC;GACA;GACA,WANgBC,iCAAmB,KAAK,UAAU;GAOlD,qBAAqBA,iCANI,MAAMC,iCAAqB,WAAW,KAAK,WAAW,IAAI,CAMxB;GAC5D;UAEM,OAAO;AACd,QAAM,IAAI,MAAM,sCAAsC,EAAE,OAAO,OAAO,CAAC;;;;;;;;;;AAW3E,eAAsB,uBACpB,oBACA,mBACwB;AACxB,KAAI;EACF,MAAM,MAAMF,0BAAY,kBAAkB,YAAY,kBAAkB,KAAK;AAI7E,SAAO;GACL,WAJgBG,iCAAmB,kBAAkB,UAAU;GAK/D,WAHgB,MAAMC,iCAAqB,oBAD1BD,iCAAmB,kBAAkB,oBAAoB,EACC,IAAI;GAIhF;UACM,OAAO;AACd,QAAM,IAAI,MAAM,sCAAsC,EAAE,OAAO,OAAO,CAAC;;;;;;;;;AAU3E,eAAsB,kBAAkB,eAA4C;AAElF,QAAOE,wDAA8BC,oCADXC,8BAAgB,cAAc,CACiB;;;;;;;;AAS3E,eAAsB,4BAA4B,SAA0C;AAC1F,QAAOF,wDAA8BG,wCAAsB,QAAQ;;;;;;;;;;;;ACrErE,eAAsB,qCACpB,WACA,SAMC;AACD,KAAI;EACF,MAAM,OAAOC,6BAAe;EAG5B,MAAM,qBAAqB,MAAM,uBADf,MAAM,4BAA4B,QAAQ,EACO,MAAM,WAAWC,2BAAa,WAAW;EAE5G,MAAM,gBAAgBC,2BAAa;AAInC,SAAO;GAAE;GAAoB,kBAFJ,MAAM,uBADX,MAAM,kBAAkB,cAAc,EACS,MAAM,WAAWD,2BAAa,SAAS;GAE3D;GAAe;GAAM;UAC7D,OAAO;AACd,QAAM,IAAI,MAAM,sDAAsD,EAAE,OAAO,OAAO,CAAC;;;;;;;;;;;AAY3F,eAAsB,uBACpB,mBACA,SACwB;AACxB,KAAI;AACF,MAAI,kBAAkB,QAAQA,2BAAa,WACzC,OAAM,IAAI,MAAM,mBAAmB;AAIrC,SADa,MAAM,uBADD,MAAM,4BAA4B,QAAQ,EACP,kBAAkB;UAEhE,OAAO;AACd,QAAM,IAAI,MAAM,sCAAsC,EAAE,OAAO,OAAO,CAAC;;;;;;;;;;;AAY3E,eAAsB,qBACpB,eACA,mBACwB;AACxB,KAAI;AACF,MAAI,kBAAkB,QAAQA,2BAAa,SACzC,OAAM,IAAI,MAAM,mBAAmB;AAIrC,SADa,MAAM,uBADC,MAAM,kBAAkB,cAAc,EACH,kBAAkB;UAElE,OAAO;AACd,QAAM,IAAI,MAAM,oCAAoC,EAAE,OAAO,OAAO,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { CONTEXT_ENC_KEYSTORE, CONTEXT_RECOVERY } from "./constants.mjs";
2
2
  import { a as genMnemonic, c as base64ToUint8Array, o as mnemonicToBytes, s as UTF8ToUint8, u as uint8ArrayToBase64 } from "./genID-D08K7JPr.mjs";
3
- import { t as deriveSymmetricKeyFromContext } from "./deriveKeysFromKey-DPU_h7wr.mjs";
3
+ import { n as deriveSymmetricKeyFromContext } from "./deriveKeysFromKey-CseBjg0n.mjs";
4
4
  import { n as encryptSymmetrically, t as decryptSymmetrically } from "./aes-B8TA-JKq.mjs";
5
5
  import { r as genHybridKeys } from "./xwing-CQmQX6hn.mjs";
6
6
  import { KeystoreType } from "./types.mjs";
@@ -124,4 +124,4 @@ async function openRecoveryKeystore(recoveryCodes, encryptedKeystore) {
124
124
 
125
125
  //#endregion
126
126
  export { openEncryptionKeystore as n, openRecoveryKeystore as r, createEncryptionAndRecoveryKeystores as t };
127
- //# sourceMappingURL=emailEncryptionKey-BtSPYd9M.mjs.map
127
+ //# sourceMappingURL=emailEncryptionKey-kIsseFo6.mjs.map