@weaveprotocol/core 0.1.2 → 0.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.
Files changed (199) hide show
  1. package/README.md +322 -45
  2. package/dist/doors/doors.d.ts +139 -0
  3. package/dist/doors/doors.d.ts.map +1 -0
  4. package/dist/doors/doors.js +210 -0
  5. package/dist/doors/doors.js.map +1 -0
  6. package/dist/doors/index.d.ts +9 -0
  7. package/dist/doors/index.d.ts.map +1 -0
  8. package/dist/doors/index.js +7 -0
  9. package/dist/doors/index.js.map +1 -0
  10. package/dist/identity/contact-key.d.ts +68 -0
  11. package/dist/identity/contact-key.d.ts.map +1 -0
  12. package/dist/identity/contact-key.js +185 -0
  13. package/dist/identity/contact-key.js.map +1 -0
  14. package/dist/index.d.ts +16 -7
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +10 -5
  17. package/dist/index.js.map +1 -1
  18. package/dist/network/index.d.ts +2 -0
  19. package/dist/network/index.d.ts.map +1 -1
  20. package/dist/network/index.js +1 -0
  21. package/dist/network/index.js.map +1 -1
  22. package/dist/network/mailbox.d.ts +49 -0
  23. package/dist/network/mailbox.d.ts.map +1 -0
  24. package/dist/network/mailbox.js +125 -0
  25. package/dist/network/mailbox.js.map +1 -0
  26. package/dist/network/mesh.d.ts +6 -0
  27. package/dist/network/mesh.d.ts.map +1 -1
  28. package/dist/network/mesh.js +11 -1
  29. package/dist/network/mesh.js.map +1 -1
  30. package/dist/network/multi-signaling.d.ts +12 -2
  31. package/dist/network/multi-signaling.d.ts.map +1 -1
  32. package/dist/network/multi-signaling.js +86 -14
  33. package/dist/network/multi-signaling.js.map +1 -1
  34. package/dist/network/peer-auth.d.ts +50 -16
  35. package/dist/network/peer-auth.d.ts.map +1 -1
  36. package/dist/network/peer-auth.js +52 -15
  37. package/dist/network/peer-auth.js.map +1 -1
  38. package/dist/node/carrier.d.ts +87 -0
  39. package/dist/node/carrier.d.ts.map +1 -1
  40. package/dist/node/carrier.js +180 -59
  41. package/dist/node/carrier.js.map +1 -1
  42. package/dist/node/copy.d.ts.map +1 -1
  43. package/dist/node/copy.js +6 -3
  44. package/dist/node/copy.js.map +1 -1
  45. package/dist/node/host.d.ts +117 -0
  46. package/dist/node/host.d.ts.map +1 -0
  47. package/dist/node/host.js +192 -0
  48. package/dist/node/host.js.map +1 -0
  49. package/dist/node/index.d.ts +6 -2
  50. package/dist/node/index.d.ts.map +1 -1
  51. package/dist/node/index.js +1 -0
  52. package/dist/node/index.js.map +1 -1
  53. package/dist/node/node.d.ts.map +1 -1
  54. package/dist/node/node.js +958 -25
  55. package/dist/node/node.js.map +1 -1
  56. package/dist/node/space-runtime.d.ts +42 -25
  57. package/dist/node/space-runtime.d.ts.map +1 -1
  58. package/dist/node/space-runtime.js +734 -35
  59. package/dist/node/space-runtime.js.map +1 -1
  60. package/dist/node/types.d.ts +375 -3
  61. package/dist/node/types.d.ts.map +1 -1
  62. package/dist/privacy/space-encryption.d.ts +16 -0
  63. package/dist/privacy/space-encryption.d.ts.map +1 -1
  64. package/dist/privacy/space-encryption.js +40 -0
  65. package/dist/privacy/space-encryption.js.map +1 -1
  66. package/dist/query/engine.js +1 -1
  67. package/dist/query/engine.js.map +1 -1
  68. package/dist/query/types.d.ts +7 -0
  69. package/dist/query/types.d.ts.map +1 -1
  70. package/dist/query/types.js.map +1 -1
  71. package/dist/react/use-query.d.ts +1 -1
  72. package/dist/react/use-query.d.ts.map +1 -1
  73. package/dist/records/topics.d.ts +21 -0
  74. package/dist/records/topics.d.ts.map +1 -0
  75. package/dist/records/topics.js +86 -0
  76. package/dist/records/topics.js.map +1 -0
  77. package/dist/schema/collection-def.d.ts +7 -0
  78. package/dist/schema/collection-def.d.ts.map +1 -1
  79. package/dist/schema/collection-def.js +4 -0
  80. package/dist/schema/collection-def.js.map +1 -1
  81. package/dist/schema/expression.d.ts +2 -0
  82. package/dist/schema/expression.d.ts.map +1 -1
  83. package/dist/schema/expression.js +1 -0
  84. package/dist/schema/expression.js.map +1 -1
  85. package/dist/schemas/contacts.d.ts +214 -0
  86. package/dist/schemas/contacts.d.ts.map +1 -0
  87. package/dist/schemas/contacts.js +98 -0
  88. package/dist/schemas/contacts.js.map +1 -0
  89. package/dist/schemas/index.d.ts +2 -0
  90. package/dist/schemas/index.d.ts.map +1 -1
  91. package/dist/schemas/index.js +1 -0
  92. package/dist/schemas/index.js.map +1 -1
  93. package/dist/session/auth.d.ts.map +1 -1
  94. package/dist/session/auth.js +15 -3
  95. package/dist/session/auth.js.map +1 -1
  96. package/dist/session/connect.d.ts +25 -1
  97. package/dist/session/connect.d.ts.map +1 -1
  98. package/dist/session/connect.js +9 -2
  99. package/dist/session/connect.js.map +1 -1
  100. package/dist/session/hosting.d.ts +155 -0
  101. package/dist/session/hosting.d.ts.map +1 -0
  102. package/dist/session/hosting.js +160 -0
  103. package/dist/session/hosting.js.map +1 -0
  104. package/dist/space/account-registry.d.ts +6 -0
  105. package/dist/space/account-registry.d.ts.map +1 -1
  106. package/dist/space/account-registry.js +16 -4
  107. package/dist/space/account-registry.js.map +1 -1
  108. package/dist/space/notify.d.ts +88 -0
  109. package/dist/space/notify.d.ts.map +1 -0
  110. package/dist/space/notify.js +127 -0
  111. package/dist/space/notify.js.map +1 -0
  112. package/dist/space/pass.d.ts +6 -0
  113. package/dist/space/pass.d.ts.map +1 -1
  114. package/dist/space/pass.js +5 -2
  115. package/dist/space/pass.js.map +1 -1
  116. package/dist/space/roles.d.ts +71 -0
  117. package/dist/space/roles.d.ts.map +1 -1
  118. package/dist/space/roles.js +114 -0
  119. package/dist/space/roles.js.map +1 -1
  120. package/dist/space/space-access.d.ts +24 -0
  121. package/dist/space/space-access.d.ts.map +1 -1
  122. package/dist/space/space-access.js +24 -0
  123. package/dist/space/space-access.js.map +1 -1
  124. package/dist/space/space-manager.d.ts +35 -1
  125. package/dist/space/space-manager.d.ts.map +1 -1
  126. package/dist/space/space-manager.js +72 -25
  127. package/dist/space/space-manager.js.map +1 -1
  128. package/dist/storage/blob/memory.d.ts +9 -0
  129. package/dist/storage/blob/memory.d.ts.map +1 -0
  130. package/dist/storage/blob/memory.js +20 -0
  131. package/dist/storage/blob/memory.js.map +1 -0
  132. package/dist/storage/blob/s3.d.ts +16 -0
  133. package/dist/storage/blob/s3.d.ts.map +1 -0
  134. package/dist/storage/blob/s3.js +86 -0
  135. package/dist/storage/blob/s3.js.map +1 -0
  136. package/dist/storage/blob-store.d.ts +26 -0
  137. package/dist/storage/blob-store.d.ts.map +1 -0
  138. package/dist/storage/blob-store.js +2 -0
  139. package/dist/storage/blob-store.js.map +1 -0
  140. package/dist/storage/encrypted-adapter.d.ts +3 -3
  141. package/dist/storage/encrypted-adapter.js +3 -3
  142. package/dist/storage/folder-adapter.d.ts +8 -8
  143. package/dist/storage/folder-adapter.d.ts.map +1 -1
  144. package/dist/storage/folder-adapter.js +7 -7
  145. package/dist/storage/folder-reconcile.d.ts +12 -14
  146. package/dist/storage/folder-reconcile.d.ts.map +1 -1
  147. package/dist/storage/folder-reconcile.js +20 -14
  148. package/dist/storage/folder-reconcile.js.map +1 -1
  149. package/dist/storage/index.d.ts +0 -1
  150. package/dist/storage/index.d.ts.map +1 -1
  151. package/dist/storage/index.js +0 -1
  152. package/dist/storage/index.js.map +1 -1
  153. package/dist/storage/indexeddb-adapter.d.ts.map +1 -1
  154. package/dist/storage/indexeddb-adapter.js +8 -9
  155. package/dist/storage/indexeddb-adapter.js.map +1 -1
  156. package/dist/storage/mirror.d.ts +68 -0
  157. package/dist/storage/mirror.d.ts.map +1 -0
  158. package/dist/storage/mirror.js +174 -0
  159. package/dist/storage/mirror.js.map +1 -0
  160. package/dist/storage/segment.d.ts +20 -0
  161. package/dist/storage/segment.d.ts.map +1 -0
  162. package/dist/storage/segment.js +27 -0
  163. package/dist/storage/segment.js.map +1 -0
  164. package/dist/storage/storage-provider.d.ts +36 -40
  165. package/dist/storage/storage-provider.d.ts.map +1 -1
  166. package/dist/storage/storage-provider.js +208 -117
  167. package/dist/storage/storage-provider.js.map +1 -1
  168. package/dist/sync/index.d.ts +1 -1
  169. package/dist/sync/index.d.ts.map +1 -1
  170. package/dist/sync/index.js +1 -1
  171. package/dist/sync/index.js.map +1 -1
  172. package/dist/sync/negentropy.d.ts +68 -0
  173. package/dist/sync/negentropy.d.ts.map +1 -0
  174. package/dist/sync/negentropy.js +379 -0
  175. package/dist/sync/negentropy.js.map +1 -0
  176. package/dist/sync/sync-engine.d.ts +45 -13
  177. package/dist/sync/sync-engine.d.ts.map +1 -1
  178. package/dist/sync/sync-engine.js +290 -207
  179. package/dist/sync/sync-engine.js.map +1 -1
  180. package/dist/sync/sync-messages.d.ts +42 -32
  181. package/dist/sync/sync-messages.d.ts.map +1 -1
  182. package/dist/sync/sync-messages.js +1 -1
  183. package/dist/sync/sync-messages.js.map +1 -1
  184. package/dist/types.d.ts +9 -0
  185. package/dist/types.d.ts.map +1 -1
  186. package/dist/types.js.map +1 -1
  187. package/dist/utils/hash.d.ts +9 -0
  188. package/dist/utils/hash.d.ts.map +1 -1
  189. package/dist/utils/hash.js +33 -0
  190. package/dist/utils/hash.js.map +1 -1
  191. package/package.json +8 -3
  192. package/dist/storage/mst.d.ts +0 -121
  193. package/dist/storage/mst.d.ts.map +0 -1
  194. package/dist/storage/mst.js +0 -402
  195. package/dist/storage/mst.js.map +0 -1
  196. package/dist/sync/anti-entropy.d.ts +0 -49
  197. package/dist/sync/anti-entropy.d.ts.map +0 -1
  198. package/dist/sync/anti-entropy.js +0 -62
  199. package/dist/sync/anti-entropy.js.map +0 -1
