@vaultsandbox/client 0.6.1 → 0.8.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/dist/email.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"email.js","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AAEH,OAAO,WAAW,MAAM,OAAO,CAAC;AAkBhC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,KAAK,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW;IACf,2DAA2D;IAC3D,GAAG,CAAa;IAChB,wEAAwE;IACxE,IAAI,CAAgB;IACpB,qGAAqG;IACrG,KAAK,CAAe;IACpB,yCAAyC;IACzC,UAAU,CAAoB;IAE9B;;OAEG;IACH,YAAY,IAAqB;QAC/B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAElC,KAAK,CACH,uEAAuE,EACvE,IAAI,CAAC,GAAG,EACR,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,UAAU,CAChB,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACjD,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,YAAY;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;QAC9C,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YAC3B,QAAQ,CAAC,IAAI,CAAC,qBAAqB,IAAI,C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aAAM,IAAI,YAAY,CAAC,GAAG,EAAE,CAAC;YAC5B,8BAA8B;YAC9B,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;QACxF,CAAC;QAED,KAAK,CAAC,6EAA6E,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1G,OAAO,EAAE,EAAE,EAAE,YAAY,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC;IACtC,CAAC;CACF"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * HTTP API client for VaultSandbox Gateway
3
3
  */
4
- import type { ClientConfig, InboxData, EmailData, ServerInfo, SyncStatus, RawEmailData } from '../types/index.js';
4
+ import type { ClientConfig, InboxData, EmailData, ServerInfo, SyncStatus, RawEmailData, CreateWebhookOptions, UpdateWebhookOptions, WebhookData, WebhookListResponse, TestWebhookResponse, RotateSecretResponse } from '../types/index.js';
5
5
  /**
6
6
  * HTTP API client for interacting with the VaultSandbox Gateway server.
7
7
  * Handles all API communication including inbox management, email operations,
@@ -44,14 +44,16 @@ export declare class ApiClient {
44
44
  checkKey(): Promise<boolean>;
45
45
  /**
46
46
  * Creates a new temporary inbox on the server.
47
- * @param publicKey - The client's KEM public key for encrypted communication
47
+ * @param publicKey - The client's KEM public key for encrypted communication (required for encrypted inboxes)
48
48
  * @param ttl - Optional time-to-live in seconds for the inbox
49
49
  * @param emailAddress - Optional desired email address or domain
50
+ * @param emailAuth - Optional flag to enable email authentication checks
51
+ * @param encryption - Optional encryption preference ('encrypted' or 'plain')
50
52
  * @returns Promise resolving to the created inbox data including email address
51
53
  * @throws {NetworkError} If network communication fails
52
54
  * @throws {ApiError} If the server returns an error response
53
55
  */
54
- createInbox(publicKey: string, ttl?: number, emailAddress?: string): Promise<InboxData>;
56
+ createInbox(publicKey?: string, ttl?: number, emailAddress?: string, emailAuth?: boolean, encryption?: 'encrypted' | 'plain'): Promise<InboxData>;
55
57
  /**
56
58
  * Deletes a specific inbox and all its emails.
57
59
  * @param emailAddress - The email address of the inbox to delete
@@ -133,6 +135,81 @@ export declare class ApiClient {
133
135
  * @throws {ApiError} If the server returns an error response
134
136
  */
135
137
  deleteEmail(emailAddress: string, emailId: string): Promise<void>;
