sealnet 1.5.1 → 2.0.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
@@ -13,12 +13,6 @@ interface OpenedStream {
13
13
  }>;
14
14
  }
15
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
-
22
16
  /** The lifetimes a seal can have: `ttl_options` of the SEAL contract, which the server checks. */
23
17
  declare const TTL_OPTIONS: readonly string[];
24
18
  /** A seal's lifetime, one of the contract's `ttl_options`. */
@@ -47,19 +41,21 @@ interface CreateAnonymousSealOptions {
47
41
  /** Restrict access to specific countries (ISO codes) */
48
42
  geoAllowlist?: string[];
49
43
  /**
50
- * The recipient's address (their `keygen().publicKey`): the link opens
51
- * only with their key and also lands in their inbox (`inbox()`).
44
+ * The recipient's address (their `keygen().address`): the link opens only
45
+ * with their seed and also lands in their inbox (`inbox()`). Its key must
46
+ * be published (`inbox()` or `keygen` of any SEAL client does it), else
47
+ * nothing is uploaded and `RESOURCE_NOT_FOUND` is thrown.
52
48
  */
53
49
  to?: string;
54
50
  /**
55
51
  * The address of a person's SEAL inbox (`pair()`): the seal also lands
56
- * there, for them to manage and revoke. Best effort: if the inbox refuses,
57
- * the seal is sent anyway and `ownerCopy` is false.
52
+ * there, for them to manage and revoke. Best effort: if the inbox has no
53
+ * published key or refuses, the seal is sent anyway and `ownerCopy` is false.
58
54
  */
59
55
  owner?: string;
60
56
  /**
61
- * Your key: the recipient's and the owner's inbox show your address as the
62
- * sender instead of an unproven one.
57
+ * Your seed (`keygen().secretKey`): the recipient's and the owner's inbox
58
+ * show your address as the sender instead of an unproven one.
63
59
  */
64
60
  keyPair?: {
65
61
  readonly secretKey: string;
@@ -91,7 +87,8 @@ interface CreateAnonymousSealResult {
91
87
  /**
92
88
  * Complete RECIPIENT share URL with encryption key.
93
89
  * ISSUE-0620: this is a minted share link (`/s/{id}/{code}#{shareKey}`)
94
- * — it never carries the owner capability.
90
+ * — it never carries the owner capability. Addressed (`to`): the path
91
+ * alone, `/s/{id}/{code}`; only the recipient's seed opens it.
95
92
  */
96
93
  shareUrl: string;
97
94
  /**
@@ -162,13 +159,20 @@ declare class SealError extends Error {
162
159
  toJSON(): Record<string, unknown>;
163
160
  }
164
161
 
165
- /** An X25519 identity: give `publicKey` to senders, keep `secretKey`. Base64url. */
162
+ /**
163
+ * An identity: give `address` to senders (and `bundle` to a request), keep
164
+ * `secretKey` — the 32-byte seed, base64url, the same value as `SEAL_SEED`
165
+ * of the CLI and the MCP server. `words` name the address to a person.
166
+ */
166
167
  interface KeyPair {
167
- readonly publicKey: string;
168
168
  readonly secretKey: string;
169
+ readonly address: string;
170
+ /** The packed bundle, base64url. */
171
+ readonly bundle: string;
172
+ readonly words: string;
169
173
  }
170
174
  interface OpenOptions {
171
- /** Opens a link addressed to this key (`x25519:` links). */
175
+ /** Opens a link addressed to this seed (and, until the removal, an `x25519:` link). */
172
176
  readonly keyPair?: Pick<KeyPair, 'secretKey'>;
173
177
  /** The seal's password, when it has one. */
174
178
  readonly password?: string;
@@ -186,8 +190,8 @@ interface OpenedSealFile {
186
190
  readonly secret: boolean;
187
191
  /**
188
192
  * Download and decrypt it — this is what counts as an open. The stream
189
- * FAILS at its end if the ciphertext is not the one the sender registered:
190
- * keep nothing written from a stream that errored.
193
+ * FAILS if the file is not the one the sender registered — a changed
194
+ * header, segment or end: keep nothing written from a stream that errored.
191
195
  */
192
196
  read(): Promise<OpenedStream>;
193
197
  }
@@ -209,8 +213,8 @@ interface OpenedSeal<F> {
209
213
  interface RequestOptions {
210
214
  /** What you ask for, as the person reads it: "Brave API key". */
211
215
  readonly what: string;
212
- /** Your public key (`keygen().publicKey`): the answer is sealed to it. */
213
- readonly recipientKey: string;
216
+ /** Your bundle (`keygen().bundle`): the answer is sealed to it. */
217
+ readonly recipientBundle: string;
214
218
  /** `secret` (a password field), `file`, or `any`. */
215
219
  readonly kind?: IntakeKind;
216
220
  /** The https page where that key is created; the person sees its domain. */
@@ -227,14 +231,12 @@ interface RequestResult {
227
231
  readonly intakeId: string;
228
232
  /** Give this to the person — or to an MCP client as a URL-mode elicitation. */
229
233
  readonly url: string;
230
- /** Three words of your key, one space apart; the page shows the same ones. */
234
+ /** Three words of your address, one space apart; the page shows the same ones. */
231
235
  readonly words: string;
232
- /** @deprecated Your key as the three emoji clients before 1.4 showed: use `words`. Removed in 2.0. */
233
- readonly emoji: string;
234
236
  readonly expiresAt: string;
235
237
  }
236
238
  interface PairOptions {
237
- /** Your key: the inbox sends to its public half. */
239
+ /** Your identity: the inbox sends to its bundle. */
238
240
  readonly keyPair: KeyPair;
239
241
  /** How the inbox names you (default `sealnet`). */
240
242
  readonly name?: string;
@@ -243,21 +245,20 @@ interface PairOptions {
243
245
  interface PairResult {
244
246
  /** Give this to the person: they open it on the device with their SEAL inbox. */
245
247
  readonly url: string;
246
- /** Three words of your key, one space apart; the page shows the same ones. */
248
+ /** Three words of your address, one space apart; the page shows the same ones. */
247
249
  readonly words: string;
248
- /** @deprecated Your key as the three emoji clients before 1.4 showed: use `words`. Removed in 2.0. */
249
- readonly emoji: string;
250
250
  readonly expiresAt: string;
251
251
  /** Wait until they connect: their inbox's address (use it as `owner`) and name. */
252
- wait(): Promise<Pairing>;
252
+ wait(): Promise<{
253
+ readonly address: string;
254
+ readonly name: string;
255
+ }>;
253
256
  }
254
- /** Something sent to your key: open it with `open(item, {keyPair})`. */
257
+ /** Something sent to your address: open it with `open(item, {keyPair})`. */
255
258
  interface InboxItem {
256
259
  readonly id: string;
257
260
  /** Three words of the sender's address when it proved one. */
258
261
  readonly fromWords: string | null;
259
- /** @deprecated The sender's address as the three emoji clients before 1.4 showed: use `fromWords`. Removed in 2.0. */
260
- readonly from: string | null;
261
262
  /** What the sender called itself, in the clear: never content. */
262
263
  readonly label: string | null;
263
264
  readonly receivedAt: string;
@@ -302,9 +303,9 @@ interface SealClientOptions {
302
303
  * SEAL client: send, open, ask a person for a file or a secret.
303
304
  *
304
305
  * No account or API key is required: ownership of a seal is proven by a
305
- * client-generated owner token, and the encryption key travels only in the
306
- * URL fragment of the links returned — neither ever reaches SEAL servers in
307
- * plaintext.
306
+ * client-generated owner token, and the key of a link travels only in its URL
307
+ * fragment — or, for a link addressed to someone, nowhere in it: it waits
308
+ * wrapped to their bundle. Neither ever reaches SEAL servers in plaintext.
308
309
  *
309
310
  * @example
310
311
  * ```typescript
@@ -331,20 +332,19 @@ declare class SealClient {
331
332
  /**
332
333
  * Open a link, or an item of your inbox (with `keyPair`). With `to` (Node)
333
334
  * every file is streamed into that directory — 0600, named only after its
334
- * ciphertext matched the digest registered at upload. Without it each file
335
- * is downloaded when you `read()` it, as a stream that fails at its end if
336
- * the ciphertext was changed. Either way memory stays one segment whatever
337
- * the size. `keyPair` opens a link addressed to your key.
335
+ * header matched the one registered at upload and its last segment opened.
336
+ * Without it each file is downloaded when you `read()` it, as a stream that
337
+ * fails if the file was changed. Either way memory stays one segment
338
+ * whatever the size. `keyPair` opens a link addressed to your address.
338
339
  */
339
340
  open(link: string | InboxItem, options: OpenOptions & {
340
341
  to: string;
341
342
  }): Promise<OpenedSeal<SavedSealFile>>;
342
343
  open(link: string | InboxItem, options?: OpenOptions): Promise<OpenedSeal<OpenedSealFile>>;
343
344
  /**
344
- * What other agents or people sent to your key (your address,
345
- * `keyPair.publicKey`); `send({to})` puts a link there. `wait` seconds
346
- * holds the answer while the inbox is empty, or with `seen` (an earlier
347
- * `version`) until it changes.
345
+ * What other agents or people sent to your address (`keyPair.address`);
346
+ * `send({to})` puts a link there. `wait` seconds holds the answer while the
347
+ * inbox is empty, or with `seen` (an earlier `version`) until it changes.
348
348
  */
349
349
  inbox(options: InboxOptions): Promise<Inbox>;
350
350
  /** Take an item out of your inbox; its link keeps working for whoever holds it. */
@@ -353,10 +353,10 @@ declare class SealClient {
353
353
  * Ask a person for a file or a secret without it passing through a chat:
354
354
  * show them `url` (or hand it to an MCP client as a URL-mode elicitation)
355
355
  * and collect the answer with {@link SealClient.waitFor}. The answer is
356
- * sealed to `recipientKey`; the server never sees it.
356
+ * sealed to `recipientBundle`; the server never sees it.
357
357
  */
358
358
  request(options: RequestOptions): Promise<RequestResult>;
359
- /** Wait for the answer to {@link SealClient.request} and open it. */
359
+ /** Wait for the answer to {@link SealClient.request} and open it: its path, and its key wrapped to your seed. */
360
360
  waitFor(intakeId: string, options: OpenOptions & {
361
361
  keyPair: KeyPair;
362
362
  to: string;
@@ -365,13 +365,16 @@ declare class SealClient {
365
365
  keyPair: KeyPair;
366
366
  }): Promise<OpenedSeal<OpenedSealFile>>;
367
367
  /**
368
- * Connect your key to a person's SEAL inbox, once: show them `url` and
368
+ * Connect your identity to a person's SEAL inbox, once: show them `url` and
369
369
  * `words`, then `wait()` gives their inbox's address. Pass it as `owner` to
370
370
  * {@link SealClient.send} (every seal lands in their inbox) or as `to` to
371
371
  * {@link SealClient.request} (the request waits there).
372
372
  */
373
373
  pair(options: PairOptions): Promise<PairResult>;
374
- /** A fresh X25519 identity for addressed links and requests. */
374
+ /**
375
+ * A new identity from a fresh seed, for addressed links and requests:
376
+ * `address` for senders, `bundle` for requests, `secretKey` (the seed) to keep.
377
+ */
375
378
  keygen(): Promise<KeyPair>;
376
379
  /**
377
380
  * Revoke a previously sent seal, making it permanently inaccessible.
package/dist/index.d.ts CHANGED
@@ -13,12 +13,6 @@ interface OpenedStream {
13
13
  }>;
14
14
  }
15
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
-
22
16
  /** The lifetimes a seal can have: `ttl_options` of the SEAL contract, which the server checks. */
23
17
  declare const TTL_OPTIONS: readonly string[];
24
18
  /** A seal's lifetime, one of the contract's `ttl_options`. */
@@ -47,19 +41,21 @@ interface CreateAnonymousSealOptions {
47
41
  /** Restrict access to specific countries (ISO codes) */
48
42
  geoAllowlist?: string[];
49
43
  /**
50
- * The recipient's address (their `keygen().publicKey`): the link opens
51
- * only with their key and also lands in their inbox (`inbox()`).
44
+ * The recipient's address (their `keygen().address`): the link opens only
45
+ * with their seed and also lands in their inbox (`inbox()`). Its key must
46
+ * be published (`inbox()` or `keygen` of any SEAL client does it), else
47
+ * nothing is uploaded and `RESOURCE_NOT_FOUND` is thrown.
52
48
  */
53
49
  to?: string;
54
50
  /**
55
51
  * The address of a person's SEAL inbox (`pair()`): the seal also lands
56
- * there, for them to manage and revoke. Best effort: if the inbox refuses,
57
- * the seal is sent anyway and `ownerCopy` is false.
52
+ * there, for them to manage and revoke. Best effort: if the inbox has no
53
+ * published key or refuses, the seal is sent anyway and `ownerCopy` is false.
58
54
  */
59
55
  owner?: string;
60
56
  /**
61
- * Your key: the recipient's and the owner's inbox show your address as the
62
- * sender instead of an unproven one.
57
+ * Your seed (`keygen().secretKey`): the recipient's and the owner's inbox
58
+ * show your address as the sender instead of an unproven one.
63
59
  */
64
60
  keyPair?: {
65
61
  readonly secretKey: string;
@@ -91,7 +87,8 @@ interface CreateAnonymousSealResult {
91
87
  /**
92
88
  * Complete RECIPIENT share URL with encryption key.
93
89
  * ISSUE-0620: this is a minted share link (`/s/{id}/{code}#{shareKey}`)
94
- * — it never carries the owner capability.
90
+ * — it never carries the owner capability. Addressed (`to`): the path
91
+ * alone, `/s/{id}/{code}`; only the recipient's seed opens it.
95
92
  */
96
93
  shareUrl: string;
97
94
  /**
@@ -162,13 +159,20 @@ declare class SealError extends Error {
162
159
  toJSON(): Record<string, unknown>;
163
160
  }
164
161
 
165
- /** An X25519 identity: give `publicKey` to senders, keep `secretKey`. Base64url. */
162
+ /**
163
+ * An identity: give `address` to senders (and `bundle` to a request), keep
164
+ * `secretKey` — the 32-byte seed, base64url, the same value as `SEAL_SEED`
165
+ * of the CLI and the MCP server. `words` name the address to a person.
166
+ */
166
167
  interface KeyPair {
167
- readonly publicKey: string;
168
168
  readonly secretKey: string;
169
+ readonly address: string;
170
+ /** The packed bundle, base64url. */
171
+ readonly bundle: string;
172
+ readonly words: string;
169
173
  }
170
174
  interface OpenOptions {
171
- /** Opens a link addressed to this key (`x25519:` links). */
175
+ /** Opens a link addressed to this seed (and, until the removal, an `x25519:` link). */
172
176
  readonly keyPair?: Pick<KeyPair, 'secretKey'>;
173
177
  /** The seal's password, when it has one. */
174
178
  readonly password?: string;
@@ -186,8 +190,8 @@ interface OpenedSealFile {
186
190
  readonly secret: boolean;
187
191
  /**
188
192
  * Download and decrypt it — this is what counts as an open. The stream
189
- * FAILS at its end if the ciphertext is not the one the sender registered:
190
- * keep nothing written from a stream that errored.
193
+ * FAILS if the file is not the one the sender registered — a changed
194
+ * header, segment or end: keep nothing written from a stream that errored.
191
195
  */
192
196
  read(): Promise<OpenedStream>;
193
197
  }
@@ -209,8 +213,8 @@ interface OpenedSeal<F> {
209
213
  interface RequestOptions {
210
214
  /** What you ask for, as the person reads it: "Brave API key". */
211
215
  readonly what: string;
212
- /** Your public key (`keygen().publicKey`): the answer is sealed to it. */
213
- readonly recipientKey: string;
216
+ /** Your bundle (`keygen().bundle`): the answer is sealed to it. */
217
+ readonly recipientBundle: string;
214
218
  /** `secret` (a password field), `file`, or `any`. */
215
219
  readonly kind?: IntakeKind;
216
220
  /** The https page where that key is created; the person sees its domain. */
@@ -227,14 +231,12 @@ interface RequestResult {
227
231
  readonly intakeId: string;
228
232
  /** Give this to the person — or to an MCP client as a URL-mode elicitation. */
229
233
  readonly url: string;
230
- /** Three words of your key, one space apart; the page shows the same ones. */
234
+ /** Three words of your address, one space apart; the page shows the same ones. */
231
235
  readonly words: string;
232
- /** @deprecated Your key as the three emoji clients before 1.4 showed: use `words`. Removed in 2.0. */
233
- readonly emoji: string;
234
236
  readonly expiresAt: string;
235
237
  }
236
238
  interface PairOptions {
237
- /** Your key: the inbox sends to its public half. */
239
+ /** Your identity: the inbox sends to its bundle. */
238
240
  readonly keyPair: KeyPair;
239
241
  /** How the inbox names you (default `sealnet`). */
240
242
  readonly name?: string;
@@ -243,21 +245,20 @@ interface PairOptions {
243
245
  interface PairResult {
244
246
  /** Give this to the person: they open it on the device with their SEAL inbox. */
245
247
  readonly url: string;
246
- /** Three words of your key, one space apart; the page shows the same ones. */
248
+ /** Three words of your address, one space apart; the page shows the same ones. */
247
249
  readonly words: string;
248
- /** @deprecated Your key as the three emoji clients before 1.4 showed: use `words`. Removed in 2.0. */
249
- readonly emoji: string;
250
250
  readonly expiresAt: string;
251
251
  /** Wait until they connect: their inbox's address (use it as `owner`) and name. */
252
- wait(): Promise<Pairing>;
252
+ wait(): Promise<{
253
+ readonly address: string;
254
+ readonly name: string;
255
+ }>;
253
256
  }
254
- /** Something sent to your key: open it with `open(item, {keyPair})`. */
257
+ /** Something sent to your address: open it with `open(item, {keyPair})`. */
255
258
  interface InboxItem {
256
259
  readonly id: string;
257
260
  /** Three words of the sender's address when it proved one. */
258
261
  readonly fromWords: string | null;
259
- /** @deprecated The sender's address as the three emoji clients before 1.4 showed: use `fromWords`. Removed in 2.0. */
260
- readonly from: string | null;
261
262
  /** What the sender called itself, in the clear: never content. */
262
263
  readonly label: string | null;
263
264
  readonly receivedAt: string;
@@ -302,9 +303,9 @@ interface SealClientOptions {
302
303
  * SEAL client: send, open, ask a person for a file or a secret.
303
304
  *
304
305
  * No account or API key is required: ownership of a seal is proven by a
305
- * client-generated owner token, and the encryption key travels only in the
306
- * URL fragment of the links returned — neither ever reaches SEAL servers in
307
- * plaintext.
306
+ * client-generated owner token, and the key of a link travels only in its URL
307
+ * fragment — or, for a link addressed to someone, nowhere in it: it waits
308
+ * wrapped to their bundle. Neither ever reaches SEAL servers in plaintext.
308
309
  *
309
310
  * @example
310
311
  * ```typescript
@@ -331,20 +332,19 @@ declare class SealClient {
331
332
  /**
332
333
  * Open a link, or an item of your inbox (with `keyPair`). With `to` (Node)
333
334
  * every file is streamed into that directory — 0600, named only after its
334
- * ciphertext matched the digest registered at upload. Without it each file
335
- * is downloaded when you `read()` it, as a stream that fails at its end if
336
- * the ciphertext was changed. Either way memory stays one segment whatever
337
- * the size. `keyPair` opens a link addressed to your key.
335
+ * header matched the one registered at upload and its last segment opened.
336
+ * Without it each file is downloaded when you `read()` it, as a stream that
337
+ * fails if the file was changed. Either way memory stays one segment
338
+ * whatever the size. `keyPair` opens a link addressed to your address.
338
339
  */
339
340
  open(link: string | InboxItem, options: OpenOptions & {
340
341
  to: string;
341
342
  }): Promise<OpenedSeal<SavedSealFile>>;
342
343
  open(link: string | InboxItem, options?: OpenOptions): Promise<OpenedSeal<OpenedSealFile>>;
343
344
  /**
344
- * What other agents or people sent to your key (your address,
345
- * `keyPair.publicKey`); `send({to})` puts a link there. `wait` seconds
346
- * holds the answer while the inbox is empty, or with `seen` (an earlier
347
- * `version`) until it changes.
345
+ * What other agents or people sent to your address (`keyPair.address`);
346
+ * `send({to})` puts a link there. `wait` seconds holds the answer while the
347
+ * inbox is empty, or with `seen` (an earlier `version`) until it changes.
348
348
  */
349
349
  inbox(options: InboxOptions): Promise<Inbox>;
350
350
  /** Take an item out of your inbox; its link keeps working for whoever holds it. */
@@ -353,10 +353,10 @@ declare class SealClient {
353
353
  * Ask a person for a file or a secret without it passing through a chat:
354
354
  * show them `url` (or hand it to an MCP client as a URL-mode elicitation)
355
355
  * and collect the answer with {@link SealClient.waitFor}. The answer is
356
- * sealed to `recipientKey`; the server never sees it.
356
+ * sealed to `recipientBundle`; the server never sees it.
357
357
  */
358
358
  request(options: RequestOptions): Promise<RequestResult>;
359
- /** Wait for the answer to {@link SealClient.request} and open it. */
359
+ /** Wait for the answer to {@link SealClient.request} and open it: its path, and its key wrapped to your seed. */
360
360
  waitFor(intakeId: string, options: OpenOptions & {
361
361
  keyPair: KeyPair;
362
362
  to: string;
@@ -365,13 +365,16 @@ declare class SealClient {
365
365
  keyPair: KeyPair;
366
366
  }): Promise<OpenedSeal<OpenedSealFile>>;
367
367
  /**
368
- * Connect your key to a person's SEAL inbox, once: show them `url` and
368
+ * Connect your identity to a person's SEAL inbox, once: show them `url` and
369
369
  * `words`, then `wait()` gives their inbox's address. Pass it as `owner` to
370
370
  * {@link SealClient.send} (every seal lands in their inbox) or as `to` to
371
371
  * {@link SealClient.request} (the request waits there).
372
372
  */
373
373
  pair(options: PairOptions): Promise<PairResult>;
374
- /** A fresh X25519 identity for addressed links and requests. */
374
+ /**
375
+ * A new identity from a fresh seed, for addressed links and requests:
376
+ * `address` for senders, `bundle` for requests, `secretKey` (the seed) to keep.
377
+ */
375
378
  keygen(): Promise<KeyPair>;
376
379
  /**
377
380
  * Revoke a previously sent seal, making it permanently inaccessible.