@minca/core 0.1.10 → 0.1.12

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 (229) hide show
  1. package/README.md +1 -1
  2. package/dist/identity/abilities.js +1 -1
  3. package/dist/identity/channel.d.ts +1 -1
  4. package/dist/identity/channel.d.ts.map +1 -1
  5. package/dist/identity/channel.js +1 -1
  6. package/dist/identity/channel.js.map +1 -1
  7. package/dist/identity/contact-key.d.ts +15 -15
  8. package/dist/identity/contact-key.d.ts.map +1 -1
  9. package/dist/identity/contact-key.js +21 -28
  10. package/dist/identity/contact-key.js.map +1 -1
  11. package/dist/inbox/inbox.d.ts +132 -0
  12. package/dist/inbox/inbox.d.ts.map +1 -0
  13. package/dist/inbox/inbox.js +197 -0
  14. package/dist/inbox/inbox.js.map +1 -0
  15. package/dist/inbox/index.d.ts +9 -0
  16. package/dist/inbox/index.d.ts.map +1 -0
  17. package/dist/inbox/index.js +7 -0
  18. package/dist/inbox/index.js.map +1 -0
  19. package/dist/index.d.ts +8 -6
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +3 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/network/introductions.d.ts +1 -1
  24. package/dist/network/introductions.d.ts.map +1 -1
  25. package/dist/network/mesh.d.ts +4 -2
  26. package/dist/network/mesh.d.ts.map +1 -1
  27. package/dist/network/mesh.js +31 -45
  28. package/dist/network/mesh.js.map +1 -1
  29. package/dist/network/peer-auth.d.ts +4 -0
  30. package/dist/network/peer-auth.d.ts.map +1 -1
  31. package/dist/network/peer-auth.js +9 -7
  32. package/dist/network/peer-auth.js.map +1 -1
  33. package/dist/network/relay-minca.d.ts +6 -0
  34. package/dist/network/relay-minca.d.ts.map +1 -0
  35. package/dist/network/relay-minca.js +146 -0
  36. package/dist/network/relay-minca.js.map +1 -0
  37. package/dist/network/relay-nostr.d.ts +10 -0
  38. package/dist/network/relay-nostr.d.ts.map +1 -0
  39. package/dist/network/relay-nostr.js +247 -0
  40. package/dist/network/relay-nostr.js.map +1 -0
  41. package/dist/network/relay-socket.d.ts +87 -0
  42. package/dist/network/relay-socket.d.ts.map +1 -0
  43. package/dist/network/{signaling.js → relay-socket.js} +201 -167
  44. package/dist/network/relay-socket.js.map +1 -0
  45. package/dist/network/relays.d.ts +87 -0
  46. package/dist/network/relays.d.ts.map +1 -0
  47. package/dist/network/relays.js +43 -0
  48. package/dist/network/relays.js.map +1 -0
  49. package/dist/network/remote-transport.d.ts +1 -1
  50. package/dist/network/remote-transport.d.ts.map +1 -1
  51. package/dist/network/remote-transport.js +6 -31
  52. package/dist/network/remote-transport.js.map +1 -1
  53. package/dist/network/rendezvous.d.ts +59 -0
  54. package/dist/network/rendezvous.d.ts.map +1 -0
  55. package/dist/network/rendezvous.js +380 -0
  56. package/dist/network/rendezvous.js.map +1 -0
  57. package/dist/network/rtc-transport.d.ts.map +1 -1
  58. package/dist/network/rtc-transport.js +32 -17
  59. package/dist/network/rtc-transport.js.map +1 -1
  60. package/dist/network/transport.d.ts +7 -5
  61. package/dist/network/transport.d.ts.map +1 -1
  62. package/dist/node/actions.d.ts.map +1 -1
  63. package/dist/node/actions.js +28 -18
  64. package/dist/node/actions.js.map +1 -1
  65. package/dist/node/api.d.ts +11 -10
  66. package/dist/node/api.d.ts.map +1 -1
  67. package/dist/node/api.js +11 -10
  68. package/dist/node/api.js.map +1 -1
  69. package/dist/node/carrier.d.ts +11 -5
  70. package/dist/node/carrier.d.ts.map +1 -1
  71. package/dist/node/carrier.js +43 -2
  72. package/dist/node/carrier.js.map +1 -1
  73. package/dist/node/copy.d.ts +1 -1
  74. package/dist/node/copy.d.ts.map +1 -1
  75. package/dist/node/copy.js +10 -4
  76. package/dist/node/copy.js.map +1 -1
  77. package/dist/node/host.d.ts +2 -0
  78. package/dist/node/host.d.ts.map +1 -1
  79. package/dist/node/host.js +2 -0
  80. package/dist/node/host.js.map +1 -1
  81. package/dist/node/index.d.ts +1 -1
  82. package/dist/node/index.d.ts.map +1 -1
  83. package/dist/node/node.d.ts.map +1 -1
  84. package/dist/node/node.js +490 -298
  85. package/dist/node/node.js.map +1 -1
  86. package/dist/node/remote.d.ts.map +1 -1
  87. package/dist/node/remote.js +0 -2
  88. package/dist/node/remote.js.map +1 -1
  89. package/dist/node/space-runtime.d.ts +6 -2
  90. package/dist/node/space-runtime.d.ts.map +1 -1
  91. package/dist/node/space-runtime.js +5 -8
  92. package/dist/node/space-runtime.js.map +1 -1
  93. package/dist/node/types.d.ts +75 -46
  94. package/dist/node/types.d.ts.map +1 -1
  95. package/dist/react/use-invite-link.d.ts +1 -1
  96. package/dist/react/use-invite-link.d.ts.map +1 -1
  97. package/dist/react/use-invite-link.js +18 -11
  98. package/dist/react/use-invite-link.js.map +1 -1
  99. package/dist/records/loose.d.ts +52 -0
  100. package/dist/records/loose.d.ts.map +1 -0
  101. package/dist/records/loose.js +86 -0
  102. package/dist/records/loose.js.map +1 -0
  103. package/dist/schema/version.d.ts +2 -0
  104. package/dist/schema/version.d.ts.map +1 -1
  105. package/dist/schema/version.js +2 -1
  106. package/dist/schema/version.js.map +1 -1
  107. package/dist/schemas/choosing.d.ts +19 -0
  108. package/dist/schemas/choosing.d.ts.map +1 -0
  109. package/dist/schemas/choosing.js +69 -0
  110. package/dist/schemas/choosing.js.map +1 -0
  111. package/dist/schemas/contacts.d.ts +34 -87
  112. package/dist/schemas/contacts.d.ts.map +1 -1
  113. package/dist/schemas/contacts.js +32 -76
  114. package/dist/schemas/contacts.js.map +1 -1
  115. package/dist/schemas/index.d.ts +2 -2
  116. package/dist/schemas/index.d.ts.map +1 -1
  117. package/dist/schemas/index.js +1 -1
  118. package/dist/schemas/index.js.map +1 -1
  119. package/dist/schemas/library/annotations.d.ts +17 -285
  120. package/dist/schemas/library/annotations.d.ts.map +1 -1
  121. package/dist/schemas/library/annotations.js +9 -65
  122. package/dist/schemas/library/annotations.js.map +1 -1
  123. package/dist/schemas/library/community.d.ts +9 -17
  124. package/dist/schemas/library/community.d.ts.map +1 -1
  125. package/dist/schemas/library/community.js +5 -5
  126. package/dist/schemas/library/community.js.map +1 -1
  127. package/dist/schemas/library/life.d.ts +3 -3
  128. package/dist/schemas/library/life.d.ts.map +1 -1
  129. package/dist/schemas/library/life.js +2 -2
  130. package/dist/schemas/library/life.js.map +1 -1
  131. package/dist/schemas/library/media.d.ts +148 -541
  132. package/dist/schemas/library/media.d.ts.map +1 -1
  133. package/dist/schemas/library/media.js +28 -64
  134. package/dist/schemas/library/media.js.map +1 -1
  135. package/dist/schemas/library/money.d.ts +8 -8
  136. package/dist/schemas/library/money.d.ts.map +1 -1
  137. package/dist/schemas/library/money.js +4 -4
  138. package/dist/schemas/library/money.js.map +1 -1
  139. package/dist/schemas/library/planning.d.ts +23 -87
  140. package/dist/schemas/library/planning.d.ts.map +1 -1
  141. package/dist/schemas/library/planning.js +10 -26
  142. package/dist/schemas/library/planning.js.map +1 -1
  143. package/dist/schemas/library/publishing.d.ts +14 -14
  144. package/dist/schemas/library/publishing.d.ts.map +1 -1
  145. package/dist/schemas/library/publishing.js +7 -7
  146. package/dist/schemas/library/publishing.js.map +1 -1
  147. package/dist/schemas/library/social.d.ts +2 -2
  148. package/dist/schemas/library/social.d.ts.map +1 -1
  149. package/dist/schemas/library/social.js +1 -1
  150. package/dist/schemas/library/social.js.map +1 -1
  151. package/dist/schemas/standard.d.ts +1 -1
  152. package/dist/schemas/standard.d.ts.map +1 -1
  153. package/dist/schemas/standard.js +3 -3
  154. package/dist/schemas/standard.js.map +1 -1
  155. package/dist/session/auth.d.ts +5 -6
  156. package/dist/session/auth.d.ts.map +1 -1
  157. package/dist/session/auth.js +5 -6
  158. package/dist/session/auth.js.map +1 -1
  159. package/dist/session/channel-room.d.ts.map +1 -1
  160. package/dist/session/channel-room.js +3 -2
  161. package/dist/session/channel-room.js.map +1 -1
  162. package/dist/session/connect-code.d.ts +69 -55
  163. package/dist/session/connect-code.d.ts.map +1 -1
  164. package/dist/session/connect-code.js +189 -89
  165. package/dist/session/connect-code.js.map +1 -1
  166. package/dist/session/connect.d.ts +11 -15
  167. package/dist/session/connect.d.ts.map +1 -1
  168. package/dist/session/connect.js +8 -21
  169. package/dist/session/connect.js.map +1 -1
  170. package/dist/session/index.d.ts +2 -2
  171. package/dist/session/index.d.ts.map +1 -1
  172. package/dist/session/index.js +1 -1
  173. package/dist/session/index.js.map +1 -1
  174. package/dist/space/account-registry.d.ts +22 -0
  175. package/dist/space/account-registry.d.ts.map +1 -1
  176. package/dist/space/account-registry.js +18 -0
  177. package/dist/space/account-registry.js.map +1 -1
  178. package/dist/space/invitation.d.ts +61 -0
  179. package/dist/space/invitation.d.ts.map +1 -0
  180. package/dist/space/invitation.js +84 -0
  181. package/dist/space/invitation.js.map +1 -0
  182. package/dist/space/invite-link.d.ts +64 -0
  183. package/dist/space/invite-link.d.ts.map +1 -0
  184. package/dist/space/invite-link.js +212 -0
  185. package/dist/space/invite-link.js.map +1 -0
  186. package/dist/space/roles.d.ts.map +1 -1
  187. package/dist/space/roles.js +4 -2
  188. package/dist/space/roles.js.map +1 -1
  189. package/dist/space/space-manager.d.ts +21 -6
  190. package/dist/space/space-manager.d.ts.map +1 -1
  191. package/dist/space/space-manager.js +40 -23
  192. package/dist/space/space-manager.js.map +1 -1
  193. package/dist/types.d.ts +2 -0
  194. package/dist/types.d.ts.map +1 -1
  195. package/dist/types.js.map +1 -1
  196. package/docs/README.md +2 -2
  197. package/docs/actions.md +37 -37
  198. package/docs/agents.md +59 -37
  199. package/docs/automations.md +2 -2
  200. package/docs/blueprints-and-guides.md +44 -3
  201. package/docs/building-an-app.md +2 -2
  202. package/docs/contacts.md +48 -69
  203. package/docs/inbox.md +145 -0
  204. package/docs/node.md +68 -45
  205. package/docs/query-format.md +1 -1
  206. package/docs/sign-in.md +5 -7
  207. package/docs/spaces.md +33 -5
  208. package/docs/standard-library.md +111 -86
  209. package/package.json +6 -5
  210. package/dist/doors/doors.d.ts +0 -140
  211. package/dist/doors/doors.d.ts.map +0 -1
  212. package/dist/doors/doors.js +0 -226
  213. package/dist/doors/doors.js.map +0 -1
  214. package/dist/doors/index.d.ts +0 -9
  215. package/dist/doors/index.d.ts.map +0 -1
  216. package/dist/doors/index.js +0 -7
  217. package/dist/doors/index.js.map +0 -1
  218. package/dist/network/mailbox.d.ts +0 -45
  219. package/dist/network/mailbox.d.ts.map +0 -1
  220. package/dist/network/mailbox.js +0 -135
  221. package/dist/network/mailbox.js.map +0 -1
  222. package/dist/network/multi-signaling.d.ts +0 -41
  223. package/dist/network/multi-signaling.d.ts.map +0 -1
  224. package/dist/network/multi-signaling.js +0 -209
  225. package/dist/network/multi-signaling.js.map +0 -1
  226. package/dist/network/signaling.d.ts +0 -95
  227. package/dist/network/signaling.d.ts.map +0 -1
  228. package/dist/network/signaling.js.map +0 -1
  229. package/docs/doors.md +0 -151