138
+ /**
139
+ * Creates a new webhook for an inbox.
140
+ * @param emailAddress - The email address of the inbox
141
+ * @param options - Options for creating the webhook
142
+ * @returns Promise resolving to the created webhook data including the secret
143
+ * @throws {NetworkError} If network communication fails
144
+ * @throws {InboxNotFoundError} If the inbox does not exist
145
+ * @throws {ApiError} If the server returns an error response
146
+ */
147
+ createInboxWebhook(emailAddress: string, options: CreateWebhookOptions): Promise<WebhookData>;
148
+ /**
149
+ * Lists all webhooks for an inbox.
150
+ * @param emailAddress - The email address of the inbox
151
+ * @returns Promise resolving to the list of webhooks
152
+ * @throws {NetworkError} If network communication fails
153
+ * @throws {InboxNotFoundError} If the inbox does not exist
154
+ * @throws {ApiError} If the server returns an error response
155
+ */
156
+ listInboxWebhooks(emailAddress: string): Promise<WebhookListResponse>;
157
+ /**
158
+ * Retrieves a specific webhook by ID.
159
+ * @param emailAddress - The email address of the inbox
160
+ * @param webhookId - The unique identifier of the webhook
161
+ * @returns Promise resolving to the webhook data
162
+ * @throws {NetworkError} If network communication fails
163
+ * @throws {InboxNotFoundError} If the inbox does not exist
164
+ * @throws {WebhookNotFoundError} If the webhook does not exist
165
+ * @throws {ApiError} If the server returns an error response
166
+ */
167
+ getInboxWebhook(emailAddress: string, webhookId: string): Promise<WebhookData>;
168
+ /**
169
+ * Updates a specific webhook.
170
+ * @param emailAddress - The email address of the inbox
171
+ * @param webhookId - The unique identifier of the webhook
172
+ * @param options - Options for updating the webhook
173
+ * @returns Promise resolving to the updated webhook data
174
+ * @throws {NetworkError} If network communication fails
175
+ * @throws {InboxNotFoundError} If the inbox does not exist
176
+ * @throws {WebhookNotFoundError} If the webhook does not exist
177
+ * @throws {ApiError} If the server returns an error response
178
+ */
179
+ updateInboxWebhook(emailAddress: string, webhookId: string, options: UpdateWebhookOptions): Promise<WebhookData>;
180
+ /**
181
+ * Deletes a specific webhook.
182
+ * @param emailAddress - The email address of the inbox
183
+ * @param webhookId - The unique identifier of the webhook
184
+ * @returns Promise that resolves when the webhook is deleted
185
+ * @throws {NetworkError} If network communication fails
186
+ * @throws {InboxNotFoundError} If the inbox does not exist
187
+ * @throws {WebhookNotFoundError} If the webhook does not exist
188
+ * @throws {ApiError} If the server returns an error response
189
+ */
190
+ deleteInboxWebhook(emailAddress: string, webhookId: string): Promise<void>;
191
+ /**
192
+ * Tests a webhook by sending a test payload.
193
+ * @param emailAddress - The email address of the inbox
194
+ * @param webhookId - The unique identifier of the webhook
195
+ * @returns Promise resolving to the test result
196
+ * @throws {NetworkError} If network communication fails
197
+ * @throws {InboxNotFoundError} If the inbox does not exist
198
+ * @throws {WebhookNotFoundError} If the webhook does not exist
199
+ * @throws {ApiError} If the server returns an error response
200
+ */
201
+ testInboxWebhook(emailAddress: string, webhookId: string): Promise<TestWebhookResponse>;
202
+ /**
203
+ * Rotates the secret for a specific webhook.
204
+ * @param emailAddress - The email address of the inbox
205
+ * @param webhookId - The unique identifier of the webhook
206
+ * @returns Promise resolving to the new secret and validity period of the old secret
207
+ * @throws {NetworkError} If network communication fails
208
+ * @throws {InboxNotFoundError} If the inbox does not exist
209
+ * @throws {WebhookNotFoundError} If the webhook does not exist
210
+ * @throws {ApiError} If the server returns an error response
211
+ */
212
+ rotateInboxWebhookSecret(emailAddress: string, webhookId: string): Promise<RotateSecretResponse>;
136
213
  /**
137
214
  * Gets the base URL of the VaultSandbox Gateway server.
138
215
  * @returns The configured base URL
@@ -2,7 +2,7 @@
2
2
  * HTTP API client for VaultSandbox Gateway
3
3
  */
4
4
  import axios from 'axios';
5
- import { ApiError, NetworkError, InboxNotFoundError, EmailNotFoundError } from '../types/index.js';
5
+ import { ApiError, NetworkError, InboxNotFoundError, EmailNotFoundError, WebhookNotFoundError, } from '../types/index.js';
6
6
  import { sleep } from '../utils/sleep.js';
7
7
  /**
8
8
  * HTTP API client for interacting with the VaultSandbox Gateway server.
@@ -73,6 +73,9 @@ export class ApiClient {
73
73
  /* istanbul ignore next - defensive fallback when server doesn't return error message */
74
74
  const message = error.response.data?.error || error.message;