@@ -7,6 +7,7 @@
7
7
  * are exposed as actions to a command line, an MCP server and WebMCP, and a
8
8
  * value that cannot cross a wire would have to be reshaped at each of them.
9
9
  */
10
+ import type { MailboxClient } from '../network/mailbox.js';
10
11
  import type { BodyOf, Query, ResultOf } from '../query/types.js';
11
12
  import type { CollectionRules } from '../records/rules.js';
12
13
  import type { CollectionDef, CryptoProvider, Link, SpaceRole, SpaceVisibility, StandardJSONSchemaV1 } from '../types.js';
@@ -17,6 +18,8 @@ import type { PeerTransport } from '../network/transport.js';
17
18
  import type { ServerAuth } from '../network/peer-auth.js';
18
19
  import type { StoreFactory } from './stores.js';
19
20
  import type { JsonSchema, SchemaIssue } from '../schema/collection-def.js';
21
+ import type { Keeper } from '../space/roles.js';
22
+ import type { NotifyWhen } from '../space/notify.js';
20
23
  export interface NodeNetworkConfig {
21
24
  /** Relays for WebRTC, browsers only. Each space meets in the room named after its id. */
22
25
  readonly relays?: ReadonlyArray<string>;
@@ -40,6 +43,21 @@ export interface NodeConfig {
40
43
  * spaces are this node's alone.
41
44
  */
42
45
  readonly accountKey?: Uint8Array;
46
+ /**
47
+ * The account's contact key (`deriveContactKeyBytes(seed)`), for a node
48
+ * allowed to handle contacts: it opens contact requests sent to the account,
49
+ * and its public half goes on the account's profile in every space this
50
+ * node writes in. Without it, a profile keeps the key another device put there.
51
+ */
52
+ readonly contactKey?: Uint8Array;
53
+ /**
54
+ * The id of the account's contacts space, for a node given it without the
55
+ * account key — an app an account home let see the contacts. With the
56
+ * account key it is derived, and this is not needed.
57
+ */
58
+ readonly contactsSpace?: string;
59
+ /** How doors reach relays' mailboxes. Default: a WebSocket to each (`createMailboxClient`). */
60
+ readonly mailbox?: MailboxClient;
43
61
  /** Where the registry and each space's store live */
44
62
  readonly stores: StoreFactory;
45
63
  readonly provider?: CryptoProvider;
@@ -63,6 +81,29 @@ export interface NodeConfig {
63
81
  readonly sessionKey?: CryptoKeyPair;
64
82
  /** How often to look for writes another process made to a folder store. 0 disables. Default 2000. */
65
83
  readonly watchIntervalMs?: number;
84
+ /**
85
+ * Hold only part of a space — the collections this node uses — once the
86
+ * space names a keeper to hold the rest. What's dropped syncs back when a
87
+ * query needs it again. Apps connected to an account home do this by default.
88
+ * Spaces with no keeper are always held whole.
89
+ */
90
+ readonly cache?: CacheConfig;
91
+ }
92
+ /**
93
+ * How a node holds part of a space. Every number here is the node's own
94
+ * choice: nothing else depends on what a node holding part of a space keeps.
95
+ */
96
+ export interface CacheConfig {
97
+ /** Collections this app uses: held from the start, and dropped last */
98
+ readonly collections?: ReadonlyArray<string>;
99
+ /** Drop a collection no query has touched for this many days, unless it holds writes of this node's still waiting. Default 30. */
100
+ readonly unusedAfterDays?: number;
101
+ /**
102
+ * How many keepers a write of this node's must reach before it can be
103
+ * dropped. The space's own number (`copies`) or 2 when it names none, and
104
+ * never more than the keepers it names; this only ever raises it.
105
+ */
106
+ readonly copies?: number;
66
107
  }
67
108
  /** A space, as the node describes it. Never carries the key. */
68
109
  export interface SpaceSummary {
@@ -134,6 +175,21 @@ export interface SpaceAccess {
134
175
  readonly role: SpaceRole | null;
135
176
  /** The latest access changes held — what a record written now names as `seen` */
136
177
  readonly heads: ReadonlyArray<string>;
178
+ /**
179
+ * A private space's key: how many times it has changed, and whether this
180
+ * device holds the one in use now — not while a new one is on its way here.
181
+ * Null in a public space.
182
+ */
183
+ readonly key: {
184
+ readonly changes: number;
185
+ readonly held: boolean;
186
+ } | null;
187
+ /** Where the space's members meet: the relays it names, or until it names some, the ones its invite did */
188
+ readonly relays: ReadonlyArray<string>;
189
+ /** The nodes that keep the space whole: a host, an extension. Empty until someone who manages it names some. */
190
+ readonly keepers: ReadonlyArray<Keeper>;
191
+ /** How many keepers a write should reach before a node holding part of the space lets go of it; null for the default */
192
+ readonly copies: number | null;
137
193
  }
138
194
  /** A record, opened and checked — its current version, unless listed as history */
139
195
  export interface NodeRecord<T = unknown> {
@@ -199,6 +255,8 @@ export interface NodeCollection {
199
255
  readonly permissions: ReadonlyArray<string>;
200
256
  /** Who may create, edit and delete, what must be unique — for records created from now on */
201
257
  readonly rules: CollectionRules;
258
+ /** Fields whose values are topics, tagged on the outside of each record so keepers can match them unread */
259
+ readonly topics: ReadonlyArray<string>;
202
260
  /** A screen for its records, when its definer gave one: one HTML document, run sealed */
203
261
  readonly screen?: string;
204
262
  readonly records: number;
@@ -223,6 +281,8 @@ export interface DefineCollection {
223
281
  readonly permissions?: ReadonlyArray<string>;
224
282
  /** Who may create, edit and delete, what must be unique, which fields are fixed */
225
283
  readonly rules?: CollectionRules;
284
+ /** Fields whose values are topics — `channel`, `mentions` — so a keeper can match them without reading (`StoredCollection.topics`) */
285
+ readonly topics?: ReadonlyArray<string>;
226
286
  /** A screen for its records — one HTML document an app may run in a sealed frame (`StoredCollection.screen`) */
227
287
  readonly screen?: string;
228
288
  }
@@ -236,6 +296,13 @@ export interface NodeCollections {
236
296
  * has records; the same people who may change a definition may remove it.
237
297
  */
238
298
  delete(spaceId: string, name: string): Promise<void>;
299
+ /**
300
+ * The topic tag for one value of a collection's topic field — what a
301
+ * record with that value carries on its outside, and what a subscription
302
+ * hands a keeper to match without reading. In a private space it takes the
303
+ * space's current key, so only its members can work it out.
304
+ */
305
+ tag(spaceId: string, collection: string, field: string, value: string | number | boolean): Promise<string>;
239
306
  }
240
307
  export interface ListOptions {
241
308
  /** Only this collection. Default: every collection except the protocol's own `sys.*` */
@@ -258,10 +325,14 @@ export interface SpaceStatus {
258
325
  readonly carriers: ReadonlyArray<string>;
259
326
  /** The account each peer showed it acts for, by the peer's session DID — only peers that showed one */
260
327
  readonly accounts: Readonly<Record<string, string>>;
261
- /** Root of this space's Merkle tree — equal on two nodes means identical data */
262
- readonly root: string | null;
328
+ /** A fingerprint of every version this node keeps here — equal on two nodes means identical data */
329
+ readonly fingerprint: string;
263
330
  /** Records peers sent that failed validation */
264
331
  readonly rejected: number;
332
+ /** What this node holds of the space: `all`, or the collections it uses (besides the space's own) */
333
+ readonly holds: 'all' | ReadonlyArray<string>;
334
+ /** Writes of this node's that haven't reached enough keepers yet, so are kept whatever else is dropped */
335
+ readonly pending: number;
265
336
  }
266
337
  /** A live message as it arrives: what was sent, and who sent it */
267
338
  export interface LiveMessage {
@@ -317,6 +388,12 @@ export interface SpaceProfile {
317
388
  readonly did: string;
318
389
  readonly name: string;
319
390
  readonly updatedAt: string;
391
+ /**
392
+ * The public half of their contact key, when they published one — what a
393
+ * contact request to them is sealed with (`contacts.ask`). It counts only
394
+ * on a profile signed under their own account, like the name.
395
+ */
396
+ readonly contactKey?: string;
320
397
  }
321
398
  export interface NodeSpaces {
322
399
  list(): Promise<ReadonlyArray<SpaceSummary>>;
@@ -330,7 +407,14 @@ export interface NodeSpaces {
330
407
  */
331
408
  invite(spaceId: string, options?: InviteOptions): Promise<string>;
332
409
  preview(invite: string): InvitePreview;
333
- join(invite: string): Promise<SpaceSummary>;
410
+ /**
411
+ * Joins a space from an invite. `memberKey` is this account's member key
412
+ * for it, for a node without the account key — an app an account home gave
413
+ * the space to — so a new key of the space reaches it too.
414
+ */
415
+ join(invite: string, options?: {
416
+ readonly memberKey?: Uint8Array;
417
+ }): Promise<SpaceSummary>;
334
418
  /**
335
419
  * Forgets a space on this node, with its key. Other members keep theirs.
336
420
  * Your role stays too — to give it up, `setMember` yourself to null first.
@@ -346,6 +430,26 @@ export interface NodeSpaces {
346
430
  removeRole(spaceId: string, name: string): Promise<void>;
347
431
  /** Closes an invite — by the link itself, or by its key from `access().invites`. Who joined with it before stays. */
348
432
  closeInvite(spaceId: string, keyOrLink: string): Promise<void>;
433
+ /**
434
+ * Gives a private space a new key, sealed to every member and nobody else.
435
+ * Happens by itself when someone is removed or leaves; call it when a
436
+ * device was lost. View-only links made before stop working. Needs `manage`.
437
+ */
438
+ changeKey(spaceId: string): Promise<void>;
439
+ /**
440
+ * Names the relays the space's members meet on — wss:// URLs, at most 8 —
441
+ * so people whose apps use different relays still find each other. Every
442
+ * member joins the space's room there too, and invites carry them. A space
443
+ * names the relays of whoever manages it first by itself. Needs `manage`.
444
+ */
445
+ setRelays(spaceId: string, relays: ReadonlyArray<string>): Promise<void>;
446
+ /**
447
+ * Names the nodes that keep the space whole — a host, an extension — at
448
+ * most 16, and optionally how many of them a write should reach before a
449
+ * node holding only part of the space lets go of it. Nodes that hold part
450
+ * of a space only do so once it names a keeper. Needs `manage`.
451
+ */
452
+ setKeepers(spaceId: string, keepers: ReadonlyArray<Keeper>, copies?: number | null): Promise<void>;
349
453
  /**
350
454
  * Revokes a note this account signed — an app's, say. Nothing written under
351
455
  * it counts from then on, except what this node had already seen.
@@ -499,6 +603,88 @@ export interface NodeCarriers {
499
603
  */
500
604
  remove(space: string): Promise<void>;
501
605
  }
606
+ /** A subscription, as the person made it (`space/notify.ts`) */
607
+ export interface NotifyView extends NotifyWhen {
608
+ readonly id: string;
609
+ }
610
+ /**
611
+ * "Let me know when…": new records in a collection, in some of the account's
612
+ * spaces or all of them, perhaps only those with a topic value, perhaps only
613
+ * other people's. The account's carriers — its extension — notice them and
614
+ * say so, without reading anything: they get each subscription with its value
615
+ * replaced by a topic tag. Needs the account key.
616
+ */
617
+ export interface NodeNotifications {
618
+ list(): Promise<ReadonlyArray<NotifyView>>;
619
+ /**
620
+ * Starts one. `topic` matches exact values of a topic field the collection
621
+ * names (`topics`): `{ field: 'mentions', value: myDid }`.
622
+ */
623
+ add(when: Omit<NotifyWhen, 'since'> & {
624
+ readonly since?: string;
625
+ }): Promise<NotifyView>;
626
+ /** Changes its label, pauses or resumes it */
627
+ update(id: string, changes: {
628
+ readonly label?: string;
629
+ readonly paused?: boolean;
630
+ }): Promise<NotifyView>;
631
+ remove(id: string): Promise<void>;
632
+ }
633
+ /** A host the account uses, and what it says now */
634
+ export interface HostingView {
635
+ /** The host's address */
636
+ readonly url: string;
637
+ /** The host's own key, as it appears to peers */
638
+ readonly host: string;
639
+ /** Its name, as it describes itself; its address's host name when it doesn't */
640
+ readonly name: string;
641
+ /** The subscription — the key the account made for this host */
642
+ readonly subscription: string;
643
+ readonly since: string;
644
+ /**
645
+ * How the subscription stands, as the host signed it: just now when `live`,
646
+ * otherwise the last it said (kept in the account registry). Null when it
647
+ * never said.
648
+ */
649
+ readonly status: import('../session/hosting.js').HostStatus | null;
650
+ /** Whether `status` is what the host said just now */
651
+ readonly live: boolean;
652
+ /** Why it could not be reached */
653
+ readonly error?: string;
654
+ /** Its price, for people, as it puts it */
655
+ readonly price?: string;
656
+ /** Whether it takes payments, on its own page (`payPage`) */
657
+ readonly pays: boolean;
658
+ }
659
+ /**
660
+ * Hosts: nodes that never sleep, keeping the account's spaces online and
661
+ * backed up when every device is off — without being able to read them. A
662
+ * host is a carrier (`carriers`) the account pays for; every device of the
663
+ * account hands it the spaces, with nothing to set up.
664
+ *
665
+ * Nothing here knows how a host is paid (docs/spec/06-nodes-and-sessions.md, Hosts): a host takes payments on
666
+ * its own page, which `payPage` links to, and says how the subscription stands
667
+ * in a status it signs.
668
+ */
669
+ export interface NodeHosting {
670
+ /** The hosts the account uses, each asked how it stands. Hands a host the spaces if it was paid since. */
671
+ list(): Promise<ReadonlyArray<HostingView>>;
672
+ /**
673
+ * Starts using a host: makes a subscription key, keeps it in the account
674
+ * registry so every device signs as it, and — once it is paid, or at once
675
+ * for a free host — hands the host the account's spaces.
676
+ */
677
+ use(url: string): Promise<HostingView>;
678
+ /**
679
+ * A link to the host's own pay page, signed with the subscription key: it
680
+ * lets whoever opens it pay for this subscription, at that host, for an
681
+ * hour. Open it in a new tab (`noopener`), and call `list` when the person
682
+ * comes back.
683
+ */
684
+ payPage(url: string): Promise<string>;
685
+ /** Stops using a host: it forgets the spaces, and the subscription is let go. A card that renews is cancelled on the host's pay page. */
686
+ stop(url: string): Promise<void>;
687
+ }
502
688
  export interface NodeAccount {
503
689
  /** The account's profile as its devices last set it. Null without an account key, or before any is set. */
504
690
  profile(): Promise<AccountProfileView | null>;
@@ -510,6 +696,184 @@ export interface NodeAccount {
510
696
  */
511
697
  revoke(token: string): Promise<void>;
512
698
  }
699
+ /** Someone in the account's contact list */
700
+ export interface ContactView {
701
+ /** Their account */
702
+ readonly did: string;
703
+ /** What you call them — yours to change; they never see it */
704
+ readonly name: string;
705
+ /** The id of your space for two, where records wait and live messages reach them. Null when there is none. */
706
+ readonly space: string | null;
707
+ readonly note?: string;
708
+ /** Their contact requests are hidden, in every space */
709
+ readonly blocked: boolean;
710
+ readonly updatedAt: string;
711
+ }
712
+ /** A contact request sent to this account, opened */
713
+ export interface ContactRequest {
714
+ /** The space it was posted in */
715
+ readonly space: string;
716
+ /** Its record there — what `accept` takes */
717
+ readonly key: string;
718
+ /** The account asking */
719
+ readonly from: string;
720
+ /** The name they go by in that space, when they gave one */
721
+ readonly name: string | null;
722
+ readonly note?: string;
723
+ /** The space for two it invites you to */
724
+ readonly pairSpace: string;
725
+ readonly createdAt: string;
726
+ }
727
+ /**
728
+ * The account's contacts. Each is a private space for two, recorded as a
729
+ * `std.contact` in the account's contacts space — a space derived from the
730
+ * account key, so every device of the account has the same list and nobody
731
+ * else can find it. There is no directory and no inbox: knowing someone's DID
732
+ * reaches nothing. You add someone by asking inside a space you share
733
+ * (`ask`), or by giving them an invite to a space for two some other way, and
734
+ * `put`ting them.
735
+ */
736
+ export interface NodeContacts {
737
+ /** The contacts space's id — null for a node not given it */
738
+ space(): Promise<string | null>;
739
+ /** Everyone in the list, blocked people too, by name */
740
+ list(): Promise<ReadonlyArray<ContactView>>;
741
+ get(did: string): Promise<ContactView | null>;
742
+ /** Adds someone, or changes what the list says about them */
743
+ put(contact: {
744
+ readonly did: string;
745
+ readonly name: string;
746
+ readonly space?: string | null;
747
+ readonly note?: string;
748
+ }): Promise<ContactView>;
749
+ /** Takes them off the list and leaves your space for two. Nobody else's space is touched. */
750
+ remove(did: string): Promise<void>;
751
+ /** Leaves your space for two, and hides their contact requests from now on */
752
+ block(did: string): Promise<void>;
753
+ /**
754
+ * Asks someone in a space you share to add you: makes a private space for
755
+ * the two of you, puts them on your list with it, and posts the space's
756
+ * invite in `spaceId` sealed with their contact key — the other members see
757
+ * that you asked, not what. Needs their profile there to carry a contact key.
758
+ * @returns The space for two, and the request's record key (delete it to take the request back)
759
+ */
760
+ ask(spaceId: string, did: string, options?: {
761
+ readonly note?: string;
762
+ }): Promise<{
763
+ readonly space: string;
764
+ readonly request: string;
765
+ }>;
766
+ /** Contact requests sent to this account in a space, opened — not from people blocked, and not ones already accepted */
767
+ requests(spaceId: string): Promise<ReadonlyArray<ContactRequest>>;
768
+ /** Joins the space for two a request invites you to, and puts whoever asked on your list */
769
+ accept(spaceId: string, requestKey: string): Promise<ContactView>;
770
+ /**
771
+ * Accounts in your space with someone other than the two of you — someone
772
+ * the invite was passed on to. Opens that space. Empty when there is none.
773
+ */
774
+ others(did: string): Promise<ReadonlyArray<string>>;
775
+ }
776
+ /** A door of this account's, as `node.doors` shows it */
777
+ export interface DoorView {
778
+ readonly id: string;
779
+ /** What you call it — only you see it */
780
+ readonly label?: string;
781
+ /** The name its code gives whoever knocks */
782
+ readonly name?: string;
783
+ /** The door key's public half: knocks are sealed to it */
784
+ readonly key: string;
785
+ /** The door's signing key's public half: its hash is the door's mailbox topic */
786
+ readonly sign: string;
787
+ readonly relays: ReadonlyArray<string>;
788
+ /** The door code to hand out: put it in a link (`#door=…`) or a QR code */
789
+ readonly code: string;
790
+ readonly createdAt: string;
791
+ }
792
+ /** Someone knocking on one of your doors, checked and opened */
793
+ export interface KnockView {
794
+ /** The knock's id, the same on every relay: what `accept` takes */
795
+ readonly id: string;
796
+ /** Which of your doors */
797
+ readonly door: string;
798
+ /** Their account — proven by their signature and note, not by what they say */
799
+ readonly from: string;
800
+ /** The name they give; nothing vouches for it */
801
+ readonly name: string;
802
+ readonly note?: string;
803
+ /** The space for two it invites you to */
804
+ readonly pairSpace: string;
805
+ /** When they knocked, ISO */
806
+ readonly at: string;
807
+ }
808
+ /** A knock you left, waiting for them to open it */
809
+ export interface SentKnockView {
810
+ /** The space for two you made */
811
+ readonly space: string;
812
+ /** The name their door code gave */
813
+ readonly name: string;
814
+ readonly at: string;
815
+ }
816
+ /**
817
+ * Doors: a way for people you share no space with to ask to become your
818
+ * contact, without your DID becoming an address. A door is a key derived from
819
+ * your contact key, and the relays whose mailboxes hold knocks on it; its code
820
+ * says both and nothing about who you are. Someone with the code knocks: a
821
+ * private space for the two of you, its invite sealed to the door and left in
822
+ * those mailboxes. Accepting joins it. Close a door and its code stops
823
+ * working; your contacts stay. See `docs/spec/07-doors.md`.
824
+ */
825
+ export interface NodeDoors {
826
+ /** Your open doors */
827
+ list(): Promise<ReadonlyArray<DoorView>>;
828
+ /**
829
+ * Opens a new door.
830
+ * @param options.relays Whose mailboxes hold its knocks, 1–3. Default: the first of this node's relays.
831
+ * @param options.name The name its code gives. Default: the account's name.
832
+ * @param options.label What you call it, for telling doors apart
833
+ */
834
+ open(options?: {
835
+ readonly relays?: ReadonlyArray<string>;
836
+ readonly name?: string;
837
+ readonly label?: string;
838
+ }): Promise<DoorView>;
839
+ /** Closes a door: its knocks are no longer read, and its code leads nowhere */
840
+ close(id: string): Promise<void>;
841
+ /**
842
+ * Clears every knock waiting at a door, from every relay it names, as its
843
+ * owner — for a door someone flooded, without closing it and breaking
844
+ * every place its code was shared.
845
+ */
846
+ clear(id: string): Promise<void>;
847
+ /**
848
+ * Knocks on someone's door: makes a private space for the two of you and
849
+ * leaves its invite, sealed and signed, in their door's mailboxes. They
850
+ * become a contact once they answer there, signed with the door's key; a
851
+ * knock nobody answers is let go after two weeks, space and all.
852
+ * @param code A door code, or a link carrying one
853
+ * @returns The space for two
854
+ */
855
+ knock(code: string, options?: {
856
+ readonly note?: string;
857
+ }): Promise<{
858
+ readonly space: string;
859
+ }>;
860
+ /**
861
+ * Knocks waiting at your doors, from every relay they name — checked, not
862
+ * from people you blocked, and not ones already accepted. Also turns knocks
863
+ * of yours that were answered into contacts.
864
+ */
865
+ knocks(): Promise<ReadonlyArray<KnockView>>;
866
+ /** Knocks you left that nobody has answered yet */
867
+ sent(): Promise<ReadonlyArray<SentKnockView>>;
868
+ /**
869
+ * Joins the space for two a knock invites you to, and puts whoever knocked
870
+ * on your list. Your answer — signed with the door's signing key — is written
871
+ * there once your membership lands, and that is what makes you their contact.
872
+ */
873
+ accept(id: string): Promise<ContactView>;
874
+ /** Lets a knock go without blocking whoever knocked: cleared from the door's relays, on every device */
875
+ dismiss(id: string): Promise<void>;
876
+ }
513
877
  export interface P2PNode {
514
878
  /** The identity this node acts for */
515
879
  readonly did: string;
@@ -522,6 +886,14 @@ export interface P2PNode {
522
886
  readonly account: NodeAccount;
523
887
  /** Nodes that keep the account's spaces online without reading them */
524
888
  readonly carriers: NodeCarriers;
889
+ /** Hosts the account pays to keep its spaces online */
890
+ readonly hosting: NodeHosting;
891
+ /** "Let me know when…" — noticed by the account's carriers, which can't read what they notice */
892
+ readonly notifications: NodeNotifications;
893
+ /** People: the account's contact list, and asking to be added */
894
+ readonly contacts: NodeContacts;
895
+ /** Doors: how people you share no space with can ask to become your contact */
896
+ readonly doors: NodeDoors;
525
897
  /** The delegation the session key currently writes under (root → session) */
526
898
  delegation(): UCANToken;
527
899
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/node/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACzH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE3E,MAAM,WAAW,iBAAiB;IAChC,yFAAyF;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doesn't match the space key's ID.
46
46
  */
47
47
  export declare function decryptExpression(encrypted: EncryptedExpression, spaceKey: SpaceKey): Promise<Expression>;
48
+ /**
49
+ * A space key from its raw bytes. Its id is the hash of the bytes, so a key
50
+ * handed over — in an invite, a box — can be checked against the id a space
51
+ * or its history names.
52
+ */
53
+ export declare function spaceKeyFromRaw(raw: Uint8Array, createdAt?: string): Promise<SpaceKey>;
54
+ /** A space key's raw bytes */
55
+ export declare function spaceKeyBytes(key: SpaceKey): Promise<Uint8Array>;
56
+ /**
57
+ * Seals a value with a space key, bound to `context`: only someone holding
58
+ * the key opens it, and only where the context matches.
59
+ * @returns base64url: the IV, then the ciphertext
60
+ */
61
+ export declare function sealWith(spaceKey: SpaceKey, value: unknown, context: string): Promise<string>;
62
+ /** Opens what `sealWith` sealed; null when it wasn't sealed with this key, for this context, or was changed */
63
+ export declare function openWith(spaceKey: SpaceKey, sealed: unknown, context: string): Promise<unknown>;
48
64
  //# sourceMappingURL=space-encryption.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"space-encryption.d.ts","sourceRoot":"","sources":["../../src/privacy/space-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,UAAU,EAAE,MAA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AAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoBhH;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAoB/G;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,SAA2B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAO9G;AAED,8BAA8B;AAC9B,wBAAsB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQnG;AAED,+GAA+G;AAC/G,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAarG"}
@@ -58,4 +58,44 @@ export async function decryptExpression(encrypted, spaceKey) {
58
58
  body
59
59
  });
60
60
  }
61
+ /**
62
+ * A space key from its raw bytes. Its id is the hash of the bytes, so a key
63
+ * handed over — in an invite, a box — can be checked against the id a space
64
+ * or its history names.
65
+ */
66
+ export async function spaceKeyFromRaw(raw, createdAt = new Date().toISOString()) {
67
+ const key = await globalThis.crypto.subtle.importKey('raw', raw, { name: 'AES-GCM', length: 256 }, true, [
68
+ 'encrypt',
69
+ 'decrypt',
70
+ ]);
71
+ const id = base64UrlEncode(new Uint8Array(await sha256(raw)));
72
+ return Object.freeze({ id, key, createdAt, version: 1 });
73
+ }
74
+ /** A space key's raw bytes */
75
+ export async function spaceKeyBytes(key) {
76
+ return new Uint8Array(await globalThis.crypto.subtle.exportKey('raw', key.key));
77
+ }
78
+ /**
79
+ * Seals a value with a space key, bound to `context`: only someone holding
80
+ * the key opens it, and only where the context matches.
81
+ * @returns base64url: the IV, then the ciphertext
82
+ */
83
+ export async function sealWith(spaceKey, value, context) {
84
+ const iv = globalThis.crypto.getRandomValues(new Uint8Array(12));
85
+ const ciphertext = await globalThis.crypto.subtle.encrypt({ name: 'AES-GCM', iv, additionalData: utf8Encode(context) }, spaceKey.key, utf8Encode(JSON.stringify(value)));
86
+ return base64UrlEncode(new Uint8Array([...iv, ...new Uint8Array(ciphertext)]));
87
+ }
88
+ /** Opens what `sealWith` sealed; null when it wasn't sealed with this key, for this context, or was changed */
89
+ export async function openWith(spaceKey, sealed, context) {
90
+ if (typeof sealed !== 'string' || sealed.length > 1_000_000)
91
+ return null;
92
+ try {
93
+ const bytes = base64UrlDecode(sealed);
94
+ const plain = await globalThis.crypto.subtle.decrypt({ name: 'AES-GCM', iv: bytes.subarray(0, 12), additionalData: utf8Encode(context) }, spaceKey.key, bytes.subarray(12));
95
+ return JSON.parse(utf8Decode(new Uint8Array(plain)));
96
+ }
97
+ catch {
98
+ return null;
99
+ }
100
+ }
61
101
  //# sourceMappingURL=space-encryption.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"space-encryption.js","sourceRoot":"","sources":["../../src/privacy/space-encryption.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA4B1C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CACpD,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,EAChC,IAAI,EACJ,CAAC,SAAS,EAAE,SAAS,CAAC,CACvB,CAAC;IACF,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,M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