@cello-protocol/daemon 0.0.189 → 0.0.191

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.
@@ -44,6 +44,29 @@ export declare const PARK_ENVELOPE_VERSION = 2;
44
44
  * that, because "only a refusal" is a claim rather than a hope.
45
45
  */
46
46
  export declare const PARK_ENVELOPE_VERSION_ALG = 3;
47
+ /**
48
+ * v4 — a v3 envelope plus THE SENDER'S SIGNATURE OVER `structure1Cbor` (034-CARRYLEAF review F1).
49
+ *
50
+ * ⚠️ **WITHOUT IT, A WITHHELD MESSAGE THAT ARRIVES BY MAILBOX CANNOT BE WITNESSED, and the
51
+ * withholding attack stays open on that route.**
52
+ *
53
+ * The direct path closed it: a message arriving with no relay ordering record is witnessed by its
54
+ * RECIPIENT, using the author's own signature carried beside the bytes it signs. The mailbox route
55
+ * had no such field — this envelope carried `structure1Cbor` and no signature over it, because
56
+ * `parkSig` covers `(session_id, recipient_pubkey, content_hash)`, a different statement. So the
57
+ * recipient held the author's words and nothing the relay would accept as proof of them, and a
58
+ * counterparty who parked instead of hand-delivering still truncated the record.
59
+ *
60
+ * The algorithm rides at index 6 exactly as on v3 and is ALWAYS present here, so the shape is a
61
+ * clean superset rather than a second optional tail nobody can parse positionally.
62
+ *
63
+ * **This is the emit half only.** A v2 or v3 envelope is still accepted — refusing one would destroy
64
+ * store-and-forward mail already sitting in every relay mailbox, which is the failure
65
+ * `SIGNED_ENVELOPE_VERSIONS` exists to prevent. Requiring v4 is a later step, once nothing in the
66
+ * field emits the older shapes; until then this route is closed against a stock client and open to
67
+ * one that deliberately strips the field.
68
+ */
69
+ export declare const PARK_ENVELOPE_VERSION_S1SIG = 4;
47
70
  export interface ParkEnvelope {
48
71
  /** 1 = legacy/unsigned (bare content or the pre-SEC-1 shape). 2 = signed. */
49
72
  version: number;
@@ -53,8 +76,16 @@ export interface ParkEnvelope {
53
76
  structure2Cbor?: Uint8Array;
54
77
  /** SEC-1 — the sender's identity key. Present only on v2. */
55
78
  senderPubkey?: Uint8Array;
56
- /** SEC-1 — Ed25519 over buildParkContentTbs(...). Present on v2 and v3. */
79
+ /** SEC-1 — Ed25519 over buildParkContentTbs(...). Present on v2, v3 and v4. */
57
80
  parkSig?: Uint8Array;
81
+ /**
82
+ * 034-CARRYLEAF — the sender's Ed25519 signature over `structure1Cbor`. Present only on v4.
83
+ *
84
+ * DISTINCT FROM `parkSig`, which signs `(session_id, recipient_pubkey, content_hash)`. This one
85
+ * signs the ordering claim itself, which is the only form the relay will accept when the recipient
86
+ * witnesses a leaf on its author's behalf.
87
+ */
88
+ structure1Signature?: Uint8Array;
58
89
  /**
59
90
  * The algorithm the sender used for `content_hash`. Present only on v3.
60
91
  *
@@ -64,6 +95,15 @@ export interface ParkEnvelope {
64
95
  * said nothing" — the same collapse B1's empty-string case exists to prevent.
65
96
  */
66
97
  contentHashAlg?: string;
98
+ /**
99
+ * 034-CARRYLEAF — the leaf DOMAIN this content belongs to (0x00 msg, 0x04 doc, …). Present only
100
+ * on v4.
101
+ *
102
+ * A leaf kind selects a hash domain, and documents ride this same envelope. Witnessing a recovered
103
+ * leaf under a guessed domain would put a wrong statement in the canonical record, so a recipient
104
+ * that does not see this does not witness at all.
105
+ */
106
+ leafKind?: number;
67
107
  }
68
108
  export type ParkAuthFailure = "unsigned_envelope" | "bad_signature" | "signer_not_counterparty" | "counterparty_unknown";
69
109
  export type ParkAuthVerdict = {
@@ -126,6 +166,16 @@ export declare function encodeParkEnvelope(args: {
126
166
  structure2Cbor?: Uint8Array;
127
167
  /** Omit, or pass the default, to emit a v2 envelope every current peer can read. */
128
168
  contentHashAlg?: string;
169
+ /**
170
+ * 034-CARRYLEAF — the sender's signature over `structure1Cbor`, which promotes the envelope to v4.
171
+ *
172
+ * It is what lets the RECIPIENT witness this leaf when the sender did not: the relay accepts a
173
+ * counter-submit only against the author's own signature over their own ordering claim, and
174
+ * `parkSig` signs a different statement.
175
+ */
176
+ structure1Signature?: Uint8Array;
177
+ /** The leaf domain, carried on v4 so a recovered leaf is never witnessed under a guessed one. */
178
+ leafKind?: number;
129
179
  }): Uint8Array;
130
180
  /**
131
181
  * SEC-1 — THE ONLY PRODUCER. Sign the entry as the sending agent, wrap it in a v2 envelope, and seal
@@ -147,6 +197,13 @@ export declare function sealParkEnvelope(args: {
147
197
  content: Uint8Array;
148
198
  structure1Cbor?: Uint8Array;
149
199
  structure2Cbor?: Uint8Array;
200
+ /**
201
+ * 034-CARRYLEAF — the sender's signature over `structure1Cbor`. Passing it promotes the envelope
202
+ * to v4 and is what lets the RECIPIENT witness this leaf if the sender never does.
203
+ */
204
+ structure1Signature?: Uint8Array;
205
+ /** The leaf domain, carried on v4 so a recovered leaf is never witnessed under a guessed one. */
206
+ leafKind?: number;
150
207
  /** The algorithm behind `contentHash`. Omit for the default; see `PARK_ENVELOPE_VERSION_ALG`. */
151
208
  contentHashAlg?: string;
152
209
  }): Promise<Uint8Array>;
