sealnet 3.1.0 → 3.2.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/dist/index.d.cts CHANGED
@@ -1,3 +1,15 @@
1
+ /** Where the WASM file comes from: a URL in a browser, a file in Node, a compiled module in a Worker. */
2
+ type WasmSource = {
3
+ url: string;
4
+ integrity?: string;
5
+ } | {
6
+ path: string;
7
+ } | {
8
+ module: WebAssembly.Module;
9
+ };
10
+ /** Name where the WASM file comes from; call before the first key operation. */
11
+ declare function configureWasm(next: WasmSource): void;
12
+
1
13
  /**
2
14
  * What an intake request asks for (SPEC-AGENTS §4.4): `pair` and `device`
3
15
  * are the inbox's own (SPEC-ADDRESS F3), answered on box.seal.net.
@@ -78,7 +90,7 @@ interface CreateAnonymousSealOptions {
78
90
  otp?: string | undefined;
79
91
  /** Require NDA signature before download */
80
92
  nda?: boolean;
81
- /** Owner email (required if nda=true) */
93
+ /** Your email: a letter each time the seal is opened, with when and from which country. Required with `nda`: the signed agreement comes here too. */
82
94
  ownerEmail?: string;
83
95
  /**
84
96
  * The document the recipient signs for (with `nda`, instead of `message`): sent last, marked as the NDA's. The
@@ -276,8 +288,22 @@ interface SavedSealFile {
276
288
  interface OpenedSeal<F> {
277
289
  readonly sealId: string;
278
290
  readonly expiresAt: string;
291
+ /** The sender's note to the recipient (`send({ message })`), read with the link's key; null when there is none. */
292
+ readonly message: string | null;
279
293
  readonly files: readonly F[];
280
294
  }
