internxt-crypto 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/dist/asymmetric-crypto.d.mts.map +1 -1
- package/dist/asymmetric-crypto.d.ts.map +1 -1
- package/dist/asymmetric-crypto.js +12 -2
- package/dist/asymmetric-crypto.js.map +1 -1
- package/dist/asymmetric-crypto.mjs +12 -2
- package/dist/asymmetric-crypto.mjs.map +1 -1
- package/dist/{email-crypto-_Wcbvr_n.mjs → email-crypto-CoRbTphp.mjs} +73 -106
- package/dist/email-crypto-CoRbTphp.mjs.map +1 -0
- package/dist/{email-crypto-CPL8ept8.js → email-crypto-DJb-I1wm.js} +90 -117
- package/dist/email-crypto-DJb-I1wm.js.map +1 -0
- package/dist/email-crypto.d.mts +33 -27
- package/dist/email-crypto.d.mts.map +1 -1
- package/dist/email-crypto.d.ts +33 -27
- package/dist/email-crypto.d.ts.map +1 -1
- package/dist/email-crypto.js +4 -3
- package/dist/email-crypto.mjs +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -3
- package/dist/index.mjs +2 -2
- package/dist/keystore-crypto.d.mts +1 -1
- package/dist/keystore-crypto.d.ts +1 -1
- package/dist/react-native/asymmetric-crypto.d.mts +21 -0
- package/dist/react-native/asymmetric-crypto.d.mts.map +1 -0
- package/dist/react-native/asymmetric-crypto.d.ts +21 -0
- package/dist/react-native/asymmetric-crypto.d.ts.map +1 -0
- package/dist/react-native/asymmetric-crypto.js +31 -0
- package/dist/react-native/asymmetric-crypto.js.map +1 -0
- package/dist/react-native/asymmetric-crypto.mjs +28 -0
- package/dist/react-native/asymmetric-crypto.mjs.map +1 -0
- package/dist/react-native/chunk-CfYAbeIz.mjs +13 -0
- package/dist/react-native/chunk-DskHE4z1.js +43 -0
- package/dist/react-native/constants.d.mts +27 -0
- package/dist/react-native/constants.d.mts.map +1 -0
- package/dist/react-native/constants.d.ts +27 -0
- package/dist/react-native/constants.d.ts.map +1 -0
- package/dist/react-native/constants.js +51 -0
- package/dist/react-native/constants.js.map +1 -0
- package/dist/react-native/constants.mjs +28 -0
- package/dist/react-native/constants.mjs.map +1 -0
- package/dist/react-native/derive-key.d.mts +32 -0
- package/dist/react-native/derive-key.d.mts.map +1 -0
- package/dist/react-native/derive-key.d.ts +32 -0
- package/dist/react-native/derive-key.d.ts.map +1 -0
- package/dist/react-native/derive-key.js +51 -0
- package/dist/react-native/derive-key.js.map +1 -0
- package/dist/react-native/derive-key.mjs +47 -0
- package/dist/react-native/derive-key.mjs.map +1 -0
- package/dist/react-native/derive-password-Bb3R3nyh.mjs +68 -0
- package/dist/react-native/derive-password-Bb3R3nyh.mjs.map +1 -0
- package/dist/react-native/derive-password-DIPrE8Mz.js +86 -0
- package/dist/react-native/derive-password-DIPrE8Mz.js.map +1 -0
- package/dist/react-native/derive-password.d.mts +28 -0
- package/dist/react-native/derive-password.d.mts.map +1 -0
- package/dist/react-native/derive-password.d.ts +28 -0
- package/dist/react-native/derive-password.d.ts.map +1 -0
- package/dist/react-native/derive-password.js +5 -0
- package/dist/react-native/derive-password.mjs +2 -0
- package/dist/react-native/email-crypto-C3ka3aAj.js +700 -0
- package/dist/react-native/email-crypto-C3ka3aAj.js.map +1 -0
- package/dist/react-native/email-crypto-CDM4iPK8.mjs +490 -0
- package/dist/react-native/email-crypto-CDM4iPK8.mjs.map +1 -0
- package/dist/react-native/email-crypto.d.mts +253 -0
- package/dist/react-native/email-crypto.d.mts.map +1 -0
- package/dist/react-native/email-crypto.d.ts +253 -0
- package/dist/react-native/email-crypto.d.ts.map +1 -0
- package/dist/react-native/email-crypto.js +35 -0
- package/dist/react-native/email-crypto.mjs +2 -0
- package/dist/react-native/hash.d.mts +50 -0
- package/dist/react-native/hash.d.mts.map +1 -0
- package/dist/react-native/hash.d.ts +50 -0
- package/dist/react-native/hash.d.ts.map +1 -0
- package/dist/react-native/hash.js +89 -0
- package/dist/react-native/hash.js.map +1 -0
- package/dist/react-native/hash.mjs +82 -0
- package/dist/react-native/hash.mjs.map +1 -0
- package/dist/react-native/index.d.mts +32 -0
- package/dist/react-native/index.d.mts.map +1 -0
- package/dist/react-native/index.d.ts +32 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +106 -0
- package/dist/react-native/index.mjs +12 -0
- package/dist/react-native/keystore-crypto-BXPEVvzq.js +238 -0
- package/dist/react-native/keystore-crypto-BXPEVvzq.js.map +1 -0
- package/dist/react-native/keystore-crypto-C6F-NQdX.mjs +185 -0
- package/dist/react-native/keystore-crypto-C6F-NQdX.mjs.map +1 -0
- package/dist/react-native/keystore-crypto.d.mts +71 -0
- package/dist/react-native/keystore-crypto.d.mts.map +1 -0
- package/dist/react-native/keystore-crypto.d.ts +71 -0
- package/dist/react-native/keystore-crypto.d.ts.map +1 -0
- package/dist/react-native/keystore-crypto.js +11 -0
- package/dist/react-native/keystore-crypto.mjs +2 -0
- package/dist/react-native/post-quantum-crypto.d.mts +32 -0
- package/dist/react-native/post-quantum-crypto.d.mts.map +1 -0
- package/dist/react-native/post-quantum-crypto.d.ts +32 -0
- package/dist/react-native/post-quantum-crypto.d.ts.map +1 -0
- package/dist/react-native/post-quantum-crypto.js +50 -0
- package/dist/react-native/post-quantum-crypto.js.map +1 -0
- package/dist/react-native/post-quantum-crypto.mjs +46 -0
- package/dist/react-native/post-quantum-crypto.mjs.map +1 -0
- package/dist/react-native/storage-service.d.mts +47 -0
- package/dist/react-native/storage-service.d.mts.map +1 -0
- package/dist/react-native/storage-service.d.ts +47 -0
- package/dist/react-native/storage-service.d.ts.map +1 -0
- package/dist/react-native/storage-service.js +66 -0
- package/dist/react-native/storage-service.js.map +1 -0
- package/dist/react-native/storage-service.mjs +54 -0
- package/dist/react-native/storage-service.mjs.map +1 -0
- package/dist/react-native/symmetric-crypto.d.mts +28 -0
- package/dist/react-native/symmetric-crypto.d.mts.map +1 -0
- package/dist/react-native/symmetric-crypto.d.ts +28 -0
- package/dist/react-native/symmetric-crypto.d.ts.map +1 -0
- package/dist/react-native/symmetric-crypto.js +52 -0
- package/dist/react-native/symmetric-crypto.js.map +1 -0
- package/dist/react-native/symmetric-crypto.mjs +48 -0
- package/dist/react-native/symmetric-crypto.mjs.map +1 -0
- package/dist/{types-fhvOo6Gw.d.ts → react-native/types-D1R4_m5r.d.mts} +6 -10
- package/dist/react-native/types-D1R4_m5r.d.mts.map +1 -0
- package/dist/{types-cEyToM9T.d.mts → react-native/types-Y0wL7HUH.d.ts} +6 -10
- package/dist/react-native/types-Y0wL7HUH.d.ts.map +1 -0
- package/dist/react-native/types.d.mts +2 -0
- package/dist/react-native/types.d.ts +2 -0
- package/dist/react-native/types.js +11 -0
- package/dist/react-native/types.js.map +1 -0
- package/dist/react-native/types.mjs +10 -0
- package/dist/react-native/types.mjs.map +1 -0
- package/dist/react-native/utils.d.mts +78 -0
- package/dist/react-native/utils.d.mts.map +1 -0
- package/dist/react-native/utils.d.ts +78 -0
- package/dist/react-native/utils.d.ts.map +1 -0
- package/dist/react-native/utils.js +123 -0
- package/dist/react-native/utils.js.map +1 -0
- package/dist/react-native/utils.mjs +109 -0
- package/dist/react-native/utils.mjs.map +1 -0
- package/dist/react-native/xwing-B34h5e3Z.mjs +15 -0
- package/dist/react-native/xwing-B34h5e3Z.mjs.map +1 -0
- package/dist/react-native/xwing-CSdiyHAt.js +33 -0
- package/dist/react-native/xwing-CSdiyHAt.js.map +1 -0
- package/dist/types-D1R4_m5r.d.mts +55 -0
- package/dist/types-D1R4_m5r.d.mts.map +1 -0
- package/dist/types-Y0wL7HUH.d.ts +55 -0
- package/dist/types-Y0wL7HUH.d.ts.map +1 -0
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.js.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +3 -8
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +3 -8
- package/dist/utils.mjs.map +1 -1
- package/package.json +4 -1
- package/dist/email-crypto-CPL8ept8.js.map +0 -1
- package/dist/email-crypto-_Wcbvr_n.mjs.map +0 -1
- package/dist/types-cEyToM9T.d.mts.map +0 -1
- package/dist/types-fhvOo6Gw.d.ts.map +0 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
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-D1R4_m5r.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/email-crypto/hybridEncyptedEmail.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Encrypts the email using hybrid encryption for multiple recipients.
|
|
6
|
+
*
|
|
7
|
+
* @param email - The email to encrypt for multiple recipients.
|
|
8
|
+
* @param recipients - The recipients with corresponding public keys.
|
|
9
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
10
|
+
* @returns The set of encrypted keys (one per user) and encrypted email
|
|
11
|
+
*/
|
|
12
|
+
declare function encryptEmailHybridForMultipleRecipients(email: Email, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<{
|
|
13
|
+
encryptedKeys: HybridEncKey[];
|
|
14
|
+
encEmail: EmailEncrypted;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Decrypts the email using hybrid encryption.
|
|
18
|
+
*
|
|
19
|
+
* @param encEmail - The encrypted email.
|
|
20
|
+
* @param encryptedKey - The encrypted key for this recipient.
|
|
21
|
+
* @param recipientPrivateHybridKeys - The private key of the recipient.
|
|
22
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
23
|
+
* @returns The decrypted email
|
|
24
|
+
*/
|
|
25
|
+
declare function decryptEmailHybrid(encEmail: EmailEncrypted, encryptedKey: HybridEncKey, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<Email>;
|
|
26
|
+
declare function decryptEmailPreviewHybrid(encPreview: string, encryptedKey: HybridEncKey, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<{
|
|
27
|
+
preview: string;
|
|
28
|
+
encryptionKey: Uint8Array;
|
|
29
|
+
}>;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/email-crypto/pwdProtectedEmail.d.ts
|
|
32
|
+
/**
|
|
33
|
+
* Creates a password-protected email.
|
|
34
|
+
*
|
|
35
|
+
* @param email - The email to password-protect
|
|
36
|
+
* @param password - The secret password shared among recipients
|
|
37
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
38
|
+
* @returns The password-protected email
|
|
39
|
+
*/
|
|
40
|
+
declare function createPwdProtectedEmail(email: Email, password: string, aux?: Uint8Array): Promise<PwdProtectedEmail>;
|
|
41
|
+
/**
|
|
42
|
+
* Opens a password-protected email.
|
|
43
|
+
*
|
|
44
|
+
* @param encryptedEmail - The encrypted email
|
|
45
|
+
* @param password - The secret password shared among recipients.
|
|
46
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
47
|
+
* @returns The decrypted email
|
|
48
|
+
*/
|
|
49
|
+
declare function decryptPwdProtectedEmail(encryptedEmail: PwdProtectedEmail, password: string, aux?: Uint8Array): Promise<Email>;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/email-crypto/hybridEncryptedEmailAndSubject.d.ts
|
|
52
|
+
/**
|
|
53
|
+
* Encrypts the email and its subject using hybrid encryption for multiple recipients.
|
|
54
|
+
*
|
|
55
|
+
* @param email - The email and subject to encrypt for multiple recipients.
|
|
56
|
+
* @param recipients - The recipients with corresponding public keys.
|
|
57
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
58
|
+
* @returns The set of encrypted keys and encrypted email and subject
|
|
59
|
+
*/
|
|
60
|
+
declare function encryptEmailAndSubjectHybridForMultipleRecipients(email: EmailAndSubject, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<{
|
|
61
|
+
encryptedKeys: HybridEncKey[];
|
|
62
|
+
encEmail: EmailAndSubjectEncrypted;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Decrypts the email and its subject using hybrid encryption.
|
|
66
|
+
*
|
|
67
|
+
* @param encEmail - The encrypted email and subject.
|
|
68
|
+
* @param encryptedKey - The encrypted key for this recipient.
|
|
69
|
+
* @param recipientPrivateHybridKeys - The private key of the recipient.
|
|
70
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
71
|
+
* @returns The decrypted email and subject
|
|
72
|
+
*/
|
|
73
|
+
declare function decryptEmailAndSubjectHybrid(encEmail: EmailAndSubjectEncrypted, encryptedKey: HybridEncKey, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubject>;
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/email-crypto/pwdProtectedEmailAndSubject.d.ts
|
|
76
|
+
/**
|
|
77
|
+
* Creates a password-protected email and subject.
|
|
78
|
+
*
|
|
79
|
+
* @param email - The email and subject to password-protect
|
|
80
|
+
* @param password - The secret password shared among recipients
|
|
81
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
82
|
+
* @returns The password-protected email
|
|
83
|
+
*/
|
|
84
|
+
declare function createPwdProtectedEmailAndSubject(email: EmailAndSubject, password: string, aux?: Uint8Array): Promise<PwdProtectedEmailAndSubject>;
|
|
85
|
+
/**
|
|
86
|
+
* Opens a password-protected email and subject.
|
|
87
|
+
*
|
|
88
|
+
* @param encryptedEmail - The encrypted email and subject
|
|
89
|
+
* @param password - The secret password shared among recipients.
|
|
90
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
91
|
+
* @returns The decrypted email and subject
|
|
92
|
+
*/
|
|
93
|
+
declare function decryptPwdProtectedEmailAndSubject(encryptedEmail: PwdProtectedEmailAndSubject, password: string, aux?: Uint8Array): Promise<EmailAndSubject>;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/email-crypto/emailKeys.d.ts
|
|
96
|
+
/**
|
|
97
|
+
* Generates public and private keys for email encryption.
|
|
98
|
+
*
|
|
99
|
+
* @returns The user's private and public keys
|
|
100
|
+
*/
|
|
101
|
+
declare function generateEmailKeys(): Promise<HybridKeyPair>;
|
|
102
|
+
/**
|
|
103
|
+
* Derives database encryption key for the given user
|
|
104
|
+
*
|
|
105
|
+
* @param mnemonic - The user's mnemonic (machine-generated with secure PRNG)
|
|
106
|
+
* @returns The symmetric key for protecting database
|
|
107
|
+
*/
|
|
108
|
+
declare const deriveDatabaseKey: (mnemonic: string) => Promise<Uint8Array>;
|
|
109
|
+
/**
|
|
110
|
+
* Derives email draft encryption key for the given user
|
|
111
|
+
*
|
|
112
|
+
* @param mnemonic - The user's mnemonic (machine-generated with secure PRNG)
|
|
113
|
+
* @returns The symmetric key for protecting email drafts
|
|
114
|
+
*/
|
|
115
|
+
declare const deriveEmailDraftKey: (mnemonic: string) => Promise<Uint8Array>;
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/email-crypto/core.d.ts
|
|
118
|
+
/**
|
|
119
|
+
* Symmetrically encrypts email.
|
|
120
|
+
*
|
|
121
|
+
* @param email - The email to encrypt.
|
|
122
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
123
|
+
* @returns The resulting encrypted email and symmetric key used for encryption
|
|
124
|
+
*/
|
|
125
|
+
declare function encryptEmail(email: Email, aux?: Uint8Array): Promise<{
|
|
126
|
+
encEmail: EmailEncrypted;
|
|
127
|
+
encryptionKey: Uint8Array;
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Symmetrically encrypts email with the given key.
|
|
131
|
+
*
|
|
132
|
+
* @param email - The email to encrypt.
|
|
133
|
+
* @param encryptionKey - The symmetric key to encrypt the email.
|
|
134
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
135
|
+
* @returns The resulting encrypted email and symmetric key used for encryption
|
|
136
|
+
*/
|
|
137
|
+
declare function encryptEmailWithKey(email: Email, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailEncrypted>;
|
|
138
|
+
/**
|
|
139
|
+
* Decrypts symmetrically encrypted email preview.
|
|
140
|
+
*
|
|
141
|
+
* @param encEmailPreview - The email preview to decrypt.
|
|
142
|
+
* @param encryptionKey - The symmetric key to decrypt the email.
|
|
143
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
144
|
+
* @returns The resulting decrypted email
|
|
145
|
+
*/
|
|
146
|
+
declare function decryptPreview(encEmailPreview: string, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<string>;
|
|
147
|
+
/**
|
|
148
|
+
* Decrypts symmetrically encrypted email.
|
|
149
|
+
*
|
|
150
|
+
* @param encEmail - The email to decrypt.
|
|
151
|
+
* @param encryptionKey - The symmetric key to decrypt the email.
|
|
152
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
153
|
+
* @returns The resulting decrypted email
|
|
154
|
+
*/
|
|
155
|
+
declare function decryptEmail(encEmail: EmailEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<Email>;
|
|
156
|
+
/**
|
|
157
|
+
* Encrypts the email symmetric key using hybrid encryption.
|
|
158
|
+
*
|
|
159
|
+
* @param emailEncryptionKey - The symmetric key used for email encryption.
|
|
160
|
+
* @param recipient - The recipient with a public hybrid key.
|
|
161
|
+
* @returns The encrypted email symmetric key
|
|
162
|
+
*/
|
|
163
|
+
declare function encryptKeysHybrid(emailEncryptionKey: Uint8Array, recipient: RecipientWithPublicKey): Promise<HybridEncKey>;
|
|
164
|
+
/**
|
|
165
|
+
* Decrypts the email symmetric key encrypted via hybrid encryption.
|
|
166
|
+
*
|
|
167
|
+
* @param encryptedKey - The encrypted email key.
|
|
168
|
+
* @param recipientPrivateKey - The private key of the recipient.
|
|
169
|
+
* @returns The email encryption key
|
|
170
|
+
*/
|
|
171
|
+
declare function decryptKeysHybrid(encryptedKey: HybridEncKey, recipientPrivateKey: Uint8Array): Promise<Uint8Array>;
|
|
172
|
+
/**
|
|
173
|
+
* Password-protects the email symmetric key.
|
|
174
|
+
*
|
|
175
|
+
* @param emailEncryptionKey - The symmetric key used for email encryption.
|
|
176
|
+
* @param password - The secret password for key protection.
|
|
177
|
+
* @returns The password-protected email symmetric key
|
|
178
|
+
*/
|
|
179
|
+
declare function passwordProtectKey(emailEncryptionKey: Uint8Array, password: string): Promise<PwdProtectedKey>;
|
|
180
|
+
/**
|
|
181
|
+
* Removes passoword-protection and exposes the email symmetric key.
|
|
182
|
+
*
|
|
183
|
+
* @param emailEncryptionKey - The password-protected email key.
|
|
184
|
+
* @param password - The secret password for key protection.
|
|
185
|
+
* @returns The email encryption key
|
|
186
|
+
*/
|
|
187
|
+
declare function removePasswordProtection(emailEncryptionKey: PwdProtectedKey, password: string): Promise<Uint8Array>;
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/email-crypto/coreSubject.d.ts
|
|
190
|
+
/**
|
|
191
|
+
* Symmetrically encrypts email and subject.
|
|
192
|
+
*
|
|
193
|
+
* @param email - The email and subject to encrypt.
|
|
194
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
195
|
+
* @returns The resulting encrypted email and symmetric key used for encryption
|
|
196
|
+
*/
|
|
197
|
+
declare function encryptEmailAndSubject(email: EmailAndSubject, aux?: Uint8Array): Promise<{
|
|
198
|
+
encEmail: EmailAndSubjectEncrypted;
|
|
199
|
+
encryptionKey: Uint8Array;
|
|
200
|
+
}>;
|
|
201
|
+
/**
|
|
202
|
+
* Symmetrically encrypts email and subject with the given key.
|
|
203
|
+
*
|
|
204
|
+
* @param email - The email and subject to encrypt.
|
|
205
|
+
* @param encryptionKey - The symmetric key to encrypt the email.
|
|
206
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
207
|
+
* @returns The resulting encrypted email and symmetric key used for encryption
|
|
208
|
+
*/
|
|
209
|
+
declare function encryptEmailAndSubjectWithKey(email: EmailAndSubject, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubjectEncrypted>;
|
|
210
|
+
/**
|
|
211
|
+
* Decrypts symmetrically encrypted email and email subject.
|
|
212
|
+
*
|
|
213
|
+
* @param encEmail - The encrypted email and subject to decrypt.
|
|
214
|
+
* @param encryptionKey - The symmetric key to decrypt the email.
|
|
215
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
216
|
+
* @returns The resulting decrypted email and subject
|
|
217
|
+
*/
|
|
218
|
+
declare function decryptEmailAndSubject(encEmail: EmailAndSubjectEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubject>;
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/email-crypto/errors.d.ts
|
|
221
|
+
declare class FailedToEncryptEmail extends Error {
|
|
222
|
+
constructor(errorMsg?: string);
|
|
223
|
+
}
|
|
224
|
+
declare class EmailSymmetricEncryptionError extends Error {
|
|
225
|
+
constructor(errorMsg?: string);
|
|
226
|
+
}
|
|
227
|
+
declare class EmailSymmetricDecryptionError extends Error {
|
|
228
|
+
constructor(errorMsg?: string);
|
|
229
|
+
}
|
|
230
|
+
declare class EmailPreviewSymmetricDecryptionError extends Error {
|
|
231
|
+
constructor(errorMsg?: string);
|
|
232
|
+
}
|
|
233
|
+
declare class EmailHybridEncryptionError extends Error {
|
|
234
|
+
constructor(errorMsg?: string);
|
|
235
|
+
}
|
|
236
|
+
declare class EmailHybridDecryptionError extends Error {
|
|
237
|
+
constructor(errorMsg?: string);
|
|
238
|
+
}
|
|
239
|
+
declare class EmailPasswordProtectError extends Error {
|
|
240
|
+
constructor(errorMsg?: string);
|
|
241
|
+
}
|
|
242
|
+
declare class EmailPasswordOpenError extends Error {
|
|
243
|
+
constructor(errorMsg?: string);
|
|
244
|
+
}
|
|
245
|
+
declare class InvalidInputEmail extends Error {
|
|
246
|
+
constructor();
|
|
247
|
+
}
|
|
248
|
+
declare class FailedToDecryptEmail extends Error {
|
|
249
|
+
constructor(errorMsg?: string);
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
252
|
+
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 };
|
|
253
|
+
//# sourceMappingURL=email-crypto.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
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":";;;;;AAYA;;;;;;iBAAsB,uCAAA,CACpB,KAAA,EAAO,KAAA,EACP,UAAA,EAAY,sBAAA,IACZ,GAAA,GAAM,UAAA,GACL,OAAA;EAAU,aAAA,EAAe,YAAA;EAAgB,QAAA,EAAU,cAAA;AAAA;;;;;;;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Ae,UAAA,EACf,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,eAAA;;;cCtEE,oBAAA,SAA6B,KAAA;cAC5B,QAAA;AAAA;AAAA,cAQD,6BAAA,SAAsC,KAAA;cACrC,QAAA;AAAA;AAAA,cAQD,6BAAA,SAAsC,KAAA;cACrC,QAAA;AAAA;AAAA,cAQD,oCAAA,SAA6C,KAAA;cAC5C,QAAA;AAAA;AAAA,cAQD,0BAAA,SAAmC,KAAA;cAClC,QAAA;AAAA;AAAA,cAQD,0BAAA,SAAmC,KAAA;cAClC,QAAA;AAAA;AAAA,cAQD,yBAAA,SAAkC,KAAA;cACjC,QAAA;AAAA;AAAA,cAQD,sBAAA,SAA+B,KAAA;cAC9B,QAAA;AAAA;AAAA,cAQD,iBAAA,SAA0B,KAAA;EAAA,WAAA,CAAA;AAAA;AAAA,cAS1B,oBAAA,SAA6B,KAAA;cAC5B,QAAA;AAAA"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
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";
|
|
2
|
+
|
|
3
|
+
//#region src/email-crypto/hybridEncyptedEmail.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Encrypts the email using hybrid encryption for multiple recipients.
|
|
6
|
+
*
|
|
7
|
+
* @param email - The email to encrypt for multiple recipients.
|
|
8
|
+
* @param recipients - The recipients with corresponding public keys.
|
|
9
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
10
|
+
* @returns The set of encrypted keys (one per user) and encrypted email
|
|
11
|
+
*/
|
|
12
|
+
declare function encryptEmailHybridForMultipleRecipients(email: Email, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<{
|
|
13
|
+
encryptedKeys: HybridEncKey[];
|
|
14
|
+
encEmail: EmailEncrypted;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Decrypts the email using hybrid encryption.
|
|
18
|
+
*
|
|
19
|
+
* @param encEmail - The encrypted email.
|
|
20
|
+
* @param encryptedKey - The encrypted key for this recipient.
|
|
21
|
+
* @param recipientPrivateHybridKeys - The private key of the recipient.
|
|
22
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
23
|
+
* @returns The decrypted email
|
|
24
|
+
*/
|
|
25
|
+
declare function decryptEmailHybrid(encEmail: EmailEncrypted, encryptedKey: HybridEncKey, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<Email>;
|
|
26
|
+
declare function decryptEmailPreviewHybrid(encPreview: string, encryptedKey: HybridEncKey, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<{
|
|
27
|
+
preview: string;
|
|
28
|
+
encryptionKey: Uint8Array;
|
|
29
|
+
}>;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/email-crypto/pwdProtectedEmail.d.ts
|
|
32
|
+
/**
|
|
33
|
+
* Creates a password-protected email.
|
|
34
|
+
*
|
|
35
|
+
* @param email - The email to password-protect
|
|
36
|
+
* @param password - The secret password shared among recipients
|
|
37
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
38
|
+
* @returns The password-protected email
|
|
39
|
+
*/
|
|
40
|
+
declare function createPwdProtectedEmail(email: Email, password: string, aux?: Uint8Array): Promise<PwdProtectedEmail>;
|
|
41
|
+
/**
|
|
42
|
+
* Opens a password-protected email.
|
|
43
|
+
*
|
|
44
|
+
* @param encryptedEmail - The encrypted email
|
|
45
|
+
* @param password - The secret password shared among recipients.
|
|
46
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
47
|
+
* @returns The decrypted email
|
|
48
|
+
*/
|
|
49
|
+
declare function decryptPwdProtectedEmail(encryptedEmail: PwdProtectedEmail, password: string, aux?: Uint8Array): Promise<Email>;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/email-crypto/hybridEncryptedEmailAndSubject.d.ts
|
|
52
|
+
/**
|
|
53
|
+
* Encrypts the email and its subject using hybrid encryption for multiple recipients.
|
|
54
|
+
*
|
|
55
|
+
* @param email - The email and subject to encrypt for multiple recipients.
|
|
56
|
+
* @param recipients - The recipients with corresponding public keys.
|
|
57
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
58
|
+
* @returns The set of encrypted keys and encrypted email and subject
|
|
59
|
+
*/
|
|
60
|
+
declare function encryptEmailAndSubjectHybridForMultipleRecipients(email: EmailAndSubject, recipients: RecipientWithPublicKey[], aux?: Uint8Array): Promise<{
|
|
61
|
+
encryptedKeys: HybridEncKey[];
|
|
62
|
+
encEmail: EmailAndSubjectEncrypted;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Decrypts the email and its subject using hybrid encryption.
|
|
66
|
+
*
|
|
67
|
+
* @param encEmail - The encrypted email and subject.
|
|
68
|
+
* @param encryptedKey - The encrypted key for this recipient.
|
|
69
|
+
* @param recipientPrivateHybridKeys - The private key of the recipient.
|
|
70
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
71
|
+
* @returns The decrypted email and subject
|
|
72
|
+
*/
|
|
73
|
+
declare function decryptEmailAndSubjectHybrid(encEmail: EmailAndSubjectEncrypted, encryptedKey: HybridEncKey, recipientPrivateHybridKeys: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubject>;
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/email-crypto/pwdProtectedEmailAndSubject.d.ts
|
|
76
|
+
/**
|
|
77
|
+
* Creates a password-protected email and subject.
|
|
78
|
+
*
|
|
79
|
+
* @param email - The email and subject to password-protect
|
|
80
|
+
* @param password - The secret password shared among recipients
|
|
81
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
82
|
+
* @returns The password-protected email
|
|
83
|
+
*/
|
|
84
|
+
declare function createPwdProtectedEmailAndSubject(email: EmailAndSubject, password: string, aux?: Uint8Array): Promise<PwdProtectedEmailAndSubject>;
|
|
85
|
+
/**
|
|
86
|
+
* Opens a password-protected email and subject.
|
|
87
|
+
*
|
|
88
|
+
* @param encryptedEmail - The encrypted email and subject
|
|
89
|
+
* @param password - The secret password shared among recipients.
|
|
90
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
91
|
+
* @returns The decrypted email and subject
|
|
92
|
+
*/
|
|
93
|
+
declare function decryptPwdProtectedEmailAndSubject(encryptedEmail: PwdProtectedEmailAndSubject, password: string, aux?: Uint8Array): Promise<EmailAndSubject>;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/email-crypto/emailKeys.d.ts
|
|
96
|
+
/**
|
|
97
|
+
* Generates public and private keys for email encryption.
|
|
98
|
+
*
|
|
99
|
+
* @returns The user's private and public keys
|
|
100
|
+
*/
|
|
101
|
+
declare function generateEmailKeys(): Promise<HybridKeyPair>;
|
|
102
|
+
/**
|
|
103
|
+
* Derives database encryption key for the given user
|
|
104
|
+
*
|
|
105
|
+
* @param mnemonic - The user's mnemonic (machine-generated with secure PRNG)
|
|
106
|
+
* @returns The symmetric key for protecting database
|
|
107
|
+
*/
|
|
108
|
+
declare const deriveDatabaseKey: (mnemonic: string) => Promise<Uint8Array>;
|
|
109
|
+
/**
|
|
110
|
+
* Derives email draft encryption key for the given user
|
|
111
|
+
*
|
|
112
|
+
* @param mnemonic - The user's mnemonic (machine-generated with secure PRNG)
|
|
113
|
+
* @returns The symmetric key for protecting email drafts
|
|
114
|
+
*/
|
|
115
|
+
declare const deriveEmailDraftKey: (mnemonic: string) => Promise<Uint8Array>;
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/email-crypto/core.d.ts
|
|
118
|
+
/**
|
|
119
|
+
* Symmetrically encrypts email.
|
|
120
|
+
*
|
|
121
|
+
* @param email - The email to encrypt.
|
|
122
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
123
|
+
* @returns The resulting encrypted email and symmetric key used for encryption
|
|
124
|
+
*/
|
|
125
|
+
declare function encryptEmail(email: Email, aux?: Uint8Array): Promise<{
|
|
126
|
+
encEmail: EmailEncrypted;
|
|
127
|
+
encryptionKey: Uint8Array;
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Symmetrically encrypts email with the given key.
|
|
131
|
+
*
|
|
132
|
+
* @param email - The email to encrypt.
|
|
133
|
+
* @param encryptionKey - The symmetric key to encrypt the email.
|
|
134
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
135
|
+
* @returns The resulting encrypted email and symmetric key used for encryption
|
|
136
|
+
*/
|
|
137
|
+
declare function encryptEmailWithKey(email: Email, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailEncrypted>;
|
|
138
|
+
/**
|
|
139
|
+
* Decrypts symmetrically encrypted email preview.
|
|
140
|
+
*
|
|
141
|
+
* @param encEmailPreview - The email preview to decrypt.
|
|
142
|
+
* @param encryptionKey - The symmetric key to decrypt the email.
|
|
143
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
144
|
+
* @returns The resulting decrypted email
|
|
145
|
+
*/
|
|
146
|
+
declare function decryptPreview(encEmailPreview: string, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<string>;
|
|
147
|
+
/**
|
|
148
|
+
* Decrypts symmetrically encrypted email.
|
|
149
|
+
*
|
|
150
|
+
* @param encEmail - The email to decrypt.
|
|
151
|
+
* @param encryptionKey - The symmetric key to decrypt the email.
|
|
152
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
153
|
+
* @returns The resulting decrypted email
|
|
154
|
+
*/
|
|
155
|
+
declare function decryptEmail(encEmail: EmailEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<Email>;
|
|
156
|
+
/**
|
|
157
|
+
* Encrypts the email symmetric key using hybrid encryption.
|
|
158
|
+
*
|
|
159
|
+
* @param emailEncryptionKey - The symmetric key used for email encryption.
|
|
160
|
+
* @param recipient - The recipient with a public hybrid key.
|
|
161
|
+
* @returns The encrypted email symmetric key
|
|
162
|
+
*/
|
|
163
|
+
declare function encryptKeysHybrid(emailEncryptionKey: Uint8Array, recipient: RecipientWithPublicKey): Promise<HybridEncKey>;
|
|
164
|
+
/**
|
|
165
|
+
* Decrypts the email symmetric key encrypted via hybrid encryption.
|
|
166
|
+
*
|
|
167
|
+
* @param encryptedKey - The encrypted email key.
|
|
168
|
+
* @param recipientPrivateKey - The private key of the recipient.
|
|
169
|
+
* @returns The email encryption key
|
|
170
|
+
*/
|
|
171
|
+
declare function decryptKeysHybrid(encryptedKey: HybridEncKey, recipientPrivateKey: Uint8Array): Promise<Uint8Array>;
|
|
172
|
+
/**
|
|
173
|
+
* Password-protects the email symmetric key.
|
|
174
|
+
*
|
|
175
|
+
* @param emailEncryptionKey - The symmetric key used for email encryption.
|
|
176
|
+
* @param password - The secret password for key protection.
|
|
177
|
+
* @returns The password-protected email symmetric key
|
|
178
|
+
*/
|
|
179
|
+
declare function passwordProtectKey(emailEncryptionKey: Uint8Array, password: string): Promise<PwdProtectedKey>;
|
|
180
|
+
/**
|
|
181
|
+
* Removes passoword-protection and exposes the email symmetric key.
|
|
182
|
+
*
|
|
183
|
+
* @param emailEncryptionKey - The password-protected email key.
|
|
184
|
+
* @param password - The secret password for key protection.
|
|
185
|
+
* @returns The email encryption key
|
|
186
|
+
*/
|
|
187
|
+
declare function removePasswordProtection(emailEncryptionKey: PwdProtectedKey, password: string): Promise<Uint8Array>;
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/email-crypto/coreSubject.d.ts
|
|
190
|
+
/**
|
|
191
|
+
* Symmetrically encrypts email and subject.
|
|
192
|
+
*
|
|
193
|
+
* @param email - The email and subject to encrypt.
|
|
194
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
195
|
+
* @returns The resulting encrypted email and symmetric key used for encryption
|
|
196
|
+
*/
|
|
197
|
+
declare function encryptEmailAndSubject(email: EmailAndSubject, aux?: Uint8Array): Promise<{
|
|
198
|
+
encEmail: EmailAndSubjectEncrypted;
|
|
199
|
+
encryptionKey: Uint8Array;
|
|
200
|
+
}>;
|
|
201
|
+
/**
|
|
202
|
+
* Symmetrically encrypts email and subject with the given key.
|
|
203
|
+
*
|
|
204
|
+
* @param email - The email and subject to encrypt.
|
|
205
|
+
* @param encryptionKey - The symmetric key to encrypt the email.
|
|
206
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
207
|
+
* @returns The resulting encrypted email and symmetric key used for encryption
|
|
208
|
+
*/
|
|
209
|
+
declare function encryptEmailAndSubjectWithKey(email: EmailAndSubject, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubjectEncrypted>;
|
|
210
|
+
/**
|
|
211
|
+
* Decrypts symmetrically encrypted email and email subject.
|
|
212
|
+
*
|
|
213
|
+
* @param encEmail - The encrypted email and subject to decrypt.
|
|
214
|
+
* @param encryptionKey - The symmetric key to decrypt the email.
|
|
215
|
+
* @param aux - An optional auxilary sting for AEAD (e.g., email ID or timestamp).
|
|
216
|
+
* @returns The resulting decrypted email and subject
|
|
217
|
+
*/
|
|
218
|
+
declare function decryptEmailAndSubject(encEmail: EmailAndSubjectEncrypted, encryptionKey: Uint8Array, aux?: Uint8Array): Promise<EmailAndSubject>;
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/email-crypto/errors.d.ts
|
|
221
|
+
declare class FailedToEncryptEmail extends Error {
|
|
222
|
+
constructor(errorMsg?: string);
|
|
223
|
+
}
|
|
224
|
+
declare class EmailSymmetricEncryptionError extends Error {
|
|
225
|
+
constructor(errorMsg?: string);
|
|
226
|
+
}
|
|
227
|
+
declare class EmailSymmetricDecryptionError extends Error {
|
|
228
|
+
constructor(errorMsg?: string);
|
|
229
|
+
}
|
|
230
|
+
declare class EmailPreviewSymmetricDecryptionError extends Error {
|
|
231
|
+
constructor(errorMsg?: string);
|
|
232
|
+
}
|
|
233
|
+
declare class EmailHybridEncryptionError extends Error {
|
|
234
|
+
constructor(errorMsg?: string);
|
|
235
|
+
}
|
|
236
|
+
declare class EmailHybridDecryptionError extends Error {
|
|
237
|
+
constructor(errorMsg?: string);
|
|
238
|
+
}
|
|
239
|
+
declare class EmailPasswordProtectError extends Error {
|
|
240
|
+
constructor(errorMsg?: string);
|
|
241
|
+
}
|
|
242
|
+
declare class EmailPasswordOpenError extends Error {
|
|
243
|
+
constructor(errorMsg?: string);
|
|
244
|
+
}
|
|
245
|
+
declare class InvalidInputEmail extends Error {
|
|
246
|
+
constructor();
|
|
247
|
+
}
|
|
248
|
+
declare class FailedToDecryptEmail extends Error {
|
|
249
|
+
constructor(errorMsg?: string);
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
252
|
+
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 };
|
|
253
|
+
//# sourceMappingURL=email-crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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":";;;;;AAYA;;;;;;iBAAsB,uCAAA,CACpB,KAAA,EAAO,KAAA,EACP,UAAA,EAAY,sBAAA,IACZ,GAAA,GAAM,UAAA,GACL,OAAA;EAAU,aAAA,EAAe,YAAA;EAAgB,QAAA,EAAU,cAAA;AAAA;;;;;;;;;;iBAoBhC,kBAAA,CACpB,QAAA,EAAU,cAAA,EACV,YAAA,EAAc,YAAA,EACd,0BAAA,EAA4B,UAAA,EAC5B,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,KAAA;AAAA,iBAKW,yBAAA,CACpB,UAAA,UACA,YAAA,EAAc,YAAA,EACd,0BAAA,EAA4B,UAAA,EAC5B,GAAA,GAAM,UAAA,GACL,OAAA;EAAU,OAAA;EAAiB,aAAA,EAAe,UAAA;AAAA;;;;;AAvC7C;;;;;;iBCOsB,uBAAA,CACpB,KAAA,EAAO,KAAA,EACP,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,iBAAA;;;;;;;;;iBAsBW,wBAAA,CACpB,cAAA,EAAgB,iBAAA,EAChB,QAAA,UACA,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,KAAA;;;;;ADrCX;;;;;;iBEGsB,iDAAA,CACpB,KAAA,EAAO,eAAA,EACP,UAAA,EAAY,sBAAA,IACZ,GAAA,GAAM,UAAA,GACL,OAAA;EAAU,aAAA,EAAe,YAAA;EAAgB,QAAA,EAAU,wBAAA;AAAA;;;;;;;;;;iBAoBhC,4BAAA,CACpB,QAAA,EAAU,wBAAA,EACV,YAAA,EAAc,YAAA,EACd,0BAAA,EAA4B,UAAA,EAC5B,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,eAAA;;;;;AF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,EACpB,QAAA,WACC,OAAA,CAAQ,UAAA;;;;;ALrMX;;;;;iBMCsB,sBAAA,CACpB,KAAA,EAAO,eAAA,EACP,GAAA,GAAM,UAAA,GACL,OAAA;EACD,QAAA,EAAU,wBAAA;EACV,aAAA,EAAe,UAAA;AAAA;;;;;;;;;iBAuBK,6BAAA,CACpB,KAAA,EAAO,eAAA,EACP,aAAA,EAAe,UAAA,EACf,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,wBAAA;;;;;;;ANTX;;iBM8BsB,sBAAA,CACpB,QAAA,EAAU,wBAAA,EACV,aAAA,EAAe,UAAA,EACf,GAAA,GAAM,UAAA,GACL,OAAA,CAAQ,eAAA;;;cCtEE,oBAAA,SAA6B,KAAA;cAC5B,QAAA;AAAA;AAAA,cAQD,6BAAA,SAAsC,KAAA;cACrC,QAAA;AAAA;AAAA,cAQD,6BAAA,SAAsC,KAAA;cACrC,QAAA;AAAA;AAAA,cAQD,oCAAA,SAA6C,KAAA;cAC5C,QAAA;AAAA;AAAA,cAQD,0BAAA,SAAmC,KAAA;cAClC,QAAA;AAAA;AAAA,cAQD,0BAAA,SAAmC,KAAA;cAClC,QAAA;AAAA;AAAA,cAQD,yBAAA,SAAkC,KAAA;cACjC,QAAA;AAAA;AAAA,cAQD,sBAAA,SAA+B,KAAA;cAC9B,QAAA;AAAA;AAAA,cAQD,iBAAA,SAA0B,KAAA;EAAA,WAAA,CAAA;AAAA;AAAA,cAS1B,oBAAA,SAA6B,KAAA;cAC5B,QAAA;AAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_email_crypto = require("./email-crypto-C3ka3aAj.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.EmailPreviewSymmetricDecryptionError = require_email_crypto.EmailPreviewSymmetricDecryptionError;
|
|
8
|
+
exports.EmailSymmetricDecryptionError = require_email_crypto.EmailSymmetricDecryptionError;
|
|
9
|
+
exports.EmailSymmetricEncryptionError = require_email_crypto.EmailSymmetricEncryptionError;
|
|
10
|
+
exports.FailedToDecryptEmail = require_email_crypto.FailedToDecryptEmail;
|
|
11
|
+
exports.FailedToEncryptEmail = require_email_crypto.FailedToEncryptEmail;
|
|
12
|
+
exports.InvalidInputEmail = require_email_crypto.InvalidInputEmail;
|
|
13
|
+
exports.createPwdProtectedEmail = require_email_crypto.createPwdProtectedEmail;
|
|
14
|
+
exports.createPwdProtectedEmailAndSubject = require_email_crypto.createPwdProtectedEmailAndSubject;
|
|
15
|
+
exports.decryptEmail = require_email_crypto.decryptEmail;
|
|
16
|
+
exports.decryptEmailAndSubject = require_email_crypto.decryptEmailAndSubject;
|
|
17
|
+
exports.decryptEmailAndSubjectHybrid = require_email_crypto.decryptEmailAndSubjectHybrid;
|
|
18
|
+
exports.decryptEmailHybrid = require_email_crypto.decryptEmailHybrid;
|
|
19
|
+
exports.decryptEmailPreviewHybrid = require_email_crypto.decryptEmailPreviewHybrid;
|
|
20
|
+
exports.decryptKeysHybrid = require_email_crypto.decryptKeysHybrid;
|
|
21
|
+
exports.decryptPreview = require_email_crypto.decryptPreview;
|
|
22
|
+
exports.decryptPwdProtectedEmail = require_email_crypto.decryptPwdProtectedEmail;
|
|
23
|
+
exports.decryptPwdProtectedEmailAndSubject = require_email_crypto.decryptPwdProtectedEmailAndSubject;
|
|
24
|
+
exports.deriveDatabaseKey = require_email_crypto.deriveDatabaseKey;
|
|
25
|
+
exports.deriveEmailDraftKey = require_email_crypto.deriveEmailDraftKey;
|
|
26
|
+
exports.encryptEmail = require_email_crypto.encryptEmail;
|
|
27
|
+
exports.encryptEmailAndSubject = require_email_crypto.encryptEmailAndSubject;
|
|
28
|
+
exports.encryptEmailAndSubjectHybridForMultipleRecipients = require_email_crypto.encryptEmailAndSubjectHybridForMultipleRecipients;
|
|
29
|
+
exports.encryptEmailAndSubjectWithKey = require_email_crypto.encryptEmailAndSubjectWithKey;
|
|
30
|
+
exports.encryptEmailHybridForMultipleRecipients = require_email_crypto.encryptEmailHybridForMultipleRecipients;
|
|
31
|
+
exports.encryptEmailWithKey = require_email_crypto.encryptEmailWithKey;
|
|
32
|
+
exports.encryptKeysHybrid = require_email_crypto.encryptKeysHybrid;
|
|
33
|
+
exports.generateEmailKeys = require_email_crypto.generateEmailKeys;
|
|
34
|
+
exports.passwordProtectKey = require_email_crypto.passwordProtectKey;
|
|
35
|
+
exports.removePasswordProtection = require_email_crypto.removePasswordProtection;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as EmailSymmetricEncryptionError, C as removePasswordProtection, D as EmailPasswordProtectError, E as EmailPasswordOpenError, M as FailedToEncryptEmail, N as InvalidInputEmail, O as EmailPreviewSymmetricDecryptionError, S as passwordProtectKey, T as EmailHybridEncryptionError, _ as decryptKeysHybrid, a as decryptPwdProtectedEmailAndSubject, b as encryptEmailWithKey, c as decryptEmailAndSubject, d as createPwdProtectedEmail, f as decryptPwdProtectedEmail, g as decryptEmail, h as encryptEmailHybridForMultipleRecipients, i as createPwdProtectedEmailAndSubject, j as FailedToDecryptEmail, k as EmailSymmetricDecryptionError, l as encryptEmailAndSubject, m as decryptEmailPreviewHybrid, n as deriveEmailDraftKey, o as decryptEmailAndSubjectHybrid, p as decryptEmailHybrid, r as generateEmailKeys, s as encryptEmailAndSubjectHybridForMultipleRecipients, t as deriveDatabaseKey, u as encryptEmailAndSubjectWithKey, v as decryptPreview, w as EmailHybridDecryptionError, x as encryptKeysHybrid, y as encryptEmail } from "./email-crypto-CDM4iPK8.mjs";
|
|
2
|
+
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 };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/hash/blake3.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Hashes the given array of data
|
|
4
|
+
*
|
|
5
|
+
* @param data - The array of data
|
|
6
|
+
* @returns The resulting hash
|
|
7
|
+
*/
|
|
8
|
+
declare function hashDataArray(data: Uint8Array[]): Uint8Array;
|
|
9
|
+
/**
|
|
10
|
+
* Hashes the given array of data with the given key
|
|
11
|
+
*
|
|
12
|
+
* @param hashKey - The key for keyed hashing
|
|
13
|
+
* @param data - The array of data
|
|
14
|
+
* @returns The resulting keyed hash
|
|
15
|
+
*/
|
|
16
|
+
declare function hashDataArrayWithKey(hashKey: Uint8Array, data: Uint8Array[]): Uint8Array;
|
|
17
|
+
/**
|
|
18
|
+
* Hashes the given array of data to the desired byte-length
|
|
19
|
+
*
|
|
20
|
+
* @param data - The array of data
|
|
21
|
+
* @param bytes - The desired output byte-length
|
|
22
|
+
* @returns The resulting hash of the desired byte-length
|
|
23
|
+
*/
|
|
24
|
+
declare function getBytesFromDataArray(data: Uint8Array[], bytes: number): Uint8Array;
|
|
25
|
+
/**
|
|
26
|
+
* Hashes the given data
|
|
27
|
+
*
|
|
28
|
+
* @param data - The data
|
|
29
|
+
* @returns The resulting hash
|
|
30
|
+
*/
|
|
31
|
+
declare function hashData(data: Uint8Array): Uint8Array;
|
|
32
|
+
/**
|
|
33
|
+
* Hashes the given data with the given key
|
|
34
|
+
*
|
|
35
|
+
* @param hashKey - The key for keyed hashing
|
|
36
|
+
* @param data - The data
|
|
37
|
+
* @returns The resulting keyed hash
|
|
38
|
+
*/
|
|
39
|
+
declare function hashDataWithKey(hashKey: Uint8Array, data: Uint8Array): Uint8Array;
|
|
40
|
+
/**
|
|
41
|
+
* Hashes the given data to the desired byte-length
|
|
42
|
+
*
|
|
43
|
+
* @param data - The data
|
|
44
|
+
* @param bytes - The desired output byte-length
|
|
45
|
+
* @returns The resulting hash of the desired byte-length
|
|
46
|
+
*/
|
|
47
|
+
declare function getBytesFromData(data: Uint8Array, bytes: number): Uint8Array;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { getBytesFromData, getBytesFromDataArray, hashData, hashDataArray, hashDataArrayWithKey, hashDataWithKey };
|
|
50
|
+
//# sourceMappingURL=hash.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.mts","names":[],"sources":["../../src/hash/blake3.ts"],"mappings":";;AAQA;;;;;iBAAgB,aAAA,CAAc,IAAA,EAAM,UAAA,KAAe,UAAA;;;;AAmBnD;;;;iBAAgB,oBAAA,CAAqB,OAAA,EAAS,UAAA,EAAY,IAAA,EAAM,UAAA,KAAe,UAAA;;;;;;;;iBAmB/D,qBAAA,CAAsB,IAAA,EAAM,UAAA,IAAc,KAAA,WAAgB,UAAA;;;AAA1E;;;;iBAkBgB,QAAA,CAAS,IAAA,EAAM,UAAA,GAAa,UAAA;;;;;;AAA5C;;iBAWgB,eAAA,CAAgB,OAAA,EAAS,UAAA,EAAY,IAAA,EAAM,UAAA,GAAa,UAAA;;;;;;;AAAxE;iBAWgB,gBAAA,CAAiB,IAAA,EAAM,UAAA,EAAY,KAAA,WAAgB,UAAA"}
|