@@ -1 +1 @@
1
- {"version":3,"file":"park-envelope.d.ts","sourceRoot":"","sources":["../src/park-envelope.ts"],"names":[],"mappings":"AA8BA,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAInF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAW3F;AAED,sGAAsG;AACtG,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAY3C,MAAM,WAAW,YAAY;IAC3B,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,UAAU,CAAC;IACpB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,6DAA6D;IAC7D,YAAY,CAAC,EAAE,UA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,GAAG,SAAS,CAAC;CAC3C,GAAG,eAAe,CA8BlB;AAGD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CA4C9G"}
@@ -90,6 +90,31 @@ export const PARK_ENVELOPE_VERSION = 2;
90
90
  * that, because "only a refusal" is a claim rather than a hope.
91
91
  */
92
92
  export const PARK_ENVELOPE_VERSION_ALG = 3;
93
+ /**
94
+ * v4 — a v3 envelope plus THE SENDER'S SIGNATURE OVER `structure1Cbor` (034-CARRYLEAF review F1).
95
+ *
96
+ * ⚠️ **WITHOUT IT, A WITHHELD MESSAGE THAT ARRIVES BY MAILBOX CANNOT BE WITNESSED, and the
97
+ * withholding attack stays open on that route.**
98
+ *
99
+ * The direct path closed it: a message arriving with no relay ordering record is witnessed by its
100
+ * RECIPIENT, using the author's own signature carried beside the bytes it signs. The mailbox route
101
+ * had no such field — this envelope carried `structure1Cbor` and no signature over it, because
102
+ * `parkSig` covers `(session_id, recipient_pubkey, content_hash)`, a different statement. So the
103
+ * recipient held the author's words and nothing the relay would accept as proof of them, and a
104
+ * counterparty who parked instead of hand-delivering still truncated the record.
105
+ *
106
+ * The algorithm rides at index 6 exactly as on v3 and is ALWAYS present here, so the shape is a
107
+ * clean superset rather than a second optional tail nobody can parse positionally.
108
+ *
109
+ * **This is the emit half only.** A v2 or v3 envelope is still accepted — refusing one would destroy
110
+ * store-and-forward mail already sitting in every relay mailbox, which is the failure
111
+ * `SIGNED_ENVELOPE_VERSIONS` exists to prevent. Requiring v4 is a later step, once nothing in the
112
+ * field emits the older shapes; until then this route is closed against a stock client and open to
113
+ * one that deliberately strips the field.
114
+ */
115
+ export const PARK_ENVELOPE_VERSION_S1SIG = 4;
116
+ /** The message leaf domain — the default a v4 envelope names when its caller does not. */
117
+ const LEAF_KIND_MSG_DOMAIN = 0x00;
93
118
  /**
94
119
  * The versions that carry a sender signature and may therefore be authenticated.
95
120
  *
@@ -98,7 +123,11 @@ export const PARK_ENVELOPE_VERSION_ALG = 3;
98
123
  * 3 would have turned every v2 envelope sitting in every relay mailbox into `unsigned_envelope`:
99
124
  * store-and-forward mail destroyed, and reported as an attack.
100
125
  */
101
- const SIGNED_ENVELOPE_VERSIONS = new Set([PARK_ENVELOPE_VERSION, PARK_ENVELOPE_VERSION_ALG]);
126
+ const SIGNED_ENVELOPE_VERSIONS = new Set([
127
+ PARK_ENVELOPE_VERSION,
128
+ PARK_ENVELOPE_VERSION_ALG,
129
+ PARK_ENVELOPE_VERSION_S1SIG,
130
+ ]);
102
131
  /**
103
132
  * Why this build refused to SEAL an entry — the producer side, distinct from `ParkAuthFailure`,
104
133
  * which is why it refused to ACCEPT one.
@@ -169,6 +198,21 @@ export function encodeParkEnvelope(args) {
169
198
  * tamper on a message nobody touched.
170
199
  */
171
200
  const alg = args.contentHashAlg;