295
+ /** A file of the link that did not come to disk, and why. */
296
+ interface RefusedSealFile {
297
+ readonly name: string;
298
+ readonly error: SealError;
299
+ }
300
+ /**
301
+ * What `open(url, {to})` wrote, and the files it did not (audit of 22.11, LEAD-52): `refused` is there only when one
302
+ * was. A caller reads it: those files did not come, and the seal's open may already be taken.
303
+ */
304
+ type SavedSeal = OpenedSeal<SavedSealFile> & {
305
+ readonly refused?: readonly RefusedSealFile[];
306
+ };
281
307
  interface RequestOptions {
282
308
  /** What you ask for, as the person reads it: "Brave API key". */
283
309
  readonly what: string;
@@ -291,13 +317,19 @@ interface RequestOptions {
291
317
  readonly ttl?: number;
292
318
  /** Who asks, as the page names it. */
293
319
  readonly label?: string;
294
- /** The address of a person's inbox (`pair()`): the request also waits there as a card. */
320
+ /**
321
+ * The address of a person's inbox (`pair()`): the request waits there as a card, which only that inbox answers, from
322
+ * its list (audit of 22.11, API-08). Without it, whoever holds the link answers.
323
+ */
295
324
  readonly to?: string;
296
325
  readonly signal?: AbortSignal;
297
326
  }
298
327
  interface RequestResult {
299
328
  readonly intakeId: string;
300
- /** Give this to the person — or to an MCP client as a URL-mode elicitation. */
329
+ /**
330
+ * Give this to the person whole — or to an MCP client as a URL-mode elicitation. Its fragment is your address: the
331
+ * page seals the answer to that address alone.
332
+ */
301
333
  readonly url: string;
302
334
  /** Eight words of your address, one space apart; the page shows the same ones. */
303
335
  readonly words: string;
@@ -311,21 +343,32 @@ interface PairOptions {
311
343
  readonly signal?: AbortSignal;
312
344
  }
313
345
  interface PairResult {
314
- /** Give this to the person: they open it on the device with their SEAL inbox. */
346
+ /**
347
+ * Give this to the person whole: they open it on the device with their SEAL inbox. Its fragment is your address: the
348
+ * inbox connects that address alone.
349
+ */
315
350
  readonly url: string;
316
351
  /** Eight words of your address, one space apart; the page shows the same ones. */
317
352
  readonly words: string;
318
353
  readonly expiresAt: string;
319
- /** Wait until they connect: their inbox's address (use it as `owner`) and name. */
320
- wait(): Promise<{
321
- readonly address: string;
322
- readonly name: string;
323
- }>;
354
+ /**
355
+ * Wait until an inbox answers: its address, name and eight words. Whoever saw the link can answer it first with an
356
+ * inbox of theirs: show the person `words` and use `address` as `owner` only once they say their inbox shows the same.
357
+ */
358
+ wait(): Promise<PairedInbox>;
359
+ }
360
+ /** The inbox that answered a pairing link (`PairResult.wait`). */
361
+ interface PairedInbox {
362
+ /** Its address: `owner` of a send, `to` of a request, once the person confirmed `words`. */
363
+ readonly address: string;
364
+ readonly name: string;
365
+ /** Eight words of its address, one space apart: the person's inbox shows its own; they must be the same. */
366
+ readonly words: string;
324
367
  }
325
368
  /** Something sent to your address: open it with `open(item, {keyPair})`. */
326
369
  interface InboxItem {
327
370
  readonly id: string;
328
- /** Eight words of the sender's address when it proved one. */
371
+ /** Eight words of the address the server recorded as the sender; null when it recorded none. */
329
372
  readonly fromWords: string | null;
330
373
  /** What the sender called itself, in the clear: never content. */
331
374
  readonly label: string | null;
@@ -406,11 +449,13 @@ declare class SealClient {
406
449
  * upload and its last segment opened. Without it each file is downloaded
407
450
  * when you `read()` it, as a stream that fails if the file was changed.
408
451
  * Either way memory stays one segment whatever the size. `keyPair` opens a
409
- * link addressed to your address.
452
+ * link addressed to your address. With `to`, a file refused does not stop
453
+ * the others: it comes back in `refused` with its error, and the call throws
454
+ * only when nothing was written.
410
455
  */
411
456
  open(link: string | InboxItem, options: OpenOptions & {
412
457
  to: string;
413
- }): Promise<OpenedSeal<SavedSealFile>>;
458
+ }): Promise<SavedSeal>;
414
459
  open(link: string | InboxItem, options?: OpenOptions): Promise<OpenedSeal<OpenedSealFile>>;
415
460
  /**
416
461
  * What other agents or people sent to your address (`keyPair.address`);
@@ -431,7 +476,7 @@ declare class SealClient {
431
476
  waitFor(intakeId: string, options: OpenOptions & {
432
477
  keyPair: KeyPair;
433
478
  to: string;
434
- }): Promise<OpenedSeal<SavedSealFile>>;
479
+ }): Promise<SavedSeal>;
435
480
  waitFor(intakeId: string, options: OpenOptions & {
436
481
  keyPair: KeyPair;
437
482
  }): Promise<OpenedSeal<OpenedSealFile>>;
@@ -460,4 +505,4 @@ declare class SealClient {
460
505
  }
461
506
  declare const VERSION: string;
462
507
 
463
- export { type Inbox, type InboxItem, type InboxOptions, type KeyPair, type OpenOptions, type OpenedSeal, type OpenedSealFile, type PairOptions, type PairResult, type RequestOptions, type RequestResult, type SavedSealFile, SealClient, type SealClientOptions, SealError, type SealErrorCode, type SealErrorDetails, type SealFile, type SealFolderFile, type SealSource, type SendOptions, type SendProgress, type SendResult, type TTL, VERSION };
508
+ export { type Inbox, type InboxItem, type InboxOptions, type KeyPair, type OpenOptions, type OpenedSeal, type OpenedSealFile, type PairOptions, type PairResult, type PairedInbox, type RefusedSealFile, type RequestOptions, type RequestResult, type SavedSeal, type SavedSealFile, SealClient, type SealClientOptions, SealError, type SealErrorCode, type SealErrorDetails, type SealFile, type SealFolderFile, type SealSource, type SendOptions, type SendProgress, type SendResult, type TTL, VERSION, type WasmSource, configureWasm };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,15 @@
1
+ /** Where the WASM file comes from: a URL in a browser, a file in Node, a compiled module in a Worker. */
2
+ type WasmSource = {
3
+ url: string;
4
+ integrity?: string;
5
+ } | {
6
+ path: string;
7
+ } | {
8
+ module: WebAssembly.Module;
9
+ };
10
+ /** Name where the WASM file comes from; call before the first key operation. */
11
+ declare function configureWasm(next: WasmSource): void;
12
+
1
13
  /**
2
14
  * What an intake request asks for (SPEC-AGENTS §4.4): `pair` and `device`
3
15
  * are the inbox's own (SPEC-ADDRESS F3), answered on box.seal.net.
@@ -78,7 +90,7 @@ interface CreateAnonymousSealOptions {
78
90
  otp?: string | undefined;
79
91
  /** Require NDA signature before download */
80
92
  nda?: boolean;
81
- /** Owner email (required if nda=true) */
93
+ /** Your email: a letter each time the seal is opened, with when and from which country. Required with `nda`: the signed agreement comes here too. */
82
94
  ownerEmail?: string;
83
95
  /**
84
96
  * The document the recipient signs for (with `nda`, instead of `message`): sent last, marked as the NDA's. The
@@ -276,8 +288,22 @@ interface SavedSealFile {
276
288
  interface OpenedSeal<F> {
277
289
  readonly sealId: string;
278
290
  readonly expiresAt: string;
291
+ /** The sender's note to the recipient (`send({ message })`), read with the link's key; null when there is none. */
292
+ readonly message: string | null;
279
293
  readonly files: readonly F[];
280
294
  }
295
+ /** A file of the link that did not come to disk, and why. */
296
+ interface RefusedSealFile {
297
+ readonly name: string;
298
+ readonly error: SealError;
299
+ }
300
+ /**
301
+ * What `open(url, {to})` wrote, and the files it did not (audit of 22.11, LEAD-52): `refused` is there only when one
302
+ * was. A caller reads it: those files did not come, and the seal's open may already be taken.
303
+ */
304
+ type SavedSeal = OpenedSeal<SavedSealFile> & {
305
+ readonly refused?: readonly RefusedSealFile[];
306
+ };
281
307
  interface RequestOptions {
282
308
  /** What you ask for, as the person reads it: "Brave API key". */
283
309
  readonly what: string;
@@ -291,13 +317,19 @@ interface RequestOptions {
291
317
  readonly ttl?: number;
292
318
  /** Who asks, as the page names it. */
293
319
  readonly label?: string;
294
- /** The address of a person's inbox (`pair()`): the request also waits there as a card. */
320
+ /**
321
+ * The address of a person's inbox (`pair()`): the request waits there as a card, which only that inbox answers, from
322
+ * its list (audit of 22.11, API-08). Without it, whoever holds the link answers.
323
+ */
295
324
  readonly to?: string;
296
325
  readonly signal?: AbortSignal;
297
326
  }
298
327
  interface RequestResult {
299
328
  readonly intakeId: string;
300
- /** Give this to the person — or to an MCP client as a URL-mode elicitation. */
329
+ /**
330
+ * Give this to the person whole — or to an MCP client as a URL-mode elicitation. Its fragment is your address: the
331
+ * page seals the answer to that address alone.
332
+ */
301
333
  readonly url: string;
302
334
  /** Eight words of your address, one space apart; the page shows the same ones. */
303
335
  readonly words: string;
@@ -311,21 +343,32 @@ interface PairOptions {
311
343
  readonly signal?: AbortSignal;
312
344
  }
313
345
  interface PairResult {
314
- /** Give this to the person: they open it on the device with their SEAL inbox. */
346
+ /**
347
+ * Give this to the person whole: they open it on the device with their SEAL inbox. Its fragment is your address: the
348
+ * inbox connects that address alone.
349
+ */
315
350
  readonly url: string;
316
351
  /** Eight words of your address, one space apart; the page shows the same ones. */
317
352
  readonly words: string;
318
353
  readonly expiresAt: string;
319
- /** Wait until they connect: their inbox's address (use it as `owner`) and name. */
320
- wait(): Promise<{
321
- readonly address: string;
322
- readonly name: string;
323
- }>;
354
+ /**
355
+ * Wait until an inbox answers: its address, name and eight words. Whoever saw the link can answer it first with an
356
+ * inbox of theirs: show the person `words` and use `address` as `owner` only once they say their inbox shows the same.
357
+ */
358
+ wait(): Promise<PairedInbox>;
359
+ }
360
+ /** The inbox that answered a pairing link (`PairResult.wait`). */
361
+ interface PairedInbox {
362
+ /** Its address: `owner` of a send, `to` of a request, once the person confirmed `words`. */
363
+ readonly address: string;
364
+ readonly name: string;
365
+ /** Eight words of its address, one space apart: the person's inbox shows its own; they must be the same. */
366
+ readonly words: string;
324
367
  }
325
368
  /** Something sent to your address: open it with `open(item, {keyPair})`. */
326
369
  interface InboxItem {
327
370
  readonly id: string;
328
- /** Eight words of the sender's address when it proved one. */
371
+ /** Eight words of the address the server recorded as the sender; null when it recorded none. */
329
372
  readonly fromWords: string | null;
330
373
  /** What the sender called itself, in the clear: never content. */
331
374
  readonly label: string | null;
@@ -406,11 +449,13 @@ declare class SealClient {
406
449
  * upload and its last segment opened. Without it each file is downloaded
407
450
  * when you `read()` it, as a stream that fails if the file was changed.
408
451
  * Either way memory stays one segment whatever the size. `keyPair` opens a
409
- * link addressed to your address.
452
+ * link addressed to your address. With `to`, a file refused does not stop
453
+ * the others: it comes back in `refused` with its error, and the call throws
454
+ * only when nothing was written.
410
455
  */
411
456
  open(link: string | InboxItem, options: OpenOptions & {
412
457
  to: string;
413
- }): Promise<OpenedSeal<SavedSealFile>>;
458
+ }): Promise<SavedSeal>;
414
459
  open(link: string | InboxItem, options?: OpenOptions): Promise<OpenedSeal<OpenedSealFile>>;
415
460
  /**
416
461
  * What other agents or people sent to your address (`keyPair.address`);
@@ -431,7 +476,7 @@ declare class SealClient {
431
476
  waitFor(intakeId: string, options: OpenOptions & {
432
477
  keyPair: KeyPair;
433
478
  to: string;
434
- }): Promise<OpenedSeal<SavedSealFile>>;
479
+ }): Promise<SavedSeal>;
435
480
  waitFor(intakeId: string, options: OpenOptions & {
436
481
  keyPair: KeyPair;
437
482
  }): Promise<OpenedSeal<OpenedSealFile>>;
@@ -460,4 +505,4 @@ declare class SealClient {
460
505
  }
461
506
  declare const VERSION: string;
462
507
 
463
- export { type Inbox, type InboxItem, type InboxOptions, type KeyPair, type OpenOptions, type OpenedSeal, type OpenedSealFile, type PairOptions, type PairResult, type RequestOptions, type RequestResult, type SavedSealFile, SealClient, type SealClientOptions, SealError, type SealErrorCode, type SealErrorDetails, type SealFile, type SealFolderFile, type SealSource, type SendOptions, type SendProgress, type SendResult, type TTL, VERSION };
508
+ export { type Inbox, type InboxItem, type InboxOptions, type KeyPair, type OpenOptions, type OpenedSeal, type OpenedSealFile, type PairOptions, type PairResult, type PairedInbox, type RefusedSealFile, type RequestOptions, type RequestResult, type SavedSeal, type SavedSealFile, SealClient, type SealClientOptions, SealError, type SealErrorCode, type SealErrorDetails, type SealFile, type SealFolderFile, type SealSource, type SendOptions, type SendProgress, type SendResult, type TTL, VERSION, type WasmSource, configureWasm };