75
75
  if (status === 404) {
76
+ if (message.toLowerCase().includes('webhook')) {
77
+ return new WebhookNotFoundError(message);
78
+ }
76
79
  if (message.toLowerCase().includes('inbox')) {
77
80
  return new InboxNotFoundError(message);
78
81
  }
@@ -106,21 +109,32 @@ export class ApiClient {
106
109
  // ===== Inbox Management =====
107
110
  /**
108
111
  * Creates a new temporary inbox on the server.
109
- * @param publicKey - The client's KEM public key for encrypted communication
112
+ * @param publicKey - The client's KEM public key for encrypted communication (required for encrypted inboxes)
110
113
  * @param ttl - Optional time-to-live in seconds for the inbox
111
114
  * @param emailAddress - Optional desired email address or domain
115
+ * @param emailAuth - Optional flag to enable email authentication checks
116
+ * @param encryption - Optional encryption preference ('encrypted' or 'plain')
112
117
  * @returns Promise resolving to the created inbox data including email address
113
118
  * @throws {NetworkError} If network communication fails
114
119
  * @throws {ApiError} If the server returns an error response
115
120
  */
116
- async createInbox(publicKey, ttl, emailAddress) {
117
- const payload = { clientKemPk: publicKey };
121
+ async createInbox(publicKey, ttl, emailAddress, emailAuth, encryption) {
122
+ const payload = {};
123
+ if (publicKey !== undefined && publicKey !== null) {
124
+ payload.clientKemPk = publicKey;
125
+ }
118
126
  if (ttl !== undefined && ttl !== null) {
119
127
  payload.ttl = ttl;
120
128
  }
121
129
  if (emailAddress !== undefined && emailAddress !== null) {
122
130
  payload.emailAddress = emailAddress;
123
131
  }
132
+ if (emailAuth !== undefined) {
133
+ payload.emailAuth = emailAuth;
134
+ }
135
+ if (encryption !== undefined) {
136
+ payload.encryption = encryption;
137
+ }
124
138
  const response = await this.client.post('/api/inboxes', payload);
125
139
  return response.data;
126
140
  }
@@ -228,6 +242,102 @@ export class ApiClient {
228
242
  async deleteEmail(emailAddress, emailId) {
229
243
  await this.client.delete(`/api/inboxes/${encodeURIComponent(emailAddress)}/emails/${emailId}`);
230
244
  }
245
+ // ===== Inbox Webhooks =====
246
+ /**
247
+ * Creates a new webhook for an inbox.
248
+ * @param emailAddress - The email address of the inbox
249
+ * @param options - Options for creating the webhook
250
+ * @returns Promise resolving to the created webhook data including the secret
251
+ * @throws {NetworkError} If network communication fails
252
+ * @throws {InboxNotFoundError} If the inbox does not exist
253
+ * @throws {ApiError} If the server returns an error response
254
+ */
255
+ async createInboxWebhook(emailAddress, options) {
256
+ const response = await this.client.post(`/api/inboxes/${encodeURIComponent(emailAddress)}/webhooks`, options);
257
+ return response.data;
258
+ }
259
+ /**
260
+ * Lists all webhooks for an inbox.
261
+ * @param emailAddress - The email address of the inbox
262
+ * @returns Promise resolving to the list of webhooks
263
+ * @throws {NetworkError} If network communication fails
264
+ * @throws {InboxNotFoundError} If the inbox does not exist
265
+ * @throws {ApiError} If the server returns an error response
266
+ */
267
+ async listInboxWebhooks(emailAddress) {
268
+ const response = await this.client.get(`/api/inboxes/${encodeURIComponent(emailAddress)}/webhooks`);
269
+ return response.data;
270
+ }
271
+ /**
272
+ * Retrieves a specific webhook by ID.
273
+ * @param emailAddress - The email address of the inbox
274
+ * @param webhookId - The unique identifier of the webhook
275
+ * @returns Promise resolving to the webhook data
276
+ * @throws {NetworkError} If network communication fails
277
+ * @throws {InboxNotFoundError} If the inbox does not exist
278
+ * @throws {WebhookNotFoundError} If the webhook does not exist
279
+ * @throws {ApiError} If the server returns an error response
280
+ */
281
+ async getInboxWebhook(emailAddress, webhookId) {
282
+ const response = await this.client.get(`/api/inboxes/${encodeURIComponent(emailAddress)}/webhooks/${webhookId}`);
283
+ return response.data;
284
+ }
285
+ /**
286
+ * Updates a specific webhook.
287
+ * @param emailAddress - The email address of the inbox
288
+ * @param webhookId - The unique identifier of the webhook
289
+ * @param options - Options for updating the webhook
290
+ * @returns Promise resolving to the updated webhook data
291
+ * @throws {NetworkError} If network communication fails
292
+ * @throws {InboxNotFoundError} If the inbox does not exist
293
+ * @throws {WebhookNotFoundError} If the webhook does not exist
294
+ * @throws {ApiError} If the server returns an error response
295
+ */
296
+ async updateInboxWebhook(emailAddress, webhookId, options) {
297
+ const response = await this.client.patch(`/api/inboxes/${encodeURIComponent(emailAddress)}/webhooks/${webhookId}`, options);
298
+ return response.data;
299
+ }
300
+ /**
301
+ * Deletes a specific webhook.
302
+ * @param emailAddress - The email address of the inbox
303
+ * @param webhookId - The unique identifier of the webhook
304
+ * @returns Promise that resolves when the webhook is deleted
305
+ * @throws {NetworkError} If network communication fails
306
+ * @throws {InboxNotFoundError} If the inbox does not exist
307
+ * @throws {WebhookNotFoundError} If the webhook does not exist
308
+ * @throws {ApiError} If the server returns an error response
309
+ */
310
+ async deleteInboxWebhook(emailAddress, webhookId) {
311
+ await this.client.delete(`/api/inboxes/${encodeURIComponent(emailAddress)}/webhooks/${webhookId}`);
312
+ }
313
+ /**
314
+ * Tests a webhook by sending a test payload.
315
+ * @param emailAddress - The email address of the inbox
316
+ * @param webhookId - The unique identifier of the webhook
317
+ * @returns Promise resolving to the test result
318
+ * @throws {NetworkError} If network communication fails
319
+ * @throws {InboxNotFoundError} If the inbox does not exist
320
+ * @throws {WebhookNotFoundError} If the webhook does not exist
321
+ * @throws {ApiError} If the server returns an error response
322
+ */
323
+ async testInboxWebhook(emailAddress, webhookId) {
324
+ const response = await this.client.post(`/api/inboxes/${encodeURIComponent(emailAddress)}/webhooks/${webhookId}/test`);
325
+ return response.data;
326
+ }
327
+ /**
328
+ * Rotates the secret for a specific webhook.
329
+ * @param emailAddress - The email address of the inbox
330
+ * @param webhookId - The unique identifier of the webhook
331
+ * @returns Promise resolving to the new secret and validity period of the old secret
332
+ * @throws {NetworkError} If network communication fails
333
+ * @throws {InboxNotFoundError} If the inbox does not exist
334
+ * @throws {WebhookNotFoundError} If the webhook does not exist
335
+ * @throws {ApiError} If the server returns an error response
336
+ */
337
+ async rotateInboxWebhookSecret(emailAddress, webhookId) {
338
+ const response = await this.client.post(`/api/inboxes/${encodeURIComponent(emailAddress)}/webhooks/${webhookId}/rotate-secret`);
339
+ return response.data;
340
+ }
231
341
  // ===== Utility =====
232
342
  /**
233
343
  * Gets the base URL of the VaultSandbox Gateway server.
@@ -1 +1 @@
1
- {"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/http/api-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAwD,MAAM,OAAO,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS1C;;;;GAIG;AACH,MAAM,OAAO,SAAS;IACZ,MAAM,CAAgB;IACtB,MAAM,CAAe;IAE7B;;;OAGG;IACH,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,MAAM,CAAC,GAAG;YACnB,OAAO,EAAE;gBACP,WAAW,EAAE,MAAM,CAAC,MAAM;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QAEH,oBAAoB;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACK,UAAU;QAChB,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CACnC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EACtB,KAAK,EAAE,KAAiB,EAAE,EAAE;YAC1B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YAC5B,MAAM,UAAU,GAAG,IA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EAAE,SAAiB;QACpE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACrC,gBAAgB,kBAAkB,CAAC,YAAY,CAAC,aAAa,SAAS,gBAAgB,CACvF,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,sBAAsB;IAEtB;;;OAGG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;CACF"}
package/dist/inbox.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Inbox class - manages email retrieval and decryption for a single inbox
3
3
  */
4
- import type { InboxData, Keypair, WaitOptions, WaitForCountOptions, SyncStatus, RawEmail, Subscription, IEmail, IEmailMetadata, ExportedInboxData, EmailData } from './types/index.js';
4
+ import type { InboxData, Keypair, WaitOptions, WaitForCountOptions, SyncStatus, RawEmail, Subscription, IEmail, IEmailMetadata, ExportedInboxData, EmailData, CreateWebhookOptions, UpdateWebhookOptions, WebhookData, WebhookListResponse, TestWebhookResponse, RotateSecretResponse } from './types/index.js';
5
5
  import type { ApiClient } from './http/api-client.js';
6
6
  import type { DeliveryStrategy } from './strategies/delivery-strategy.js';
7
7
  /**
@@ -17,6 +17,10 @@ export declare class Inbox {
17
17
  expiresAt: Date;
18
18
  /** A unique identifier for the inbox. */
19
19
  readonly inboxHash: string;
20
+ /** Whether this inbox uses encryption. */
21
+ readonly encrypted: boolean;
22
+ /** Whether email authentication checks (SPF, DKIM, DMARC, PTR) are enabled for this inbox. */
23
+ readonly emailAuth: boolean;
20
24
  private keypair;
21
25
  private apiClient;
22
26
  private serverPublicKey;
@@ -26,7 +30,7 @@ export declare class Inbox {
26
30
  * @internal
27
31
  * Do not construct this class directly. Use `VaultSandboxClient.createInbox()` instead.
28
32
  */
29
- constructor(inboxData: InboxData, keypair: Keypair, apiClient: ApiClient, serverPublicKey: string);
33
+ constructor(inboxData: InboxData, keypair: Keypair | null, apiClient: ApiClient, serverPublicKey: string | null);
30
34
  /**
31
35
  * @internal
32
36
  * Sets the delivery strategy for this inbox.
@@ -111,7 +115,7 @@ export declare class Inbox {
111
115
  */
112
116
  delete(): Promise<void>;
113
117
  /**
114
- * Exports this inbox, including its key material, for backup/sharing.
118
+ * Exports this inbox, including its key material (for encrypted inboxes), for backup/sharing.
115
119
  * See vaultsandbox-spec.md Section 9: Inbox Export Format
116
120
  */
117
121
  export(): ExportedInboxData;
@@ -174,10 +178,10 @@ export declare class Inbox {
174
178
  /**
175
179
  * Gets the keypair for this inbox.
176
180
  *
177
- * @returns The keypair.
181
+ * @returns The keypair, or null for plain inboxes.
178
182
  * @internal
179
183
  */
180
- getKeypair(): Keypair;
184
+ getKeypair(): Keypair | null;
181
185
  /**
182
186
  * Gets the API client for this inbox.
183
187
  *
@@ -185,4 +189,53 @@ export declare class Inbox {
185
189
  * @internal
186
190
  */
187
191
  getApiClient(): ApiClient;
192
+ /**
193
+ * Creates a new webhook for this inbox.
194
+ *
195
+ * @param options - Options for creating the webhook.
196
+ * @returns A promise that resolves to the created webhook data including the secret.
197
+ */
198
+ createWebhook(options: CreateWebhookOptions): Promise<WebhookData>;
199
+ /**
200
+ * Lists all webhooks for this inbox.
201
+ *
202
+ * @returns A promise that resolves to the list of webhooks.
203
+ */
204
+ listWebhooks(): Promise<WebhookListResponse>;
205
+ /**
206
+ * Retrieves a specific webhook by ID.
207
+ *
208
+ * @param webhookId - The ID of the webhook to retrieve.
209
+ * @returns A promise that resolves to the webhook data.
210
+ */
211
+ getWebhook(webhookId: string): Promise<WebhookData>;
212
+ /**
213
+ * Updates a specific webhook.
214
+ *
215
+ * @param webhookId - The ID of the webhook to update.
216
+ * @param options - Options for updating the webhook.
217
+ * @returns A promise that resolves to the updated webhook data.
218
+ */
219
+ updateWebhook(webhookId: string, options: UpdateWebhookOptions): Promise<WebhookData>;
220
+ /**
221
+ * Deletes a specific webhook.
222
+ *
223
+ * @param webhookId - The ID of the webhook to delete.
224
+ * @returns A promise that resolves when the webhook is deleted.
225
+ */
226
+ deleteWebhook(webhookId: string): Promise<void>;
227
+ /**
228
+ * Tests a webhook by sending a test payload.
229
+ *
230
+ * @param webhookId - The ID of the webhook to test.
231
+ * @returns A promise that resolves to the test result.
232
+ */
233
+ testWebhook(webhookId: string): Promise<TestWebhookResponse>;
234
+ /**
235
+ * Rotates the secret for a specific webhook.
236
+ *
237
+ * @param webhookId - The ID of the webhook whose secret to rotate.
238
+ * @returns A promise that resolves to the new secret and validity period of the old secret.
239
+ */
240
+ rotateWebhookSecret(webhookId: string): Promise<RotateSecretResponse>;
188
241
  }
package/dist/inbox.js CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import createDebug from 'debug';
5
5
  import { decryptMetadata, decryptRaw } from './crypto/decrypt.js';
6
- import { decryptEmailData } from './utils/email-utils.js';
6
+ import { decryptEmailData, decodeBase64EmailData, isEncryptedEmailData } from './utils/email-utils.js';
7
7
  import { toBase64Url } from './crypto/utils.js';
8
8
  import { EXPORT_VERSION } from './crypto/constants.js';
9
9
  import { computeEmailsHash } from './utils/hash.js';
@@ -22,6 +22,10 @@ export class Inbox {
22
22
  expiresAt;
23
23
  /** A unique identifier for the inbox. */
24
24
  inboxHash;
25
+ /** Whether this inbox uses encryption. */
26
+ encrypted;
27
+ /** Whether email authentication checks (SPF, DKIM, DMARC, PTR) are enabled for this inbox. */
28
+ emailAuth;
25
29
  keypair;
26
30
  apiClient;
27
31
  serverPublicKey;
@@ -35,10 +39,12 @@ export class Inbox {
35
39
  this.emailAddress = inboxData.emailAddress;
36
40
  this.inboxHash = inboxData.inboxHash;
37
41
  this.expiresAt = new Date(inboxData.expiresAt);
42
+ this.encrypted = inboxData.encrypted;
43
+ this.emailAuth = inboxData.emailAuth ?? false;
38
44
  this.keypair = keypair;
39
45
  this.apiClient = apiClient;
40
46
  this.serverPublicKey = serverPublicKey;
41
- debug('Created inbox for %s (expires: %s)', this.emailAddress, this.expiresAt.toISOString());
47
+ debug('Created inbox for %s (expires: %s, encrypted: %s)', this.emailAddress, this.expiresAt.toISOString(), this.encrypted);
42
48
  }
43
49
  /**
44
50
  * @internal
@@ -60,10 +66,12 @@ export class Inbox {
60
66
  debug('Retrieved %d raw email data entries', emailsData.length);
61
67
  const emails = [];
62
68
  for (const emailData of emailsData) {
63
- const email = await decryptEmailData(emailData, this.keypair, this.emailAddress, this.apiClient);
69
+ const email = isEncryptedEmailData(emailData)
70
+ ? await decryptEmailData(emailData, this.keypair, this.emailAddress, this.apiClient)
71
+ : decodeBase64EmailData(emailData, this.emailAddress, this.apiClient);
64
72
  emails.push(email);
65
73
  }
66
- debug('Successfully decrypted %d emails for inbox %s', emails.length, this.emailAddress);
74
+ debug('Successfully processed %d emails for inbox %s', emails.length, this.emailAddress);
67
75
  return emails;
68
76
  }
69
77
  /**
@@ -77,7 +85,15 @@ export class Inbox {
77
85
  debug('Retrieved %d raw email data entries', emailsData.length);
78
86
  const emails = [];
79
87
  for (const emailData of emailsData) {
80
- const metadata = await decryptMetadata(emailData.encryptedMetadata, this.keypair);
88
+ let metadata;
89
+ if (isEncryptedEmailData(emailData)) {
90
+ metadata = await decryptMetadata(emailData.encryptedMetadata, this.keypair);
91
+ }
92
+ else {
93
+ // Plain email - decode base64 metadata
94
+ const metadataJson = Buffer.from(emailData.metadata, 'base64').toString('utf-8');
95
+ metadata = JSON.parse(metadataJson);
96
+ }
81
97
  emails.push({
82
98
  id: emailData.id,
83
99
  from: metadata.from,
@@ -86,7 +102,7 @@ export class Inbox {
86
102
  isRead: emailData.isRead,
87
103
  });
88
104
  }
89
- debug('Successfully decrypted %d email metadata for inbox %s', emails.length, this.emailAddress);
105
+ debug('Successfully processed %d email metadata for inbox %s', emails.length, this.emailAddress);
90
106
  return emails;
91
107
  }
92
108
  /**
@@ -98,8 +114,10 @@ export class Inbox {
98
114
  async getEmail(emailId) {
99
115
  debug('Retrieving email %s from inbox %s', emailId, this.emailAddress);
100
116
  const emailData = await this.apiClient.getEmail(this.emailAddress, emailId);
101
- const email = await decryptEmailData(emailData, this.keypair, this.emailAddress, this.apiClient);
102
- debug('Successfully retrieved and decrypted email %s', emailId);
117
+ const email = isEncryptedEmailData(emailData)
118
+ ? await decryptEmailData(emailData, this.keypair, this.emailAddress, this.apiClient)
119
+ : decodeBase64EmailData(emailData, this.emailAddress, this.apiClient);
120
+ debug('Successfully retrieved and processed email %s', emailId);
103
121
  return email;
104
122
  }
105
123
  /**
@@ -111,8 +129,18 @@ export class Inbox {
111
129
  async getRawEmail(emailId) {
112
130
  debug('Retrieving raw email %s from inbox %s', emailId, this.emailAddress);
113
131
  const rawEmailData = await this.apiClient.getRawEmail(this.emailAddress, emailId);
114
- const raw = await decryptRaw(rawEmailData.encryptedRaw, this.keypair);
115
- debug('Successfully retrieved and decrypted raw email %s (%d characters)', emailId, raw.length);
132
+ let raw;
133
+ if (rawEmailData.encryptedRaw) {
134
+ raw = await decryptRaw(rawEmailData.encryptedRaw, this.keypair);
135
+ }
136
+ else if (rawEmailData.raw) {
137
+ // Plain email - decode base64
138
+ raw = Buffer.from(rawEmailData.raw, 'base64').toString('utf-8');
139
+ }
140
+ else {
141
+ throw new Error('Invalid raw email data: neither encryptedRaw nor raw field present');
142
+ }
143
+ debug('Successfully retrieved and processed raw email %s (%d characters)', emailId, raw.length);
116
144
  return { id: rawEmailData.id, raw };
117
145
  }
118
146
  /**
@@ -235,20 +263,24 @@ export class Inbox {
235
263
  debug('Successfully deleted inbox %s', this.emailAddress);
236
264
  }
237
265
  /**
238
- * Exports this inbox, including its key material, for backup/sharing.
266
+ * Exports this inbox, including its key material (for encrypted inboxes), for backup/sharing.
239
267
  * See vaultsandbox-spec.md Section 9: Inbox Export Format
240
268
  */
241
269
  export() {
242
- debug('Exporting inbox %s with key material', this.emailAddress);
270
+ debug('Exporting inbox %s (encrypted: %s)', this.emailAddress, this.encrypted);
243
271
  const exportedData = {
244
272
  version: EXPORT_VERSION,
245
273
  emailAddress: this.emailAddress,
246
274
  expiresAt: this.expiresAt.toISOString(),
247
275
  inboxHash: this.inboxHash,
248
- serverSigPk: this.serverPublicKey,
249
- secretKey: toBase64Url(this.keypair.secretKey),
276
+ encrypted: this.encrypted,
250
277
  exportedAt: new Date().toISOString(),
251
278
  };
279
+ // Only include keys for encrypted inboxes
280
+ if (this.encrypted && this.serverPublicKey && this.keypair) {
281
+ exportedData.serverSigPk = this.serverPublicKey;
282
+ exportedData.secretKey = toBase64Url(this.keypair.secretKey);
283
+ }
252
284
  debug('Successfully exported inbox %s', this.emailAddress);
253
285
  return exportedData;
254
286
  }
@@ -344,7 +376,7 @@ export class Inbox {
344
376
  /**
345
377
  * Gets the keypair for this inbox.
346
378
  *
347
- * @returns The keypair.
379
+ * @returns The keypair, or null for plain inboxes.
348
380
  * @internal
349
381
  */
350
382
  getKeypair() {
@@ -359,5 +391,89 @@ export class Inbox {
359
391
  getApiClient() {
360
392
  return this.apiClient;
361
393
  }
394
+ // ===== Webhooks =====
395
+ /**
396
+ * Creates a new webhook for this inbox.
397
+ *
398
+ * @param options - Options for creating the webhook.
399
+ * @returns A promise that resolves to the created webhook data including the secret.
400
+ */
401
+ async createWebhook(options) {
402
+ debug('Creating webhook for inbox %s', this.emailAddress);
403
+ const webhook = await this.apiClient.createInboxWebhook(this.emailAddress, options);
404
+ debug('Successfully created webhook %s for inbox %s', webhook.id, this.emailAddress);
405
+ return webhook;
406
+ }
407
+ /**
408
+ * Lists all webhooks for this inbox.
409
+ *
410
+ * @returns A promise that resolves to the list of webhooks.
411
+ */
412
+ async listWebhooks() {
413
+ debug('Listing webhooks for inbox %s', this.emailAddress);
414
+ const response = await this.apiClient.listInboxWebhooks(this.emailAddress);
415
+ debug('Found %d webhooks for inbox %s', response.total, this.emailAddress);
416
+ return response;
417
+ }
418
+ /**
419
+ * Retrieves a specific webhook by ID.
420
+ *
421
+ * @param webhookId - The ID of the webhook to retrieve.
422
+ * @returns A promise that resolves to the webhook data.
423
+ */
424
+ async getWebhook(webhookId) {
425
+ debug('Retrieving webhook %s for inbox %s', webhookId, this.emailAddress);
426
+ const webhook = await this.apiClient.getInboxWebhook(this.emailAddress, webhookId);
427
+ debug('Successfully retrieved webhook %s', webhookId);
428
+ return webhook;
429
+ }
430
+ /**
431
+ * Updates a specific webhook.
432
+ *
433
+ * @param webhookId - The ID of the webhook to update.
434
+ * @param options - Options for updating the webhook.
435
+ * @returns A promise that resolves to the updated webhook data.
436
+ */
437
+ async updateWebhook(webhookId, options) {
438
+ debug('Updating webhook %s for inbox %s', webhookId, this.emailAddress);
439
+ const webhook = await this.apiClient.updateInboxWebhook(this.emailAddress, webhookId, options);
440
+ debug('Successfully updated webhook %s', webhookId);
441
+ return webhook;
442
+ }
443
+ /**
444
+ * Deletes a specific webhook.
445
+ *
446
+ * @param webhookId - The ID of the webhook to delete.
447
+ * @returns A promise that resolves when the webhook is deleted.
448
+ */
449
+ async deleteWebhook(webhookId) {
450
+ debug('Deleting webhook %s for inbox %s', webhookId, this.emailAddress);
451
+ await this.apiClient.deleteInboxWebhook(this.emailAddress, webhookId);
452
+ debug('Successfully deleted webhook %s', webhookId);
453
+ }
454
+ /**
455
+ * Tests a webhook by sending a test payload.
456
+ *
457
+ * @param webhookId - The ID of the webhook to test.
458
+ * @returns A promise that resolves to the test result.
459
+ */
460
+ async testWebhook(webhookId) {
461
+ debug('Testing webhook %s for inbox %s', webhookId, this.emailAddress);
462
+ const result = await this.apiClient.testInboxWebhook(this.emailAddress, webhookId);
463
+ debug('Webhook %s test result: success=%s', webhookId, result.success);
464
+ return result;
465
+ }
466
+ /**
467
+ * Rotates the secret for a specific webhook.
468
+ *
469
+ * @param webhookId - The ID of the webhook whose secret to rotate.
470
+ * @returns A promise that resolves to the new secret and validity period of the old secret.
471
+ */
472
+ async rotateWebhookSecret(webhookId) {
473
+ debug('Rotating secret for webhook %s in inbox %s', webhookId, this.emailAddress);
474
+ const result = await this.apiClient.rotateInboxWebhookSecret(this.emailAddress, webhookId);
475
+ debug('Successfully rotated secret for webhook %s', webhookId);
476
+ return result;
477
+ }
362
478
  }
363
479
  //# sourceMappingURL=inbox.js.map