201
+ /**
202
+ * v4 WHEN THE ORDERING CLAIM IS SIGNED — 034-CARRYLEAF. Checked before the algorithm branches,
203
+ * because v4 always carries the algorithm slot and a v2/v3 decision would drop the signature.
204
+ * Both fields must be present: a signature with no claim to check it against is not evidence.
205
+ */
206
+ if (args.structure1Signature && args.structure1Cbor) {
207
+ const named = alg === undefined || alg === null ? CONTENT_HASH_ALGS.SHA256 : alg;
208
+ if (!isKnownContentHashAlg(named)) {
209
+ throw new ParkEnvelopeError(PARK_ENVELOPE_REASONS.ALG_UNREADABLE, named, `PARK ENVELOPE: refusing to seal an entry naming content-hash algorithm "${named}", which ` +
210
+ "this build cannot itself reproduce.");
211
+ }
212
+ return encodeCbor([
213
+ PARK_ENVELOPE_VERSION_S1SIG, ...base, named, args.structure1Signature, args.leafKind ?? LEAF_KIND_MSG_DOMAIN,
214
+ ]);
215
+ }
172
216
  if (alg === undefined || alg === null || alg === CONTENT_HASH_ALGS.SHA256) {
173
217
  return encodeCbor([PARK_ENVELOPE_VERSION, ...base]);
174
218
  }
