import { d as PwdProtectedKey, f as RecipientWithPublicKey, i as EmailEncrypted, l as PwdProtectedEmail, n as EmailAndSubject, o as HybridEncKey, r as EmailAndSubjectEncrypted, s as HybridKeyPair, t as Email, u as PwdProtectedEmailAndSubject } from "./types-Y0wL7HUH.js"; //#region src/email-crypto/hybridEncyptedEmail.d.ts /** * Encrypts the email using hybrid encryption for multiple recipients. * * @param email - The email to encrypt for multiple recipients. * @param recipients - The recipients with corresponding public keys. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The set of encrypted keys (one per user) and encrypted email */ declare function encryptEmailHybridForMultipleRecipients(email: Email, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<{ encryptedKeys: HybridEncKey[]; encEmail: EmailEncrypted; }>; /** * Decrypts the email using hybrid encryption. * * @param encEmail - The encrypted email. * @param encryptedKey - The encrypted key for this recipient. * @param recipientPrivateHybridKeys - The private key of the recipient. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The decrypted email */ declare function decryptEmailHybrid(encEmail: EmailEncrypted, encryptedKey: HybridEncKey, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise; declare function decryptEmailPreviewHybrid(encPreview: string, encryptedKey: HybridEncKey, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<{ preview: string; encryptionKey: Uint8Array; }>; //#endregion //#region src/email-crypto/pwdProtectedEmail.d.ts /** * Creates a password-protected email. * * @param email - The email to password-protect * @param password - The secret password shared among recipients * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The password-protected email */ declare function createPwdProtectedEmail(email: Email, password: string, aux?: Uint8Array): Promise; /** * Opens a password-protected email. * * @param encryptedEmail - The encrypted email * @param password - The secret password shared among recipients. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The decrypted email */ declare function decryptPwdProtectedEmail(encryptedEmail: PwdProtectedEmail, password: string, aux?: Uint8Array): Promise; //#endregion //#region src/email-crypto/hybridEncryptedEmailAndSubject.d.ts /** * Encrypts the email and its subject using hybrid encryption for multiple recipients. * * @param email - The email and subject to encrypt for multiple recipients. * @param recipients - The recipients with corresponding public keys. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The set of encrypted keys and encrypted email and subject */ declare function encryptEmailAndSubjectHybridForMultipleRecipients(email: EmailAndSubject, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<{ encryptedKeys: HybridEncKey[]; encEmail: EmailAndSubjectEncrypted; }>; /** * Decrypts the email and its subject using hybrid encryption. * * @param encEmail - The encrypted email and subject. * @param encryptedKey - The encrypted key for this recipient. * @param recipientPrivateHybridKeys - The private key of the recipient. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The decrypted email and subject */ declare function decryptEmailAndSubjectHybrid(encEmail: EmailAndSubjectEncrypted, encryptedKey: HybridEncKey, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise; //#endregion //#region src/email-crypto/pwdProtectedEmailAndSubject.d.ts /** * Creates a password-protected email and subject. * * @param email - The email and subject to password-protect * @param password - The secret password shared among recipients * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The password-protected email */ declare function createPwdProtectedEmailAndSubject(email: EmailAndSubject, password: string, aux?: Uint8Array): Promise; /** * Opens a password-protected email and subject. * * @param encryptedEmail - The encrypted email and subject * @param password - The secret password shared among recipients. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The decrypted email and subject */ declare function decryptPwdProtectedEmailAndSubject(encryptedEmail: PwdProtectedEmailAndSubject, password: string, aux?: Uint8Array): Promise; //#endregion //#region src/email-crypto/emailKeys.d.ts /** * Generates public and private keys for email encryption. * * @returns The user's private and public keys */ declare function generateEmailKeys(): Promise; /** * Derives database encryption key for the given user * * @param mnemonic - The user's mnemonic (machine-generated with secure PRNG) * @returns The symmetric key for protecting database */ declare const deriveDatabaseKey: (mnemonic: string) => Promise; /** * Derives email draft encryption key for the given user * * @param mnemonic - The user's mnemonic (machine-generated with secure PRNG) * @returns The symmetric key for protecting email drafts */ declare const deriveEmailDraftKey: (mnemonic: string) => Promise; //#endregion //#region src/email-crypto/core.d.ts /** * Symmetrically encrypts email. * * @param email - The email to encrypt. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The resulting encrypted email and symmetric key used for encryption */ declare function encryptEmail(email: Email, aux?: Uint8Array): Promise<{ encEmail: EmailEncrypted; encryptionKey: Uint8Array; }>; /** * Symmetrically encrypts email with the given key. * * @param email - The email to encrypt. * @param encryptionKey - The symmetric key to encrypt the email. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The resulting encrypted email and symmetric key used for encryption */ declare function encryptEmailWithKey(email: Email, encryptionKey: Uint8Array, aux?: Uint8Array): Promise; /** * Decrypts symmetrically encrypted email preview. * * @param encEmailPreview - The email preview to decrypt. * @param encryptionKey - The symmetric key to decrypt the email. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The resulting decrypted email */ declare function decryptPreview(encEmailPreview: string, encryptionKey: Uint8Array, aux?: Uint8Array): Promise; /** * Decrypts symmetrically encrypted email. * * @param encEmail - The email to decrypt. * @param encryptionKey - The symmetric key to decrypt the email. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The resulting decrypted email */ declare function decryptEmail(encEmail: EmailEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise; /** * Encrypts the email symmetric key using hybrid encryption. * * @param emailEncryptionKey - The symmetric key used for email encryption. * @param recipient - The recipient with a public hybrid key. * @returns The encrypted email symmetric key */ declare function encryptKeysHybrid(emailEncryptionKey: Uint8Array, recipient: RecipientWithPublicKey): Promise; /** * Decrypts the email symmetric key encrypted via hybrid encryption. * * @param encryptedKey - The encrypted email key. * @param recipientPrivateKey - The private key of the recipient. * @returns The email encryption key */ declare function decryptKeysHybrid(encryptedKey: HybridEncKey, recipientPrivateKey: Uint8Array): Promise; /** * Password-protects the email symmetric key. * * @param emailEncryptionKey - The symmetric key used for email encryption. * @param password - The secret password for key protection. * @returns The password-protected email symmetric key */ declare function passwordProtectKey(emailEncryptionKey: Uint8Array, password: string): Promise; /** * Removes passoword-protection and exposes the email symmetric key. * * @param emailEncryptionKey - The password-protected email key. * @param password - The secret password for key protection. * @returns The email encryption key */ declare function removePasswordProtection(emailEncryptionKey: PwdProtectedKey, password: string): Promise; //#endregion //#region src/email-crypto/coreSubject.d.ts /** * Symmetrically encrypts email and subject. * * @param email - The email and subject to encrypt. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The resulting encrypted email and symmetric key used for encryption */ declare function encryptEmailAndSubject(email: EmailAndSubject, aux?: Uint8Array): Promise<{ encEmail: EmailAndSubjectEncrypted; encryptionKey: Uint8Array; }>; /** * Symmetrically encrypts email and subject with the given key. * * @param email - The email and subject to encrypt. * @param encryptionKey - The symmetric key to encrypt the email. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The resulting encrypted email and symmetric key used for encryption */ declare function encryptEmailAndSubjectWithKey(email: EmailAndSubject, encryptionKey: Uint8Array, aux?: Uint8Array): Promise; /** * Decrypts symmetrically encrypted email and email subject. * * @param encEmail - The encrypted email and subject to decrypt. * @param encryptionKey - The symmetric key to decrypt the email. * @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp). * @returns The resulting decrypted email and subject */ declare function decryptEmailAndSubject(encEmail: EmailAndSubjectEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise; //#endregion //#region src/email-crypto/errors.d.ts declare class FailedToEncryptEmail extends Error { constructor(errorMsg?: string); } declare class EmailSymmetricEncryptionError extends Error { constructor(errorMsg?: string); } declare class EmailSymmetricDecryptionError extends Error { constructor(errorMsg?: string); } declare class EmailPreviewSymmetricDecryptionError extends Error { constructor(errorMsg?: string); } declare class EmailHybridEncryptionError extends Error { constructor(errorMsg?: string); } declare class EmailHybridDecryptionError extends Error { constructor(errorMsg?: string); } declare class EmailPasswordProtectError extends Error { constructor(errorMsg?: string); } declare class EmailPasswordOpenError extends Error { constructor(errorMsg?: string); } declare class InvalidInputEmail extends Error { constructor(); } declare class FailedToDecryptEmail extends Error { constructor(errorMsg?: string); } //#endregion export { EmailHybridDecryptionError, EmailHybridEncryptionError, EmailPasswordOpenError, EmailPasswordProtectError, EmailPreviewSymmetricDecryptionError, EmailSymmetricDecryptionError, EmailSymmetricEncryptionError, FailedToDecryptEmail, FailedToEncryptEmail, InvalidInputEmail, createPwdProtectedEmail, createPwdProtectedEmailAndSubject, decryptEmail, decryptEmailAndSubject, decryptEmailAndSubjectHybrid, decryptEmailHybrid, decryptEmailPreviewHybrid, decryptKeysHybrid, decryptPreview, decryptPwdProtectedEmail, decryptPwdProtectedEmailAndSubject, deriveDatabaseKey, deriveEmailDraftKey, encryptEmail, encryptEmailAndSubject, encryptEmailAndSubjectHybridForMultipleRecipients, encryptEmailAndSubjectWithKey, encryptEmailHybridForMultipleRecipients, encryptEmailWithKey, encryptKeysHybrid, generateEmailKeys, passwordProtectKey, removePasswordProtection }; //# sourceMappingURL=email-crypto.d.ts.map