@@ -38,6 +38,39 @@ hold rather than by name is [compatible definitions](blueprints-and-guides.md#co
38
38
 
39
39
  _Source: `packages/core/src/schemas/blueprints.ts` (`standardCollections`), `packages/core/src/schemas/standard.ts` (`standardDefinition`, `standardGroups`), `packages/core/src/node/actions.ts` (`collections_standard`, `collections_propose`). Tests: `packages/core/tests/records-only.test.ts` ("a standard collection by name is exactly the library’s; a look-alike std.\* is refused", "collections_standard lists the library by area, and gives definitions in full")._
40
40
 
41
+ ## How the library is shaped
42
+
43
+ People start with a few apps, then change them, add views, and build new
44
+ apps over the same records, often by asking an agent. That only works if
45
+ every app reaches for the same collection for the same thing. These rules
46
+ keep the library small enough to choose from, and each choice obvious:
47
+
48
+ 1. **One collection per kind of thing.** Variants are optional fields, not
49
+ collections of their own: a photo, a video and a PDF are each a
50
+ `std.file`, with `width`, `duration` or none. Two collections an agent
51
+ could reasonably pick for the same thing is a bug in the library.
52
+ 2. **A group is a relation, never a field on what is in it.** There are two
53
+ ways to group, and only two: `std.tag` for loose labels, any number on a
54
+ record, and `std.list` with a `std.list-item` per member for a named,
55
+ ordered group that exists while empty: a folder, an album, a playlist, a
56
+ category, an itinerary (`kind`). Because the group is a record of its
57
+ own, one file can be in a chat, a category and an album, and each app
58
+ arranges it without touching the file. A single facet that nearly every
59
+ app filters by, like an event's or a transaction's `category`, may stay a
60
+ field.
61
+ 3. **What an app adds to a standard record is a record of its own about
62
+ it.** A definition here is exact (`collections_propose` refuses a
63
+ look-alike), so an app that needs more on a `std.file`, say, defines
64
+ `recipes.photo-note` with an `about` link to the file and
65
+ `onePer: [link:about]`. Every other app still reads the file; only the
66
+ recipes app reads the note. Never a parallel `recipes.photo` collection.
67
+ 4. **Links use one vocabulary**, below. A link that says where a record
68
+ sits is `in`, whether that is a channel, a board column or a list.
69
+ 5. **A description says when not to use it.** Agents choose by reading
70
+ descriptions, so where a neighbour could be mistaken for it, the
71
+ description names the neighbour: "To vote on a std.proposal, use
72
+ std.ballot."
73
+
41
74
  ## Conventions
42
75
 
43
76
  - What several people edit is several records, not an array in one body,
@@ -92,20 +125,17 @@ anything, and only moderators and admins write in the collections in
92
125
 
93
126
  **Annotations**
94
127
 
95
- | Name | Body | Links | Rules |
96
- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | -------------------------------------- |
97
- | `std.reaction` | **`emoji`** string 1–16; `respondingTo` DID; topic `respondingTo` | `about` → `*`, one | `onePer: [@author, link:about, emoji]` |
98
- | `std.comment` | **`text`** string 1–10000; `mentions` DID[] (≤ 64); `replyingTo` DID; `respondingTo` DID; topics `mentions`, `replyingTo`, `respondingTo` | `about` → `*`, one; `replyTo` → `std.comment`, one | — |
99
- | `std.tag` | **`label`** string 1–100 | `about` → `*`, many | — |
100
- | `std.attachment` | **`name`** string ≥ 1; **`mime`** string ≥ 1; `size` integer ≥ 0; `url` string; `blob` blob | `about` → `*`, one | — |
101
- | `std.reference` | `note` string | `about` → `*`, one; `to` → `*`, one | — |
102
- | `std.bookmark` | `title` string ≤ 500; `url` string 1–2048; `note` string ≤ 2000 | `about` → `*`, one | — |
103
- | `std.rating` | **`score`** integer 1–5; `review` string ≤ 10000 | `about` → `*`, one | `onePer: [@author, link:about]` |
104
- | `std.highlight` | **`quote`** string 1–10000; `prefix` string ≤ 500; `suffix` string ≤ 500; `note` string ≤ 10000 | `about` → `*`, one | — |
105
- | `std.pin` | `note` string ≤ 500 | `about` → `*`, one | `onePer: [link:about]` |
106
- | `std.report` | **`reason`** `spam`/`abuse`/`sexual`/`misleading`/`illegal`/`other`; `note` string ≤ 2000 | `about` → `*`, one | `onePer: [@author, link:about]` |
107
- | `std.label` | **`value`** string 1–64 | `about` → `*`, one | `onePer: [link:about, value]` |
108
- | `std.claim` | `note` string ≤ 500; `respondingTo` DID; topic `respondingTo` | `about` → `*`, one | `onePer: [link:about]` |
128
+ | Name | Body | Links | Rules |
129
+ | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | -------------------------------------- |
130
+ | `std.reaction` | **`emoji`** string 1–16; `respondingTo` DID; topic `respondingTo` | `about` → `*`, one | `onePer: [@author, link:about, emoji]` |
131
+ | `std.comment` | **`text`** string 1–10000; `mentions` DID[] (≤ 64); `replyingTo` DID; `respondingTo` DID; topics `mentions`, `replyingTo`, `respondingTo` | `about` → `*`, one; `replyTo` → `std.comment`, one | — |
132
+ | `std.tag` | **`label`** string 1–100 | `about` → `*`, one | `onePer: [@author, link:about, label]` |
133
+ | `std.rating` | **`score`** integer 1–5; `review` string ≤ 10000 | `about` → `*`, one | `onePer: [@author, link:about]` |
134
+ | `std.highlight` | **`quote`** string 1–10000; `prefix` string ≤ 500; `suffix` string ≤ 500; `note` string ≤ 10000 | `about` → `*`, one | — |
135
+ | `std.pin` | `note` string ≤ 500 | `about` → `*`, one | `onePer: [link:about]` |
136
+ | `std.report` | **`reason`** `spam`/`abuse`/`sexual`/`misleading`/`illegal`/`other`; `note` string ≤ 2000 | `about` → `*`, one | `onePer: [@author, link:about]` |
137
+ | `std.label` | **`value`** string 1–64 | `about` → `*`, one | `onePer: [link:about, value]` |
138
+ | `std.claim` | `note` string ≤ 500; `respondingTo` DID; topic `respondingTo` | `about` → `*`, one | `onePer: [link:about]` |
109
139
 
110
140
  **People**
111
141
 
@@ -120,20 +150,20 @@ anything, and only moderators and admins write in the collections in
120
150
 
121
151
  **Messaging and publishing**
122
152
 
123
- | Name | Body | Links | Rules |
124
- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- | ------------------------------- |
125
- | `std.message` | **`text`** string 1–10000; `mentions` DID[] (≤ 64); `replyingTo` DID; topics `link:channel`, `mentions`, `replyingTo` | `channel` → `std.channel`, one; `replyTo` → `std.message`, one; `shares` → `*`, one | — |
126
- | `std.channel` | **`name`** string 1–100; `topic` string ≤ 500; `position` string 1–200 | — | — |
127
- | `std.direct` | **`to`** DID[] (1–16); **`data`** string ≤ 60000; **`boxes`** `{to, sealed}`[] (≤ 17); topic `to` | — | — |
128
- | `std.post` | `text` string ≤ 10000; `images` image[] (≤ 8); `langs` string 2–35[] (≤ 3); `mentions` DID[] (≤ 64); `replyingTo` DID; topics `mentions`, `replyingTo` | `replyTo` → `std.post`, one; `root` → `std.post`, one; `shares` → `*`, one | — |
129
- | `std.repost` | `respondingTo` DID; topic `respondingTo` | `about` → `*`, one | `onePer: [@author, link:about]` |
130
- | `std.article` | **`title`** string 1–300; `summary` string ≤ 1000; `content` string ≤ 200000; `cover` blob; `slug` string 1–200; `publishedAt` when; `draft` boolean; `mentions` DID[] (≤ 64); topic `mentions` | `in` → `std.publication`, one | — |
131
- | `std.publication` | **`title`** string 1–200; `description` string ≤ 2000; `icon` blob | — | — |
132
- | `std.doc` | **`title`** string 1–500 | — | — |
133
- | `std.doc-block` | **`type`** `paragraph`/`heading1`/`heading2`/`heading3`/`bullet`/`numbered`/`todo`/`quote`/`code`/`image`/`divider`; `text` string ≤ 20000; `checked` boolean; `language` string ≤ 32; `image` image; `position` string 1–200; `mentions` DID[] (≤ 64); topic `mentions` | `in` → `std.doc`, one; `parent` → `std.doc-block`, one | — |
134
- | `std.wiki-page` | **`slug`** string 1–200; **`title`** string 1–300; `content` string ≤ 200000 | — | `onePer: [slug]`; history `all` |
135
- | `std.note` | `title` string ≤ 500; `content` string ≤ 200000; `pinned` boolean; `color` string ≤ 32; `mentions` DID[] (≤ 64); topic `mentions` | — | — |
136
- | `std.call` | **`status`** `missed`/`ended`; `to` string ≤ 256; **`startedAt`** string ≤ 64; `endedAt` string ≤ 64; `people` string ≤ 256[] (≤ 64); topics `to`, `people` | — | — |
153
+ | Name | Body | Links | Rules |
154
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------- |
155
+ | `std.message` | **`text`** string 1–10000; `mentions` DID[] (≤ 64); `replyingTo` DID; topics `link:in`, `mentions`, `replyingTo` | `in` → `std.channel`, one; `replyTo` → `std.message`, one; `shares` → `*`, one | — |
156
+ | `std.channel` | **`name`** string 1–100; `topic` string ≤ 500; `position` string 1–200 | — | — |
157
+ | `std.direct` | **`to`** DID[] (1–16); **`data`** string ≤ 60000; **`boxes`** `{to, sealed}`[] (≤ 17); topic `to` | — | — |
158
+ | `std.post` | `text` string ≤ 10000; `images` image[] (≤ 8); `langs` string 2–35[] (≤ 3); `mentions` DID[] (≤ 64); `replyingTo` DID; topics `mentions`, `replyingTo` | `replyTo` → `std.post`, one; `root` → `std.post`, one; `shares` → `*`, one | — |
159
+ | `std.repost` | `respondingTo` DID; topic `respondingTo` | `about` → `*`, one | `onePer: [@author, link:about]` |
160
+ | `std.article` | **`title`** string 1–300; `summary` string ≤ 1000; `content` string ≤ 200000; `cover` blob; `slug` string 1–200; `publishedAt` when; `draft` boolean; `mentions` DID[] (≤ 64); topic `mentions` | `in` → `std.publication`, one | — |
161
+ | `std.publication` | **`title`** string 1–200; `description` string ≤ 2000; `icon` blob | — | — |
162
+ | `std.doc` | **`title`** string 1–500 | — | — |
163
+ | `std.doc-block` | **`type`** `paragraph`/`heading1`/`heading2`/`heading3`/`bullet`/`numbered`/`todo`/`quote`/`code`/`image`/`divider`; `text` string ≤ 20000; `checked` boolean; `language` string ≤ 32; `image` image; `position` string 1–200; `mentions` DID[] (≤ 64); topic `mentions` | `in` → `std.doc`, one; `parent` → `std.doc-block`, one | — |
164
+ | `std.wiki-page` | **`slug`** string 1–200; **`title`** string 1–300; `content` string ≤ 200000 | — | `onePer: [slug]`; history `all` |
165
+ | `std.note` | `title` string ≤ 500; `content` string ≤ 200000; `pinned` boolean; `color` string ≤ 32; `mentions` DID[] (≤ 64); topic `mentions` | — | — |
166
+ | `std.call` | **`status`** `missed`/`ended`; `to` string ≤ 256; **`startedAt`** string ≤ 64; `endedAt` string ≤ 64; `people` string ≤ 256[] (≤ 64); topics `to`, `people` | — | — |
137
167
 
138
168
  **Lists**
139
169
 
@@ -144,32 +174,27 @@ anything, and only moderators and admins write in the collections in
144
174
 
145
175
  **Files and media**
146
176
 
147
- | Name | Body | Links | Rules |
148
- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ----- |
149
- | `std.folder` | **`name`** string 1–255 | `parent` → `std.folder`, one | — |
150
- | `std.file` | **`name`** string 1–255; **`blob`** blob | `parent` → `std.folder`, one | — |
151
- | `std.photo` | **`blob`** blob; `alt` string ≤ 2000; `width` integer ≥ 1; `height` integer ≥ 1; `takenAt` when; `place` place | `in` → `std.album`, many | — |
152
- | `std.album` | **`title`** string 1–200; `description` string ≤ 2000 | `cover` → `std.photo`, one | — |
153
- | `std.video` | **`blob`** blob; `thumbnail` blob; `duration` number ≥ 0; `captions` blob; `alt` string ≤ 2000; `title` string ≤ 300 | `in` → `*`, many | — |
154
- | `std.track` | **`title`** string 1–300; `artists` string 1–200[] (≤ 20); `album` string ≤ 300; `duration` number ≥ 0; `isrc` string ≤ 12; `mbid` string ≤ 36; `blob` blob | `in` → `std.list`, many | — |
155
- | `std.play` | **`title`** string 1–300; `artists` string 1–200[] (≤ 20); `album` string ≤ 300; `duration` number ≥ 0; `isrc` string ≤ 12; `mbid` string ≤ 36; **`playedAt`** when | — | — |
177
+ | Name | Body | Links | Rules |
178
+ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | ----- |
179
+ | `std.file` | **`name`** string 1–255; **`mime`** string 1–255; `size` integer ≥ 0; `blob` blob; `url` string 1–2048; `alt` string ≤ 2000; `width` integer ≥ 1; `height` integer ≥ 1; `duration` number ≥ 0; `takenAt` when; `place` place; `thumbnail` blob; `captions` blob | `about` → `*`, one | — |
180
+ | `std.track` | **`title`** string 1–300; `artists` string 1–200[] (≤ 20); `album` string ≤ 300; `duration` number ≥ 0; `isrc` string ≤ 12; `mbid` string ≤ 36 | `file` → `std.file`, one | — |
181
+ | `std.play` | **`title`** string 1–300; `artists` string 1–200[] (≤ 20); `album` string ≤ 300; `duration` number ≥ 0; `isrc` string ≤ 12; `mbid` string ≤ 36; **`playedAt`** when | `about` → `std.track`, one | — |
156
182
 
157
183
  **Time and planning**
158
184
 
159
- | Name | Body | Links | Rules |
160
- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------- |
161
- | `std.calendar` | **`name`** string 1–200; `color` string ≤ 32 | — | — |
162
- | `std.event` | **`title`** string 1–500; `description` string ≤ 10000; `category` string ≤ 100; **`start`** when; `end` when; `tz` string 1–64; `allDay` boolean; `place` place; `url` string 1–2048; `rrule` string 1–1000; `status` `confirmed`/`tentative`/`cancelled`; topic `place.cells` | `in` → `std.calendar`, one | — |
163
- | `std.rsvp` | **`status`** `going`/`maybe`/`no`; `guests` integer 0–100; `note` string ≤ 500; `respondingTo` DID; topic `respondingTo` | `about` → `std.event`, one | `onePer: [@author, link:about]` |
164
- | `std.slot` | **`start`** when; **`end`** when; `tz` string 1–64; `note` string ≤ 1000 | `in` → `std.calendar`, one | — |
165
- | `std.booking` | `note` string ≤ 1000; `respondingTo` DID; topic `respondingTo` | `about` → `std.slot`, one | `onePer: [link:about]` |
166
- | `std.column` | **`name`** string 1–200; `position` string 1–200 | — | — |
167
- | `std.task` | **`title`** string 1–500; `notes` string ≤ 10000; `position` string 1–200; `due` when; `status` `todo`/`doing`/`done`/`cancelled`; `assignees` DID[] (≤ 20); `priority` integer 0–4; topic `assignees` | `column` → `std.column`, one; `parent` → `std.task`, one; `project` → `std.project`, one | — |
168
- | `std.project` | **`name`** string 1–200; `description` string ≤ 10000; `status` `planned`/`active`/`paused`/`done`/`cancelled`; `due` when | — | — |
169
- | `std.time-entry` | **`start`** when; `end` when; `note` string ≤ 1000 | `about` → `*`, one | — |
170
- | `std.reminder` | **`at`** when; `note` string ≤ 1000; `done` boolean | `about` → `*`, one | — |
171
- | `std.habit` | **`name`** string 1–200; `schedule` string ≤ 1000; `target` number ≥ 0; `unit` string ≤ 32; `position` string 1–200 | — | — |
172
- | `std.checkin` | **`date`** day; `value` number; `note` string ≤ 1000 | `about` → `std.habit`, one | `onePer: [@author, link:about, date]` |
185
+ | Name | Body | Links | Rules |
186
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------- |
187
+ | `std.calendar` | **`name`** string 1–200; `color` string ≤ 32 | — | — |
188
+ | `std.event` | **`title`** string 1–500; `description` string ≤ 10000; `category` string ≤ 100; **`start`** when; `end` when; `tz` string 1–64; `allDay` boolean; `place` place; `url` string 1–2048; `rrule` string 1–1000; `status` `confirmed`/`tentative`/`cancelled`; topic `place.cells` | `in` → `std.calendar`, one | — |
189
+ | `std.rsvp` | **`status`** `going`/`maybe`/`no`; `guests` integer 0–100; `note` string ≤ 500; `respondingTo` DID; topic `respondingTo` | `about` → `std.event`, one | `onePer: [@author, link:about]` |
190
+ | `std.slot` | **`start`** when; **`end`** when; `tz` string 1–64; `note` string ≤ 1000 | `in` → `std.calendar`, one | — |
191
+ | `std.column` | **`name`** string 1–200; `position` string 1–200 | `in` → `std.project`, one | — |
192
+ | `std.task` | **`title`** string 1–500; `notes` string ≤ 10000; `position` string 1–200; `due` when; `status` `todo`/`doing`/`done`/`cancelled`; `assignees` DID[] (≤ 20); `priority` integer 0–4; topic `assignees` | `in` → `std.column`, `std.project`, one; `parent` → `std.task`, one | — |
193
+ | `std.project` | **`name`** string 1–200; `description` string ≤ 10000; `status` `planned`/`active`/`paused`/`done`/`cancelled`; `due` when | — | — |
194
+ | `std.time-entry` | **`start`** when; `end` when; `note` string ≤ 1000 | `about` → `*`, one | — |
195
+ | `std.reminder` | **`at`** when; `note` string ≤ 1000; `done` boolean | `about` → `*`, one | — |
196
+ | `std.habit` | **`name`** string 1–200; `schedule` string ≤ 1000; `target` number ≥ 0; `unit` string ≤ 32; `position` string 1–200 | — | — |
197
+ | `std.checkin` | **`date`** day; `value` number; `note` string ≤ 1000 | `about` → `std.habit`, one | `onePer: [@author, link:about, date]` |
173
198
 
174
199
  **Places and travel**
175
200
 
@@ -206,19 +231,19 @@ anything, and only moderators and admins write in the collections in
206
231
 
207
232
  **Community and governance**
208
233
 
209
- | Name | Body | Links | Rules |
210
- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -------------------------------------------------- |
211
- | `std.poll` | **`question`** string 1–500; **`options`** string 1–200[]; `closed` boolean | — | `fixed: [options]` |
212
- | `std.vote` | **`choice`** integer ≥ 0; `choices` integer ≥ 0[] (≤ 100); `respondingTo` DID; topic `respondingTo` | `about` → `std.poll`, `std.proposal`, one | `onePer: [@author, link:about]` |
213
- | `std.proposal` | **`title`** string 1–300; `body` string ≤ 20000; **`options`** string 1–200[] (1–20); `closesAt` when; `status` `open`/`passed`/`rejected`/`withdrawn`; `quorum` integer 1–10000 | — | `fixed: [options]` |
214
- | `std.ballot` | **`choice`** integer ≥ 0; `respondingTo` DID; topic `respondingTo` | `about` → `std.proposal`, one | `onePer: [@author, link:about]`; `fixed: [choice]` |
215
- | `std.decision` | **`outcome`** integer ≥ 0; **`proposal`** string 1–128 (a version id); **`ballots`** string 1–128[] (≤ 256) | `about` → `std.proposal`, one | `onePer: [link:about]`; `check` (below) |
216
- | `std.goal` | **`title`** string 1–300; `body` string ≤ 20000; **`target`** integer 1–10⁹; **`unit`** string 1–50; `closesAt` when | — | `fixed: [target, unit]` |
217
- | `std.pledge` | **`amount`** integer 1–10⁹; `note` string ≤ 1000; `respondingTo` DID; topic `respondingTo` | `about` → `std.goal`, one | `onePer: [@author, link:about]`; `fixed: [amount]` |
218
- | `std.goal-reached` | **`goal`** string 1–128 (a version id); **`pledges`** string 1–128[] (≤ 256) | `about` → `std.goal`, one | `onePer: [link:about]`; `check` (below) |
219
- | `std.announcement` | **`title`** string 1–300; `text` string ≤ 20000 | — | — |
220
- | `std.badge` | **`name`** string 1–100; `description` string ≤ 1000; `image` blob | — | — |
221
- | `std.award` | **`did`** DID; `note` string ≤ 1000; topic `did` | `about` → `std.badge`, one | `onePer: [link:about, did]` |
234
+ | Name | Body | Links | Rules |
235
+ | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | -------------------------------------------------- |
236
+ | `std.poll` | **`question`** string 1–500; **`options`** string 1–200[]; `closed` boolean | — | `fixed: [options]` |
237
+ | `std.vote` | **`choice`** integer ≥ 0; `choices` integer ≥ 0[] (≤ 100); `respondingTo` DID; topic `respondingTo` | `about` → `std.poll`, one | `onePer: [@author, link:about]` |
238
+ | `std.proposal` | **`title`** string 1–300; `body` string ≤ 20000; **`options`** string 1–200[] (1–20); `closesAt` when; `status` `open`/`passed`/`rejected`/`withdrawn`; `quorum` integer 1–10000 | — | `fixed: [options]` |
239
+ | `std.ballot` | **`choice`** integer ≥ 0; `respondingTo` DID; topic `respondingTo` | `about` → `std.proposal`, one | `onePer: [@author, link:about]`; `fixed: [choice]` |
240
+ | `std.decision` | **`outcome`** integer ≥ 0; **`proposal`** string 1–128 (a version id); **`ballots`** string 1–128[] (≤ 256) | `about` → `std.proposal`, one | `onePer: [link:about]`; `check` (below) |
241
+ | `std.goal` | **`title`** string 1–300; `body` string ≤ 20000; **`target`** integer 1–10⁹; **`unit`** string 1–50; `closesAt` when | — | `fixed: [target, unit]` |
242
+ | `std.pledge` | **`amount`** integer 1–10⁹; `note` string ≤ 1000; `respondingTo` DID; topic `respondingTo` | `about` → `std.goal`, one | `onePer: [@author, link:about]`; `fixed: [amount]` |
243
+ | `std.goal-reached` | **`goal`** string 1–128 (a version id); **`pledges`** string 1–128[] (≤ 256) | `about` → `std.goal`, one | `onePer: [link:about]`; `check` (below) |
244
+ | `std.announcement` | **`title`** string 1–300; `text` string ≤ 20000 | — | — |
245
+ | `std.badge` | **`name`** string 1–100; `description` string ≤ 1000; `image` blob | — | — |
246
+ | `std.award` | **`did`** DID; `note` string ≤ 1000; topic `did` | `about` → `std.badge`, one | `onePer: [link:about, did]` |
222
247
 
223
248
  **Proven outcomes.** A `std.decision` and a `std.goal-reached` are not
224
249
  declared by anyone: each cites the records that prove it, by version id, and
@@ -356,8 +381,8 @@ _Source: `packages/core/src/schemas/library/publishing.ts` (`message`, `post`),
356
381
 
357
382
  **Responses.** A record written in answer to someone's record names them in
358
383
  `respondingTo`: a `std.reaction`, `std.comment` or `std.repost` the author of
359
- what it is about, a `std.rsvp` the event's, a `std.booking` the slot's, a
360
- `std.vote` or `std.ballot` the poll's or proposal's, a `std.pledge` the
384
+ what it is about, a `std.rsvp` the event's, a
385
+ `std.vote` the poll's, a `std.ballot` the proposal's, a `std.pledge` the
361
386
  goal's, a `std.claim` the claimed record's, a `std.order` the listing's, and a
362
387
  `std.order-update` the order's. It is their topic, so "someone reacted to,
363
388
  commented on, or answered what I wrote" is `where: { "respondingTo":
@@ -387,10 +412,10 @@ most 63 so that with `paidBy` every one is tagged: a record carries at most
387
412
  _Source: `packages/core/src/schemas/library/annotations.ts`, `packages/core/src/schemas/library/publishing.ts`, `packages/core/src/schemas/library/planning.ts`, `packages/core/src/schemas/library/community.ts`, `packages/core/src/schemas/library/money.ts`, `packages/core/src/schemas/library/social.ts`, `packages/core/src/schemas/library/media.ts`; `apps/example/src/derive/people.ts` (`respondingTo`), `apps/example/src/components/std/Reactions.tsx`, `apps/example/src/components/std/Comments.tsx`, `apps/example/src/components/apps/Polls.tsx`, `apps/example/src/components/apps/Decisions.tsx`, `apps/example/src/components/apps/Events.tsx`, `apps/example/src/components/apps/Marketplace.tsx`. Tests: `packages/core/tests/topics.test.ts` ("every standard collection that names people has them as topics…", "a report names nobody…", "a std.reaction is tagged for the person in its respondingTo…" and the rest of that list)._
388
413
 
389
414
  **Channels.** A space with more than one conversation lists `std.channel`
390
- records, by `position` then name, and a message links its channel as
391
- `channel`: `where: { 'link:channel': key }` finds a channel's messages, and
392
- `include: { messages: { rel: 'channel', from: 'std.message', count: true } }`
393
- counts them. A message with no `channel` link is in the space's own room,
415
+ records, by `position` then name, and a message is `in` its channel:
416
+ `where: { 'link:in': key }` finds a channel's messages, and
417
+ `include: { messages: { rel: 'in', from: 'std.message', count: true } }`
418
+ counts them. A message in no channel is in the space's own room,
394
419
  which a chat shows first, as "general". In the `community` template only
395
420
  moderators and admins make or rename a channel. A channel is a label, not a boundary: every member reads
396
421
  every channel. Something only some members may read is a space of its own, or
@@ -405,18 +430,19 @@ keeper can match unread.
405
430
 
406
431
  _Source: `packages/core/src/schemas/library/publishing.ts` (`channel`, `direct`), `packages/core/src/privacy/direct.ts`, `apps/example/src/components/apps/Chat.tsx`. Tests: `packages/core/tests/direct.test.ts`._
407
432
 
408
- **Changes to earlier definitions.** `std.attachment`, `std.task`,
409
- `std.message`, `std.vote` and `std.proposal` existed before the library grew. Each gained
410
- only optional fields and link roles: `std.attachment` a `blob`; `std.task`
411
- `due`, `status`, `assignees`, `priority` and the `parent` and `project` links;
412
- `std.message` a `channel`, the `root` link, `mentions`, `replyingTo`, and its
413
- first topics ([spec 02 §8](https://github.com/leifriksheim/minca/blob/main/spec/02-records.md)); `std.vote` `choices` (every
414
- choice, most preferred first, with `choice` the first of them); `std.proposal`
415
- `quorum`, for `std.decision`. A space that
416
- holds an earlier definition keeps it until someone applies a blueprint that
417
- carries the new one, which its review shows as a change. One of them is not additive in the sense of
418
- [spec 02 §6.5](https://github.com/leifriksheim/minca/blob/main/spec/02-records.md): `std.vote`'s `about` may now also point at a `std.proposal`, so an app
419
- that reads votes may meet one on something that is not a poll.
433
+ **Changes to earlier definitions.** Before v1 the library is reshaped
434
+ without migrations, to keep to the rules above. The last such change merged
435
+ `std.attachment`, `std.photo`, `std.video`, `std.folder` and `std.album` into
436
+ one `std.file` (groups of files are `std.list`s); removed `std.booking` (a
437
+ booking is a `std.claim` about a `std.slot`), `std.reference` (any link
438
+ refers) and `std.bookmark` (a saved thing is a `std.list-item`); renamed
439
+ `std.message`'s `channel` link and `std.task`'s `column` link to `in`, and
440
+ dropped the task's `project` link (a task is `in` a project when it has no
441
+ column, and a column is `in` its project); made `std.tag` one record per
442
+ person, record and label; gave `std.track` a `file` link and `std.play` an
443
+ `about` link to its track; and narrowed `std.vote` to polls, since a proposal
444
+ is decided by `std.ballot`s. A space that holds an earlier definition keeps
445
+ it until someone applies a blueprint that carries the new one.
420
446
 
421
447
  Since then ([#105](https://github.com/leifriksheim/minca/issues/105)), `std.comment` and `std.post` gained the same optional
422
448
  `mentions` and `replyingTo` as a message, and `std.note`, `std.doc-block` and
@@ -433,10 +459,9 @@ so "mentions me" and "assigned to me" match from then on.
433
459
  | Name | Body | Rules | Where |
434
460
  | --------------------- | --------------------------------------------------------------------------------------- | ----------------- | ----------------------- |
435
461
  | `std.contact` | `did` ≤ 256 and `name` ≤ 200, required; `space` ≤ 256; `note` ≤ 2000; `blocked` boolean | `onePer: [did]` | [contacts](contacts.md) |
436
- | `std.contact-request` | `to` ≤ 256 and `sealed` ≤ 16000, required | — | [contacts](contacts.md) |
437
- | `std.door` | `id` 16–64 and `relays` (1–3, each ≤ 200), required; `name` ≤ 64; `label` ≤ 64 | `onePer: [id]` | [doors.md](doors.md) |
438
- | `std.knock` | `space` ≤ 256, `name` ≤ 64, `door` ≤ 64, `sign` ≤ 64 and `invite` ≤ 8000, all required | `onePer: [space]` | [doors.md](doors.md) |
439
- | `std.knock-answer` | `sig` ≤ 200, required | — | [doors.md](doors.md) |
462
+ | `std.contact-request` | `to` ≤ 64 and `sealed` ≤ 16000, required | — | [contacts](contacts.md) |
463
+ | `std.inbox` | `gen` ≥ 0 and `places` (1–3, each ≤ 200), required; `name` ≤ 64 | — | [inbox.md](inbox.md) |
464
+ | `std.knock` | `space` ≤ 256, `name` ≤ 64 and `invite` ≤ 12000, all required | `onePer: [space]` | [inbox.md](inbox.md) |
440
465
 
441
466
  **Positions.** `position` is a string that sorts (by plain string comparison)
442
467
  where a record goes in a hand-made order. Digits are `0–9a–z`; a position
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minca/core",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "description": "Self-sovereign P2P protocol for the browser — identity, schemas, storage, networking, and gossip sync",
6
6
  "repository": {
@@ -61,10 +61,10 @@
61
61
  "types": "./dist/calls/index.d.ts",
62
62
  "import": "./dist/calls/index.js"
63
63
  },
64
- "./doors": {
65
- "@minca/source": "./src/doors/index.ts",
66
- "types": "./dist/doors/index.d.ts",
67
- "import": "./dist/doors/index.js"
64
+ "./inbox": {
65
+ "@minca/source": "./src/inbox/index.ts",
66
+ "types": "./dist/inbox/index.d.ts",
67
+ "import": "./dist/inbox/index.js"
68
68
  }
69
69
  },
70
70
  "scripts": {
@@ -91,6 +91,7 @@
91
91
  "dependencies": {
92
92
  "@cfworker/json-schema": "^4.1.1",
93
93
  "@noble/curves": "^2.4.0",
94
+ "@noble/hashes": "^2.4.0",
94
95
  "@scure/base": "^2.4.0",
95
96
  "aws4fetch": "^1.0.20"
96
97
  },
@@ -1,140 +0,0 @@
1
- /**
2
- * @module doors
3
- * Doors: how someone you share no space with can ask to become your contact.
4
- *
5
- * A DID is a name, not an address — knowing it must not be enough to reach
6
- * you. A **door** is an address you hand out on purpose, and can close:
7
- *
8
- * - a **door key**, derived from your contact key and the door's id
9
- * (`deriveDoorKeyBytes`), which says nothing about the account behind it,
10
- * and a **signing key** beside it (`deriveDoorSignKeyBytes`) that proves
11
- * ownership of the door — to a relay clearing its mailbox, and to a knocker
12
- * when you answer;
13
- * - the **relays** whose mailboxes hold knocks on it — two or three, chosen by
14
- * you, so no one relay can shut it.
15
- *
16
- * Both travel in a **door code** (a link, a QR code, a line in a bio). Someone
17
- * with it **knocks**: makes a private space for the two of you, and leaves its
18
- * invite, sealed to the door key, in the door's mailboxes. The knock is signed
19
- * by the knocker's session key under their account's note, like a record, so
20
- * it proves who knocked before anyone joins anything. Opening the door is
21
- * joining that space.
22
- *
23
- * ```
24
- * code = base64url(JSON { v: 1, key, sign, relays, name? })
25
- * topic = base64url(SHA-256("minca/door-topic/v1|" + sign))
26
- * knock = sealTo(key, "minca/knock/v1", { door: key }, JSON { body, sig }) // HPKE
27
- * body = { v: 2, door: key, from, name, invite, note?, at, session, proof }
28
- * sig = session key signs canonical(body)
29
- * ```
30
- *
31
- * The relay sees a topic and a sealed blob: not whose door it is, not who
32
- * knocked, not what they said. See `spec/07-doors.md`.
33
- */
34
- import type { CryptoProvider } from '../types.js';
35
- import { type Delegation } from '../identity/ucan.js';
36
- /** A door names at most this many relays: enough that one going away doesn't matter */
37
- export declare const MAX_DOOR_RELAYS = 3;
38
- /** How long a knock waits in a mailbox, and so how old one may be when opened */
39
- export declare const KNOCK_TTL_SECONDS: number;
40
- /**
41
- * How far a knock's own time may be from when the relay took it. A knock is
42
- * dropped as soon as it is signed, so its time is checked against the relay's
43
- * — which the knocker can't choose — and a note that ran out can't be used by
44
- * dating a knock back to when it was good.
45
- */
46
- export declare const KNOCK_DROP_WINDOW_SECONDS = 600;
47
- /** What a door code says: where to knock, and whose door the owner says it is */
48
- export interface DoorCode {
49
- readonly v: 1;
50
- /** The door key's public half: a compressed P-256 point, base64url. Knocks are sealed to it. */
51
- readonly key: string;
52
- /** The door's signing key's public half, likewise. Its hash is the door's topic. */
53
- readonly sign: string;
54
- /** Relays whose mailboxes hold knocks on it, 1–3 */
55
- readonly relays: ReadonlyArray<string>;
56
- /** Who the owner says they are — shown to the knocker, and proves nothing */
57
- readonly name?: string;
58
- }
59
- /** What a knock carries, signed by the knocker's session key */
60
- export interface KnockBody {
61
- readonly v: 2;
62
- /** The door knocked on: its key. Binds the knock to this door. */
63
- readonly door: string;
64
- /** The knocker's account */
65
- readonly from: string;
66
- /** The name they give */
67
- readonly name: string;
68
- /** The invite to the space for two they made */
69
- readonly invite: string;
70
- readonly note?: string;
71
- /** When it was signed, Unix seconds */
72
- readonly at: number;
73
- /** The session key that signed it */
74
- readonly session: string;
75
- /** The note from `from` to `session`: one token */
76
- readonly proof: Delegation;
77
- }
78
- /** A knock that opened and checked out */
79
- export interface OpenedKnock {
80
- readonly from: string;
81
- readonly name: string;
82
- readonly note?: string;
83
- readonly invite: string;
84
- /** The id of the space for two */
85
- readonly pairSpace: string;
86
- /** When it was signed, ms */
87
- readonly at: number;
88
- }
89
- /** Cuts text to at most `max` characters without splitting one (a surrogate pair stays whole) */
90
- export declare function clip(text: string, max: number): string;
91
- /** Encodes a door code: what goes in a link or a QR code */
92
- export declare function encodeDoorCode(code: Omit<DoorCode, 'v'>): string;
93
- /**
94
- * Reads a door code, or a link carrying one after `#door=` or `door=`.
95
- * @throws When it isn't one, saying why
96
- */
97
- export declare function parseDoorCode(text: string): DoorCode;
98
- /** Why a value is not a door code, or null */
99
- export declare function checkDoorCode(value: unknown): string | null;
100
- /**
101
- * The mailbox topic of a door: a hash of its signing key. The relay can't tell
102
- * whose door it is, and can check that whoever clears it holds that key.
103
- */
104
- export declare function doorTopic(sign: string): Promise<string>;
105
- /**
106
- * What a door's owner signs to clear knocks from a relay's mailbox: the topic,
107
- * the relay's one-time challenge, and which knocks (`*` for all of them).
108
- */
109
- export declare const purgeMessage: (topic: string, nonce: string, ids: ReadonlyArray<string> | null) => Uint8Array<ArrayBuffer>;
110
- /** Signs a relay's purge challenge with the door's signing key */
111
- export declare function signPurge(signKey: Uint8Array, topic: string, nonce: string, ids: ReadonlyArray<string> | null): Promise<string>;
112
- export declare function signAnswer(signKey: Uint8Array, pairSpace: string, did: string): Promise<string>;
113
- export declare function checkAnswer(sign: string, pairSpace: string, did: string, signature: string): Promise<boolean>;
114
- /** A knock's id: the hash of its sealed blob, as relays file it */
115
- export declare function knockId(blob: string): Promise<string>;
116
- /**
117
- * Makes a knock: the body, signed by the session key, sealed to the door key.
118
- * @returns The sealed blob, for relays' mailboxes
119
- */
120
- export declare function sealKnock(door: string, knock: {
121
- readonly from: string;
122
- readonly name: string;
123
- readonly invite: string;
124
- readonly note?: string;
125
- }, session: {
126
- readonly did: string;
127
- readonly key: CryptoKey;
128
- readonly proof: Delegation;
129
- }, provider: CryptoProvider): Promise<string>;
130
- /**
131
- * Opens a knock left on a door, and checks it through: sealed to this door;
132
- * signed by a session key that its account's note vouches for, for the whole
133
- * account and not by an agent; signed when the relay took it; recent; and
134
- * carrying an invite to a private space that account made.
135
- * @param doorKey The door key's private scalar (`deriveDoorKeyBytes`)
136
- * @param receivedAt When the relay took it, ms, as `fetch` says
137
- * @returns The knock, or null when it is anything less
138
- */
139
- export declare function openKnock(doorKey: Uint8Array, blob: string, receivedAt: number, provider: CryptoProvider): Promise<OpenedKnock | null>;
140
- //# sourceMappingURL=doors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doors.d.ts","sourceRoot":"","sources":["../../src/doors/doors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAUlD,OAAO,EAAmD,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAUvG,uFAAuF;AACvF,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,iFAAiF;AACjF,eAAO,M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