internxt-crypto 1.3.0 → 1.4.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 (101) hide show
  1. package/README.md +15 -73
  2. package/dist/asymmetric-crypto.js +3 -4
  3. package/dist/asymmetric-crypto.js.map +1 -1
  4. package/dist/asymmetric-crypto.mjs +1 -2
  5. package/dist/asymmetric-crypto.mjs.map +1 -1
  6. package/dist/chunk-C13QxCFV.js +50 -0
  7. package/dist/chunk-CfYAbeIz.mjs +13 -0
  8. package/dist/constants.js +2 -3
  9. package/dist/constants.js.map +1 -1
  10. package/dist/constants.mjs +1 -1
  11. package/dist/derive-key.js +50 -5
  12. package/dist/derive-key.js.map +1 -0
  13. package/dist/derive-key.mjs +46 -2
  14. package/dist/derive-key.mjs.map +1 -0
  15. package/dist/{deriveKeysFromPassword-iMHv-tIA.js → derive-password-CbYRDq7V.js} +25 -30
  16. package/dist/derive-password-CbYRDq7V.js.map +1 -0
  17. package/dist/{deriveKeysFromPassword-DFzo2OII.mjs → derive-password-PED-YfwE.mjs} +27 -34
  18. package/dist/derive-password-PED-YfwE.mjs.map +1 -0
  19. package/dist/derive-password.js +5 -6
  20. package/dist/derive-password.mjs +2 -3
  21. package/dist/email-crypto-Di814Pbk.js +739 -0
  22. package/dist/email-crypto-Di814Pbk.js.map +1 -0
  23. package/dist/email-crypto-DpjfXDes.mjs +535 -0
  24. package/dist/email-crypto-DpjfXDes.mjs.map +1 -0
  25. package/dist/email-crypto.d.mts +138 -29
  26. package/dist/email-crypto.d.mts.map +1 -1
  27. package/dist/email-crypto.d.ts +138 -29
  28. package/dist/email-crypto.d.ts.map +1 -1
  29. package/dist/email-crypto.js +34 -18
  30. package/dist/email-crypto.mjs +2 -3
  31. package/dist/hash.js +3 -4
  32. package/dist/hash.js.map +1 -1
  33. package/dist/hash.mjs +1 -2
  34. package/dist/hash.mjs.map +1 -1
  35. package/dist/index.d.mts +3 -3
  36. package/dist/index.d.ts +3 -3
  37. package/dist/index.js +72 -56
  38. package/dist/index.mjs +7 -8
  39. package/dist/{emailEncryptionKey-CYvr26FG.mjs → keystore-crypto-C6F-NQdX.mjs} +12 -15
  40. package/dist/keystore-crypto-C6F-NQdX.mjs.map +1 -0
  41. package/dist/{emailEncryptionKey-Ba95VuFO.js → keystore-crypto-CFiiGohl.js} +67 -70
  42. package/dist/keystore-crypto-CFiiGohl.js.map +1 -0
  43. package/dist/keystore-crypto.d.mts +1 -1
  44. package/dist/keystore-crypto.d.ts +1 -1
  45. package/dist/keystore-crypto.js +11 -12
  46. package/dist/keystore-crypto.mjs +2 -3
  47. package/dist/post-quantum-crypto.js +3 -4
  48. package/dist/post-quantum-crypto.js.map +1 -1
  49. package/dist/post-quantum-crypto.mjs +1 -2
  50. package/dist/post-quantum-crypto.mjs.map +1 -1
  51. package/dist/storage-service.js +13 -15
  52. package/dist/storage-service.js.map +1 -1
  53. package/dist/storage-service.mjs +2 -4
  54. package/dist/storage-service.mjs.map +1 -1
  55. package/dist/symmetric-crypto.js +51 -5
  56. package/dist/symmetric-crypto.js.map +1 -0
  57. package/dist/symmetric-crypto.mjs +47 -2
  58. package/dist/symmetric-crypto.mjs.map +1 -0
  59. package/dist/types-CrAiKyb0.d.ts +61 -0
  60. package/dist/types-CrAiKyb0.d.ts.map +1 -0
  61. package/dist/types-D6hsUfma.d.mts +61 -0
  62. package/dist/types-D6hsUfma.d.mts.map +1 -0
  63. package/dist/types.d.mts +2 -49
  64. package/dist/types.d.ts +2 -49
  65. package/dist/types.js +2 -3
  66. package/dist/types.js.map +1 -1
  67. package/dist/types.mjs +1 -1
  68. package/dist/types.mjs.map +1 -1
  69. package/dist/utils.js +127 -14
  70. package/dist/utils.js.map +1 -0
  71. package/dist/utils.mjs +113 -2
  72. package/dist/utils.mjs.map +1 -0
  73. package/dist/{xwing-iRWVRtNE.js → xwing-7fEqAT7W.js} +18 -19
  74. package/dist/{xwing-iRWVRtNE.js.map → xwing-7fEqAT7W.js.map} +1 -1
  75. package/dist/{xwing-CQmQX6hn.mjs → xwing-B34h5e3Z.mjs} +2 -3
  76. package/dist/{xwing-CQmQX6hn.mjs.map → xwing-B34h5e3Z.mjs.map} +1 -1
  77. package/package.json +22 -22
  78. package/dist/aes-B8TA-JKq.mjs +0 -49
  79. package/dist/aes-B8TA-JKq.mjs.map +0 -1
  80. package/dist/aes-CuW_SPl-.js +0 -67
  81. package/dist/aes-CuW_SPl-.js.map +0 -1
  82. package/dist/chunk-DQk6qfdC.mjs +0 -18
  83. package/dist/chunk-EbLFQX5m.js +0 -60
  84. package/dist/deriveKeysFromMnemonic-DB0UHE-y.mjs +0 -49
  85. package/dist/deriveKeysFromMnemonic-DB0UHE-y.mjs.map +0 -1
  86. package/dist/deriveKeysFromMnemonic-Dbx7VSBQ.js +0 -67
  87. package/dist/deriveKeysFromMnemonic-Dbx7VSBQ.js.map +0 -1
  88. package/dist/deriveKeysFromPassword-DFzo2OII.mjs.map +0 -1
  89. package/dist/deriveKeysFromPassword-iMHv-tIA.js.map +0 -1
  90. package/dist/emailEncryptionKey-Ba95VuFO.js.map +0 -1
  91. package/dist/emailEncryptionKey-CYvr26FG.mjs.map +0 -1
  92. package/dist/emailKeys-BFI-paQq.js +0 -406
  93. package/dist/emailKeys-BFI-paQq.js.map +0 -1
  94. package/dist/emailKeys-BjIeINfC.mjs +0 -304
  95. package/dist/emailKeys-BjIeINfC.mjs.map +0 -1
  96. package/dist/genID-D08K7JPr.mjs +0 -117
  97. package/dist/genID-D08K7JPr.mjs.map +0 -1
  98. package/dist/genID-cWOPmspk.js +0 -190
  99. package/dist/genID-cWOPmspk.js.map +0 -1
  100. package/dist/types.d.mts.map +0 -1
  101. package/dist/types.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-crypto-DpjfXDes.mjs","names":[],"sources":["../src/key-wrapper/aesWrapper.ts","../src/email-crypto/errors.ts","../src/email-crypto/core.ts","../src/email-crypto/hybridEncyptedEmail.ts","../src/email-crypto/pwdProtectedEmail.ts","../src/email-crypto/coreSubject.ts","../src/email-crypto/hybridEncryptedEmailAndSubject.ts","../src/email-crypto/pwdProtectedEmailAndSubject.ts","../src/email-crypto/emailKeys.ts"],"sourcesContent":["import { aeskw } from '@noble/ciphers/aes.js';\n\n/**\n * Unwraps the given wrapped key\n *\n * @param encryptedKey - The wrapped key\n * @param wrappingKey - The secret key used for unwrapping\n * @returns The resulting key\n */\nexport async function unwrapKey(encryptedKey: Uint8Array, wrappingKey: Uint8Array): Promise<Uint8Array> {\n return aeskw(wrappingKey).decrypt(encryptedKey);\n}\n\n/**\n * Wraps the given key\n *\n * @param key - The key to be wrapped\n * @param wrappingKey - The secret key used for wrapping\n * @returns The resulting ciphertext\n */\nexport async function wrapKey(key: Uint8Array, wrappingKey: Uint8Array): Promise<Uint8Array> {\n return aeskw(wrappingKey).encrypt(key);\n}\n","export class FailedToEncryptEmail extends Error {\n constructor(errorMsg?: string) {\n super('Failed to encrypt email: ' + errorMsg);\n\n Object.setPrototypeOf(this, FailedToEncryptEmail.prototype);\n }\n}\n\nexport class EmailSymmetricEncryptionError extends Error {\n constructor(errorMsg?: string) {\n super('Failed to symmetrically encrypt email: ' + errorMsg);\n\n Object.setPrototypeOf(this, EmailSymmetricEncryptionError.prototype);\n }\n}\n\nexport class EmailSymmetricDecryptionError extends Error {\n constructor(errorMsg?: string) {\n super('Failed to symmetrically decrypt email: ' + errorMsg);\n\n Object.setPrototypeOf(this, EmailSymmetricDecryptionError.prototype);\n }\n}\n\nexport class EmailHybridEncryptionError extends Error {\n constructor(errorMsg?: string) {\n super('Failed to hybridly encrypt the key: ' + errorMsg);\n\n Object.setPrototypeOf(this, EmailHybridEncryptionError.prototype);\n }\n}\n\nexport class EmailHybridDecryptionError extends Error {\n constructor(errorMsg?: string) {\n super('Failed to hybridly decrypt the key: ' + errorMsg);\n\n Object.setPrototypeOf(this, EmailHybridDecryptionError.prototype);\n }\n}\n\nexport class EmailPasswordProtectError extends Error {\n constructor(errorMsg?: string) {\n super('Failed to password-protect the key: ' + errorMsg);\n\n Object.setPrototypeOf(this, EmailPasswordProtectError.prototype);\n }\n}\n\nexport class EmailPasswordOpenError extends Error {\n constructor(errorMsg?: string) {\n super('Failed to open password-protected key: ' + errorMsg);\n\n Object.setPrototypeOf(this, EmailPasswordOpenError.prototype);\n }\n}\n\nexport class InvalidInputEmail extends Error {\n constructor() {\n super('Invalid input');\n\n Object.setPrototypeOf(this, InvalidInputEmail.prototype);\n }\n}\n\nexport class FailedToDecryptEmail extends Error {\n constructor(errorMsg?: string) {\n super('Failed to decrypt email: ' + errorMsg);\n\n Object.setPrototypeOf(this, FailedToDecryptEmail.prototype);\n }\n}\n","import { HybridEncKey, PwdProtectedKey, Email, RecipientWithPublicKey, EmailEncrypted } from '../types';\nimport { encryptSymmetrically, decryptSymmetrically, genSymmetricKey } from '../symmetric-crypto';\nimport { encapsulateHybrid, decapsulateHybrid } from '../hybrid-crypto';\nimport { wrapKey, unwrapKey } from '../key-wrapper';\nimport { getKeyFromPassword, getKeyFromPasswordAndSalt } from '../derive-password';\nimport { UTF8ToUint8, base64ToUint8Array, uint8ArrayToBase64, uint8ToUTF8 } from '../utils';\nimport {\n EmailHybridDecryptionError,\n EmailHybridEncryptionError,\n InvalidInputEmail,\n EmailSymmetricDecryptionError,\n EmailSymmetricEncryptionError,\n EmailPasswordOpenError,\n EmailPasswordProtectError,\n} from './errors';\n\n/**\n * Symmetrically encrypts email.\n *\n * @param email - The email to encrypt.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The resulting encrypted email and symmetric key used for encryption\n */\nexport async function encryptEmail(\n email: Email,\n aux?: Uint8Array,\n): Promise<{\n encEmail: EmailEncrypted;\n encryptionKey: Uint8Array;\n}> {\n if (!email.text) {\n throw new InvalidInputEmail();\n }\n try {\n const encryptionKey = genSymmetricKey();\n const encEmail = await encryptEmailWithKey(email, encryptionKey, aux);\n\n return { encEmail, encryptionKey };\n } catch (error) {\n throw new EmailSymmetricEncryptionError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Symmetrically encrypts email with the given key.\n *\n * @param email - The email to encrypt.\n * @param encryptionKey - The symmetric key to encrypt the email.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The resulting encrypted email and symmetric key used for encryption\n */\nexport async function encryptEmailWithKey(\n email: Email,\n encryptionKey: Uint8Array,\n aux?: Uint8Array,\n): Promise<EmailEncrypted> {\n try {\n const text = UTF8ToUint8(email.text);\n\n const encryptedText = await encryptSymmetrically(encryptionKey, text, aux);\n const encText = uint8ArrayToBase64(encryptedText);\n const enc: EmailEncrypted = { encText };\n if (email.attachments) {\n const promises = email.attachments.map((attachment) => {\n const binaryAttachment = UTF8ToUint8(attachment);\n return encryptSymmetrically(encryptionKey, binaryAttachment, aux);\n });\n const encryptedAttachments = await Promise.all(promises);\n enc.encAttachments = encryptedAttachments?.map(uint8ArrayToBase64);\n }\n return enc;\n } catch (error) {\n throw new EmailSymmetricEncryptionError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Decrypts symmetrically encrypted email.\n *\n * @param encEmail - The email to decrypt.\n * @param encryptionKey - The symmetric key to decrypt the email.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The resulting decrypted email\n */\nexport async function decryptEmail(\n encEmail: EmailEncrypted,\n encryptionKey: Uint8Array,\n aux?: Uint8Array,\n): Promise<Email> {\n try {\n const encText = base64ToUint8Array(encEmail.encText);\n const textArray = await decryptSymmetrically(encryptionKey, encText, aux);\n const text = uint8ToUTF8(textArray);\n const email: Email = { text };\n\n if (encEmail.encAttachments) {\n const encAttachments = encEmail.encAttachments?.map(base64ToUint8Array);\n const promises = encAttachments?.map((encAtt) => decryptSymmetrically(encryptionKey, encAtt, aux));\n const decryptedAttachments = await Promise.all(promises);\n email.attachments = decryptedAttachments?.map((att) => uint8ToUTF8(att));\n }\n\n return email;\n } catch (error) {\n throw new EmailSymmetricDecryptionError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Encrypts the email symmetric key using hybrid encryption.\n *\n * @param emailEncryptionKey - The symmetric key used for email encryption.\n * @param recipient - The recipient with a public hybrid key.\n * @returns The encrypted email symmetric key\n */\nexport async function encryptKeysHybrid(\n emailEncryptionKey: Uint8Array,\n recipient: RecipientWithPublicKey,\n): Promise<HybridEncKey> {\n try {\n const { cipherText, sharedSecret } = encapsulateHybrid(recipient.publicHybridKey);\n const encryptedKey = await wrapKey(emailEncryptionKey, sharedSecret);\n const encryptedKeyBase64 = uint8ArrayToBase64(encryptedKey);\n const kyberCiphertextBase64 = uint8ArrayToBase64(cipherText);\n\n return {\n encryptedKey: encryptedKeyBase64,\n hybridCiphertext: kyberCiphertextBase64,\n encryptedForEmail: recipient.email,\n };\n } catch (error) {\n throw new EmailHybridEncryptionError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Decrypts the email symmetric key encrypted via hybrid encryption.\n *\n * @param encryptedKey - The encrypted email key.\n * @param recipientPrivateKey - The private key of the recipient.\n * @returns The email encryption key\n */\nexport async function decryptKeysHybrid(\n encryptedKey: HybridEncKey,\n recipientPrivateKey: Uint8Array,\n): Promise<Uint8Array> {\n try {\n const kyberCiphertext = base64ToUint8Array(encryptedKey.hybridCiphertext);\n const encKey = base64ToUint8Array(encryptedKey.encryptedKey);\n const sharedSecret = decapsulateHybrid(kyberCiphertext, recipientPrivateKey);\n const encryptionKey = await unwrapKey(encKey, sharedSecret);\n return encryptionKey;\n } catch (error) {\n throw new EmailHybridDecryptionError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Password-protects the email symmetric key.\n *\n * @param emailEncryptionKey - The symmetric key used for email encryption.\n * @param password - The secret password for key protection.\n * @returns The password-protected email symmetric key\n */\nexport async function passwordProtectKey(emailEncryptionKey: Uint8Array, password: string): Promise<PwdProtectedKey> {\n try {\n const { key, salt } = await getKeyFromPassword(password);\n const encryptedKey = await wrapKey(emailEncryptionKey, key);\n const saltStr = uint8ArrayToBase64(salt);\n const encryptedKeyStr = uint8ArrayToBase64(encryptedKey);\n return { encryptedKey: encryptedKeyStr, salt: saltStr };\n } catch (error) {\n throw new EmailPasswordProtectError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Removes passoword-protection and exposes the email symmetric key.\n *\n * @param emailEncryptionKey - The password-protected email key.\n * @param password - The secret password for key protection.\n * @returns The email encryption key\n */\nexport async function removePasswordProtection(\n emailEncryptionKey: PwdProtectedKey,\n password: string,\n): Promise<Uint8Array> {\n try {\n const salt = base64ToUint8Array(emailEncryptionKey.salt);\n const encryptedKey = base64ToUint8Array(emailEncryptionKey.encryptedKey);\n const key = await getKeyFromPasswordAndSalt(password, salt);\n const encryptionKey = await unwrapKey(encryptedKey, key);\n return encryptionKey;\n } catch (error) {\n throw new EmailPasswordOpenError(error instanceof Error ? error.message : String(error));\n }\n}\n","import { HybridEncryptedEmail, Email, RecipientWithPublicKey } from '../types';\nimport { decryptEmail, encryptKeysHybrid, decryptKeysHybrid, encryptEmail } from './core';\nimport {\n FailedToDecryptEmail,\n FailedToEncryptEmail,\n EmailHybridDecryptionError,\n EmailHybridEncryptionError,\n InvalidInputEmail,\n EmailSymmetricDecryptionError,\n EmailSymmetricEncryptionError,\n} from './errors';\n/**\n * Encrypts the email using hybrid encryption.\n *\n * @param email - The email to encrypt.\n * @param recipientPublicKeys - The public keys of the recipient.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The encrypted email\n */\nexport async function encryptEmailHybrid(\n email: Email,\n recipient: RecipientWithPublicKey,\n aux?: Uint8Array,\n): Promise<HybridEncryptedEmail> {\n try {\n const { encryptionKey, encEmail } = await encryptEmail(email, aux);\n const encryptedKey = await encryptKeysHybrid(encryptionKey, recipient);\n return { encEmail, encryptedKey };\n } catch (error) {\n if (error instanceof InvalidInputEmail) throw error;\n if (error instanceof EmailSymmetricEncryptionError) throw error;\n if (error instanceof EmailHybridEncryptionError) throw error;\n throw new FailedToEncryptEmail(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Encrypts the email using hybrid encryption for multiple recipients.\n *\n * @param email - The email to encrypt for multiple recipients.\n * @param recipients - The recipients with corresponding public keys.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The set of encrypted emails\n */\nexport async function encryptEmailHybridForMultipleRecipients(\n email: Email,\n recipients: RecipientWithPublicKey[],\n aux?: Uint8Array,\n): Promise<HybridEncryptedEmail[]> {\n try {\n if (!recipients || recipients.length === 0) {\n throw new InvalidInputEmail();\n }\n const { encryptionKey, encEmail } = await encryptEmail(email, aux);\n\n const encryptedEmails: HybridEncryptedEmail[] = [];\n for (const recipient of recipients) {\n const encryptedKey = await encryptKeysHybrid(encryptionKey, recipient);\n encryptedEmails.push({\n encEmail,\n encryptedKey,\n });\n }\n return encryptedEmails;\n } catch (error) {\n if (error instanceof InvalidInputEmail) throw error;\n if (error instanceof EmailSymmetricEncryptionError) throw error;\n if (error instanceof EmailHybridEncryptionError) throw error;\n throw new FailedToEncryptEmail(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Decrypts the email using hybrid encryption.\n *\n * @param encEmail - The encrypted email.\n * @param recipientPrivateHybridKeys - The private key of the recipient.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The decrypted email\n */\nexport async function decryptEmailHybrid(\n encEmail: HybridEncryptedEmail,\n recipientPrivateHybridKeys: Uint8Array,\n aux?: Uint8Array,\n): Promise<Email> {\n try {\n const encryptionKey = await decryptKeysHybrid(encEmail.encryptedKey, recipientPrivateHybridKeys);\n return await decryptEmail(encEmail.encEmail, encryptionKey, aux);\n } catch (error) {\n if (error instanceof EmailHybridDecryptionError) throw error;\n if (error instanceof EmailSymmetricDecryptionError) throw error;\n throw new FailedToDecryptEmail(error instanceof Error ? error.message : String(error));\n }\n}\n","import { PwdProtectedEmail, Email } from '../types';\nimport { decryptEmail, passwordProtectKey, removePasswordProtection, encryptEmail } from './core';\nimport {\n EmailSymmetricEncryptionError,\n FailedToDecryptEmail,\n FailedToEncryptEmail,\n EmailPasswordProtectError,\n EmailSymmetricDecryptionError,\n EmailPasswordOpenError,\n InvalidInputEmail,\n} from './errors';\n/**\n * Creates a password-protected email.\n *\n * @param email - The email to password-protect\n * @param password - The secret password shared among recipients\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The password-protected email\n */\nexport async function createPwdProtectedEmail(\n email: Email,\n password: string,\n aux?: Uint8Array,\n): Promise<PwdProtectedEmail> {\n try {\n const { encryptionKey, encEmail } = await encryptEmail(email, aux);\n const encryptedKey = await passwordProtectKey(encryptionKey, password);\n\n return { encEmail, encryptedKey };\n } catch (error) {\n if (error instanceof InvalidInputEmail) throw error;\n if (error instanceof EmailSymmetricEncryptionError) throw error;\n if (error instanceof EmailPasswordProtectError) throw error;\n throw new FailedToEncryptEmail(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Opens a password-protected email.\n *\n * @param encryptedEmail - The encrypted email\n * @param password - The secret password shared among recipients.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The decrypted email\n */\nexport async function decryptPwdProtectedEmail(\n encryptedEmail: PwdProtectedEmail,\n password: string,\n aux?: Uint8Array,\n): Promise<Email> {\n if (!encryptedEmail?.encEmail || !encryptedEmail?.encryptedKey) {\n throw new InvalidInputEmail();\n }\n try {\n const encryptionKey = await removePasswordProtection(encryptedEmail.encryptedKey, password);\n return await decryptEmail(encryptedEmail.encEmail, encryptionKey, aux);\n } catch (error) {\n if (error instanceof EmailPasswordOpenError) throw error;\n if (error instanceof EmailSymmetricDecryptionError) throw error;\n throw new FailedToDecryptEmail(error instanceof Error ? error.message : String(error));\n }\n}\n","import { EmailAndSubject, EmailAndSubjectEncrypted } from '../types';\nimport { encryptSymmetrically, decryptSymmetrically, genSymmetricKey } from '../symmetric-crypto';\nimport { encryptEmailWithKey, decryptEmail } from './core';\nimport { UTF8ToUint8, base64ToUint8Array, uint8ArrayToBase64, uint8ToUTF8 } from '../utils';\nimport { InvalidInputEmail, EmailSymmetricDecryptionError, EmailSymmetricEncryptionError } from './errors';\n\n/**\n * Symmetrically encrypts email and subject.\n *\n * @param email - The email and subject to encrypt.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The resulting encrypted email and symmetric key used for encryption\n */\nexport async function encryptEmailAndSubject(\n email: EmailAndSubject,\n aux?: Uint8Array,\n): Promise<{\n encEmail: EmailAndSubjectEncrypted;\n encryptionKey: Uint8Array;\n}> {\n if (!email.text || !email.subject) {\n throw new InvalidInputEmail();\n }\n try {\n const encryptionKey = genSymmetricKey();\n const encEmail = await encryptEmailAndSubjectWithKey(email, encryptionKey, aux);\n\n return { encEmail, encryptionKey };\n } catch (error) {\n throw new EmailSymmetricEncryptionError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Symmetrically encrypts email and subject with the given key.\n *\n * @param email - The email and subject to encrypt.\n * @param encryptionKey - The symmetric key to encrypt the email.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The resulting encrypted email and symmetric key used for encryption\n */\nexport async function encryptEmailAndSubjectWithKey(\n email: EmailAndSubject,\n encryptionKey: Uint8Array,\n aux?: Uint8Array,\n): Promise<EmailAndSubjectEncrypted> {\n try {\n const enc = await encryptEmailWithKey(email, encryptionKey, aux);\n const subject = UTF8ToUint8(email.subject);\n const subjectEnc = await encryptSymmetrically(encryptionKey, subject, aux);\n const encSubject = uint8ArrayToBase64(subjectEnc);\n\n return { ...enc, encSubject };\n } catch (error) {\n throw new EmailSymmetricEncryptionError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Decrypts symmetrically encrypted email and email subject.\n *\n * @param encEmail - The encrypted email and subject to decrypt.\n * @param encryptionKey - The symmetric key to decrypt the email.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The resulting decrypted email and subject\n */\nexport async function decryptEmailAndSubject(\n encEmail: EmailAndSubjectEncrypted,\n encryptionKey: Uint8Array,\n aux?: Uint8Array,\n): Promise<EmailAndSubject> {\n try {\n const encSubject = base64ToUint8Array(encEmail.encSubject);\n const subjectArray = await decryptSymmetrically(encryptionKey, encSubject, aux);\n const subject = uint8ToUTF8(subjectArray);\n const email = await decryptEmail(encEmail, encryptionKey, aux);\n\n return { ...email, subject };\n } catch (error) {\n throw new EmailSymmetricDecryptionError(error instanceof Error ? error.message : String(error));\n }\n}\n","import { RecipientWithPublicKey, EmailAndSubject, HybridEncryptedEmailAndSubject } from '../types';\nimport { encryptKeysHybrid, decryptKeysHybrid } from './core';\nimport { encryptEmailAndSubject, decryptEmailAndSubject } from './coreSubject';\nimport {\n FailedToDecryptEmail,\n FailedToEncryptEmail,\n EmailHybridDecryptionError,\n EmailHybridEncryptionError,\n InvalidInputEmail,\n EmailSymmetricDecryptionError,\n EmailSymmetricEncryptionError,\n} from './errors';\n\n/**\n * Encrypts the email and its subject using hybrid encryption.\n *\n * @param email - The email and subject to encrypt.\n * @param recipientPublicKeys - The public keys of the recipient.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The encrypted email and subject\n */\nexport async function encryptEmailAndSubjectHybrid(\n email: EmailAndSubject,\n recipient: RecipientWithPublicKey,\n aux?: Uint8Array,\n): Promise<HybridEncryptedEmailAndSubject> {\n try {\n const { encryptionKey, encEmail } = await encryptEmailAndSubject(email, aux);\n const encryptedKey = await encryptKeysHybrid(encryptionKey, recipient);\n return { encEmail, encryptedKey };\n } catch (error) {\n if (error instanceof InvalidInputEmail) throw error;\n if (error instanceof EmailSymmetricEncryptionError) throw error;\n if (error instanceof EmailHybridEncryptionError) throw error;\n throw new FailedToEncryptEmail(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Encrypts the email and its subject using hybrid encryption for multiple recipients.\n *\n * @param email - The email and subject to encrypt for multiple recipients.\n * @param recipients - The recipients with corresponding public keys.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The set of encrypted emails and subjects\n */\nexport async function encryptEmailAndSubjectHybridForMultipleRecipients(\n email: EmailAndSubject,\n recipients: RecipientWithPublicKey[],\n aux?: Uint8Array,\n): Promise<HybridEncryptedEmailAndSubject[]> {\n try {\n if (!recipients || recipients.length === 0) {\n throw new InvalidInputEmail();\n }\n const { encryptionKey, encEmail } = await encryptEmailAndSubject(email, aux);\n\n const encryptedEmails: HybridEncryptedEmailAndSubject[] = [];\n for (const recipient of recipients) {\n const encryptedKey = await encryptKeysHybrid(encryptionKey, recipient);\n encryptedEmails.push({\n encEmail,\n encryptedKey,\n });\n }\n return encryptedEmails;\n } catch (error) {\n if (error instanceof InvalidInputEmail) throw error;\n if (error instanceof EmailSymmetricEncryptionError) throw error;\n if (error instanceof EmailHybridEncryptionError) throw error;\n throw new FailedToEncryptEmail(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Decrypts the email and its subject using hybrid encryption.\n *\n * @param hybridEmail - The encrypted email and subject.\n * @param recipientPrivateHybridKeys - The private key of the recipient.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The decrypted email and subject\n */\nexport async function decryptEmailAndSubjectHybrid(\n hybridEmail: HybridEncryptedEmailAndSubject,\n recipientPrivateHybridKeys: Uint8Array,\n aux?: Uint8Array,\n): Promise<EmailAndSubject> {\n try {\n const encryptionKey = await decryptKeysHybrid(hybridEmail.encryptedKey, recipientPrivateHybridKeys);\n return await decryptEmailAndSubject(hybridEmail.encEmail, encryptionKey, aux);\n } catch (error) {\n if (error instanceof InvalidInputEmail) throw error;\n if (error instanceof EmailHybridDecryptionError) throw error;\n if (error instanceof EmailSymmetricDecryptionError) throw error;\n throw new FailedToDecryptEmail(error instanceof Error ? error.message : String(error));\n }\n}\n","import { EmailAndSubject, PwdProtectedEmailAndSubject } from '../types';\nimport { passwordProtectKey, removePasswordProtection } from './core';\nimport { encryptEmailAndSubject, decryptEmailAndSubject } from './coreSubject';\nimport {\n FailedToDecryptEmail,\n FailedToEncryptEmail,\n InvalidInputEmail,\n EmailPasswordOpenError,\n EmailPasswordProtectError,\n EmailSymmetricDecryptionError,\n EmailSymmetricEncryptionError,\n} from './errors';\n\n/**\n * Creates a password-protected email and subject.\n *\n * @param email - The email and subject to password-protect\n * @param password - The secret password shared among recipients\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The password-protected email\n */\nexport async function createPwdProtectedEmailAndSubject(\n email: EmailAndSubject,\n password: string,\n aux?: Uint8Array,\n): Promise<PwdProtectedEmailAndSubject> {\n try {\n const { encryptionKey, encEmail } = await encryptEmailAndSubject(email, aux);\n const encryptedKey = await passwordProtectKey(encryptionKey, password);\n\n return { encEmail, encryptedKey };\n } catch (error) {\n if (error instanceof InvalidInputEmail) throw error;\n if (error instanceof EmailSymmetricEncryptionError) throw error;\n if (error instanceof EmailPasswordProtectError) throw error;\n throw new FailedToEncryptEmail(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Opens a password-protected email and subject.\n *\n * @param encryptedEmail - The encrypted email and subject\n * @param password - The secret password shared among recipients.\n * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).\n * @returns The decrypted email and subject\n */\nexport async function decryptPwdProtectedEmailAndSubject(\n encryptedEmail: PwdProtectedEmailAndSubject,\n password: string,\n aux?: Uint8Array,\n): Promise<EmailAndSubject> {\n if (!encryptedEmail?.encEmail || !encryptedEmail?.encryptedKey) {\n throw new InvalidInputEmail();\n }\n try {\n const encryptionKey = await removePasswordProtection(encryptedEmail.encryptedKey, password);\n return await decryptEmailAndSubject(encryptedEmail.encEmail, encryptionKey, aux);\n } catch (error) {\n if (error instanceof EmailPasswordOpenError) throw error;\n if (error instanceof EmailSymmetricDecryptionError) throw error;\n throw new FailedToDecryptEmail(error instanceof Error ? error.message : String(error));\n }\n}\n","import { genHybridKeys } from '../hybrid-crypto';\nimport { HybridKeyPair } from '../types';\nimport { deriveKeyFromMnemonic } from '../derive-key';\nimport { CONTEXT_DATABASE, CONTEXT_DRAFT } from '../constants';\n\n/**\n * Generates public and private keys for email encryption.\n *\n * @returns The user's private and public keys\n */\nexport async function generateEmailKeys(): Promise<HybridKeyPair> {\n return genHybridKeys();\n}\n\n/**\n * Derives database encryption key for the given user\n *\n * @param mnemonic - The user's mnemonic (machine-generated with secure PRNG)\n * @returns The symmetric key for protecting database\n */\nexport const deriveDatabaseKey = async (mnemonic: string): Promise<Uint8Array> => {\n return deriveKeyFromMnemonic(mnemonic, CONTEXT_DATABASE);\n};\n\n/**\n * Derives email draft encryption key for the given user\n *\n * @param mnemonic - The user's mnemonic (machine-generated with secure PRNG)\n * @returns The symmetric key for protecting email drafts\n */\nexport const deriveEmailDraftKey = async (mnemonic: string): Promise<Uint8Array> => {\n return deriveKeyFromMnemonic(mnemonic, CONTEXT_DRAFT);\n};\n"],"mappings":";;;;;;;;;;;;;;;AASA,eAAsB,UAAU,cAA0B,aAA8C;AACtG,QAAO,MAAM,YAAY,CAAC,QAAQ,aAAa;;;;;;;;;AAUjD,eAAsB,QAAQ,KAAiB,aAA8C;AAC3F,QAAO,MAAM,YAAY,CAAC,QAAQ,IAAI;;;;ACrBxC,IAAa,uBAAb,MAAa,6BAA6B,MAAM;CAC9C,YAAY,UAAmB;AAC7B,QAAM,8BAA8B,SAAS;AAE7C,SAAO,eAAe,MAAM,qBAAqB,UAAU;;;AAI/D,IAAa,gCAAb,MAAa,sCAAsC,MAAM;CACvD,YAAY,UAAmB;AAC7B,QAAM,4CAA4C,SAAS;AAE3D,SAAO,eAAe,MAAM,8BAA8B,UAAU;;;AAIxE,IAAa,gCAAb,MAAa,sCAAsC,MAAM;CACvD,YAAY,UAAmB;AAC7B,QAAM,4CAA4C,SAAS;AAE3D,SAAO,eAAe,MAAM,8BAA8B,UAAU;;;AAIxE,IAAa,6BAAb,MAAa,mCAAmC,MAAM;CACpD,YAAY,UAAmB;AAC7B,QAAM,yCAAyC,SAAS;AAExD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Ae,SAAS;GAErC;UAC1B,OAAO;AACd,MAAI,iBAAiB,kBAAmB,OAAM;AAC9C,MAAI,iBAAiB,8BAA+B,OAAM;AAC1D,MAAI,iBAAiB,0BAA2B,OAAM;AACtD,QAAM,IAAI,qBAAqB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;;;;;;;;;;AAY1F,eAAsB,mCACpB,gBACA,UACA,KAC0B;AAC1B,KAAI,CAAC,gBAAgB,YAAY,CAAC,gBAAgB,aAChD,OAAM,IAAI,mBAAmB;AAE/B,KAAI;EACF,MAAM,gBAAgB,MAAM,yBAAyB,eAAe,cAAc,SAAS;AAC3F,SAAO,MAAM,uBAAuB,eAAe,UAAU,eAAe,IAAI;UACzE,OAAO;AACd,MAAI,iBAAiB,uBAAwB,OAAM;AACnD,MAAI,iBAAiB,8BAA+B,OAAM;AAC1D,QAAM,IAAI,qBAAqB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;;;;;;;;;ACnD1F,eAAsB,oBAA4C;AAChE,QAAO,eAAe;;;;;;;;AASxB,MAAa,oBAAoB,OAAO,aAA0C;AAChF,QAAO,sBAAsB,UAAU,iBAAiB;;;;;;;;AAS1D,MAAa,sBAAsB,OAAO,aAA0C;AAClF,QAAO,sBAAsB,UAAU,cAAc"}
@@ -1,33 +1,33 @@
1
- import { EmailBody, EmailBodyEncrypted, HybridEncKey, HybridEncryptedEmail, HybridKeyPair, PwdProtectedEmail, PwdProtectedKey, RecipientWithPublicKey } from "./types.mjs";
1
+ import { c as HybridEncryptedEmailAndSubject, d as PwdProtectedEmail, f as PwdProtectedEmailAndSubject, i as EmailEncrypted, l as HybridKeyPair, m as RecipientWithPublicKey, n as EmailAndSubject, o as HybridEncKey, p as PwdProtectedKey, r as EmailAndSubjectEncrypted, s as HybridEncryptedEmail, t as Email } from "./types-D6hsUfma.mjs";
2
2
 
3
3
  //#region src/email-crypto/hybridEncyptedEmail.d.ts
4
4
  /**
5
- * Encrypts the email body using hybrid encryption.
5
+ * Encrypts the email using hybrid encryption.
6
6
  *
7
- * @param body - The email body to encrypt.
7
+ * @param email - The email to encrypt.
8
8
  * @param recipientPublicKeys - The public keys of the recipient.
9
9
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
10
- * @returns The encrypted email body
10
+ * @returns The encrypted email
11
11
  */
12
- declare function encryptEmailHybrid(body: EmailBody, recipient: RecipientWithPublicKey, aux?: Uint8Array): Promise<HybridEncryptedEmail>;
12
+ declare function encryptEmailHybrid(email: Email, recipient: RecipientWithPublicKey, aux?: Uint8Array): Promise<HybridEncryptedEmail>;
13
13
  /**
14
- * Encrypts the email body using hybrid encryption for multiple recipients.
14
+ * Encrypts the email using hybrid encryption for multiple recipients.
15
15
  *
16
- * @param body - The email body to encrypt for multiple recipients.
16
+ * @param email - The email to encrypt for multiple recipients.
17
17
  * @param recipients - The recipients with corresponding public keys.
18
18
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
19
- * @returns The set of encrypted email bodies
19
+ * @returns The set of encrypted emails
20
20
  */
21
- declare function encryptEmailHybridForMultipleRecipients(body: EmailBody, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<HybridEncryptedEmail[]>;
21
+ declare function encryptEmailHybridForMultipleRecipients(email: Email, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<HybridEncryptedEmail[]>;
22
22
  /**
23
23
  * Decrypts the email using hybrid encryption.
24
24
  *
25
- * @param encEmailBody - The encrypted email.
25
+ * @param encEmail - The encrypted email.
26
26
  * @param recipientPrivateHybridKeys - The private key of the recipient.
27
27
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
28
- * @returns The decrypted email body
28
+ * @returns The decrypted email
29
29
  */
30
- declare function decryptEmailHybrid(encEmailBody: HybridEncryptedEmail, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<EmailBody>;
30
+ declare function decryptEmailHybrid(encEmail: HybridEncryptedEmail, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<Email>;
31
31
  //#endregion
32
32
  //#region src/email-crypto/pwdProtectedEmail.d.ts
33
33
  /**
@@ -38,16 +38,65 @@ declare function decryptEmailHybrid(encEmailBody: HybridEncryptedEmail, recipien
38
38
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
39
39
  * @returns The password-protected email
40
40
  */
41
- declare function createPwdProtectedEmail(emailBody: EmailBody, password: string, aux?: Uint8Array): Promise<PwdProtectedEmail>;
41
+ declare function createPwdProtectedEmail(email: Email, password: string, aux?: Uint8Array): Promise<PwdProtectedEmail>;
42
42
  /**
43
43
  * Opens a password-protected email.
44
44
  *
45
45
  * @param encryptedEmail - The encrypted email
46
46
  * @param password - The secret password shared among recipients.
47
47
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
48
- * @returns The decrypted email body
48
+ * @returns The decrypted email
49
49
  */
50
- declare function decryptPwdProtectedEmail(encryptedEmail: PwdProtectedEmail, password: string, aux?: Uint8Array): Promise<EmailBody>;
50
+ declare function decryptPwdProtectedEmail(encryptedEmail: PwdProtectedEmail, password: string, aux?: Uint8Array): Promise<Email>;
51
+ //#endregion
52
+ //#region src/email-crypto/hybridEncryptedEmailAndSubject.d.ts
53
+ /**
54
+ * Encrypts the email and its subject using hybrid encryption.
55
+ *
56
+ * @param email - The email and subject to encrypt.
57
+ * @param recipientPublicKeys - The public keys of the recipient.
58
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
59
+ * @returns The encrypted email and subject
60
+ */
61
+ declare function encryptEmailAndSubjectHybrid(email: EmailAndSubject, recipient: RecipientWithPublicKey, aux?: Uint8Array): Promise<HybridEncryptedEmailAndSubject>;
62
+ /**
63
+ * Encrypts the email and its subject using hybrid encryption for multiple recipients.
64
+ *
65
+ * @param email - The email and subject to encrypt for multiple recipients.
66
+ * @param recipients - The recipients with corresponding public keys.
67
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
68
+ * @returns The set of encrypted emails and subjects
69
+ */
70
+ declare function encryptEmailAndSubjectHybridForMultipleRecipients(email: EmailAndSubject, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<HybridEncryptedEmailAndSubject[]>;
71
+ /**
72
+ * Decrypts the email and its subject using hybrid encryption.
73
+ *
74
+ * @param hybridEmail - The encrypted email and subject.
75
+ * @param recipientPrivateHybridKeys - The private key of the recipient.
76
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
77
+ * @returns The decrypted email and subject
78
+ */
79
+ declare function decryptEmailAndSubjectHybrid(hybridEmail: HybridEncryptedEmailAndSubject, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubject>;
80
+ //#endregion
81
+ //#region src/email-crypto/pwdProtectedEmailAndSubject.d.ts
82
+ /**
83
+ * Creates a password-protected email and subject.
84
+ *
85
+ * @param email - The email and subject to password-protect
86
+ * @param password - The secret password shared among recipients
87
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
88
+ * @returns The password-protected email
89
+ */
90
+ declare function createPwdProtectedEmailAndSubject(email: EmailAndSubject, password: string, aux?: Uint8Array): Promise<PwdProtectedEmailAndSubject>;
91
+ /**
92
+ * Opens a password-protected email and subject.
93
+ *
94
+ * @param encryptedEmail - The encrypted email and subject
95
+ * @param password - The secret password shared among recipients.
96
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
97
+ * @returns The decrypted email and subject
98
+ */
99
+ declare function decryptPwdProtectedEmailAndSubject(encryptedEmail: PwdProtectedEmailAndSubject, password: string, aux?: Uint8Array): Promise<EmailAndSubject>;
51
100
  //#endregion
52
101
  //#region src/email-crypto/emailKeys.d.ts
53
102
  /**
@@ -73,34 +122,34 @@ declare const deriveEmailDraftKey: (mnemonic: string) => Promise<Uint8Array>;
73
122
  //#endregion
74
123
  //#region src/email-crypto/core.d.ts
75
124
  /**
76
- * Symmetrically encrypts email body.
125
+ * Symmetrically encrypts email.
77
126
  *
78
- * @param body - The email body to encrypt.
127
+ * @param email - The email to encrypt.
79
128
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
80
- * @returns The resulting encrypted email body and symmetric key used for encryption
129
+ * @returns The resulting encrypted email and symmetric key used for encryption
81
130
  */
82
- declare function encryptEmailBody(body: EmailBody, aux?: Uint8Array): Promise<{
83
- encEmailBody: EmailBodyEncrypted;
131
+ declare function encryptEmail(email: Email, aux?: Uint8Array): Promise<{
132
+ encEmail: EmailEncrypted;
84
133
  encryptionKey: Uint8Array;
85
134
  }>;
86
135
  /**
87
- * Symmetrically encrypts email body with the given key.
136
+ * Symmetrically encrypts email with the given key.
88
137
  *
89
- * @param body - The email body to encrypt.
138
+ * @param email - The email to encrypt.
90
139
  * @param encryptionKey - The symmetric key to encrypt the email.
91
140
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
92
- * @returns The resulting encrypted email body and symmetric key used for encryption
141
+ * @returns The resulting encrypted email and symmetric key used for encryption
93
142
  */
94
- declare function encryptEmailBodyWithKey(body: EmailBody, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailBodyEncrypted>;
143
+ declare function encryptEmailWithKey(email: Email, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailEncrypted>;
95
144
  /**
96
- * Decrypts symmetrically encrypted email body.
145
+ * Decrypts symmetrically encrypted email.
97
146
  *
98
- * @param encEmailBody - The email body to decrypt.
147
+ * @param encEmail - The email to decrypt.
99
148
  * @param encryptionKey - The symmetric key to decrypt the email.
100
149
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
101
- * @returns The resulting decrypted email body
150
+ * @returns The resulting decrypted email
102
151
  */
103
- declare function decryptEmailBody(encEmailBody: EmailBodyEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailBody>;
152
+ declare function decryptEmail(encEmail: EmailEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<Email>;
104
153
  /**
105
154
  * Encrypts the email symmetric key using hybrid encryption.
106
155
  *
@@ -134,5 +183,65 @@ declare function passwordProtectKey(emailEncryptionKey: Uint8Array, password: st
134
183
  */
135
184
  declare function removePasswordProtection(emailEncryptionKey: PwdProtectedKey, password: string): Promise<Uint8Array>;
136
185
  //#endregion
137
- export { createPwdProtectedEmail, decryptEmailBody, decryptEmailHybrid, decryptKeysHybrid, decryptPwdProtectedEmail, deriveDatabaseKey, deriveEmailDraftKey, encryptEmailBody, encryptEmailBodyWithKey, encryptEmailHybrid, encryptEmailHybridForMultipleRecipients, encryptKeysHybrid, generateEmailKeys, passwordProtectKey, removePasswordProtection };
186
+ //#region src/email-crypto/coreSubject.d.ts
187
+ /**
188
+ * Symmetrically encrypts email and subject.
189
+ *
190
+ * @param email - The email and subject to encrypt.
191
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
192
+ * @returns The resulting encrypted email and symmetric key used for encryption
193
+ */
194
+ declare function encryptEmailAndSubject(email: EmailAndSubject, aux?: Uint8Array): Promise<{
195
+ encEmail: EmailAndSubjectEncrypted;
196
+ encryptionKey: Uint8Array;
197
+ }>;
198
+ /**
199
+ * Symmetrically encrypts email and subject with the given key.
200
+ *
201
+ * @param email - The email and subject to encrypt.
202
+ * @param encryptionKey - The symmetric key to encrypt the email.
203
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
204
+ * @returns The resulting encrypted email and symmetric key used for encryption
205
+ */
206
+ declare function encryptEmailAndSubjectWithKey(email: EmailAndSubject, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubjectEncrypted>;
207
+ /**
208
+ * Decrypts symmetrically encrypted email and email subject.
209
+ *
210
+ * @param encEmail - The encrypted email and subject to decrypt.
211
+ * @param encryptionKey - The symmetric key to decrypt the email.
212
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
213
+ * @returns The resulting decrypted email and subject
214
+ */
215
+ declare function decryptEmailAndSubject(encEmail: EmailAndSubjectEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubject>;
216
+ //#endregion
217
+ //#region src/email-crypto/errors.d.ts
218
+ declare class FailedToEncryptEmail extends Error {
219
+ constructor(errorMsg?: string);
220
+ }
221
+ declare class EmailSymmetricEncryptionError extends Error {
222
+ constructor(errorMsg?: string);
223
+ }
224
+ declare class EmailSymmetricDecryptionError extends Error {
225
+ constructor(errorMsg?: string);
226
+ }
227
+ declare class EmailHybridEncryptionError extends Error {
228
+ constructor(errorMsg?: string);
229
+ }
230
+ declare class EmailHybridDecryptionError extends Error {
231
+ constructor(errorMsg?: string);
232
+ }
233
+ declare class EmailPasswordProtectError extends Error {
234
+ constructor(errorMsg?: string);
235
+ }
236
+ declare class EmailPasswordOpenError extends Error {
237
+ constructor(errorMsg?: string);
238
+ }
239
+ declare class InvalidInputEmail extends Error {
240
+ constructor();
241
+ }
242
+ declare class FailedToDecryptEmail extends Error {
243
+ constructor(errorMsg?: string);
244
+ }
245
+ //#endregion
246
+ export { EmailHybridDecryptionError, EmailHybridEncryptionError, EmailPasswordOpenError, EmailPasswordProtectError, EmailSymmetricDecryptionError, EmailSymmetricEncryptionError, FailedToDecryptEmail, FailedToEncryptEmail, InvalidInputEmail, createPwdProtectedEmail, createPwdProtectedEmailAndSubject, decryptEmail, decryptEmailAndSubject, decryptEmailAndSubjectHybrid, decryptEmailHybrid, decryptKeysHybrid, decryptPwdProtectedEmail, decryptPwdProtectedEmailAndSubject, deriveDatabaseKey, deriveEmailDraftKey, encryptEmail, encryptEmailAndSubject, encryptEmailAndSubjectHybrid, encryptEmailAndSubjectHybridForMultipleRecipients, encryptEmailAndSubjectWithKey, encryptEmailHybrid, encryptEmailHybridForMultipleRecipients, encryptEmailWithKey, encryptKeysHybrid, generateEmailKeys, passwordProtectKey, removePasswordProtection };
138
247
  //# sourceMappingURL=email-crypto.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"email-crypto.d.mts","names":[],"sources":["../src/email-crypto/hybridEncyptedEm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AAM,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
+ {"version":3,"file":"email-crypto.d.mts","names":[],"sources":["../src/email-crypto/hybridEncyptedEmail.ts","../src/email-crypto/pwdProtectedEmail.ts","../src/email-crypto/hybridEncryptedEmailAndSubject.ts","../src/email-crypto/pwdProtectedEmailAndSubject.ts","../src/email-crypto/emailKeys.ts","../src/email-crypto/core.ts","../src/email-crypto/coreSubject.ts","../src/email-crypto/errors.ts"],"mappings":";;;;;AAmBA;;;;;;iBAAsB,kBAAA,CACpB,KAAA,EAAO,KAAA,EACP,SAAA,EAAW,sBAAA,EACX,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;;;;;;iBAqBW,uCAAA,CACpB,KAAA,EAAO,KAAA,EACP,UAAA,EAAY,sBAAA,IACZ,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;;AAJX;;;;iBAoCsB,kBAAA,CACpB,QAAA,EAAU,oBAAA,EACV,0BAAA,EAA4B,UAAA,EAC5B,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,KAAA;;;;;AAjEX;;;;;;iBCAsB,uBAAA,CACpB,KAAA,EAAO,KAAA,EACP,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,iBAAA;;;;;;;;;iBAsBW,wBAAA,CACpB,cAAA,EAAgB,iBAAA,EAChB,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AAAA"}
@@ -1,33 +1,33 @@
1
- import { EmailBody, EmailBodyEncrypted, HybridEncKey, HybridEncryptedEmail, HybridKeyPair, PwdProtectedEmail, PwdProtectedKey, RecipientWithPublicKey } from "./types.js";
1
+ import { c as HybridEncryptedEmailAndSubject, d as PwdProtectedEmail, f as PwdProtectedEmailAndSubject, i as EmailEncrypted, l as HybridKeyPair, m as RecipientWithPublicKey, n as EmailAndSubject, o as HybridEncKey, p as PwdProtectedKey, r as EmailAndSubjectEncrypted, s as HybridEncryptedEmail, t as Email } from "./types-CrAiKyb0.js";
2
2
 
3
3
  //#region src/email-crypto/hybridEncyptedEmail.d.ts
4
4
  /**
5
- * Encrypts the email body using hybrid encryption.
5
+ * Encrypts the email using hybrid encryption.
6
6
  *
7
- * @param body - The email body to encrypt.
7
+ * @param email - The email to encrypt.
8
8
  * @param recipientPublicKeys - The public keys of the recipient.
9
9
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
10
- * @returns The encrypted email body
10
+ * @returns The encrypted email
11
11
  */
12
- declare function encryptEmailHybrid(body: EmailBody, recipient: RecipientWithPublicKey, aux?: Uint8Array): Promise<HybridEncryptedEmail>;
12
+ declare function encryptEmailHybrid(email: Email, recipient: RecipientWithPublicKey, aux?: Uint8Array): Promise<HybridEncryptedEmail>;
13
13
  /**
14
- * Encrypts the email body using hybrid encryption for multiple recipients.
14
+ * Encrypts the email using hybrid encryption for multiple recipients.
15
15
  *
16
- * @param body - The email body to encrypt for multiple recipients.
16
+ * @param email - The email to encrypt for multiple recipients.
17
17
  * @param recipients - The recipients with corresponding public keys.
18
18
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
19
- * @returns The set of encrypted email bodies
19
+ * @returns The set of encrypted emails
20
20
  */
21
- declare function encryptEmailHybridForMultipleRecipients(body: EmailBody, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<HybridEncryptedEmail[]>;
21
+ declare function encryptEmailHybridForMultipleRecipients(email: Email, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<HybridEncryptedEmail[]>;
22
22
  /**
23
23
  * Decrypts the email using hybrid encryption.
24
24
  *
25
- * @param encEmailBody - The encrypted email.
25
+ * @param encEmail - The encrypted email.
26
26
  * @param recipientPrivateHybridKeys - The private key of the recipient.
27
27
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
28
- * @returns The decrypted email body
28
+ * @returns The decrypted email
29
29
  */
30
- declare function decryptEmailHybrid(encEmailBody: HybridEncryptedEmail, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<EmailBody>;
30
+ declare function decryptEmailHybrid(encEmail: HybridEncryptedEmail, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<Email>;
31
31
  //#endregion
32
32
  //#region src/email-crypto/pwdProtectedEmail.d.ts
33
33
  /**
@@ -38,16 +38,65 @@ declare function decryptEmailHybrid(encEmailBody: HybridEncryptedEmail, recipien
38
38
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
39
39
  * @returns The password-protected email
40
40
  */
41
- declare function createPwdProtectedEmail(emailBody: EmailBody, password: string, aux?: Uint8Array): Promise<PwdProtectedEmail>;
41
+ declare function createPwdProtectedEmail(email: Email, password: string, aux?: Uint8Array): Promise<PwdProtectedEmail>;
42
42
  /**
43
43
  * Opens a password-protected email.
44
44
  *
45
45
  * @param encryptedEmail - The encrypted email
46
46
  * @param password - The secret password shared among recipients.
47
47
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
48
- * @returns The decrypted email body
48
+ * @returns The decrypted email
49
49
  */
50
- declare function decryptPwdProtectedEmail(encryptedEmail: PwdProtectedEmail, password: string, aux?: Uint8Array): Promise<EmailBody>;
50
+ declare function decryptPwdProtectedEmail(encryptedEmail: PwdProtectedEmail, password: string, aux?: Uint8Array): Promise<Email>;
51
+ //#endregion
52
+ //#region src/email-crypto/hybridEncryptedEmailAndSubject.d.ts
53
+ /**
54
+ * Encrypts the email and its subject using hybrid encryption.
55
+ *
56
+ * @param email - The email and subject to encrypt.
57
+ * @param recipientPublicKeys - The public keys of the recipient.
58
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
59
+ * @returns The encrypted email and subject
60
+ */
61
+ declare function encryptEmailAndSubjectHybrid(email: EmailAndSubject, recipient: RecipientWithPublicKey, aux?: Uint8Array): Promise<HybridEncryptedEmailAndSubject>;
62
+ /**
63
+ * Encrypts the email and its subject using hybrid encryption for multiple recipients.
64
+ *
65
+ * @param email - The email and subject to encrypt for multiple recipients.
66
+ * @param recipients - The recipients with corresponding public keys.
67
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
68
+ * @returns The set of encrypted emails and subjects
69
+ */
70
+ declare function encryptEmailAndSubjectHybridForMultipleRecipients(email: EmailAndSubject, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<HybridEncryptedEmailAndSubject[]>;
71
+ /**
72
+ * Decrypts the email and its subject using hybrid encryption.
73
+ *
74
+ * @param hybridEmail - The encrypted email and subject.
75
+ * @param recipientPrivateHybridKeys - The private key of the recipient.
76
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
77
+ * @returns The decrypted email and subject
78
+ */
79
+ declare function decryptEmailAndSubjectHybrid(hybridEmail: HybridEncryptedEmailAndSubject, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubject>;
80
+ //#endregion
81
+ //#region src/email-crypto/pwdProtectedEmailAndSubject.d.ts
82
+ /**
83
+ * Creates a password-protected email and subject.
84
+ *
85
+ * @param email - The email and subject to password-protect
86
+ * @param password - The secret password shared among recipients
87
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
88
+ * @returns The password-protected email
89
+ */
90
+ declare function createPwdProtectedEmailAndSubject(email: EmailAndSubject, password: string, aux?: Uint8Array): Promise<PwdProtectedEmailAndSubject>;
91
+ /**
92
+ * Opens a password-protected email and subject.
93
+ *
94
+ * @param encryptedEmail - The encrypted email and subject
95
+ * @param password - The secret password shared among recipients.
96
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
97
+ * @returns The decrypted email and subject
98
+ */
99
+ declare function decryptPwdProtectedEmailAndSubject(encryptedEmail: PwdProtectedEmailAndSubject, password: string, aux?: Uint8Array): Promise<EmailAndSubject>;
51
100
  //#endregion
52
101
  //#region src/email-crypto/emailKeys.d.ts
53
102
  /**
@@ -73,34 +122,34 @@ declare const deriveEmailDraftKey: (mnemonic: string) => Promise<Uint8Array>;
73
122
  //#endregion
74
123
  //#region src/email-crypto/core.d.ts
75
124
  /**
76
- * Symmetrically encrypts email body.
125
+ * Symmetrically encrypts email.
77
126
  *
78
- * @param body - The email body to encrypt.
127
+ * @param email - The email to encrypt.
79
128
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
80
- * @returns The resulting encrypted email body and symmetric key used for encryption
129
+ * @returns The resulting encrypted email and symmetric key used for encryption
81
130
  */
82
- declare function encryptEmailBody(body: EmailBody, aux?: Uint8Array): Promise<{
83
- encEmailBody: EmailBodyEncrypted;
131
+ declare function encryptEmail(email: Email, aux?: Uint8Array): Promise<{
132
+ encEmail: EmailEncrypted;
84
133
  encryptionKey: Uint8Array;
85
134
  }>;
86
135
  /**
87
- * Symmetrically encrypts email body with the given key.
136
+ * Symmetrically encrypts email with the given key.
88
137
  *
89
- * @param body - The email body to encrypt.
138
+ * @param email - The email to encrypt.
90
139
  * @param encryptionKey - The symmetric key to encrypt the email.
91
140
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
92
- * @returns The resulting encrypted email body and symmetric key used for encryption
141
+ * @returns The resulting encrypted email and symmetric key used for encryption
93
142
  */
94
- declare function encryptEmailBodyWithKey(body: EmailBody, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailBodyEncrypted>;
143
+ declare function encryptEmailWithKey(email: Email, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailEncrypted>;
95
144
  /**
96
- * Decrypts symmetrically encrypted email body.
145
+ * Decrypts symmetrically encrypted email.
97
146
  *
98
- * @param encEmailBody - The email body to decrypt.
147
+ * @param encEmail - The email to decrypt.
99
148
  * @param encryptionKey - The symmetric key to decrypt the email.
100
149
  * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
101
- * @returns The resulting decrypted email body
150
+ * @returns The resulting decrypted email
102
151
  */
103
- declare function decryptEmailBody(encEmailBody: EmailBodyEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailBody>;
152
+ declare function decryptEmail(encEmail: EmailEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<Email>;
104
153
  /**
105
154
  * Encrypts the email symmetric key using hybrid encryption.
106
155
  *
@@ -134,5 +183,65 @@ declare function passwordProtectKey(emailEncryptionKey: Uint8Array, password: st
134
183
  */
135
184
  declare function removePasswordProtection(emailEncryptionKey: PwdProtectedKey, password: string): Promise<Uint8Array>;
136
185
  //#endregion
137
- export { createPwdProtectedEmail, decryptEmailBody, decryptEmailHybrid, decryptKeysHybrid, decryptPwdProtectedEmail, deriveDatabaseKey, deriveEmailDraftKey, encryptEmailBody, encryptEmailBodyWithKey, encryptEmailHybrid, encryptEmailHybridForMultipleRecipients, encryptKeysHybrid, generateEmailKeys, passwordProtectKey, removePasswordProtection };
186
+ //#region src/email-crypto/coreSubject.d.ts
187
+ /**
188
+ * Symmetrically encrypts email and subject.
189
+ *
190
+ * @param email - The email and subject to encrypt.
191
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
192
+ * @returns The resulting encrypted email and symmetric key used for encryption
193
+ */
194
+ declare function encryptEmailAndSubject(email: EmailAndSubject, aux?: Uint8Array): Promise<{
195
+ encEmail: EmailAndSubjectEncrypted;
196
+ encryptionKey: Uint8Array;
197
+ }>;
198
+ /**
199
+ * Symmetrically encrypts email and subject with the given key.
200
+ *
201
+ * @param email - The email and subject to encrypt.
202
+ * @param encryptionKey - The symmetric key to encrypt the email.
203
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
204
+ * @returns The resulting encrypted email and symmetric key used for encryption
205
+ */
206
+ declare function encryptEmailAndSubjectWithKey(email: EmailAndSubject, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubjectEncrypted>;
207
+ /**
208
+ * Decrypts symmetrically encrypted email and email subject.
209
+ *
210
+ * @param encEmail - The encrypted email and subject to decrypt.
211
+ * @param encryptionKey - The symmetric key to decrypt the email.
212
+ * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
213
+ * @returns The resulting decrypted email and subject
214
+ */
215
+ declare function decryptEmailAndSubject(encEmail: EmailAndSubjectEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubject>;
216
+ //#endregion
217
+ //#region src/email-crypto/errors.d.ts
218
+ declare class FailedToEncryptEmail extends Error {
219
+ constructor(errorMsg?: string);
220
+ }
221
+ declare class EmailSymmetricEncryptionError extends Error {
222
+ constructor(errorMsg?: string);
223
+ }
224
+ declare class EmailSymmetricDecryptionError extends Error {
225
+ constructor(errorMsg?: string);
226
+ }
227
+ declare class EmailHybridEncryptionError extends Error {
228
+ constructor(errorMsg?: string);
229
+ }
230
+ declare class EmailHybridDecryptionError extends Error {
231
+ constructor(errorMsg?: string);
232
+ }
233
+ declare class EmailPasswordProtectError extends Error {
234
+ constructor(errorMsg?: string);
235
+ }
236
+ declare class EmailPasswordOpenError extends Error {
237
+ constructor(errorMsg?: string);
238
+ }
239
+ declare class InvalidInputEmail extends Error {
240
+ constructor();
241
+ }
242
+ declare class FailedToDecryptEmail extends Error {
243
+ constructor(errorMsg?: string);
244
+ }
245
+ //#endregion
246
+ export { EmailHybridDecryptionError, EmailHybridEncryptionError, EmailPasswordOpenError, EmailPasswordProtectError, EmailSymmetricDecryptionError, EmailSymmetricEncryptionError, FailedToDecryptEmail, FailedToEncryptEmail, InvalidInputEmail, createPwdProtectedEmail, createPwdProtectedEmailAndSubject, decryptEmail, decryptEmailAndSubject, decryptEmailAndSubjectHybrid, decryptEmailHybrid, decryptKeysHybrid, decryptPwdProtectedEmail, decryptPwdProtectedEmailAndSubject, deriveDatabaseKey, deriveEmailDraftKey, encryptEmail, encryptEmailAndSubject, encryptEmailAndSubjectHybrid, encryptEmailAndSubjectHybridForMultipleRecipients, encryptEmailAndSubjectWithKey, encryptEmailHybrid, encryptEmailHybridForMultipleRecipients, encryptEmailWithKey, encryptKeysHybrid, generateEmailKeys, passwordProtectKey, removePasswordProtection };
138
247
  //# 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","../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;;;iBEDsB,iBAAA,CAAA,GAAqB,OAAA,CAAQ,aAAA;;;;;;;cAUtC,iBAAA,GAA2B,QAAA,aAAmB,OAAA,CAAQ,UAAA;;;;;;;cAUtD,mBAAA,GAA6B,QAAA,aAAmB,OAAA,CAAQ,UAAA;;;;;AFnBrE;;;;;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
+ {"version":3,"file":"email-crypto.d.ts","names":[],"sources":["../src/email-crypto/hybridEncyptedEmail.ts","../src/email-crypto/pwdProtectedEmail.ts","../src/email-crypto/hybridEncryptedEmailAndSubject.ts","../src/email-crypto/pwdProtectedEmailAndSubject.ts","../src/email-crypto/emailKeys.ts","../src/email-crypto/core.ts","../src/email-crypto/coreSubject.ts","../src/email-crypto/errors.ts"],"mappings":";;;;;AAmBA;;;;;;iBAAsB,kBAAA,CACpB,KAAA,EAAO,KAAA,EACP,SAAA,EAAW,sBAAA,EACX,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,oBAAA;;;;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5B,QAAA;AAAA;AAAA,cAOD,6BAAA,SAAsC,KAAA;cACrC,QAAA;AAAA;AAAA,cAOD,6BAAA,SAAsC,KAAA;cACrC,QAAA;AAAA;AAAA,cAOD,0BAAA,SAAmC,KAAA;cAClC,QAAA;AAAA;AAAA,cAOD,0BAAA,SAAmC,KAAA;cAClC,QAAA;AAAA;AAAA,cAOD,yBAAA,SAAkC,KAAA;cACjC,QAAA;AAAA;AAAA,cAOD,sBAAA,SAA+B,KAAA;cAC9B,QAAA;AAAA;AAAA,cAOD,iBAAA,SAA0B,KAAA;EAAA,WAAA,CAAA;AAAA;AAAA,cAQ1B,oBAAA,SAA6B,KAAA;cAC5B,QAAA;AAAA"}
@@ -1,18 +1,34 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_emailKeys = require('./emailKeys-BFI-paQq.js');
3
-
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.deriveDatabaseKey = require_emailKeys.deriveDatabaseKey;
10
- exports.deriveEmailDraftKey = require_emailKeys.deriveEmailDraftKey;
11
- exports.encryptEmailBody = require_emailKeys.encryptEmailBody;
12
- exports.encryptEmailBodyWithKey = require_emailKeys.encryptEmailBodyWithKey;
13
- exports.encryptEmailHybrid = require_emailKeys.encryptEmailHybrid;
14
- exports.encryptEmailHybridForMultipleRecipients = require_emailKeys.encryptEmailHybridForMultipleRecipients;
15
- exports.encryptKeysHybrid = require_emailKeys.encryptKeysHybrid;
16
- exports.generateEmailKeys = require_emailKeys.generateEmailKeys;
17
- exports.passwordProtectKey = require_emailKeys.passwordProtectKey;
18
- exports.removePasswordProtection = require_emailKeys.removePasswordProtection;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_email_crypto = require("./email-crypto-Di814Pbk.js");
3
+ exports.EmailHybridDecryptionError = require_email_crypto.EmailHybridDecryptionError;
4
+ exports.EmailHybridEncryptionError = require_email_crypto.EmailHybridEncryptionError;
5
+ exports.EmailPasswordOpenError = require_email_crypto.EmailPasswordOpenError;
6
+ exports.EmailPasswordProtectError = require_email_crypto.EmailPasswordProtectError;
7
+ exports.EmailSymmetricDecryptionError = require_email_crypto.EmailSymmetricDecryptionError;
8
+ exports.EmailSymmetricEncryptionError = require_email_crypto.EmailSymmetricEncryptionError;
9
+ exports.FailedToDecryptEmail = require_email_crypto.FailedToDecryptEmail;
10
+ exports.FailedToEncryptEmail = require_email_crypto.FailedToEncryptEmail;
11
+ exports.InvalidInputEmail = require_email_crypto.InvalidInputEmail;
12
+ exports.createPwdProtectedEmail = require_email_crypto.createPwdProtectedEmail;
13
+ exports.createPwdProtectedEmailAndSubject = require_email_crypto.createPwdProtectedEmailAndSubject;
14
+ exports.decryptEmail = require_email_crypto.decryptEmail;
15
+ exports.decryptEmailAndSubject = require_email_crypto.decryptEmailAndSubject;
16
+ exports.decryptEmailAndSubjectHybrid = require_email_crypto.decryptEmailAndSubjectHybrid;
17
+ exports.decryptEmailHybrid = require_email_crypto.decryptEmailHybrid;
18
+ exports.decryptKeysHybrid = require_email_crypto.decryptKeysHybrid;
19
+ exports.decryptPwdProtectedEmail = require_email_crypto.decryptPwdProtectedEmail;
20
+ exports.decryptPwdProtectedEmailAndSubject = require_email_crypto.decryptPwdProtectedEmailAndSubject;
21
+ exports.deriveDatabaseKey = require_email_crypto.deriveDatabaseKey;
22
+ exports.deriveEmailDraftKey = require_email_crypto.deriveEmailDraftKey;
23
+ exports.encryptEmail = require_email_crypto.encryptEmail;
24
+ exports.encryptEmailAndSubject = require_email_crypto.encryptEmailAndSubject;
25
+ exports.encryptEmailAndSubjectHybrid = require_email_crypto.encryptEmailAndSubjectHybrid;
26
+ exports.encryptEmailAndSubjectHybridForMultipleRecipients = require_email_crypto.encryptEmailAndSubjectHybridForMultipleRecipients;
27
+ exports.encryptEmailAndSubjectWithKey = require_email_crypto.encryptEmailAndSubjectWithKey;
28
+ exports.encryptEmailHybrid = require_email_crypto.encryptEmailHybrid;
29
+ exports.encryptEmailHybridForMultipleRecipients = require_email_crypto.encryptEmailHybridForMultipleRecipients;
30
+ exports.encryptEmailWithKey = require_email_crypto.encryptEmailWithKey;
31
+ exports.encryptKeysHybrid = require_email_crypto.encryptKeysHybrid;
32
+ exports.generateEmailKeys = require_email_crypto.generateEmailKeys;
33
+ exports.passwordProtectKey = require_email_crypto.passwordProtectKey;
34
+ exports.removePasswordProtection = require_email_crypto.removePasswordProtection;