@@ -206,6 +250,8 @@ export async function sealParkEnvelope(args) {
206
250
  content: args.content,
207
251
  structure1Cbor: args.structure1Cbor,
208
252
  structure2Cbor: args.structure2Cbor,
253
+ structure1Signature: args.structure1Signature,
254
+ leafKind: args.leafKind,
209
255
  senderPubkey,
210
256
  parkSig,
211
257
  contentHashAlg: args.contentHashAlg,
@@ -223,6 +269,20 @@ export function decodeParkEnvelope(plaintext) {
223
269
  try {
224
270
  const arr = cborDecode(plaintext);
225
271
  // v3 first: a v2 envelope plus the content-hash algorithm as a 7th element.
272
+ // v4 FIRST — longest shape first, so a v4 array can never be read as a shorter one.
273
+ if (Array.isArray(arr) && arr.length === 9 && arr[0] === PARK_ENVELOPE_VERSION_S1SIG && arr[1] instanceof Uint8Array) {
274
+ return {
275
+ version: PARK_ENVELOPE_VERSION_S1SIG,
276
+ content: arr[1],
277
+ structure1Cbor: arr[2] instanceof Uint8Array ? arr[2] : undefined,
278
+ structure2Cbor: arr[3] instanceof Uint8Array ? arr[3] : undefined,
279
+ senderPubkey: arr[4] instanceof Uint8Array ? arr[4] : undefined,
280
+ parkSig: arr[5] instanceof Uint8Array ? arr[5] : undefined,
281
+ contentHashAlg: typeof arr[6] === "string" ? arr[6] : undefined,
282
+ structure1Signature: arr[7] instanceof Uint8Array ? arr[7] : undefined,
283
+ leafKind: typeof arr[8] === "number" ? arr[8] : undefined,
284
+ };
285
+ }
226
286
  if (Array.isArray(arr) && arr.length === 7 && arr[0] === PARK_ENVELOPE_VERSION_ALG && arr[1] instanceof Uint8Array) {
227
287
  return {
228
288
  version: PARK_ENVELOPE_VERSION_ALG,
@@ -1 +1 @@
1
- {"version":3,"file":"park-envelope.js","sourceRoot":"","sources":["../src/park-envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,QAAQ,CA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b,KAAK,KAAK,mBAAmB,CAAC,YAAY;QACxC,CAAC,CAAC,0LAA0L,mBAAmB,CAAC,YAAY,CAAC,GAAG;QAChO,CAAC,CAAC,KAAK,KAAK,mBAAmB,CAAC,cAAc;YAC5C,CAAC,CAAC,uRAAuR;YACzR,CAAC,CAAC,KAAK,KAAK,mBAAmB,CAAC,UAAU;gBACxC,CAAC,CAAC,6LAA6L;gBAC/L,CAAC,CAAC,IAAI,CAAC;IAEf,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,OAAO;YACZ,CAAC,CAAC,GAAG,SAAS,qHAAqH;YACnI,CAAC,CAAC,GAAG,SAAS,kEAAkE,CAAC;IACrF,CAAC;IAED,OAAO,OAAO;QACZ,CAAC,CAAC,sNAAsN;QACxN,CAAC,CAAC,mGAAmG,CAAC;AAC1G,CAAC;AAGD;;;;;;;;GAQG;AACH,SAAS,mBAAmB,CAAC,YAAgC;IAC3D,IAAI,YAAY,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACjG,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC/C,OAAO,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,aAAa,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC,UAAU,CAAC;AACxH,CAAC"}
@@ -122,4 +122,25 @@ export type AnyRefusalReason = RefusalReason | CapacityReason;
122
122
  * `session_refused` frame, which goes to the side that can act on it.
123
123
  */
124
124
  export declare const REFUSAL_GUIDANCE: Record<RefusalReason, string>;
125
+ /**
126
+ * 033-ACKEMIT — what the operator is told when the RELAY refuses to witness a message because the
127
+ * acknowledgement this daemon signed contradicts the relay's own record.
128
+ *
129
+ * ⚠️ **A PURE FUNCTION, AND THAT IS THE POINT.** The two sentences it returns lived inline at the
130
+ * one call site, which sits behind a real relay answering a real `hash_submit_error` — so nothing in
131
+ * the suite could reach them, and the guard's own comment invoked the "a refusal nobody hears"
132
+ * pattern while being, itself, untestable. Review F6 then found the `relay_fault` remedy naming a
133
+ * move that does not exist ("sending again usually picks a healthy one" — a session keeps the relay
134
+ * its assignment names, and there is no handover anywhere). Pulling the text out is what lets a test
135
+ * hold it.
136
+ *
137
+ * `relayFault` is `ack_hash_unverifiable`: the relay's counter reached a position its own leaf log
138
+ * did not, which is a fault on the relay and NOT something either participant did. It is separate
139
+ * from a mismatch for that reason — sending an operator to ask their counterparty about a problem
140
+ * the witness caused spends their attention on the wrong party.
141
+ */
142
+ export declare function relayAckHashRefusalNotice(relayFault: boolean, mailboxRouteAvailable: boolean): {
143
+ impact: string;
144
+ guidance: string;
145
+ };
125
146
  //# sourceMappingURL=refusal-reasons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refusal-reasons.d.ts","sourceRoot":"","sources":["../src/refusal-reasons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa;IACxB,6FAA6F;;IAE7F,2FAA2F;;IAE3F,mGAAmG;;IAEnG,gGAAgG;;IAEhG,0FAA0F;;CAElF,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE7E;;;;;;;GAOG;AACH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,QAQoC,CAAC;AAExE,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAsD7D,CAAC;AAEF,eAAO,MAAM,eAAe;IAC1B,4FAA4F;;IAE5F,6FAA6F;;IAE7F,gFAAgF;;CAExE,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAA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BAAgB,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,cAAc,CAAC;AAE9D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAoB1D,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,OAAO,EAAE,qBAAqB,EAAE,OAAO,GAAG;IAC9F,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CASA"}
@@ -175,4 +175,31 @@ export const REFUSAL_GUIDANCE = {
175
175
  "start a new one. If it repeats for the SAME counterparty, do not accept anything from them " +
176
176
  "until you have confirmed out of band that they still control the identity you know them by.",
177
177
  };
178
+ /**
179
+ * 033-ACKEMIT — what the operator is told when the RELAY refuses to witness a message because the
180
+ * acknowledgement this daemon signed contradicts the relay's own record.
181
+ *
182
+ * ⚠️ **A PURE FUNCTION, AND THAT IS THE POINT.** The two sentences it returns lived inline at the
183
+ * one call site, which sits behind a real relay answering a real `hash_submit_error` — so nothing in
184
+ * the suite could reach them, and the guard's own comment invoked the "a refusal nobody hears"
185
+ * pattern while being, itself, untestable. Review F6 then found the `relay_fault` remedy naming a
186
+ * move that does not exist ("sending again usually picks a healthy one" — a session keeps the relay
187
+ * its assignment names, and there is no handover anywhere). Pulling the text out is what lets a test
188
+ * hold it.
189
+ *
190
+ * `relayFault` is `ack_hash_unverifiable`: the relay's counter reached a position its own leaf log
191
+ * did not, which is a fault on the relay and NOT something either participant did. It is separate
192
+ * from a mismatch for that reason — sending an operator to ask their counterparty about a problem
193
+ * the witness caused spends their attention on the wrong party.
194
+ */
195
+ export function relayAckHashRefusalNotice(relayFault, mailboxRouteAvailable) {
196
+ const impact = relayFault
197
+ ? "the relay could not check what this agent said it had received, so it did not witness this message. The message was still sent; it has no place in the notarized record."
198
+ : "the relay REFUSED to witness this message: what this agent signed as the last thing it received from your counterparty does not match what the relay recorded at that position. The message was still sent, and it has no place in the notarized record. Your copy of this conversation and the witness's copy have stopped agreeing.";
199
+ const guidance = relayFault
200
+ ? "Nothing to change on your machine — the fault is on the relay this session is bound to, and it cannot be moved: a session keeps the relay its assignment names. Your messages still reach your counterparty; what stops is the notarized record growing. Close the session (cello_close_session) while its record is still worth notarizing, and open a new one, which will be assigned a relay afresh."
201
+ : "Do NOT rely on a receipt for this conversation until this stops. Send one more message: if it is witnessed, this was a one-off. If it repeats, the two records genuinely disagree — confirm what your counterparty actually sent you OUT OF BAND, then close this session and open a new one." +
202
+ (mailboxRouteAvailable ? "" : "");
203
+ return { impact, guidance };
204
+ }
178
205
  //# sourceMappingURL=refusal-reasons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"refusal-reasons.js","sourceRoot":"","sources":["../src/refusal-reasons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,6FAA6F;IAC7F,OAAO,EAAE,SAAS;IAClB,2FAA2F;IAC3F,OAAO,EAAE,SAAS;IAClB,mGAAmG;IACnG,QAAQ,EAAE,UAAU;IACpB,gGAAgG;IAChG,IAAI,EAAE,MAAM;IACZ,0FAA0F;IAC1F,QAAQ,EAAE,UAAU;CACZ,CAAC;AAIX;;;;;;;GAOG;AACH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,sBAAsB,GACjC,+FAA+F;IAC/F,iGAAiG;IACjG,0FAA0F;IAC1F,gGAAgG;IAChG,kGAAkG;IAClG,+FAA+F;IAC/F,4FAA4F;IAC5F,qEAAqE,CAAC;AAExE,MAAM,CAAC,MAAM,qBAAqB,GAAgC;IAChE;;;;OAIG;IACH,CAAC,aAAa,CAAC,OAAO,CAAC;IACrB;;;;;;;;;OASG;IACH,2FAA2F;QAC3F;;;;;;;;;WASG;QACH,oEAAoE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e,GAAG;IAC7B,4FAA4F;IAC5F,gCAAgC,EAAE,kCAAkC;IACpE,6FAA6F;IAC7F,gCAAgC,EAAE,kCAAkC;IACpE,gFAAgF;IAChF,0BAA0B,EAAE,4BAA4B;CAChD,CAAC;AAIX;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,+BAA+B,EAAE,iCAAiC;IAClE,mCAAmC,EAAE,qCAAqC;CAClE,CAAC;AAuBX;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkC;IAC7D,CAAC,eAAe,CAAC,gCAAgC,CAAC,EAChD,8FAA8F;QAC9F,+FAA+F;QAC/F,8FAA8F;QAC9F,6FAA6F;QAC7F,mEAAmE;IACrE,CAAC,eAAe,CAAC,gCAAgC,CAAC,EAChD,gGAAgG;QAChG,gGAAgG;QAChG,6FAA6F;QAC7F,+FAA+F;QAC/F,gGAAgG;QAChG,0FAA0F;IAC5F,CAAC,eAAe,CAAC,0BAA0B,CAAC,EAC1C,2FAA2F;QAC3F,+FAA+F;QAC/F,6FAA6F;QAC7F,6FAA6F;QAC7F,6FAA6F;CAChG,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAmB,EAAE,qBAA8B;IAI3F,MAAM,MAAM,GAAG,UAAU;QACvB,CAAC,CAAC,0KAA0K;QAC5K,CAAC,CAAC,uUAAuU,CAAC;IAC5U,MAAM,QAAQ,GAAG,UAAU;QACzB,CAAC,CAAC,yYAAyY;QAC3Y,CAAC,CAAC,+RAA+R;YAC/R,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
@@ -80,10 +80,26 @@ export declare class SessionConnectionGater implements ConnectionGater {
80
80
  */
81
81
  closeInbound(): void;
82
82
  /**
83
- * Record that this receiver now holds a LIVE circuit reservation with `peerId`, which is what
84
- * earns that relay the inbound AutoNAT carve-out. Pass null when the reservation is lost.
83
+ * Record the relays this receiver holds LIVE circuit reservations with the only peers that earn
84
+ * the inbound AutoNAT carve-out.
85
+ *
86
+ * REPLACES the set rather than adding to it. A relay absent from `peerIds` loses its carve-out in
87
+ * the same call that notices the reservation is gone, so the bound stays "holds one now" and
88
+ * cannot drift into "granted one once". Pass `[]` when nothing is held.
89
+ */
90
+ /**
91
+ * Does this relay hold the inbound carve-out — i.e. would this gater ADMIT an inbound dial from
92
+ * it on the strength of a live reservation?
93
+ *
94
+ * **This IS the carve-out branch**, not a description of it: `denyInboundEncryptedConnection`
95
+ * calls this method rather than re-testing the set. One definition, so nothing observing the gate
96
+ * can be told something different from what the gate does — which matters because the review
97
+ * found that substituting the CANDIDATE list for the held list at the manager's
98
+ * `setReservedRelayPeers` call left every test in this unit green while opening exactly the hole
99
+ * the bound exists to close. Read-only and silent: an observation must not log a refusal.
85
100
  */
86
- setReservedRelayPeer(peerId: string | null): void;
101
+ holdsInboundCarveOut(peerId: string): boolean;
102
+ setReservedRelayPeers(peerIds: readonly string[]): void;
87
103
  /**
88
104
  * M7 DOD-SPINE-6: permit an OUTBOUND connection to a relay peer (the assigned
89
105
  * witness, a reservation relay, or the relay inside the counterparty's circuit
@@ -1 +1 @@
1
- {"version":3,"file":"session-connection-gater.d.ts","sourceRoot":"","sources":["../src/session-connection-gater.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CA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H,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI5C;;;;;;;;OAQG;IACH,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAI9C,YAAY,IAAI,MAAM;IAItB,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAIjC;;;;OAIG;IACH,8BAA8B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO;IAIrF;;;;OAIG;IACH,+BAA+B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO;CA8FvF;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,YAAW,eAAe;;gBAIlD,QAAQ,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM;IAK7D,8BAA8B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO;IAIrF,+BAA+B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO;CAgBvF"}
@@ -76,7 +76,7 @@ export class SessionConnectionGater {
76
76
  */
77
77
  #standingReceiverOutbound;
78
78
  /**
79
- * The ONE relay this receiver currently holds a live circuit reservation with, or null.
79
+ * The relays this receiver currently holds a live circuit reservation with. Empty by default.
80
80
  *
81
81
  * Review N3. The inbound AutoNAT carve-out below first keyed on `#allowedOutboundPeerIds`, and
82
82
  * that set is populated from the relay peer ids **the directory hands out at signaling-auth
@@ -84,11 +84,18 @@ export class SessionConnectionGater {
84
84
  * entire threat model is "one compromised directory", that handed the adversary back a narrow
85
85
  * inbound foothold: name a relay, never complete a reservation, and dial in anyway.
86
86
  *
87
- * A single slot, set only when a reservation actually succeeds, is the honest version of the
87
+ * Entries added ONLY when a reservation actually succeeded is the honest version of the
88
88
  * justification the carve-out's comment makes — "a peer this node already dials and holds a
89
89
  * reservation with" — rather than a set that merely tends to contain those.
90
+ *
91
+ * 032-RELAYSPREAD widened this from ONE peer to a set, because the receiver now holds a
92
+ * reservation with every relay that will grant one. **The BOUND did not widen with it, and that
93
+ * is the security-sensitive part**: membership is still "this relay's own reservation is
94
+ * confirmed held", never "this relay is in the pool". Widening it to the candidate list would
95
+ * let a directory that merely NAMES a relay dial in behind the gate — the exact failure the
96
+ * single-relay version was written to prevent, multiplied by the size of the pool.
90
97
  */
91
- #reservedRelayPeerId = null;
98
+ #reservedRelayPeerIds = new Set();
92
99
  constructor(opts) {
93
100
  this.#sessionId = opts.sessionId;
94
101
  this.#allowedPeerId = opts.allowedPeerId;
@@ -129,11 +136,31 @@ export class SessionConnectionGater {
129
136
  this.#allowedPeerId = null;
130
137
  }
131
138
  /**
132
- * Record that this receiver now holds a LIVE circuit reservation with `peerId`, which is what
133
- * earns that relay the inbound AutoNAT carve-out. Pass null when the reservation is lost.
139
+ * Record the relays this receiver holds LIVE circuit reservations with the only peers that earn
140
+ * the inbound AutoNAT carve-out.
141
+ *
142
+ * REPLACES the set rather than adding to it. A relay absent from `peerIds` loses its carve-out in
143
+ * the same call that notices the reservation is gone, so the bound stays "holds one now" and
144
+ * cannot drift into "granted one once". Pass `[]` when nothing is held.
145
+ */
146
+ /**
147
+ * Does this relay hold the inbound carve-out — i.e. would this gater ADMIT an inbound dial from
148
+ * it on the strength of a live reservation?
149
+ *
150
+ * **This IS the carve-out branch**, not a description of it: `denyInboundEncryptedConnection`
151
+ * calls this method rather than re-testing the set. One definition, so nothing observing the gate
152
+ * can be told something different from what the gate does — which matters because the review
153
+ * found that substituting the CANDIDATE list for the held list at the manager's
154
+ * `setReservedRelayPeers` call left every test in this unit green while opening exactly the hole
155
+ * the bound exists to close. Read-only and silent: an observation must not log a refusal.
134
156
  */
135
- setReservedRelayPeer(peerId) {
136
- this.#reservedRelayPeerId = peerId;
157
+ holdsInboundCarveOut(peerId) {
158
+ return this.#standingReceiverOutbound && this.#reservedRelayPeerIds.has(peerId);
159
+ }
160
+ setReservedRelayPeers(peerIds) {
161
+ this.#reservedRelayPeerIds.clear();
162
+ for (const peerId of peerIds)
163
+ this.#reservedRelayPeerIds.add(peerId);
137
164
  }
138
165
  /**
139
166
  * M7 DOD-SPINE-6: permit an OUTBOUND connection to a relay peer (the assigned
@@ -235,14 +262,16 @@ export class SessionConnectionGater {
235
262
  * breaks INV-5 — a SESSION node admits exactly one counterparty, and the existing tests say so
236
263
  * in those words. A promoted node has no AutoNAT probe to answer, so it needs nothing here.
237
264
  *
238
- * To the ONE RELAY HOLDING A LIVE RESERVATION (`#reservedRelayPeerId`), not the outbound
265
+ * To THE RELAYS HOLDING A LIVE RESERVATION (`#reservedRelayPeerIds`), not the outbound
239
266
  * allowlist. That allowlist is built from relay peer ids the DIRECTORY supplies, cumulatively,
240
267
  * including ones whose reservation never completed — so keying on it let a compromised
241
268
  * directory name a relay and dial in without ever holding a reservation. In a unit whose threat
242
- * model is exactly that adversary, the set was the wrong thing to trust.
269
+ * model is exactly that adversary, the outbound allowlist was the wrong thing to trust, and it
270
+ * still is: this set holds only relays whose own reservation was confirmed, however many relays
271
+ * the pool names.
243
272
  */
244
- if (direction === "inbound" && this.#standingReceiverOutbound && peerId.toString() === this.#reservedRelayPeerId) {
245
- return false; // allow — the relay we hold a live reservation with, answering a probe we started
273
+ if (direction === "inbound" && this.holdsInboundCarveOut(peerId.toString())) {
274
+ return false; // allow — a relay we hold a live reservation with, answering a probe we started
246
275
  }
247
276
  if (this.#allowedPeerId === null) {
248
277
  if (direction === "outbound")
@@ -1 +1 @@
1
- {"version":3,"file":"session-connection-gater.js","sourceRoot":"","sources":["../src/session-connection-gater.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAcH,gFAAgF;AAChF,MAAM,OAAO,iCAAiC;IAC5C,eAAe,CAAC,OAAe;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,uEAAuE;AACvE,MAAM,OAAO,4BAA4B;IACvC,eAAe,CAAC,OAAe;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;CACF;A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SAAS;YAC1B,cAAc,EAAE,sBAAsB;SACvC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,CAAC,OAAO;IACtB,CAAC;CACF"}
1
+ {"version":3,"file":"session-connection-gater.js","sourceRoot":"","sources":["../src/session-connection-gater.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAcH,gFAAgF;AAChF,MAAM,OAAO,iCAAiC;IAC5C,eAAe,CAAC,OAAe;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,uEAAuE;AACvE,MAAM,OAAO,4BAA4B;IACvC,eAAe,CAAC,OAAe;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,sBAAsB;IACjC,cAAc,CAAgB;IAC9B;;;;;;;;;OASG;IACM,uBAAuB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5C,UAAU,CAAS;IACnB,OAAO,CAAS;IAEzB;;;;;;;;;;;;;;;;OAgBG;IACH,yBAAyB,CAAU;IAEnC;;;;;;;;;;;;;;;;;;;OAmBG;IACM,qBAAqB,GAAG,IAAI,GAAG,EAAU,CAAC;IAEnD,YAAY,IAIX;QACC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,gGAAgG;QAChG,iGAAiG;QACjG,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC;QAC7D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,MAAc;QAC3B,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;QAC7B,IAAI,CAAC,yBAAyB,GAAG,KAAK,CAAC;IACzC,CAAC;IAED;;;;;;OAMG;IACH,gBAAgB,CAAC,MAAc;QAC7B,IAAI,CAAC,cAAc,GAA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AO,wBAAwB;IAC1B,SAAS,CAA0B;IACnC,OAAO,CAAS;IAEzB,YAAY,QAAiC,EAAE,MAAc;QAC3D,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,8BAA8B,CAAC,MAAc,EAAE,OAA4B;QACzE,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,+BAA+B,CAAC,MAAc,EAAE,OAA4B;QAC1E,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,mBAAmB,CAAC,MAAc;QAChC,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9C,OAAO,KAAK,CAAC,CAAC,QAAQ;QACxB,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kCAAkC,EAAE;YACpD,SAAS,EAAE,sBAAsB;YACjC,eAAe,EAAE,SAAS;YAC1B,cAAc,EAAE,sBAAsB;SACvC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,CAAC,OAAO;IACtB,CAAC;CACF"}
@@ -410,6 +410,35 @@ export interface SentAuthorship {
410
410
  senderPubkey: Uint8Array;
411
411
  senderSig: Uint8Array;
412
412
  }
413
+ /**
414
+ * ─── 033-ACKEMIT: the three things that can be wrong with an ACKNOWLEDGEMENT ─────────────────────
415
+ *
416
+ * All three are `unusable` — the message is refused and the session lives. None of them is an
417
+ * identity fault: by the time any is returned the signature has verified, the signer IS this
418
+ * session's counterparty, and the claim is about this content in this conversation. What is wrong is
419
+ * what the claim says the sender had SEEN.
420
+ *
421
+ * They are three names and not one because the operator's next move differs for each, and because an
422
+ * investigator who cannot tell "your counterparty is on an older build" from "your counterparty
423
+ * acknowledged something you never sent" is looking at the wrong half of the problem.
424
+ *
425
+ * ⚠️ **NAME WHAT WAS OBSERVED, NEVER AN INFERRED CONCLUSION** (`DOD-M15-ERRSTRING-1`). Not one of
426
+ * these says "peer is malicious" — a mismatch is equally what a genuine software fault on the other
427
+ * side looks like, and an error that names a party the code did not check is this milestone's
428
+ * founding defect.
429
+ */
430
+ /** A v1 claim: it carries no `last_seen_hash`, so it asserts a POSITION and no content at all. */
431
+ declare const AUTHORSHIP_ACK_HASH_ABSENT = "ack_hash_absent";
432
+ /** The hash names content this side does not hold at the position the claim names. */
433
+ declare const AUTHORSHIP_ACK_HASH_MISMATCH = "ack_hash_mismatch";
434
+ /** The hash names content this side has never held — not in the tree, and not held pending a gap. */
435
+ declare const AUTHORSHIP_ACK_HASH_UNKNOWN = "ack_hash_unknown_content";
436
+ /**
437
+ * The set that routes an `unusable` reason to the acknowledgement wording rather than the generic
438
+ * one. A SET, not a string prefix test: a name-shaped check would silently adopt any future reason
439
+ * someone happens to call `ack_*`, and give it a sentence written for these four.
440
+ */
441
+ export type AckHashReason = typeof AUTHORSHIP_ACK_HASH_ABSENT | typeof AUTHORSHIP_ACK_HASH_MISMATCH | typeof AUTHORSHIP_ACK_HASH_UNKNOWN;
413
442
  /**
414
443
  * One row of a session's durable transcript as a reader sees it.
415
444
  *
@@ -601,6 +630,8 @@ export declare class SessionNodeManager {
601
630
  content: Uint8Array;
602
631
  structure1Cbor?: Uint8Array;
603
632
  structure2Cbor?: Uint8Array;
633
+ structure1Signature?: Uint8Array;
634
+ leafKind?: number;
604
635
  contentHashAlg: string | undefined;
605
636
  }) => Promise<{
606
637
  ok: true;
@@ -1101,6 +1132,19 @@ export declare class SessionNodeManager {
1101
1132
  * counterparty_session_* fields. Read-only — does NOT consume the standing receiver
1102
1133
  * (unlike acceptSession, which hands it off).
1103
1134
  */
1135
+ /**
1136
+ * 032-RELAYSPREAD — would this receiver ADMIT an inbound dial from this relay?
1137
+ *
1138
+ * The gater's inbound carve-out is the security-sensitive half of the spread: only relays whose
1139
+ * own reservation is confirmed held earn it, so a directory that merely NAMES a relay cannot dial
1140
+ * in behind the gate. Nothing could observe that from outside the manager, and the review found
1141
+ * the consequence: substituting the CANDIDATE list for the held list at the `setReservedRelayPeers`
1142
+ * call kept every test in the unit green while shipping exactly that hole. A guard whose wiring
1143
+ * cannot be observed is a guard nothing can test.
1144
+ *
1145
+ * Reads the live gater rather than a copy, so it cannot drift from what the gate actually does.
1146
+ */
1147
+ isRelayCarvedOutInbound(agentName: string, relayPeerId: string): boolean;
1104
1148
  getStandingReceiverInfo(agentName: string): {
1105
1149
  peerId: string;
1106
1150
  addrs: string[];
@@ -1728,11 +1772,6 @@ export declare class SessionNodeManager {
1728
1772
  relayPeerId: string;
1729
1773
  relayAddrs: string[];
1730
1774
  }>;
1731
- /**
1732
- * Return the daemon-owned Merkle tree for a session, loading it from SQLite
1733
- * on first access (so it survives a restart — AC-007). Never returns null;
1734
- * an unknown session yields an empty tree.
1735
- */
1736
1775
  getSessionTree(agentName: string, sessionId: string): SessionTree;
1737
1776
  /** Current daemon-owned tree root for a session, as hex. */
1738
1777
  getSessionTreeRootHex(agentName: string, sessionId: string): string;
@@ -2428,6 +2467,31 @@ export declare class SessionNodeManager {
2428
2467
  * itself drive the real signed frames and must not use this.
2429
2468
  */
2430
2469
  setSessionContentKeyForTest(agentName: string, sessionId: string, key: Uint8Array): void;
2470
+ /**
2471
+ * Test seam: put an own leaf in the HELD state instead of the tree — 033-ACKEMIT.
2472
+ *
2473
+ * The state `placeOwnLeaf` produces when the relay assigns a position ahead of our tail: the leaf
2474
+ * exists on this side and is not in the tree, while the counterparty already has it from the relay
2475
+ * and can acknowledge it. Reproducing it through the real hold map rather than by asserting the
2476
+ * tree is short is what makes the acknowledgement test measure the case instead of a neighbour of
2477
+ * it.
2478
+ */
2479
+ holdOwnLeafForTest(agentName: string, sessionId: string, canonicalSeq: number, contentHashHex: string): void;
2480
+ /**
2481
+ * Test seam: put the session's genesis prev_root where a completed session open leaves it —
2482
+ * 033-ACKEMIT.
2483
+ *
2484
+ * ⚠️ THE STATE IS THE PRODUCTION ONE; ONLY HOW IT GOT THERE IS SHORT-CIRCUITED, exactly as
2485
+ * `setSessionContentKeyForTest` short-circuits the key exchange next door.
2486
+ *
2487
+ * In production this value is derived from the directory-signed relay assignment and written to
2488
+ * the session row the moment the session learns it, so every real session has one. A fixture that
2489
+ * builds a session node directly never sees an assignment — so without this seam every content
2490
+ * test built on the fixture would be exercising the "no starting point" REFUSAL path instead of
2491
+ * the thing it was written for, and would report that as a pass or a mysterious failure depending
2492
+ * on which side of the send it sat on.
2493
+ */
2494
+ setSessionGenesisForTest(agentName: string, sessionId: string, genesis: Uint8Array): void;
2431
2495
  /**
2432
2496
  * Test seam: drop the agreed key while leaving the session up — the state before an exchange
2433
2497
  * completes, and after a teardown evicts one. Its mirror above is what a completed exchange