@openvtc/trust-tasks 0.18.3 → 0.18.5

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 (53) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/dist/_shared/components.d.ts +56 -0
  3. package/dist/_shared/components.d.ts.map +1 -1
  4. package/dist/index.d.ts +4 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +4 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/process-attestation/0.1/payload.d.ts +1190 -0
  9. package/dist/process-attestation/0.1/payload.d.ts.map +1 -0
  10. package/dist/process-attestation/0.1/payload.js +660 -0
  11. package/dist/process-attestation/0.1/payload.js.map +1 -0
  12. package/dist/rooms/_shared/0.1/room.d.ts +1 -1
  13. package/dist/rooms/_shared/0.1/room.d.ts.map +1 -1
  14. package/dist/rooms/create/0.1/payload.d.ts +58 -2
  15. package/dist/rooms/create/0.1/payload.d.ts.map +1 -1
  16. package/dist/rooms/create/0.1/payload.js +32 -0
  17. package/dist/rooms/create/0.1/payload.js.map +1 -1
  18. package/dist/rooms/epoch/commits/0.1/payload.d.ts +506 -0
  19. package/dist/rooms/epoch/commits/0.1/payload.d.ts.map +1 -0
  20. package/dist/rooms/epoch/commits/0.1/payload.js +268 -0
  21. package/dist/rooms/epoch/commits/0.1/payload.js.map +1 -0
  22. package/dist/rooms/epoch/mint/0.1/payload.d.ts +20 -0
  23. package/dist/rooms/epoch/mint/0.1/payload.d.ts.map +1 -1
  24. package/dist/rooms/epoch/mint/0.1/payload.js +5 -0
  25. package/dist/rooms/epoch/mint/0.1/payload.js.map +1 -1
  26. package/dist/rooms/epoch/prune/0.1/payload.d.ts +423 -0
  27. package/dist/rooms/epoch/prune/0.1/payload.d.ts.map +1 -0
  28. package/dist/rooms/epoch/prune/0.1/payload.js +229 -0
  29. package/dist/rooms/epoch/prune/0.1/payload.js.map +1 -0
  30. package/dist/rooms/keys/browse/0.1/payload.d.ts +20 -0
  31. package/dist/rooms/keys/browse/0.1/payload.d.ts.map +1 -1
  32. package/dist/rooms/keys/browse/0.1/payload.js +24 -0
  33. package/dist/rooms/keys/browse/0.1/payload.js.map +1 -1
  34. package/dist/rooms/keys/read/0.1/payload.d.ts +20 -0
  35. package/dist/rooms/keys/read/0.1/payload.d.ts.map +1 -1
  36. package/dist/rooms/keys/read/0.1/payload.js +24 -0
  37. package/dist/rooms/keys/read/0.1/payload.js.map +1 -1
  38. package/dist/rooms/owner/anchor/0.1/payload.d.ts +537 -0
  39. package/dist/rooms/owner/anchor/0.1/payload.d.ts.map +1 -0
  40. package/dist/rooms/owner/anchor/0.1/payload.js +291 -0
  41. package/dist/rooms/owner/anchor/0.1/payload.js.map +1 -0
  42. package/package.json +1 -1
  43. package/src/_shared/components.ts +56 -0
  44. package/src/index.ts +4 -0
  45. package/src/process-attestation/0.1/payload.ts +794 -0
  46. package/src/rooms/_shared/0.1/room.ts +1 -1
  47. package/src/rooms/create/0.1/payload.ts +42 -2
  48. package/src/rooms/epoch/commits/0.1/payload.ts +341 -0
  49. package/src/rooms/epoch/mint/0.1/payload.ts +15 -0
  50. package/src/rooms/epoch/prune/0.1/payload.ts +289 -0
  51. package/src/rooms/keys/browse/0.1/payload.ts +24 -0
  52. package/src/rooms/keys/read/0.1/payload.ts +24 -0
  53. package/src/rooms/owner/anchor/0.1/payload.ts +353 -0
