sealnet 1.1.2 → 1.3.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/index.d.cts CHANGED
@@ -1,5 +1,8 @@
1
- /** What an intake request asks for (SPEC-AGENTS §4.4). */
2
- type IntakeKind = 'secret' | 'file' | 'any';
1
+ /**
2
+ * What an intake request asks for (SPEC-AGENTS §4.4): `pair` and `device`
3
+ * are the inbox's own (SPEC-ADDRESS F3), answered on box.seal.net.
4
+ */
5
+ type IntakeKind = 'secret' | 'file' | 'any' | 'pair' | 'device';
3
6
  /** A file's plaintext, and what it turned out to be once the stream ended. */
4
7
  interface OpenedStream {
5
8
  readonly stream: ReadableStream<Uint8Array>;
@@ -10,6 +13,12 @@ interface OpenedStream {
10
13
  }>;
11
14
  }
12
15
 
16
+ /** The inbox an agent is paired with: what the answer to `pair` carries. */
17
+ interface Pairing {
18
+ readonly address: string;
19
+ readonly name: string;
20
+ }
21
+
13
22
  type TTL = '5m' | '30m' | '1h' | '1d' | '7d';
14
23
  interface CreateAnonymousSealOptions {
15
24
  /** File data (File, ArrayBuffer, Uint8Array, or Blob) */
@@ -34,6 +43,24 @@ interface CreateAnonymousSealOptions {
34
43
  maxOpens?: number;
35
44
  /** Restrict access to specific countries (ISO codes) */
36
45
  geoAllowlist?: string[];
46
+ /**
47
+ * The recipient's address (their `keygen().publicKey`): the link opens
48
+ * only with their key and also lands in their inbox (`inbox()`).
49
+ */
50
+ to?: string;
51
+ /**
52
+ * The address of a person's SEAL inbox (`pair()`): the seal also lands
53
+ * there, for them to manage and revoke. Best effort: if the inbox refuses,
54
+ * the seal is sent anyway and `ownerCopy` is false.
55
+ */
56
+ owner?: string;
57
+ /**
58
+ * Your key: the recipient's and the owner's inbox show your address as the
59
+ * sender instead of an unproven one.
60
+ */
61
+ keyPair?: {
62
+ readonly secretKey: string;
63
+ };
37
64
  /**
38
65
  * Over 1 GB: the tier the person pays for once by card (`5gb` $9 90 days,
39
66
  * `50gb` $29 180 days, `500gb` $99 365 days). Needs `ttl` 1d or 7d and
@@ -79,6 +106,10 @@ interface CreateAnonymousSealResult {
79
106
  encryptionKey: string;
80
107
  /** File ID */
81
108
  fileId: string;
109
+ /** The link is in the recipient's inbox (`to` was given). */
110
+ delivered: boolean;
111
+ /** The seal is in the owner's inbox (`owner` was given and it took it). */
112
+ ownerCopy: boolean;
82
113
  }
83
114
 
84
115
  /**
@@ -183,6 +214,8 @@ interface RequestOptions {
183
214
  readonly ttl?: number;
184
215
  /** Who asks, as the page names it. */
185
216
  readonly label?: string;
217
+ /** The address of a person's inbox (`pair()`): the request also waits there as a card. */
218
+ readonly to?: string;
186
219
  readonly signal?: AbortSignal;
187
220
  }
