sealnet 1.2.0 → 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/README.md +21 -2
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/dist/index.cjs +324 -129
- package/dist/index.d.cts +53 -4
- package/dist/index.d.ts +53 -4
- package/dist/index.js +319 -124
- package/dist/seal.global.js +2 -2
- package/dist/seal.global.js.sha384 +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
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) */
|
|
@@ -39,6 +48,19 @@ interface CreateAnonymousSealOptions {
|
|
|
39
48
|
* only with their key and also lands in their inbox (`inbox()`).
|
|
40
49
|
*/
|
|
41
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
|
+
};
|
|
42
64
|
/**
|
|
43
65
|
* Over 1 GB: the tier the person pays for once by card (`5gb` $9 90 days,
|
|
44
66
|
* `50gb` $29 180 days, `500gb` $99 365 days). Needs `ttl` 1d or 7d and
|
|
@@ -86,6 +108,8 @@ interface CreateAnonymousSealResult {
|
|
|
86
108
|
fileId: string;
|
|
87
109
|
/** The link is in the recipient's inbox (`to` was given). */
|
|
88
110
|
delivered: boolean;
|
|
111
|
+
/** The seal is in the owner's inbox (`owner` was given and it took it). */
|
|
112
|
+
ownerCopy: boolean;
|
|
89
113
|
}
|
|
90
114
|
|
|
91
115
|
/**
|
|
@@ -190,6 +214,8 @@ interface RequestOptions {
|
|
|
190
214
|
readonly ttl?: number;
|
|
191
215
|
/** Who asks, as the page names it. */
|
|
192
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;
|
|
193
219
|
readonly signal?: AbortSignal;
|
|
194
220
|
}
|
|
195
221
|
interface RequestResult {
|
|
@@ -200,6 +226,22 @@ interface RequestResult {
|
|
|
200
226
|
readonly emoji: string;
|
|
201
227
|
readonly expiresAt: string;
|
|
202
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
|
+
}
|
|
203
245
|
/** Something sent to your key: open it with `open(item, {keyPair})`. */
|
|
204
246
|
interface InboxItem {
|
|
205
247
|
readonly id: string;
|
|
@@ -311,6 +353,13 @@ declare class SealClient {
|
|
|
311
353
|
waitFor(intakeId: string, options: OpenOptions & {
|
|
312
354
|
keyPair: KeyPair;
|
|
313
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>;
|
|
314
363
|
/** A fresh X25519 identity for addressed links and requests. */
|
|
315
364
|
keygen(): Promise<KeyPair>;
|
|
316
365
|
/**
|
|
@@ -324,6 +373,6 @@ declare class SealClient {
|
|
|
324
373
|
revokedAt: string | null;
|
|
325
374
|
}>;
|
|
326
375
|
}
|
|
327
|
-
declare const VERSION = "1.
|
|
376
|
+
declare const VERSION = "1.3.0";
|
|
328
377
|
|
|
329
|
-
export { type Inbox, type InboxItem, type InboxOptions, 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
|
-
/**
|
|
2
|
-
|
|
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) */
|
|
@@ -39,6 +48,19 @@ interface CreateAnonymousSealOptions {
|
|
|
39
48
|
* only with their key and also lands in their inbox (`inbox()`).
|
|
40
49
|
*/
|
|
41
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
|
+
};
|
|
42
64
|
/**
|
|
43
65
|
* Over 1 GB: the tier the person pays for once by card (`5gb` $9 90 days,
|
|
44
66
|
* `50gb` $29 180 days, `500gb` $99 365 days). Needs `ttl` 1d or 7d and
|
|
@@ -86,6 +108,8 @@ interface CreateAnonymousSealResult {
|
|
|
86
108
|
fileId: string;
|
|
87
109
|
/** The link is in the recipient's inbox (`to` was given). */
|
|
88
110
|
delivered: boolean;
|
|
111
|
+
/** The seal is in the owner's inbox (`owner` was given and it took it). */
|
|
112
|
+
ownerCopy: boolean;
|
|
89
113
|
}
|
|
90
114
|
|
|
91
115
|
/**
|
|
@@ -190,6 +214,8 @@ interface RequestOptions {
|
|
|
190
214
|
readonly ttl?: number;
|
|
191
215
|
/** Who asks, as the page names it. */
|
|
192
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;
|
|
193
219
|
readonly signal?: AbortSignal;
|
|
194
220
|
}
|
|
195
221
|
interface RequestResult {
|
|
@@ -200,6 +226,22 @@ interface RequestResult {
|
|
|
200
226
|
readonly emoji: string;
|
|
201
227
|
readonly expiresAt: string;
|
|
202
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
|
+
}
|
|
203
245
|
/** Something sent to your key: open it with `open(item, {keyPair})`. */
|
|
204
246
|
interface InboxItem {
|
|
205
247
|
readonly id: string;
|
|
@@ -311,6 +353,13 @@ declare class SealClient {
|
|
|
311
353
|
waitFor(intakeId: string, options: OpenOptions & {
|
|
312
354
|
keyPair: KeyPair;
|
|
313
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>;
|
|
314
363
|
/** A fresh X25519 identity for addressed links and requests. */
|
|
315
364
|
keygen(): Promise<KeyPair>;
|
|
316
365
|
/**
|
|
@@ -324,6 +373,6 @@ declare class SealClient {
|
|
|
324
373
|
revokedAt: string | null;
|
|
325
374
|
}>;
|
|
326
375
|
}
|
|
327
|
-
declare const VERSION = "1.
|
|
376
|
+
declare const VERSION = "1.3.0";
|
|
328
377
|
|
|
329
|
-
export { type Inbox, type InboxItem, type InboxOptions, 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 };
|