@@ -0,0 +1,537 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/rooms/owner/anchor/0.1/payload.schema.json
4
+ */
5
+ import type { DataCommitment, DigestMultibase, EpochAnchor, Ext, HeadVersion, RecordCount } from "../../../../_shared/components.js";
6
+ /**
7
+ * TODO: what the request payload of rooms/owner/anchor carries. The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.
8
+ */
9
+ export interface RoomsOwnerAnchorPayload {
10
+ /**
11
+ * The room to anchor. The recipient MUST hold its group state and MUST be able to update its DID.
12
+ */
13
+ roomId: string;
14
+ /**
15
+ * The host to read the room's head from, as a DID.
16
+ *
17
+ * The owner holds **one** of the three values it is about to publish. `rooms/epoch/mint`'s response is `{roomId, epoch}` — no watermark, and no reason there should be one: minting acts on the epoch, while the watermark and the commitment are facts about the room's *records*, which live at the host. So an anchor is assembled from a read, and this names where.
18
+ */
19
+ host: string;
20
+ /**
21
+ * The room's signing key, named rather than looked up: nothing maps a DID to its key, and a wrong key fails to verify against the room's own document at first use.
22
+ */
23
+ signingKeyId: string;
24
+ /**
25
+ * Ecosystem-defined extension members per SPEC.md §4.5.1.
26
+ */
27
+ ext?: Ext;
28
+ }
29
+ /**
30
+ * Success response to rooms/owner/anchor. Type https://trusttasks.org/spec/rooms/owner/anchor/0.1#response.
31
+ */
32
+ export interface RoomsOwnerAnchorResponsePayload {
33
+ roomId: string;
34
+ /**
35
+ * What was written — returned so an owner can see it without resolving their own room, and so an operator can compare it with what a member later reads.
36
+ */
37
+ anchored: EpochAnchor;
38
+ /**
39
+ * The `did:webvh` log entry the anchor rode. This is what makes the anchor *witnessed*: naming the entry lets anyone fetch it and check the witnesses' signature over it.
40
+ */
41
+ versionId: string;
42
+ /**
43
+ * Whether the host's own listing reconciled with the `recordCount` it committed to, at the moment this was read.
44
+ *
45
+ * `false` is a host contradicting itself, and the anchor was still written — deliberately. An owner that refused to anchor a suspect room would leave it with no witnessed statement at all, which is the position the host benefits from. What is published is *what the host claimed*, and this member records that the owner had already caught it claiming something inconsistent.
46
+ */
47
+ reconciled?: boolean;
48
+ ext?: Ext;
49
+ }
50
+ /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
51
+ export type { DataCommitment, DigestMultibase, EpochAnchor, Ext, HeadVersion, RecordCount };
52
+ /** Trust Task type URI. */
53
+ export declare const TYPE_URI: "https://trusttasks.org/spec/rooms/owner/anchor/0.1";
54
+ /** Stable alias for this specification's request payload shape. */
55
+ export type Payload = RoomsOwnerAnchorPayload;
56
+ /** Trust Task response type URI (request type URI + "#response"). */
57
+ export declare const RESPONSE_TYPE_URI: "https://trusttasks.org/spec/rooms/owner/anchor/0.1#response";
58
+ /** Stable alias for this specification's success-response payload shape. */
59
+ export type Response = RoomsOwnerAnchorResponsePayload;
60
+ /**
61
+ * This specification's payload schema, as a value.
62
+ *
63
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
64
+ * rather than only as a `.json` file because TypeScript types are erased
65
+ * at runtime: without a schema a consumer has nothing to validate, and
66
+ * every REQUIRED payload member is optional in practice. Cross-file
67
+ * `$ref`s are already inlined, so it needs no resolver.
68
+ */
69
+ export declare const PAYLOAD_SCHEMA: {
70
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
71
+ readonly $id: "https://trusttasks.org/spec/rooms/owner/anchor/0.1";
72
+ readonly title: "Rooms Owner Anchor — payload";
73
+ readonly description: "TODO: what the request payload of rooms/owner/anchor carries. The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.";
74
+ readonly type: "object";
75
+ readonly additionalProperties: false;
76
+ readonly required: readonly ["roomId", "host", "signingKeyId"];
77
+ readonly properties: {
78
+ readonly roomId: {
79
+ readonly type: "string";
80
+ readonly description: "The room to anchor. The recipient MUST hold its group state and MUST be able to update its DID.";
81
+ };
82
+ readonly host: {
83
+ readonly type: "string";
84
+ readonly description: "The host to read the room's head from, as a DID.\n\nThe owner holds **one** of the three values it is about to publish. `rooms/epoch/mint`'s response is `{roomId, epoch}` — no watermark, and no reason there should be one: minting acts on the epoch, while the watermark and the commitment are facts about the room's *records*, which live at the host. So an anchor is assembled from a read, and this names where.";
85
+ };
86
+ readonly signingKeyId: {
87
+ readonly type: "string";
88
+ readonly description: "The room's signing key, named rather than looked up: nothing maps a DID to its key, and a wrong key fails to verify against the room's own document at first use.";
89
+ };
90
+ readonly ext: {
91
+ readonly $ref: "#/$defs/Ext";
92
+ readonly description: "Ecosystem-defined extension members per SPEC.md §4.5.1.";
93
+ };
94
+ };
95
+ readonly $defs: {
96
+ readonly Response: {
97
+ readonly $anchor: "response";
98
+ readonly type: "object";
99
+ readonly additionalProperties: false;
100
+ readonly required: readonly ["roomId", "anchored", "versionId"];
101
+ readonly description: "Success response to rooms/owner/anchor. Type https://trusttasks.org/spec/rooms/owner/anchor/0.1#response.";
102
+ readonly properties: {
103
+ readonly roomId: {
104
+ readonly type: "string";
105
+ };
106
+ readonly anchored: {
107
+ readonly $ref: "#/$defs/EpochAnchor";
108
+ readonly description: "What was written — returned so an owner can see it without resolving their own room, and so an operator can compare it with what a member later reads.";
109
+ };
110
+ readonly versionId: {
111
+ readonly type: "string";
112
+ readonly description: "The `did:webvh` log entry the anchor rode. This is what makes the anchor *witnessed*: naming the entry lets anyone fetch it and check the witnesses' signature over it.";
113
+ };
114
+ readonly reconciled: {
115
+ readonly type: "boolean";
116
+ readonly description: "Whether the host's own listing reconciled with the `recordCount` it committed to, at the moment this was read.\n\n`false` is a host contradicting itself, and the anchor was still written — deliberately. An owner that refused to anchor a suspect room would leave it with no witnessed statement at all, which is the position the host benefits from. What is published is *what the host claimed*, and this member records that the owner had already caught it claiming something inconsistent.";
117
+ };
118
+ readonly ext: {
119
+ readonly $ref: "#/$defs/Ext";
120
+ };
121
+ };
122
+ readonly title: "Rooms Owner Anchor — response payload";
123
+ };
124
+ readonly Ext: {
125
+ readonly title: "Ext";
126
+ readonly description: "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.";
127
+ readonly type: "object";
128
+ readonly minProperties: 1;
129
+ readonly additionalProperties: true;
130
+ readonly propertyNames: {
131
+ readonly pattern: "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$";
132
+ };
133
+ };
134
+ readonly EpochAnchor: {
135
+ readonly title: "EpochAnchor";
136
+ readonly type: "object";
137
+ readonly additionalProperties: false;
138
+ readonly required: readonly ["epoch", "epochAuthenticator", "headVersion"];
139
+ readonly description: "What a room writes into its own witnessed log, so that a host serving a stale, forked or partial view of it becomes **evident rather than merely possible**.\n\n**Witnessed is the whole point.** Witnesses co-sign a `did:webvh` log entry, so a value that rides one is singular: the room cannot have told two members two different things about the same epoch without the log showing it. An anchor that did not ride a log entry would be a value the host could equally have made up, which is what every unanchored assertion in this family already is.\n\nIt goes in a **typed service entry** on the room's DID document, which is the only slot in a `did:webvh` log entry that carries an ecosystem-defined value today: `parameters` is a closed struct, `versionId` and `versionTime` are computed, and `proof` is the witnesses' signature over the rest — it secures the anchor and cannot be it.\n\n**Publishing one is not free.** A `did:webvh` update that supplies a document rotates the DID's update key and refreshes its pre-rotation commitments, so every anchor is a witnessed update *and* a rotation. That makes cadence an operational decision rather than only a freshness one: a room anchoring on every write would rotate its own DID's update key on every write.";
140
+ readonly properties: {
141
+ readonly epoch: {
142
+ readonly type: "integer";
143
+ readonly minimum: 1;
144
+ readonly description: "The key epoch this anchor describes.";
145
+ };
146
+ readonly epochAuthenticator: {
147
+ readonly $ref: "#/$defs/DigestMultibase";
148
+ readonly description: "The MLS epoch authenticator for `epoch` — a value every member of the group derives independently and no host can compute. A member whose own authenticator differs from the anchored one is in a **forked group**, which is the attack this exists to make visible.";
149
+ };
150
+ readonly headVersion: {
151
+ readonly $ref: "#/$defs/HeadVersion";
152
+ readonly description: "The room's version watermark at the moment of anchoring, as the host reported it.";
153
+ };
154
+ readonly dataCommitment: {
155
+ readonly $ref: "#/$defs/DataCommitment";
156
+ readonly description: "The room's record-tree root at the same moment. OPTIONAL for the same reason it is on a read: a host that maintains no tree asserts none, and an owner cannot anchor what it was not given. Where it is present it is the only comparison in this family that needs neither a gossip channel rooms deliberately lack nor durable state in a member's agent — every member reads the same anchored root.";
157
+ };
158
+ readonly recordCount: {
159
+ readonly $ref: "#/$defs/RecordCount";
160
+ readonly description: "How many records the room held. Present with `dataCommitment` and absent without it: a root without the state it describes is not comparable to another root.";
161
+ };
162
+ };
163
+ };
164
+ readonly RecordCount: {
165
+ readonly title: "RecordCount";
166
+ readonly type: "integer";
167
+ readonly minimum: 0;
168
+ readonly description: "How many records the room held when `DataCommitment` was computed — the number of leaves in that tree, tombstones included, since a tombstone is a record.\n\n**Why a root needs this.** Certificate Transparency's signed tree head is a root *and a tree size*; this family shipped the root alone, and the half that was dropped is the half that makes a listing checkable. A reader holding a **complete, unfiltered** listing cannot recompute the root — a leaf commits to a whole record and a listing returns a projection without the body — but it can count. A host that omits a record from a listing while committing to a tree that holds it now contradicts itself in the same response, with no second party and no anchor involved.\n\nA host can of course understate both together. That is the point rather than a hole: the omission stops being silence and becomes a **specific claim about how many records the room holds**, which any other member's view, or any writer's signed put acknowledgement, contradicts. Making an omission attributable is the whole of what this machinery buys; it never claimed to make one impossible.\n\n**It counts the room, never the page.** The same rule `DataCommitment` states, and the same trap: a count scoped to what was returned is one a host satisfies by construction. So this is only comparable against a listing read to the end with **no** `prefix` and **no** `sinceVersion` — a filtered listing legitimately holds fewer, and a reader that compares one against this has found a discrepancy it created itself.";
169
+ };
170
+ readonly DataCommitment: {
171
+ readonly title: "DataCommitment";
172
+ readonly $ref: "#/$defs/DigestMultibase";
173
+ readonly description: "The root of the room's record tree — a host's commitment to *which records the room holds*, as distinct from what any one of them says.\n\nA room's records are already signed and room-bound, so a host cannot forge, alter or relocate one. What it can do for free is stay silent: a listing that omits a record is indistinguishable from a room that never held it. This value is what makes that omission detectable, so it is only worth anything when the reader can compare it against a copy the host did not choose for them — one it gave another member, one it gave the same member earlier, or the witnessed anchor. A commitment read once, in isolation, proves nothing.\n\n**A root on its own is not comparable, and an earlier revision of this description said it was.** It claimed a host showing two members two different roots had been caught, which is false while a room can move between two reads: the host answers *there was a write*, and nothing contradicts it. Comparison needs the state each root describes, which is what `HeadVersion` names — and `RecordCount` is the other half of the same omission, since Certificate Transparency's signed tree head is a root *and a size* and this family shipped only the root. A reader that receives a `dataCommitment` **without** them can use it against a witnessed anchor, where the epoch pins the state, and **MUST NOT** compare it against another root.\n\n**The construction is normative**, because two hosts that compute different roots over the same room make every comparison meaningless:\n 1. Take every record the room holds — including tombstones, which are records — and order them by `key` using unsigned byte order.\n 2. Leaf: `SHA-256(0x00 || JCS(record))`, where the record is a `CommittedRecord` — that definition fixes the members exactly, and this step used to name a *projection* instead, which two implementations could read two ways — JCS is its RFC 8785 canonicalization, and `0x00` is RFC 6962's leaf-domain prefix.\n 3. Internal node: `SHA-256(0x01 || left || right)`.\n 4. A level with an odd number of nodes promotes the last one unchanged. It MUST NOT be duplicated: duplicating makes a tree of n leaves collide with one of n+1 whose last is repeated, so two different rooms commit to the same root.\n 5. A room holding no records commits to `SHA-256(\"\")`, a distinguished value rather than zeroes — a root of zeroes is what an uninitialised buffer looks like, and an empty room is a real state a host must be able to commit to honestly.\n\nThe leaf covers the whole record rather than its body, and that is deliberate: a host that could flip `status` from active to retracted, move `pinned`, or rewrite `author` on an `attributed` room would rewrite what the room means without touching a byte of ciphertext. The **plaintext is never involved** — on the sealed tiers the host holds ciphertext and commits to exactly what it stores.\n\nThe commitment is over the **whole room**, never over the page being returned. A page-scoped root is one a host satisfies by construction and could never fail.\n\nProving that a *particular* record sits under this root is a separate question, answered by `RecordTrace` on a single-record read. A commitment catches a host that equivocates; a trace binds one record to what the host committed to. Neither is the other, and a reader wanting completeness needs both plus a root it did not get from the host it is checking.";
174
+ };
175
+ readonly DigestMultibase: {
176
+ readonly title: "DigestMultibase";
177
+ readonly description: "A cryptographic digest as a multibase-encoded multihash — the encoding the W3C Verifiable Credentials Data Model 2.0 defines for `digestMultibase`, and the one `did:webvh` uses for its SCID and entry hashes.\n\nMultihash carries the hash algorithm in-band, so the value is self-describing and the wire format survives an algorithm change without a schema revision; multibase does the same for the base encoding, so a verifier never infers base58 from base64url by context. A bare hex string or a `sha-256:`-style prefix hard-codes one algorithm into the wire contract and is non-conforming here.\n\nThis definition constrains the *encoding only*. What the digest is computed over is stated by each referencing field, because it differs legitimately: a digest over a JSON document is taken over its RFC 8785 (JCS) canonicalization, while a digest over an opaque artifact is taken over its bytes. A field whose input is a JSON document and which does not name a canonicalization is not reproducible.\n\nRestricted to the two multibase headers W3C Controlled Identifiers 1.0 §2.4 normatively requires — `z` (base58btc) and `u` (base64url-no-pad). CID permits others but states that \"interoperability is not guaranteed between implementations using such values\", and a registry whose purpose is interoperability should not mint digests a conforming verifier may be unable to read. The alphabets are enforced rather than assumed: base58btc excludes 0, O, I and l, and an earlier permissive pattern let three published examples carry digests that were not valid base58 at all. base58btc is RECOMMENDED, for consistency with `did:key` and `did:webvh`.";
178
+ readonly type: "string";
179
+ readonly minLength: 16;
180
+ readonly pattern: "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$";
181
+ readonly examples: readonly ["zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"];
182
+ };
183
+ readonly HeadVersion: {
184
+ readonly title: "HeadVersion";
185
+ readonly type: "integer";
186
+ readonly minimum: 0;
187
+ readonly description: "The highest version among the records `DataCommitment` covers. `0` for a room that holds none.\n\n**Derived from the same set as the root, and not read from the room's own counter.** The two agree for any host that has never erased a record — versions are assigned strictly increasing and a retraction keeps its tombstone — but they are not interchangeable, because a root and a counter are *two reads*, and two reads are not a snapshot. A write landing between them yields a pair that is individually correct and jointly false: two members holding roots taken over different trees, labelled with one version. That reads as equivocation and is not, and a **false accusation discredits the mechanism rather than the host** — the worst outcome available here. Taken from the committed set, the version cannot disagree with the root it labels, whatever else is happening to the room.\n\nThe corollary is worth stating: a host that **erases** a record — as distinct from retracting it, which leaves a tombstone in the tree — moves the root without necessarily moving this value, and two members straddling that erasure would see one version over two roots. Erasure is a retention act with its own answer, and a family that exposes one owes this definition another look.\n\n**This is what makes two roots comparable at all**, and without it the comparison this family is built on cannot be performed. A room moves: every put, curate and retraction assigns a new version, so two roots taken at two moments differ legitimately and a reader learns nothing from the difference. Shown two different roots, a host that equivocated and a host that was merely written to are indistinguishable — the first can always answer *the room moved between your reads*, and nothing contradicts it.\n\nA version is assigned by exactly the mutations that change the tree — every put, curate and retraction takes the next one — so the highest of them names the **state** the root describes. Two roots carrying the same `headVersion` and differing is a host caught: there is no write to attribute the difference to. Two roots carrying different ones are simply two moments, and a reader should draw nothing from them.\n\nA host can lie about this number too, and it is then lying about the counter it also uses for optimistic concurrency (`expectedVersion`) and for incremental sync (`sinceVersion`) — so a member holding a signed acknowledgement of a write at version `V` contradicts any head below `V` directly.\n\n**Not a timestamp.** A time is host-asserted, unverifiable and useless for this: two roots a second apart are not evidence of anything, while two roots at one version are.";
188
+ };
189
+ };
190
+ };
191
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
192
+ export declare const RESPONSE_PAYLOAD_SCHEMA: {
193
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
194
+ readonly $ref: "#/$defs/Response";
195
+ readonly $defs: {
196
+ readonly Response: {
197
+ readonly $anchor: "response";
198
+ readonly type: "object";
199
+ readonly additionalProperties: false;
200
+ readonly required: readonly ["roomId", "anchored", "versionId"];
201
+ readonly description: "Success response to rooms/owner/anchor. Type https://trusttasks.org/spec/rooms/owner/anchor/0.1#response.";
202
+ readonly properties: {
203
+ readonly roomId: {
204
+ readonly type: "string";
205
+ };
206
+ readonly anchored: {
207
+ readonly $ref: "#/$defs/EpochAnchor";
208
+ readonly description: "What was written — returned so an owner can see it without resolving their own room, and so an operator can compare it with what a member later reads.";
209
+ };
210
+ readonly versionId: {
211
+ readonly type: "string";
212
+ readonly description: "The `did:webvh` log entry the anchor rode. This is what makes the anchor *witnessed*: naming the entry lets anyone fetch it and check the witnesses' signature over it.";
213
+ };
214
+ readonly reconciled: {
215
+ readonly type: "boolean";
216
+ readonly description: "Whether the host's own listing reconciled with the `recordCount` it committed to, at the moment this was read.\n\n`false` is a host contradicting itself, and the anchor was still written — deliberately. An owner that refused to anchor a suspect room would leave it with no witnessed statement at all, which is the position the host benefits from. What is published is *what the host claimed*, and this member records that the owner had already caught it claiming something inconsistent.";
217
+ };
218
+ readonly ext: {
219
+ readonly $ref: "#/$defs/Ext";
220
+ };
221
+ };
222
+ readonly title: "Rooms Owner Anchor — response payload";
223
+ };
224
+ readonly Ext: {
225
+ readonly title: "Ext";
226
+ readonly description: "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.";
227
+ readonly type: "object";
228
+ readonly minProperties: 1;
229
+ readonly additionalProperties: true;
230
+ readonly propertyNames: {
231
+ readonly pattern: "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$";
232
+ };
233
+ };
234
+ readonly EpochAnchor: {
235
+ readonly title: "EpochAnchor";
236
+ readonly type: "object";
237
+ readonly additionalProperties: false;
238
+ readonly required: readonly ["epoch", "epochAuthenticator", "headVersion"];
239
+ readonly description: "What a room writes into its own witnessed log, so that a host serving a stale, forked or partial view of it becomes **evident rather than merely possible**.\n\n**Witnessed is the whole point.** Witnesses co-sign a `did:webvh` log entry, so a value that rides one is singular: the room cannot have told two members two different things about the same epoch without the log showing it. An anchor that did not ride a log entry would be a value the host could equally have made up, which is what every unanchored assertion in this family already is.\n\nIt goes in a **typed service entry** on the room's DID document, which is the only slot in a `did:webvh` log entry that carries an ecosystem-defined value today: `parameters` is a closed struct, `versionId` and `versionTime` are computed, and `proof` is the witnesses' signature over the rest — it secures the anchor and cannot be it.\n\n**Publishing one is not free.** A `did:webvh` update that supplies a document rotates the DID's update key and refreshes its pre-rotation commitments, so every anchor is a witnessed update *and* a rotation. That makes cadence an operational decision rather than only a freshness one: a room anchoring on every write would rotate its own DID's update key on every write.";
240
+ readonly properties: {
241
+ readonly epoch: {
242
+ readonly type: "integer";
243
+ readonly minimum: 1;
244
+ readonly description: "The key epoch this anchor describes.";
245
+ };
246
+ readonly epochAuthenticator: {
247
+ readonly $ref: "#/$defs/DigestMultibase";
248
+ readonly description: "The MLS epoch authenticator for `epoch` — a value every member of the group derives independently and no host can compute. A member whose own authenticator differs from the anchored one is in a **forked group**, which is the attack this exists to make visible.";
249
+ };
250
+ readonly headVersion: {
251
+ readonly $ref: "#/$defs/HeadVersion";
252
+ readonly description: "The room's version watermark at the moment of anchoring, as the host reported it.";
253
+ };
254
+ readonly dataCommitment: {
255
+ readonly $ref: "#/$defs/DataCommitment";
256
+ readonly description: "The room's record-tree root at the same moment. OPTIONAL for the same reason it is on a read: a host that maintains no tree asserts none, and an owner cannot anchor what it was not given. Where it is present it is the only comparison in this family that needs neither a gossip channel rooms deliberately lack nor durable state in a member's agent — every member reads the same anchored root.";
257
+ };
258
+ readonly recordCount: {
259
+ readonly $ref: "#/$defs/RecordCount";
260
+ readonly description: "How many records the room held. Present with `dataCommitment` and absent without it: a root without the state it describes is not comparable to another root.";
261
+ };
262
+ };
263
+ };
264
+ readonly RecordCount: {
265
+ readonly title: "RecordCount";
266
+ readonly type: "integer";
267
+ readonly minimum: 0;
268
+ readonly description: "How many records the room held when `DataCommitment` was computed — the number of leaves in that tree, tombstones included, since a tombstone is a record.\n\n**Why a root needs this.** Certificate Transparency's signed tree head is a root *and a tree size*; this family shipped the root alone, and the half that was dropped is the half that makes a listing checkable. A reader holding a **complete, unfiltered** listing cannot recompute the root — a leaf commits to a whole record and a listing returns a projection without the body — but it can count. A host that omits a record from a listing while committing to a tree that holds it now contradicts itself in the same response, with no second party and no anchor involved.\n\nA host can of course understate both together. That is the point rather than a hole: the omission stops being silence and becomes a **specific claim about how many records the room holds**, which any other member's view, or any writer's signed put acknowledgement, contradicts. Making an omission attributable is the whole of what this machinery buys; it never claimed to make one impossible.\n\n**It counts the room, never the page.** The same rule `DataCommitment` states, and the same trap: a count scoped to what was returned is one a host satisfies by construction. So this is only comparable against a listing read to the end with **no** `prefix` and **no** `sinceVersion` — a filtered listing legitimately holds fewer, and a reader that compares one against this has found a discrepancy it created itself.";
269
+ };
270
+ readonly DataCommitment: {
271
+ readonly title: "DataCommitment";
272
+ readonly $ref: "#/$defs/DigestMultibase";
273
+ readonly description: "The root of the room's record tree — a host's commitment to *which records the room holds*, as distinct from what any one of them says.\n\nA room's records are already signed and room-bound, so a host cannot forge, alter or relocate one. What it can do for free is stay silent: a listing that omits a record is indistinguishable from a room that never held it. This value is what makes that omission detectable, so it is only worth anything when the reader can compare it against a copy the host did not choose for them — one it gave another member, one it gave the same member earlier, or the witnessed anchor. A commitment read once, in isolation, proves nothing.\n\n**A root on its own is not comparable, and an earlier revision of this description said it was.** It claimed a host showing two members two different roots had been caught, which is false while a room can move between two reads: the host answers *there was a write*, and nothing contradicts it. Comparison needs the state each root describes, which is what `HeadVersion` names — and `RecordCount` is the other half of the same omission, since Certificate Transparency's signed tree head is a root *and a size* and this family shipped only the root. A reader that receives a `dataCommitment` **without** them can use it against a witnessed anchor, where the epoch pins the state, and **MUST NOT** compare it against another root.\n\n**The construction is normative**, because two hosts that compute different roots over the same room make every comparison meaningless:\n 1. Take every record the room holds — including tombstones, which are records — and order them by `key` using unsigned byte order.\n 2. Leaf: `SHA-256(0x00 || JCS(record))`, where the record is a `CommittedRecord` — that definition fixes the members exactly, and this step used to name a *projection* instead, which two implementations could read two ways — JCS is its RFC 8785 canonicalization, and `0x00` is RFC 6962's leaf-domain prefix.\n 3. Internal node: `SHA-256(0x01 || left || right)`.\n 4. A level with an odd number of nodes promotes the last one unchanged. It MUST NOT be duplicated: duplicating makes a tree of n leaves collide with one of n+1 whose last is repeated, so two different rooms commit to the same root.\n 5. A room holding no records commits to `SHA-256(\"\")`, a distinguished value rather than zeroes — a root of zeroes is what an uninitialised buffer looks like, and an empty room is a real state a host must be able to commit to honestly.\n\nThe leaf covers the whole record rather than its body, and that is deliberate: a host that could flip `status` from active to retracted, move `pinned`, or rewrite `author` on an `attributed` room would rewrite what the room means without touching a byte of ciphertext. The **plaintext is never involved** — on the sealed tiers the host holds ciphertext and commits to exactly what it stores.\n\nThe commitment is over the **whole room**, never over the page being returned. A page-scoped root is one a host satisfies by construction and could never fail.\n\nProving that a *particular* record sits under this root is a separate question, answered by `RecordTrace` on a single-record read. A commitment catches a host that equivocates; a trace binds one record to what the host committed to. Neither is the other, and a reader wanting completeness needs both plus a root it did not get from the host it is checking.";
274
+ };
275
+ readonly DigestMultibase: {
276
+ readonly title: "DigestMultibase";
277
+ readonly description: "A cryptographic digest as a multibase-encoded multihash — the encoding the W3C Verifiable Credentials Data Model 2.0 defines for `digestMultibase`, and the one `did:webvh` uses for its SCID and entry hashes.\n\nMultihash carries the hash algorithm in-band, so the value is self-describing and the wire format survives an algorithm change without a schema revision; multibase does the same for the base encoding, so a verifier never infers base58 from base64url by context. A bare hex string or a `sha-256:`-style prefix hard-codes one algorithm into the wire contract and is non-conforming here.\n\nThis definition constrains the *encoding only*. What the digest is computed over is stated by each referencing field, because it differs legitimately: a digest over a JSON document is taken over its RFC 8785 (JCS) canonicalization, while a digest over an opaque artifact is taken over its bytes. A field whose input is a JSON document and which does not name a canonicalization is not reproducible.\n\nRestricted to the two multibase headers W3C Controlled Identifiers 1.0 §2.4 normatively requires — `z` (base58btc) and `u` (base64url-no-pad). CID permits others but states that \"interoperability is not guaranteed between implementations using such values\", and a registry whose purpose is interoperability should not mint digests a conforming verifier may be unable to read. The alphabets are enforced rather than assumed: base58btc excludes 0, O, I and l, and an earlier permissive pattern let three published examples carry digests that were not valid base58 at all. base58btc is RECOMMENDED, for consistency with `did:key` and `did:webvh`.";
278
+ readonly type: "string";
279
+ readonly minLength: 16;
280
+ readonly pattern: "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$";
281
+ readonly examples: readonly ["zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"];
282
+ };
283
+ readonly HeadVersion: {
284
+ readonly title: "HeadVersion";
285
+ readonly type: "integer";
286
+ readonly minimum: 0;
287
+ readonly description: "The highest version among the records `DataCommitment` covers. `0` for a room that holds none.\n\n**Derived from the same set as the root, and not read from the room's own counter.** The two agree for any host that has never erased a record — versions are assigned strictly increasing and a retraction keeps its tombstone — but they are not interchangeable, because a root and a counter are *two reads*, and two reads are not a snapshot. A write landing between them yields a pair that is individually correct and jointly false: two members holding roots taken over different trees, labelled with one version. That reads as equivocation and is not, and a **false accusation discredits the mechanism rather than the host** — the worst outcome available here. Taken from the committed set, the version cannot disagree with the root it labels, whatever else is happening to the room.\n\nThe corollary is worth stating: a host that **erases** a record — as distinct from retracting it, which leaves a tombstone in the tree — moves the root without necessarily moving this value, and two members straddling that erasure would see one version over two roots. Erasure is a retention act with its own answer, and a family that exposes one owes this definition another look.\n\n**This is what makes two roots comparable at all**, and without it the comparison this family is built on cannot be performed. A room moves: every put, curate and retraction assigns a new version, so two roots taken at two moments differ legitimately and a reader learns nothing from the difference. Shown two different roots, a host that equivocated and a host that was merely written to are indistinguishable — the first can always answer *the room moved between your reads*, and nothing contradicts it.\n\nA version is assigned by exactly the mutations that change the tree — every put, curate and retraction takes the next one — so the highest of them names the **state** the root describes. Two roots carrying the same `headVersion` and differing is a host caught: there is no write to attribute the difference to. Two roots carrying different ones are simply two moments, and a reader should draw nothing from them.\n\nA host can lie about this number too, and it is then lying about the counter it also uses for optimistic concurrency (`expectedVersion`) and for incremental sync (`sinceVersion`) — so a member holding a signed acknowledgement of a write at version `V` contradicts any head below `V` directly.\n\n**Not a timestamp.** A time is host-asserted, unverifiable and useless for this: two roots a second apart are not evidence of anything, while two roots at one version are.";
288
+ };
289
+ };
290
+ };
291
+ /**
292
+ * SPEC.md §7.2 policy for the request variant, from this specification's
293
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
294
+ * per-specification and cannot be derived from the document alone, and
295
+ * item 2 needs the schema this carries.
296
+ */
297
+ export declare const SPEC: {
298
+ readonly typeUri: "https://trusttasks.org/spec/rooms/owner/anchor/0.1";
299
+ readonly isBearer: false;
300
+ readonly isProofRequired: true;
301
+ readonly isRecipientRequired: true;
302
+ readonly isIssuedAtRequired: true;
303
+ readonly payloadSchema: {
304
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
305
+ readonly $id: "https://trusttasks.org/spec/rooms/owner/anchor/0.1";
306
+ readonly title: "Rooms Owner Anchor — payload";
307
+ readonly description: "TODO: what the request payload of rooms/owner/anchor carries. The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.";
308
+ readonly type: "object";
309
+ readonly additionalProperties: false;
310
+ readonly required: readonly ["roomId", "host", "signingKeyId"];
311
+ readonly properties: {
312
+ readonly roomId: {
313
+ readonly type: "string";
314
+ readonly description: "The room to anchor. The recipient MUST hold its group state and MUST be able to update its DID.";
315
+ };
316
+ readonly host: {
317
+ readonly type: "string";
318
+ readonly description: "The host to read the room's head from, as a DID.\n\nThe owner holds **one** of the three values it is about to publish. `rooms/epoch/mint`'s response is `{roomId, epoch}` — no watermark, and no reason there should be one: minting acts on the epoch, while the watermark and the commitment are facts about the room's *records*, which live at the host. So an anchor is assembled from a read, and this names where.";
319
+ };
320
+ readonly signingKeyId: {
321
+ readonly type: "string";
322
+ readonly description: "The room's signing key, named rather than looked up: nothing maps a DID to its key, and a wrong key fails to verify against the room's own document at first use.";
323
+ };
324
+ readonly ext: {
325
+ readonly $ref: "#/$defs/Ext";
326
+ readonly description: "Ecosystem-defined extension members per SPEC.md §4.5.1.";
327
+ };
328
+ };
329
+ readonly $defs: {
330
+ readonly Response: {
331
+ readonly $anchor: "response";
332
+ readonly type: "object";
333
+ readonly additionalProperties: false;
334
+ readonly required: readonly ["roomId", "anchored", "versionId"];
335
+ readonly description: "Success response to rooms/owner/anchor. Type https://trusttasks.org/spec/rooms/owner/anchor/0.1#response.";
336
+ readonly properties: {
337
+ readonly roomId: {
338
+ readonly type: "string";
339
+ };
340
+ readonly anchored: {
341
+ readonly $ref: "#/$defs/EpochAnchor";
342
+ readonly description: "What was written — returned so an owner can see it without resolving their own room, and so an operator can compare it with what a member later reads.";
343
+ };
344
+ readonly versionId: {
345
+ readonly type: "string";
346
+ readonly description: "The `did:webvh` log entry the anchor rode. This is what makes the anchor *witnessed*: naming the entry lets anyone fetch it and check the witnesses' signature over it.";
347
+ };
348
+ readonly reconciled: {
349
+ readonly type: "boolean";
350
+ readonly description: "Whether the host's own listing reconciled with the `recordCount` it committed to, at the moment this was read.\n\n`false` is a host contradicting itself, and the anchor was still written — deliberately. An owner that refused to anchor a suspect room would leave it with no witnessed statement at all, which is the position the host benefits from. What is published is *what the host claimed*, and this member records that the owner had already caught it claiming something inconsistent.";
351
+ };
352
+ readonly ext: {
353
+ readonly $ref: "#/$defs/Ext";
354
+ };
355
+ };
356
+ readonly title: "Rooms Owner Anchor — response payload";
357
+ };
358
+ readonly Ext: {
359
+ readonly title: "Ext";
360
+ readonly description: "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.";
361
+ readonly type: "object";
362
+ readonly minProperties: 1;
363
+ readonly additionalProperties: true;
364
+ readonly propertyNames: {
365
+ readonly pattern: "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$";
366
+ };
367
+ };
368
+ readonly EpochAnchor: {
369
+ readonly title: "EpochAnchor";
370
+ readonly type: "object";
371
+ readonly additionalProperties: false;
372
+ readonly required: readonly ["epoch", "epochAuthenticator", "headVersion"];
373
+ readonly description: "What a room writes into its own witnessed log, so that a host serving a stale, forked or partial view of it becomes **evident rather than merely possible**.\n\n**Witnessed is the whole point.** Witnesses co-sign a `did:webvh` log entry, so a value that rides one is singular: the room cannot have told two members two different things about the same epoch without the log showing it. An anchor that did not ride a log entry would be a value the host could equally have made up, which is what every unanchored assertion in this family already is.\n\nIt goes in a **typed service entry** on the room's DID document, which is the only slot in a `did:webvh` log entry that carries an ecosystem-defined value today: `parameters` is a closed struct, `versionId` and `versionTime` are computed, and `proof` is the witnesses' signature over the rest — it secures the anchor and cannot be it.\n\n**Publishing one is not free.** A `did:webvh` update that supplies a document rotates the DID's update key and refreshes its pre-rotation commitments, so every anchor is a witnessed update *and* a rotation. That makes cadence an operational decision rather than only a freshness one: a room anchoring on every write would rotate its own DID's update key on every write.";
374
+ readonly properties: {
375
+ readonly epoch: {
376
+ readonly type: "integer";
377
+ readonly minimum: 1;
378
+ readonly description: "The key epoch this anchor describes.";
379
+ };
380
+ readonly epochAuthenticator: {
381
+ readonly $ref: "#/$defs/DigestMultibase";
382
+ readonly description: "The MLS epoch authenticator for `epoch` — a value every member of the group derives independently and no host can compute. A member whose own authenticator differs from the anchored one is in a **forked group**, which is the attack this exists to make visible.";
383
+ };
384
+ readonly headVersion: {
385
+ readonly $ref: "#/$defs/HeadVersion";
386
+ readonly description: "The room's version watermark at the moment of anchoring, as the host reported it.";
387
+ };
388
+ readonly dataCommitment: {
389
+ readonly $ref: "#/$defs/DataCommitment";
390
+ readonly description: "The room's record-tree root at the same moment. OPTIONAL for the same reason it is on a read: a host that maintains no tree asserts none, and an owner cannot anchor what it was not given. Where it is present it is the only comparison in this family that needs neither a gossip channel rooms deliberately lack nor durable state in a member's agent — every member reads the same anchored root.";
391
+ };
392
+ readonly recordCount: {
393
+ readonly $ref: "#/$defs/RecordCount";
394
+ readonly description: "How many records the room held. Present with `dataCommitment` and absent without it: a root without the state it describes is not comparable to another root.";
395
+ };
396
+ };
397
+ };
398
+ readonly RecordCount: {
399
+ readonly title: "RecordCount";
400
+ readonly type: "integer";
401
+ readonly minimum: 0;
402
+ readonly description: "How many records the room held when `DataCommitment` was computed — the number of leaves in that tree, tombstones included, since a tombstone is a record.\n\n**Why a root needs this.** Certificate Transparency's signed tree head is a root *and a tree size*; this family shipped the root alone, and the half that was dropped is the half that makes a listing checkable. A reader holding a **complete, unfiltered** listing cannot recompute the root — a leaf commits to a whole record and a listing returns a projection without the body — but it can count. A host that omits a record from a listing while committing to a tree that holds it now contradicts itself in the same response, with no second party and no anchor involved.\n\nA host can of course understate both together. That is the point rather than a hole: the omission stops being silence and becomes a **specific claim about how many records the room holds**, which any other member's view, or any writer's signed put acknowledgement, contradicts. Making an omission attributable is the whole of what this machinery buys; it never claimed to make one impossible.\n\n**It counts the room, never the page.** The same rule `DataCommitment` states, and the same trap: a count scoped to what was returned is one a host satisfies by construction. So this is only comparable against a listing read to the end with **no** `prefix` and **no** `sinceVersion` — a filtered listing legitimately holds fewer, and a reader that compares one against this has found a discrepancy it created itself.";
403
+ };
404
+ readonly DataCommitment: {
405
+ readonly title: "DataCommitment";
406
+ readonly $ref: "#/$defs/DigestMultibase";
407
+ readonly description: "The root of the room's record tree — a host's commitment to *which records the room holds*, as distinct from what any one of them says.\n\nA room's records are already signed and room-bound, so a host cannot forge, alter or relocate one. What it can do for free is stay silent: a listing that omits a record is indistinguishable from a room that never held it. This value is what makes that omission detectable, so it is only worth anything when the reader can compare it against a copy the host did not choose for them — one it gave another member, one it gave the same member earlier, or the witnessed anchor. A commitment read once, in isolation, proves nothing.\n\n**A root on its own is not comparable, and an earlier revision of this description said it was.** It claimed a host showing two members two different roots had been caught, which is false while a room can move between two reads: the host answers *there was a write*, and nothing contradicts it. Comparison needs the state each root describes, which is what `HeadVersion` names — and `RecordCount` is the other half of the same omission, since Certificate Transparency's signed tree head is a root *and a size* and this family shipped only the root. A reader that receives a `dataCommitment` **without** them can use it against a witnessed anchor, where the epoch pins the state, and **MUST NOT** compare it against another root.\n\n**The construction is normative**, because two hosts that compute different roots over the same room make every comparison meaningless:\n 1. Take every record the room holds — including tombstones, which are records — and order them by `key` using unsigned byte order.\n 2. Leaf: `SHA-256(0x00 || JCS(record))`, where the record is a `CommittedRecord` — that definition fixes the members exactly, and this step used to name a *projection* instead, which two implementations could read two ways — JCS is its RFC 8785 canonicalization, and `0x00` is RFC 6962's leaf-domain prefix.\n 3. Internal node: `SHA-256(0x01 || left || right)`.\n 4. A level with an odd number of nodes promotes the last one unchanged. It MUST NOT be duplicated: duplicating makes a tree of n leaves collide with one of n+1 whose last is repeated, so two different rooms commit to the same root.\n 5. A room holding no records commits to `SHA-256(\"\")`, a distinguished value rather than zeroes — a root of zeroes is what an uninitialised buffer looks like, and an empty room is a real state a host must be able to commit to honestly.\n\nThe leaf covers the whole record rather than its body, and that is deliberate: a host that could flip `status` from active to retracted, move `pinned`, or rewrite `author` on an `attributed` room would rewrite what the room means without touching a byte of ciphertext. The **plaintext is never involved** — on the sealed tiers the host holds ciphertext and commits to exactly what it stores.\n\nThe commitment is over the **whole room**, never over the page being returned. A page-scoped root is one a host satisfies by construction and could never fail.\n\nProving that a *particular* record sits under this root is a separate question, answered by `RecordTrace` on a single-record read. A commitment catches a host that equivocates; a trace binds one record to what the host committed to. Neither is the other, and a reader wanting completeness needs both plus a root it did not get from the host it is checking.";
408
+ };
409
+ readonly DigestMultibase: {
410
+ readonly title: "DigestMultibase";
411
+ readonly description: "A cryptographic digest as a multibase-encoded multihash — the encoding the W3C Verifiable Credentials Data Model 2.0 defines for `digestMultibase`, and the one `did:webvh` uses for its SCID and entry hashes.\n\nMultihash carries the hash algorithm in-band, so the value is self-describing and the wire format survives an algorithm change without a schema revision; multibase does the same for the base encoding, so a verifier never infers base58 from base64url by context. A bare hex string or a `sha-256:`-style prefix hard-codes one algorithm into the wire contract and is non-conforming here.\n\nThis definition constrains the *encoding only*. What the digest is computed over is stated by each referencing field, because it differs legitimately: a digest over a JSON document is taken over its RFC 8785 (JCS) canonicalization, while a digest over an opaque artifact is taken over its bytes. A field whose input is a JSON document and which does not name a canonicalization is not reproducible.\n\nRestricted to the two multibase headers W3C Controlled Identifiers 1.0 §2.4 normatively requires — `z` (base58btc) and `u` (base64url-no-pad). CID permits others but states that \"interoperability is not guaranteed between implementations using such values\", and a registry whose purpose is interoperability should not mint digests a conforming verifier may be unable to read. The alphabets are enforced rather than assumed: base58btc excludes 0, O, I and l, and an earlier permissive pattern let three published examples carry digests that were not valid base58 at all. base58btc is RECOMMENDED, for consistency with `did:key` and `did:webvh`.";
412
+ readonly type: "string";
413
+ readonly minLength: 16;
414
+ readonly pattern: "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$";
415
+ readonly examples: readonly ["zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"];
416
+ };
417
+ readonly HeadVersion: {
418
+ readonly title: "HeadVersion";
419
+ readonly type: "integer";
420
+ readonly minimum: 0;
421
+ readonly description: "The highest version among the records `DataCommitment` covers. `0` for a room that holds none.\n\n**Derived from the same set as the root, and not read from the room's own counter.** The two agree for any host that has never erased a record — versions are assigned strictly increasing and a retraction keeps its tombstone — but they are not interchangeable, because a root and a counter are *two reads*, and two reads are not a snapshot. A write landing between them yields a pair that is individually correct and jointly false: two members holding roots taken over different trees, labelled with one version. That reads as equivocation and is not, and a **false accusation discredits the mechanism rather than the host** — the worst outcome available here. Taken from the committed set, the version cannot disagree with the root it labels, whatever else is happening to the room.\n\nThe corollary is worth stating: a host that **erases** a record — as distinct from retracting it, which leaves a tombstone in the tree — moves the root without necessarily moving this value, and two members straddling that erasure would see one version over two roots. Erasure is a retention act with its own answer, and a family that exposes one owes this definition another look.\n\n**This is what makes two roots comparable at all**, and without it the comparison this family is built on cannot be performed. A room moves: every put, curate and retraction assigns a new version, so two roots taken at two moments differ legitimately and a reader learns nothing from the difference. Shown two different roots, a host that equivocated and a host that was merely written to are indistinguishable — the first can always answer *the room moved between your reads*, and nothing contradicts it.\n\nA version is assigned by exactly the mutations that change the tree — every put, curate and retraction takes the next one — so the highest of them names the **state** the root describes. Two roots carrying the same `headVersion` and differing is a host caught: there is no write to attribute the difference to. Two roots carrying different ones are simply two moments, and a reader should draw nothing from them.\n\nA host can lie about this number too, and it is then lying about the counter it also uses for optimistic concurrency (`expectedVersion`) and for incremental sync (`sinceVersion`) — so a member holding a signed acknowledgement of a write at version `V` contradicts any head below `V` directly.\n\n**Not a timestamp.** A time is host-asserted, unverifiable and useless for this: two roots a second apart are not evidence of anything, while two roots at one version are.";
422
+ };
423
+ };
424
+ };
425
+ };
426
+ /**
427
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
428
+ * tracks the *issuer* party's requirement because a response swaps the
429
+ * parties (§7.3 item 5).
430
+ */
431
+ export declare const RESPONSE_SPEC: {
432
+ readonly typeUri: "https://trusttasks.org/spec/rooms/owner/anchor/0.1#response";
433
+ readonly isBearer: false;
434
+ readonly isProofRequired: true;
435
+ readonly isRecipientRequired: true;
436
+ readonly isIssuedAtRequired: true;
437
+ readonly payloadSchema: {
438
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
439
+ readonly $ref: "#/$defs/Response";
440
+ readonly $defs: {
441
+ readonly Response: {
442
+ readonly $anchor: "response";
443
+ readonly type: "object";
444
+ readonly additionalProperties: false;
445
+ readonly required: readonly ["roomId", "anchored", "versionId"];
446
+ readonly description: "Success response to rooms/owner/anchor. Type https://trusttasks.org/spec/rooms/owner/anchor/0.1#response.";
447
+ readonly properties: {
448
+ readonly roomId: {
449
+ readonly type: "string";
450
+ };
451
+ readonly anchored: {
452
+ readonly $ref: "#/$defs/EpochAnchor";
453
+ readonly description: "What was written — returned so an owner can see it without resolving their own room, and so an operator can compare it with what a member later reads.";
454
+ };
455
+ readonly versionId: {
456
+ readonly type: "string";
457
+ readonly description: "The `did:webvh` log entry the anchor rode. This is what makes the anchor *witnessed*: naming the entry lets anyone fetch it and check the witnesses' signature over it.";
458
+ };
459
+ readonly reconciled: {
460
+ readonly type: "boolean";
461
+ readonly description: "Whether the host's own listing reconciled with the `recordCount` it committed to, at the moment this was read.\n\n`false` is a host contradicting itself, and the anchor was still written — deliberately. An owner that refused to anchor a suspect room would leave it with no witnessed statement at all, which is the position the host benefits from. What is published is *what the host claimed*, and this member records that the owner had already caught it claiming something inconsistent.";
462
+ };
463
+ readonly ext: {
464
+ readonly $ref: "#/$defs/Ext";
465
+ };
466
+ };
467
+ readonly title: "Rooms Owner Anchor — response payload";
468
+ };
469
+ readonly Ext: {
470
+ readonly title: "Ext";
471
+ readonly description: "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.";
472
+ readonly type: "object";
473
+ readonly minProperties: 1;
474
+ readonly additionalProperties: true;
475
+ readonly propertyNames: {
476
+ readonly pattern: "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$";
477
+ };
478
+ };
479
+ readonly EpochAnchor: {
480
+ readonly title: "EpochAnchor";
481
+ readonly type: "object";
482
+ readonly additionalProperties: false;
483
+ readonly required: readonly ["epoch", "epochAuthenticator", "headVersion"];
484
+ readonly description: "What a room writes into its own witnessed log, so that a host serving a stale, forked or partial view of it becomes **evident rather than merely possible**.\n\n**Witnessed is the whole point.** Witnesses co-sign a `did:webvh` log entry, so a value that rides one is singular: the room cannot have told two members two different things about the same epoch without the log showing it. An anchor that did not ride a log entry would be a value the host could equally have made up, which is what every unanchored assertion in this family already is.\n\nIt goes in a **typed service entry** on the room's DID document, which is the only slot in a `did:webvh` log entry that carries an ecosystem-defined value today: `parameters` is a closed struct, `versionId` and `versionTime` are computed, and `proof` is the witnesses' signature over the rest — it secures the anchor and cannot be it.\n\n**Publishing one is not free.** A `did:webvh` update that supplies a document rotates the DID's update key and refreshes its pre-rotation commitments, so every anchor is a witnessed update *and* a rotation. That makes cadence an operational decision rather than only a freshness one: a room anchoring on every write would rotate its own DID's update key on every write.";
485
+ readonly properties: {
486
+ readonly epoch: {
487
+ readonly type: "integer";
488
+ readonly minimum: 1;
489
+ readonly description: "The key epoch this anchor describes.";
490
+ };
491
+ readonly epochAuthenticator: {
492
+ readonly $ref: "#/$defs/DigestMultibase";
493
+ readonly description: "The MLS epoch authenticator for `epoch` — a value every member of the group derives independently and no host can compute. A member whose own authenticator differs from the anchored one is in a **forked group**, which is the attack this exists to make visible.";
494
+ };
495
+ readonly headVersion: {
496
+ readonly $ref: "#/$defs/HeadVersion";
497
+ readonly description: "The room's version watermark at the moment of anchoring, as the host reported it.";
498
+ };
499
+ readonly dataCommitment: {
500
+ readonly $ref: "#/$defs/DataCommitment";
501
+ readonly description: "The room's record-tree root at the same moment. OPTIONAL for the same reason it is on a read: a host that maintains no tree asserts none, and an owner cannot anchor what it was not given. Where it is present it is the only comparison in this family that needs neither a gossip channel rooms deliberately lack nor durable state in a member's agent — every member reads the same anchored root.";
502
+ };
503
+ readonly recordCount: {
504
+ readonly $ref: "#/$defs/RecordCount";
505
+ readonly description: "How many records the room held. Present with `dataCommitment` and absent without it: a root without the state it describes is not comparable to another root.";
506
+ };
507
+ };
508
+ };
509
+ readonly RecordCount: {
510
+ readonly title: "RecordCount";
511
+ readonly type: "integer";
512
+ readonly minimum: 0;
513
+ readonly description: "How many records the room held when `DataCommitment` was computed — the number of leaves in that tree, tombstones included, since a tombstone is a record.\n\n**Why a root needs this.** Certificate Transparency's signed tree head is a root *and a tree size*; this family shipped the root alone, and the half that was dropped is the half that makes a listing checkable. A reader holding a **complete, unfiltered** listing cannot recompute the root — a leaf commits to a whole record and a listing returns a projection without the body — but it can count. A host that omits a record from a listing while committing to a tree that holds it now contradicts itself in the same response, with no second party and no anchor involved.\n\nA host can of course understate both together. That is the point rather than a hole: the omission stops being silence and becomes a **specific claim about how many records the room holds**, which any other member's view, or any writer's signed put acknowledgement, contradicts. Making an omission attributable is the whole of what this machinery buys; it never claimed to make one impossible.\n\n**It counts the room, never the page.** The same rule `DataCommitment` states, and the same trap: a count scoped to what was returned is one a host satisfies by construction. So this is only comparable against a listing read to the end with **no** `prefix` and **no** `sinceVersion` — a filtered listing legitimately holds fewer, and a reader that compares one against this has found a discrepancy it created itself.";
514
+ };
515
+ readonly DataCommitment: {
516
+ readonly title: "DataCommitment";
517
+ readonly $ref: "#/$defs/DigestMultibase";
518
+ readonly description: "The root of the room's record tree — a host's commitment to *which records the room holds*, as distinct from what any one of them says.\n\nA room's records are already signed and room-bound, so a host cannot forge, alter or relocate one. What it can do for free is stay silent: a listing that omits a record is indistinguishable from a room that never held it. This value is what makes that omission detectable, so it is only worth anything when the reader can compare it against a copy the host did not choose for them — one it gave another member, one it gave the same member earlier, or the witnessed anchor. A commitment read once, in isolation, proves nothing.\n\n**A root on its own is not comparable, and an earlier revision of this description said it was.** It claimed a host showing two members two different roots had been caught, which is false while a room can move between two reads: the host answers *there was a write*, and nothing contradicts it. Comparison needs the state each root describes, which is what `HeadVersion` names — and `RecordCount` is the other half of the same omission, since Certificate Transparency's signed tree head is a root *and a size* and this family shipped only the root. A reader that receives a `dataCommitment` **without** them can use it against a witnessed anchor, where the epoch pins the state, and **MUST NOT** compare it against another root.\n\n**The construction is normative**, because two hosts that compute different roots over the same room make every comparison meaningless:\n 1. Take every record the room holds — including tombstones, which are records — and order them by `key` using unsigned byte order.\n 2. Leaf: `SHA-256(0x00 || JCS(record))`, where the record is a `CommittedRecord` — that definition fixes the members exactly, and this step used to name a *projection* instead, which two implementations could read two ways — JCS is its RFC 8785 canonicalization, and `0x00` is RFC 6962's leaf-domain prefix.\n 3. Internal node: `SHA-256(0x01 || left || right)`.\n 4. A level with an odd number of nodes promotes the last one unchanged. It MUST NOT be duplicated: duplicating makes a tree of n leaves collide with one of n+1 whose last is repeated, so two different rooms commit to the same root.\n 5. A room holding no records commits to `SHA-256(\"\")`, a distinguished value rather than zeroes — a root of zeroes is what an uninitialised buffer looks like, and an empty room is a real state a host must be able to commit to honestly.\n\nThe leaf covers the whole record rather than its body, and that is deliberate: a host that could flip `status` from active to retracted, move `pinned`, or rewrite `author` on an `attributed` room would rewrite what the room means without touching a byte of ciphertext. The **plaintext is never involved** — on the sealed tiers the host holds ciphertext and commits to exactly what it stores.\n\nThe commitment is over the **whole room**, never over the page being returned. A page-scoped root is one a host satisfies by construction and could never fail.\n\nProving that a *particular* record sits under this root is a separate question, answered by `RecordTrace` on a single-record read. A commitment catches a host that equivocates; a trace binds one record to what the host committed to. Neither is the other, and a reader wanting completeness needs both plus a root it did not get from the host it is checking.";
519
+ };
520
+ readonly DigestMultibase: {
521
+ readonly title: "DigestMultibase";
522
+ readonly description: "A cryptographic digest as a multibase-encoded multihash — the encoding the W3C Verifiable Credentials Data Model 2.0 defines for `digestMultibase`, and the one `did:webvh` uses for its SCID and entry hashes.\n\nMultihash carries the hash algorithm in-band, so the value is self-describing and the wire format survives an algorithm change without a schema revision; multibase does the same for the base encoding, so a verifier never infers base58 from base64url by context. A bare hex string or a `sha-256:`-style prefix hard-codes one algorithm into the wire contract and is non-conforming here.\n\nThis definition constrains the *encoding only*. What the digest is computed over is stated by each referencing field, because it differs legitimately: a digest over a JSON document is taken over its RFC 8785 (JCS) canonicalization, while a digest over an opaque artifact is taken over its bytes. A field whose input is a JSON document and which does not name a canonicalization is not reproducible.\n\nRestricted to the two multibase headers W3C Controlled Identifiers 1.0 §2.4 normatively requires — `z` (base58btc) and `u` (base64url-no-pad). CID permits others but states that \"interoperability is not guaranteed between implementations using such values\", and a registry whose purpose is interoperability should not mint digests a conforming verifier may be unable to read. The alphabets are enforced rather than assumed: base58btc excludes 0, O, I and l, and an earlier permissive pattern let three published examples carry digests that were not valid base58 at all. base58btc is RECOMMENDED, for consistency with `did:key` and `did:webvh`.";
523
+ readonly type: "string";
524
+ readonly minLength: 16;
525
+ readonly pattern: "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$";
526
+ readonly examples: readonly ["zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR"];
527
+ };
528
+ readonly HeadVersion: {
529
+ readonly title: "HeadVersion";
530
+ readonly type: "integer";
531
+ readonly minimum: 0;
532
+ readonly description: "The highest version among the records `DataCommitment` covers. `0` for a room that holds none.\n\n**Derived from the same set as the root, and not read from the room's own counter.** The two agree for any host that has never erased a record — versions are assigned strictly increasing and a retraction keeps its tombstone — but they are not interchangeable, because a root and a counter are *two reads*, and two reads are not a snapshot. A write landing between them yields a pair that is individually correct and jointly false: two members holding roots taken over different trees, labelled with one version. That reads as equivocation and is not, and a **false accusation discredits the mechanism rather than the host** — the worst outcome available here. Taken from the committed set, the version cannot disagree with the root it labels, whatever else is happening to the room.\n\nThe corollary is worth stating: a host that **erases** a record — as distinct from retracting it, which leaves a tombstone in the tree — moves the root without necessarily moving this value, and two members straddling that erasure would see one version over two roots. Erasure is a retention act with its own answer, and a family that exposes one owes this definition another look.\n\n**This is what makes two roots comparable at all**, and without it the comparison this family is built on cannot be performed. A room moves: every put, curate and retraction assigns a new version, so two roots taken at two moments differ legitimately and a reader learns nothing from the difference. Shown two different roots, a host that equivocated and a host that was merely written to are indistinguishable — the first can always answer *the room moved between your reads*, and nothing contradicts it.\n\nA version is assigned by exactly the mutations that change the tree — every put, curate and retraction takes the next one — so the highest of them names the **state** the root describes. Two roots carrying the same `headVersion` and differing is a host caught: there is no write to attribute the difference to. Two roots carrying different ones are simply two moments, and a reader should draw nothing from them.\n\nA host can lie about this number too, and it is then lying about the counter it also uses for optimistic concurrency (`expectedVersion`) and for incremental sync (`sinceVersion`) — so a member holding a signed acknowledgement of a write at version `V` contradicts any head below `V` directly.\n\n**Not a timestamp.** A time is host-asserted, unverifiable and useless for this: two roots a second apart are not evidence of anything, while two roots at one version are.";
533
+ };
534
+ };
535
+ };
536
+ };
537
+ //# sourceMappingURL=payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../../../src/rooms/owner/anchor/0.1/payload.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGrI;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AACD;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED,kHAAkH;AAClH,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AAE5F,2BAA2B;AAC3B,eAAO,MAAM,QAAQ,EAAG,oDAA6D,CAAC;AAEtF,mEAAmE;AACnE,MAAM,MAAM,OAAO,GAAG,uBAAuB,CAAC;AAE9C,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,EAAG,6DAAsE,CAAC;AAExG,4EAA4E;AAC5E,MAAM,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AAEvD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIjB,CAAC;AAEX,mEAAmE;AACnE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4G1B,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOP,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOhB,CAAC"}