188
221
  interface RequestResult {
@@ -193,6 +226,44 @@ interface RequestResult {
193
226
  readonly emoji: string;
194
227
  readonly expiresAt: string;
195
228
  }
229
+ interface PairOptions {
230
+ /** Your key: the inbox sends to its public half. */
231
+ readonly keyPair: KeyPair;
232
+ /** How the inbox names you (default `sealnet`). */
233
+ readonly name?: string;
234
+ readonly signal?: AbortSignal;
235
+ }
236
+ interface PairResult {
237
+ /** Give this to the person: they open it on the device with their SEAL inbox. */
238
+ readonly url: string;
239
+ /** Three emoji of your key; the page shows the same ones. */
240
+ readonly emoji: string;
241
+ readonly expiresAt: string;
242
+ /** Wait until they connect: their inbox's address (use it as `owner`) and name. */
243
+ wait(): Promise<Pairing>;
244
+ }
245
+ /** Something sent to your key: open it with `open(item, {keyPair})`. */
246
+ interface InboxItem {
247
+ readonly id: string;
248
+ /** Three emoji of the sender's address when it proved one. */
249
+ readonly from: string | null;
250
+ /** What the sender called itself, in the clear: never content. */
251
+ readonly label: string | null;
252
+ readonly receivedAt: string;
253
+ readonly expiresAt: string;
254
+ }
255
+ interface Inbox {
256
+ readonly items: readonly InboxItem[];
257
+ /** Pass as `seen` to wait for a change. */
258
+ readonly version: string;
259
+ }
260
+ interface InboxOptions {
261
+ readonly keyPair: Pick<KeyPair, 'secretKey'>;
262
+ /** Seconds to wait: while the inbox is empty, or with `seen` while it is still that version. */
263
+ readonly wait?: number;
264
+ readonly seen?: string;
265
+ readonly signal?: AbortSignal;
266
+ }
196
267
 
197
268
  /**
198
269
  * SEAL SDK
@@ -247,17 +318,26 @@ declare class SealClient {
247
318
  */
248
319
  send(options: SendOptions): Promise<SendResult>;
249
320
  /**
250
- * Open a link. With `to` (Node) every file is streamed into that directory
251
- * — 0600, named only after its ciphertext matched the digest registered at
252
- * upload. Without it each file is downloaded when you `read()` it, as a
253
- * stream that fails at its end if the ciphertext was changed. Either way
254
- * memory stays one segment whatever the size. `keyPair` opens a link
255
- * addressed to your key.
321
+ * Open a link, or an item of your inbox (with `keyPair`). With `to` (Node)
322
+ * every file is streamed into that directory — 0600, named only after its
323
+ * ciphertext matched the digest registered at upload. Without it each file
324
+ * is downloaded when you `read()` it, as a stream that fails at its end if
325
+ * the ciphertext was changed. Either way memory stays one segment whatever
326
+ * the size. `keyPair` opens a link addressed to your key.
256
327
  */
257
- open(url: string, options: OpenOptions & {
328
+ open(link: string | InboxItem, options: OpenOptions & {
258
329
  to: string;
259
330
  }): Promise<OpenedSeal<SavedSealFile>>;
260
- open(url: string, options?: OpenOptions): Promise<OpenedSeal<OpenedSealFile>>;
331
+ open(link: string | InboxItem, options?: OpenOptions): Promise<OpenedSeal<OpenedSealFile>>;
332
+ /**
333
+ * What other agents or people sent to your key (your address,
334
+ * `keyPair.publicKey`); `send({to})` puts a link there. `wait` seconds
335
+ * holds the answer while the inbox is empty, or with `seen` (an earlier
336
+ * `version`) until it changes.
337
+ */
338
+ inbox(options: InboxOptions): Promise<Inbox>;
339
+ /** Take an item out of your inbox; its link keeps working for whoever holds it. */
340
+ dismiss(item: InboxItem, options: Pick<InboxOptions, 'keyPair' | 'signal'>): Promise<void>;
261
341
  /**
262
342
  * Ask a person for a file or a secret without it passing through a chat:
263
343
  * show them `url` (or hand it to an MCP client as a URL-mode elicitation)
@@ -273,6 +353,13 @@ declare class SealClient {
273
353
  waitFor(intakeId: string, options: OpenOptions & {
274
354
  keyPair: KeyPair;
275
355
  }): Promise<OpenedSeal<OpenedSealFile>>;
356
+ /**
357
+ * Connect your key to a person's SEAL inbox, once: show them `url` and
358
+ * `emoji`, then `wait()` gives their inbox's address. Pass it as `owner` to
359
+ * {@link SealClient.send} (every seal lands in their inbox) or as `to` to
360
+ * {@link SealClient.request} (the request waits there).
361
+ */
362
+ pair(options: PairOptions): Promise<PairResult>;
276
363
  /** A fresh X25519 identity for addressed links and requests. */
277
364
  keygen(): Promise<KeyPair>;
278
365
  /**
@@ -286,6 +373,6 @@ declare class SealClient {
286
373
  revokedAt: string | null;
287
374
  }>;
288
375
  }
289
- declare const VERSION = "1.1.2";
376
+ declare const VERSION = "1.3.0";
290
377
 
291
- export { type KeyPair, type OpenOptions, type OpenedSeal, type OpenedSealFile, type RequestOptions, type RequestResult, type SavedSealFile, SealClient, type SealClientOptions, SealError, type SealErrorCode, type SealErrorDetails, type SendOptions, type SendResult, type TTL, VERSION };
378
+ 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 SendOptions, type SendResult, type TTL, VERSION };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- /** What an intake request asks for (SPEC-AGENTS §4.4). */
2
- type IntakeKind = 'secret' | 'file' | 'any';
1
+ /**
2
+ * What an intake request asks for (SPEC-AGENTS §4.4): `pair` and `device`
3
+ * are the inbox's own (SPEC-ADDRESS F3), answered on box.seal.net.
4
+ */
5
+ type IntakeKind = 'secret' | 'file' | 'any' | 'pair' | 'device';
3
6
  /** A file's plaintext, and what it turned out to be once the stream ended. */
4
7
  interface OpenedStream {
5
8
  readonly stream: ReadableStream<Uint8Array>;
@@ -10,6 +13,12 @@ interface OpenedStream {
10
13
  }>;
11
14
  }
12
15
 
16
+ /** The inbox an agent is paired with: what the answer to `pair` carries. */
17
+ interface Pairing {
18
+ readonly address: string;
19
+ readonly name: string;
20
+ }
21
+
13
22
  type TTL = '5m' | '30m' | '1h' | '1d' | '7d';
14
23
  interface CreateAnonymousSealOptions {
15
24
  /** File data (File, ArrayBuffer, Uint8Array, or Blob) */
@@ -34,6 +43,24 @@ interface CreateAnonymousSealOptions {
34
43
  maxOpens?: number;
35
44
  /** Restrict access to specific countries (ISO codes) */
36
45
  geoAllowlist?: string[];
46
+ /**
47
+ * The recipient's address (their `keygen().publicKey`): the link opens
48
+ * only with their key and also lands in their inbox (`inbox()`).
49
+ */
50
+ to?: string;
51
+ /**
52
+ * The address of a person's SEAL inbox (`pair()`): the seal also lands
53
+ * there, for them to manage and revoke. Best effort: if the inbox refuses,
54
+ * the seal is sent anyway and `ownerCopy` is false.
55
+ */
56
+ owner?: string;
57
+ /**
58
+ * Your key: the recipient's and the owner's inbox show your address as the
59
+ * sender instead of an unproven one.
60
+ */
61
+ keyPair?: {
62
+ readonly secretKey: string;
63
+ };
37
64
  /**
38
65
  * Over 1 GB: the tier the person pays for once by card (`5gb` $9 90 days,
39
66
  * `50gb` $29 180 days, `500gb` $99 365 days). Needs `ttl` 1d or 7d and
@@ -79,6 +106,10 @@ interface CreateAnonymousSealResult {
79
106
  encryptionKey: string;
80
107
  /** File ID */
81
108
  fileId: string;
109
+ /** The link is in the recipient's inbox (`to` was given). */
110
+ delivered: boolean;
111
+ /** The seal is in the owner's inbox (`owner` was given and it took it). */
112
+ ownerCopy: boolean;
82
113
  }
83
114
 
84
115
  /**
@@ -183,6 +214,8 @@ interface RequestOptions {
183
214
  readonly ttl?: number;
184
215
  /** Who asks, as the page names it. */
185
216
  readonly label?: string;
217
+ /** The address of a person's inbox (`pair()`): the request also waits there as a card. */
218
+ readonly to?: string;
186
219
  readonly signal?: AbortSignal;
187
220
  }
188
221
  interface RequestResult {
@@ -193,6 +226,44 @@ interface RequestResult {
193
226
  readonly emoji: string;
194
227
  readonly expiresAt: string;
195
228
  }
229
+ interface PairOptions {
230
+ /** Your key: the inbox sends to its public half. */
231
+ readonly keyPair: KeyPair;
232
+ /** How the inbox names you (default `sealnet`). */
233
+ readonly name?: string;
234
+ readonly signal?: AbortSignal;
235
+ }
236
+ interface PairResult {
237
+ /** Give this to the person: they open it on the device with their SEAL inbox. */
238
+ readonly url: string;
239
+ /** Three emoji of your key; the page shows the same ones. */
240
+ readonly emoji: string;
241
+ readonly expiresAt: string;
242
+ /** Wait until they connect: their inbox's address (use it as `owner`) and name. */
243
+ wait(): Promise<Pairing>;
244
+ }
245
+ /** Something sent to your key: open it with `open(item, {keyPair})`. */
246
+ interface InboxItem {
247
+ readonly id: string;
248
+ /** Three emoji of the sender's address when it proved one. */
249
+ readonly from: string | null;
250
+ /** What the sender called itself, in the clear: never content. */
251
+ readonly label: string | null;
252
+ readonly receivedAt: string;
253
+ readonly expiresAt: string;
254
+ }
255
+ interface Inbox {
256
+ readonly items: readonly InboxItem[];
257
+ /** Pass as `seen` to wait for a change. */
258
+ readonly version: string;
259
+ }
260
+ interface InboxOptions {
261
+ readonly keyPair: Pick<KeyPair, 'secretKey'>;
262
+ /** Seconds to wait: while the inbox is empty, or with `seen` while it is still that version. */
263
+ readonly wait?: number;
264
+ readonly seen?: string;
265
+ readonly signal?: AbortSignal;
266
+ }
196
267
 
197
268
  /**
198
269
  * SEAL SDK
@@ -247,17 +318,26 @@ declare class SealClient {
247
318
  */
248
319
  send(options: SendOptions): Promise<SendResult>;
249
320
  /**
250
- * Open a link. With `to` (Node) every file is streamed into that directory
251
- * — 0600, named only after its ciphertext matched the digest registered at
252
- * upload. Without it each file is downloaded when you `read()` it, as a
253
- * stream that fails at its end if the ciphertext was changed. Either way
254
- * memory stays one segment whatever the size. `keyPair` opens a link
255
- * addressed to your key.
321
+ * Open a link, or an item of your inbox (with `keyPair`). With `to` (Node)
322
+ * every file is streamed into that directory — 0600, named only after its
323
+ * ciphertext matched the digest registered at upload. Without it each file
324
+ * is downloaded when you `read()` it, as a stream that fails at its end if
325
+ * the ciphertext was changed. Either way memory stays one segment whatever
326
+ * the size. `keyPair` opens a link addressed to your key.
256
327
  */
257
- open(url: string, options: OpenOptions & {
328
+ open(link: string | InboxItem, options: OpenOptions & {
258
329
  to: string;
259
330
  }): Promise<OpenedSeal<SavedSealFile>>;
260
- open(url: string, options?: OpenOptions): Promise<OpenedSeal<OpenedSealFile>>;
331
+ open(link: string | InboxItem, options?: OpenOptions): Promise<OpenedSeal<OpenedSealFile>>;
332
+ /**
333
+ * What other agents or people sent to your key (your address,
334
+ * `keyPair.publicKey`); `send({to})` puts a link there. `wait` seconds
335
+ * holds the answer while the inbox is empty, or with `seen` (an earlier
336
+ * `version`) until it changes.
337
+ */
338
+ inbox(options: InboxOptions): Promise<Inbox>;
339
+ /** Take an item out of your inbox; its link keeps working for whoever holds it. */
340
+ dismiss(item: InboxItem, options: Pick<InboxOptions, 'keyPair' | 'signal'>): Promise<void>;
261
341
  /**
262
342
  * Ask a person for a file or a secret without it passing through a chat:
263
343
  * show them `url` (or hand it to an MCP client as a URL-mode elicitation)
@@ -273,6 +353,13 @@ declare class SealClient {
273
353
  waitFor(intakeId: string, options: OpenOptions & {
274
354
  keyPair: KeyPair;
275
355
  }): Promise<OpenedSeal<OpenedSealFile>>;
356
+ /**
357
+ * Connect your key to a person's SEAL inbox, once: show them `url` and
358
+ * `emoji`, then `wait()` gives their inbox's address. Pass it as `owner` to
359
+ * {@link SealClient.send} (every seal lands in their inbox) or as `to` to
360
+ * {@link SealClient.request} (the request waits there).
361
+ */
362
+ pair(options: PairOptions): Promise<PairResult>;
276
363
  /** A fresh X25519 identity for addressed links and requests. */
277
364
  keygen(): Promise<KeyPair>;
278
365
  /**
@@ -286,6 +373,6 @@ declare class SealClient {
286
373
  revokedAt: string | null;
287
374
  }>;
288
375
  }
289
- declare const VERSION = "1.1.2";
376
+ declare const VERSION = "1.3.0";
290
377
 
291
- export { type KeyPair, type OpenOptions, type OpenedSeal, type OpenedSealFile, type RequestOptions, type RequestResult, type SavedSealFile, SealClient, type SealClientOptions, SealError, type SealErrorCode, type SealErrorDetails, type SendOptions, type SendResult, type TTL, VERSION };
378
+ 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 SendOptions, type SendResult, type TTL, VERSION };