@vaultsandbox/client 0.6.1 → 0.7.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.
- package/LICENSE +190 -21
- package/README.md +2 -2
- package/dist/client.d.ts +11 -3
- package/dist/client.js +74 -26
- package/dist/client.js.map +1 -1
- package/dist/email.d.ts +2 -2
- package/dist/email.js +24 -12
- package/dist/email.js.map +1 -1
- package/dist/http/api-client.d.ts +4 -2
- package/dist/http/api-client.js +14 -3
- package/dist/http/api-client.js.map +1 -1
- package/dist/inbox.d.ts +8 -4
- package/dist/inbox.js +47 -15
- package/dist/inbox.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/strategies/delivery-strategy.d.ts +4 -4
- package/dist/strategies/polling-strategy.d.ts +4 -4
- package/dist/strategies/polling-strategy.js +10 -6
- package/dist/strategies/polling-strategy.js.map +1 -1
- package/dist/strategies/sse-strategy.d.ts +2 -2
- package/dist/strategies/sse-strategy.js +9 -5
- package/dist/strategies/sse-strategy.js.map +1 -1
- package/dist/types/index.d.ts +62 -14
- package/dist/types/index.js.map +1 -1
- package/dist/utils/email-utils.d.ts +14 -3
- package/dist/utils/email-utils.js +39 -1
- package/dist/utils/email-utils.js.map +1 -1
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,21 +1,190 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Antero
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
[](https://www.npmjs.com/package/@vaultsandbox/client)
|
|
12
12
|
[](https://github.com/vaultsandbox/client-node/actions/workflows/ci.yml)
|
|
13
13
|
[](https://codecov.io/gh/vaultsandbox/client-node)
|
|
14
|
-
[](https://opensource.org/licenses/Apache-2.0)
|
|
15
15
|
[](https://nodejs.org/)
|
|
16
16
|
|
|
17
17
|
**Production-like email testing. Self-hosted & secure.**
|
|
@@ -621,4 +621,4 @@ Contributions are welcome! Please read our [contributing guidelines](CONTRIBUTIN
|
|
|
621
621
|
|
|
622
622
|
## License
|
|
623
623
|
|
|
624
|
-
|
|
624
|
+
Apache 2.0 — see [LICENSE](LICENSE) for details.
|
package/dist/client.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export declare class VaultSandboxClient {
|
|
|
46
46
|
private apiClient;
|
|
47
47
|
private config;
|
|
48
48
|
private serverPublicKey;
|
|
49
|
+
private encryptionPolicy;
|
|
49
50
|
private inboxes;
|
|
50
51
|
private strategy;
|
|
51
52
|
/**
|
|
@@ -59,6 +60,11 @@ export declare class VaultSandboxClient {
|
|
|
59
60
|
* @private
|
|
60
61
|
*/
|
|
61
62
|
private ensureInitialized;
|
|
63
|
+
/**
|
|
64
|
+
* Determines whether to create an encrypted inbox based on options and server policy.
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
private shouldEncrypt;
|
|
62
68
|
/**
|
|
63
69
|
* Creates the appropriate delivery strategy based on configuration.
|
|
64
70
|
* SSE for email events (/api/events) is always available on the server.
|
|
@@ -68,13 +74,14 @@ export declare class VaultSandboxClient {
|
|
|
68
74
|
/**
|
|
69
75
|
* Creates a new, temporary email inbox.
|
|
70
76
|
*
|
|
71
|
-
* This method generates a new quantum-safe keypair
|
|
72
|
-
* with the VaultSandbox server, and returns an `Inbox` instance.
|
|
77
|
+
* This method optionally generates a new quantum-safe keypair (for encrypted inboxes),
|
|
78
|
+
* registers the inbox with the VaultSandbox server, and returns an `Inbox` instance.
|
|
73
79
|
*
|
|
74
80
|
* @param options - Optional parameters for inbox creation.
|
|
75
81
|
* @returns A promise that resolves to a new `Inbox` instance.
|
|
76
82
|
* @example
|
|
77
83
|
* const inbox = await client.createInbox({ ttl: 3600 }); // Inbox expires in 1 hour
|
|
84
|
+
* const plainInbox = await client.createInbox({ encryption: 'plain' }); // Plain inbox (no encryption)
|
|
78
85
|
*/
|
|
79
86
|
createInbox(options?: CreateInboxOptions): Promise<Inbox>;
|
|
80
87
|
/**
|
|
@@ -142,6 +149,7 @@ export declare class VaultSandboxClient {
|
|
|
142
149
|
private validateVersion;
|
|
143
150
|
/**
|
|
144
151
|
* Validates that all required fields are present and non-empty in the exported inbox data.
|
|
152
|
+
* Note: serverSigPk and secretKey are only required for encrypted inboxes.
|
|
145
153
|
* @private
|
|
146
154
|
* @param data - The exported inbox data to validate
|
|
147
155
|
* @throws {InvalidImportDataError} If any required field is missing or empty
|
|
@@ -228,7 +236,7 @@ export declare class VaultSandboxClient {
|
|
|
228
236
|
* Creates a new Inbox instance, configures it with the delivery strategy, and adds it to tracking.
|
|
229
237
|
* @private
|
|
230
238
|
* @param inboxData - The inbox metadata
|
|
231
|
-
* @param keypair - The cryptographic keypair for the inbox
|
|
239
|
+
* @param keypair - The cryptographic keypair for the inbox (null for plain inboxes)
|
|
232
240
|
* @returns The newly created and tracked Inbox instance
|
|
233
241
|
*/
|
|
234
242
|
private createAndTrackInbox;
|
package/dist/client.js
CHANGED
|
@@ -11,7 +11,7 @@ import { toBase64Url, fromBase64Url } from './crypto/utils.js';
|
|
|
11
11
|
import { EXPORT_VERSION, MLDSA_PUBLIC_KEY_SIZE } from './crypto/constants.js';
|
|
12
12
|
import { SSEStrategy } from './strategies/sse-strategy.js';
|
|
13
13
|
import { PollingStrategy } from './strategies/polling-strategy.js';
|
|
14
|
-
import { InboxNotFoundError, InboxAlreadyExistsError, InvalidImportDataError, StrategyError } from './types/index.js';
|
|
14
|
+
import { InboxNotFoundError, InboxAlreadyExistsError, InvalidImportDataError, StrategyError, ApiError, } from './types/index.js';
|
|
15
15
|
const debug = createDebug('vaultsandbox:client');
|
|
16
16
|
/**
|
|
17
17
|
* An event emitter for monitoring multiple inboxes simultaneously.
|
|
@@ -63,6 +63,7 @@ export class VaultSandboxClient {
|
|
|
63
63
|
apiClient;
|
|
64
64
|
config;
|
|
65
65
|
serverPublicKey = null;
|
|
66
|
+
encryptionPolicy = null;
|
|
66
67
|
inboxes = new Map();
|
|
67
68
|
strategy = null;
|
|
68
69
|
/**
|
|
@@ -84,10 +85,23 @@ export class VaultSandboxClient {
|
|
|
84
85
|
}
|
|
85
86
|
const serverInfo = await this.apiClient.getServerInfo();
|
|
86
87
|
this.serverPublicKey = serverInfo.serverSigPk;
|
|
88
|
+
this.encryptionPolicy = serverInfo.encryptionPolicy;
|
|
87
89
|
// Create delivery strategy based on config
|
|
88
90
|
// Note: SSE for email events (/api/events) is always available
|
|
89
91
|
this.strategy = this.createStrategy();
|
|
90
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Determines whether to create an encrypted inbox based on options and server policy.
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
shouldEncrypt(options) {
|
|
98
|
+
// If explicit encryption preference is set, use it
|
|
99
|
+
if (options.encryption) {
|
|
100
|
+
return options.encryption === 'encrypted';
|
|
101
|
+
}
|
|
102
|
+
// Use server default based on policy
|
|
103
|
+
return this.encryptionPolicy === 'always' || this.encryptionPolicy === 'enabled';
|
|
104
|
+
}
|
|
91
105
|
/**
|
|
92
106
|
* Creates the appropriate delivery strategy based on configuration.
|
|
93
107
|
* SSE for email events (/api/events) is always available on the server.
|
|
@@ -118,22 +132,36 @@ export class VaultSandboxClient {
|
|
|
118
132
|
/**
|
|
119
133
|
* Creates a new, temporary email inbox.
|
|
120
134
|
*
|
|
121
|
-
* This method generates a new quantum-safe keypair
|
|
122
|
-
* with the VaultSandbox server, and returns an `Inbox` instance.
|
|
135
|
+
* This method optionally generates a new quantum-safe keypair (for encrypted inboxes),
|
|
136
|
+
* registers the inbox with the VaultSandbox server, and returns an `Inbox` instance.
|
|
123
137
|
*
|
|
124
138
|
* @param options - Optional parameters for inbox creation.
|
|
125
139
|
* @returns A promise that resolves to a new `Inbox` instance.
|
|
126
140
|
* @example
|
|
127
141
|
* const inbox = await client.createInbox({ ttl: 3600 }); // Inbox expires in 1 hour
|
|
142
|
+
* const plainInbox = await client.createInbox({ encryption: 'plain' }); // Plain inbox (no encryption)
|
|
128
143
|
*/
|
|
129
144
|
async createInbox(options = {}) {
|
|
130
145
|
await this.ensureInitialized();
|
|
131
|
-
|
|
132
|
-
|
|
146
|
+
const useEncryption = this.shouldEncrypt(options);
|
|
147
|
+
// Generate keypair only for encrypted inboxes
|
|
148
|
+
const keypair = useEncryption ? generateKeypair() : null;
|
|
133
149
|
// Create inbox on server
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
150
|
+
let inboxData;
|
|
151
|
+
try {
|
|
152
|
+
inboxData = await this.apiClient.createInbox(keypair?.publicKeyB64, options.ttl, options.emailAddress, options.emailAuth, options.encryption);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
// Convert 409 Conflict to InboxAlreadyExistsError
|
|
156
|
+
if (error instanceof ApiError && error.statusCode === 409) {
|
|
157
|
+
/* istanbul ignore next - defensive fallback for error message */
|
|
158
|
+
const address = options.emailAddress ?? 'requested address';
|
|
159
|
+
throw new InboxAlreadyExistsError(`Inbox already exists: ${address}`);
|
|
160
|
+
}
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
// Create Inbox instance
|
|
164
|
+
const inbox = new Inbox(inboxData, keypair, this.apiClient, inboxData.serverSigPk ?? null);
|
|
137
165
|
// Set delivery strategy
|
|
138
166
|
/* istanbul ignore else - strategy always exists after ensureInitialized */
|
|
139
167
|
if (this.strategy) {
|
|
@@ -234,7 +262,7 @@ export class VaultSandboxClient {
|
|
|
234
262
|
async importInbox(data) {
|
|
235
263
|
// Step 2: Validate version
|
|
236
264
|
this.validateVersion(data);
|
|
237
|
-
// Step 3: Validate required fields
|
|
265
|
+
// Step 3: Validate required fields (depends on encryption status)
|
|
238
266
|
this.validateRequiredFields(data);
|
|
239
267
|
// Step 4: Validate emailAddress
|
|
240
268
|
this.validateEmailAddress(data.emailAddress);
|
|
@@ -245,11 +273,28 @@ export class VaultSandboxClient {
|
|
|
245
273
|
// Check for duplicates
|
|
246
274
|
this.checkInboxDoesNotExist(data.emailAddress);
|
|
247
275
|
await this.ensureInitialized();
|
|
248
|
-
//
|
|
249
|
-
|
|
250
|
-
this
|
|
251
|
-
|
|
252
|
-
|
|
276
|
+
// For encrypted inboxes, validate server public key and decode keys
|
|
277
|
+
let keypair = null;
|
|
278
|
+
/* istanbul ignore else - plain inbox import doesn't enter this block */
|
|
279
|
+
if (data.encrypted) {
|
|
280
|
+
// Step 7: Validate and decode serverSigPk
|
|
281
|
+
/* istanbul ignore else - defensive, already validated by validateRequiredFields */
|
|
282
|
+
if (data.serverSigPk) {
|
|
283
|
+
this.validateServerSigPkSize(data.serverSigPk);
|
|
284
|
+
this.validateServerPublicKey(data.serverSigPk);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
throw new InvalidImportDataError('serverSigPk is required for encrypted inboxes');
|
|
288
|
+
}
|
|
289
|
+
// Step 6: Validate and decode secretKey
|
|
290
|
+
/* istanbul ignore else - defensive, already validated by validateRequiredFields */
|
|
291
|
+
if (data.secretKey) {
|
|
292
|
+
keypair = this.decodeAndValidateKeys(data);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
throw new InvalidImportDataError('secretKey is required for encrypted inboxes');
|
|
296
|
+
}
|
|
297
|
+
}
|
|
253
298
|
const inboxData = this.buildInboxData(data);
|
|
254
299
|
return this.createAndTrackInbox(inboxData, keypair);
|
|
255
300
|
}
|
|
@@ -266,25 +311,27 @@ export class VaultSandboxClient {
|
|
|
266
311
|
}
|
|
267
312
|
/**
|
|
268
313
|
* Validates that all required fields are present and non-empty in the exported inbox data.
|
|
314
|
+
* Note: serverSigPk and secretKey are only required for encrypted inboxes.
|
|
269
315
|
* @private
|
|
270
316
|
* @param data - The exported inbox data to validate
|
|
271
317
|
* @throws {InvalidImportDataError} If any required field is missing or empty
|
|
272
318
|
*/
|
|
273
319
|
validateRequiredFields(data) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
'inboxHash',
|
|
278
|
-
'serverSigPk',
|
|
279
|
-
'secretKey',
|
|
280
|
-
'exportedAt',
|
|
281
|
-
];
|
|
282
|
-
for (const field of requiredStringFields) {
|
|
320
|
+
// These fields are always required
|
|
321
|
+
const alwaysRequiredFields = ['emailAddress', 'expiresAt', 'inboxHash', 'exportedAt'];
|
|
322
|
+
for (const field of alwaysRequiredFields) {
|
|
283
323
|
const value = data[field];
|
|
284
324
|
if (value === undefined || value === null || (typeof value === 'string' && value.trim() === '')) {
|
|
285
325
|
throw new InvalidImportDataError(`Missing or invalid field: ${field}`);
|
|
286
326
|
}
|
|
287
327
|
}
|
|
328
|
+
// encrypted field must be a boolean
|
|
329
|
+
if (typeof data.encrypted !== 'boolean') {
|
|
330
|
+
/* istanbul ignore next - defensive for non-TypeScript callers */
|
|
331
|
+
throw new InvalidImportDataError('Missing or invalid field: encrypted');
|
|
332
|
+
}
|
|
333
|
+
// serverSigPk and secretKey are only required for encrypted inboxes
|
|
334
|
+
// Their validation is handled in importInbox when encrypted is true
|
|
288
335
|
}
|
|
289
336
|
/**
|
|
290
337
|
* Validates that the email address contains exactly one @ character.
|
|
@@ -377,7 +424,7 @@ export class VaultSandboxClient {
|
|
|
377
424
|
* @throws {InvalidImportDataError} If keys cannot be decoded or have invalid lengths
|
|
378
425
|
*/
|
|
379
426
|
decodeAndValidateKeys(data) {
|
|
380
|
-
// Decode and validate secret key
|
|
427
|
+
// Decode and validate secret key (caller ensures secretKey is defined for encrypted inboxes)
|
|
381
428
|
const secretKey = this.decodeBase64UrlKey(data.secretKey, 'secret');
|
|
382
429
|
this.validateKeyLength(secretKey, SECRET_KEY_SIZE, 'secret');
|
|
383
430
|
// Derive public key from secret key per spec Section 10.2
|
|
@@ -428,6 +475,7 @@ export class VaultSandboxClient {
|
|
|
428
475
|
emailAddress: data.emailAddress,
|
|
429
476
|
expiresAt: data.expiresAt,
|
|
430
477
|
inboxHash: data.inboxHash,
|
|
478
|
+
encrypted: data.encrypted,
|
|
431
479
|
serverSigPk: data.serverSigPk,
|
|
432
480
|
};
|
|
433
481
|
}
|
|
@@ -435,11 +483,11 @@ export class VaultSandboxClient {
|
|
|
435
483
|
* Creates a new Inbox instance, configures it with the delivery strategy, and adds it to tracking.
|
|
436
484
|
* @private
|
|
437
485
|
* @param inboxData - The inbox metadata
|
|
438
|
-
* @param keypair - The cryptographic keypair for the inbox
|
|
486
|
+
* @param keypair - The cryptographic keypair for the inbox (null for plain inboxes)
|
|
439
487
|
* @returns The newly created and tracked Inbox instance
|
|
440
488
|
*/
|
|
441
489
|
createAndTrackInbox(inboxData, keypair) {
|
|
442
|
-
const inbox = new Inbox(inboxData, keypair, this.apiClient, inboxData.serverSigPk);
|
|
490
|
+
const inbox = new Inbox(inboxData, keypair, this.apiClient, inboxData.serverSigPk ?? /* istanbul ignore next */ null);
|
|
443
491
|
/* istanbul ignore else - strategy always exists after ensureInitialized */
|
|
444
492
|
if (this.strategy) {
|
|
445
493
|
inbox.setStrategy(this.strategy);
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA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AG,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,iBAAiB,CAAC,YAA4B,EAAE,QAAgB;QACpE,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3C,MAAM,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,mBAAmB,CAAC,QAAgB;QACxC,IAAI,IAAuB,CAAC;QAE5B,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACvD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,sBAAsB,CAC9B,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAC5F,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
|
package/dist/email.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare class Email implements IEmail {
|
|
|
41
41
|
* @internal
|
|
42
42
|
* Do not construct this class directly.
|
|
43
43
|
*/
|
|
44
|
-
constructor(emailData: EmailData, metadata: DecryptedMetadata, parsed: DecryptedParsed | null, emailAddress: string, apiClient: ApiClient, keypair: Keypair);
|
|
44
|
+
constructor(emailData: EmailData, metadata: DecryptedMetadata, parsed: DecryptedParsed | null, emailAddress: string, apiClient: ApiClient, keypair: Keypair | null);
|
|
45
45
|
/**
|
|
46
46
|
* Marks this email as read.
|
|
47
47
|
*
|
|
@@ -55,7 +55,7 @@ export declare class Email implements IEmail {
|
|
|
55
55
|
*/
|
|
56
56
|
delete(): Promise<void>;
|
|
57
57
|
/**
|
|
58
|
-
* Fetches the raw
|
|
58
|
+
* Fetches the raw source of the email (decrypts if encrypted).
|
|
59
59
|
*
|
|
60
60
|
* @returns A promise that resolves to the raw email data.
|
|
61
61
|
*/
|
package/dist/email.js
CHANGED
|
@@ -37,28 +37,28 @@ class AuthResults {
|
|
|
37
37
|
validate() {
|
|
38
38
|
debug('Validating email authentication results');
|
|
39
39
|
const failures = [];
|
|
40
|
-
// Check SPF
|
|
41
|
-
const spfPassed = this.spf?.result === 'pass';
|
|
40
|
+
// Check SPF (skipped is treated as passing - not a failure)
|
|
41
|
+
const spfPassed = this.spf?.result === 'pass' || this.spf?.result === 'skipped';
|
|
42
42
|
if (this.spf && !spfPassed) {
|
|
43
43
|
failures.push(`SPF check failed: ${this.spf.result}${this.spf.domain ? ` (domain: ${this.spf.domain})` : ''}`);
|
|
44
44
|
}
|
|
45
|
-
// Check DKIM (at least one signature must pass)
|
|
46
|
-
const dkimPassed = this.dkim?.some((d) => d.result === 'pass') ?? false;
|
|
45
|
+
// Check DKIM (at least one signature must pass or be skipped)
|
|
46
|
+
const dkimPassed = this.dkim?.some((d) => d.result === 'pass' || d.result === 'skipped') ?? false;
|
|
47
47
|
if (this.dkim && this.dkim.length > 0 && !dkimPassed) {
|
|
48
48
|
const failedDomains = this.dkim
|
|
49
|
-
.filter((d) => d.result !== 'pass')
|
|
49
|
+
.filter((d) => d.result !== 'pass' && d.result !== 'skipped')
|
|
50
50
|
.map((d) => d.domain)
|
|
51
51
|
.filter(Boolean)
|
|
52
52
|
.join(', ');
|
|
53
53
|
failures.push(`DKIM signature failed${failedDomains ? `: ${failedDomains}` : ''}`);
|
|
54
54
|
}
|
|
55
|
-
// Check DMARC
|
|
56
|
-
const dmarcPassed = this.dmarc?.result === 'pass';
|
|
55
|
+
// Check DMARC (skipped is treated as passing - not a failure)
|
|
56
|
+
const dmarcPassed = this.dmarc?.result === 'pass' || this.dmarc?.result === 'skipped';
|
|
57
57
|
if (this.dmarc && !dmarcPassed) {
|
|
58
58
|
failures.push(`DMARC policy: ${this.dmarc.result}${this.dmarc.policy ? ` (policy: ${this.dmarc.policy})` : ''}`);
|
|
59
59
|
}
|
|
60
|
-
// Check Reverse DNS -
|
|
61
|
-
const reverseDnsPassed = this.reverseDns?.
|
|
60
|
+
// Check Reverse DNS (skipped is treated as passing - not a failure)
|
|
61
|
+
const reverseDnsPassed = this.reverseDns?.result === 'pass' || this.reverseDns?.result === 'skipped';
|
|
62
62
|
if (this.reverseDns && !reverseDnsPassed) {
|
|
63
63
|
failures.push(`Reverse DNS check failed${this.reverseDns.hostname ? ` (hostname: ${this.reverseDns.hostname})` : ''}`);
|
|
64
64
|
}
|
|
@@ -172,15 +172,27 @@ export class Email {
|
|
|
172
172
|
debug('Successfully deleted email %s', this.id);
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
|
-
* Fetches the raw
|
|
175
|
+
* Fetches the raw source of the email (decrypts if encrypted).
|
|
176
176
|
*
|
|
177
177
|
* @returns A promise that resolves to the raw email data.
|
|
178
178
|
*/
|
|
179
179
|
async getRaw() {
|
|
180
180
|
debug('Fetching raw content for email %s', this.id);
|
|
181
181
|
const rawEmailData = await this.apiClient.getRawEmail(this.emailAddress, this.id);
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
let raw;
|
|
183
|
+
/* istanbul ignore else - defensive for invalid raw email response */
|
|
184
|
+
if (rawEmailData.encryptedRaw) {
|
|
185
|
+
// Encrypted inbox - decrypt the raw content
|
|
186
|
+
raw = await decryptRaw(rawEmailData.encryptedRaw, this.keypair);
|
|
187
|
+
}
|
|
188
|
+
else if (rawEmailData.raw) {
|
|
189
|
+
// Plain inbox - decode base64
|
|
190
|
+
raw = Buffer.from(rawEmailData.raw, 'base64').toString('utf-8');
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
throw new Error('Invalid raw email data: neither encryptedRaw nor raw field present');
|
|
194
|
+
}
|
|
195
|
+
debug('Successfully fetched and processed raw content for email %s (%d characters)', this.id, raw.length);
|
|
184
196
|
return { id: rawEmailData.id, raw };
|
|
185
197
|
}
|
|
186
198
|
}
|