@cello-protocol/protocol-types 0.0.43 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cbor.d.ts +16 -0
- package/dist/cbor.d.ts.map +1 -1
- package/dist/cbor.js +56 -0
- package/dist/cbor.js.map +1 -1
- package/dist/document-ack.d.ts +111 -0
- package/dist/document-ack.d.ts.map +1 -0
- package/dist/document-ack.js +228 -0
- package/dist/document-ack.js.map +1 -0
- package/dist/document-control.d.ts +74 -0
- package/dist/document-control.d.ts.map +1 -0
- package/dist/document-control.js +174 -0
- package/dist/document-control.js.map +1 -0
- package/dist/document-proposal-ack.d.ts +98 -0
- package/dist/document-proposal-ack.d.ts.map +1 -0
- package/dist/document-proposal-ack.js +203 -0
- package/dist/document-proposal-ack.js.map +1 -0
- package/dist/document-proposal.d.ts.map +1 -1
- package/dist/document-proposal.js +12 -1
- package/dist/document-proposal.js.map +1 -1
- package/dist/document-rejection-envelope.d.ts +87 -0
- package/dist/document-rejection-envelope.d.ts.map +1 -0
- package/dist/document-rejection-envelope.js +189 -0
- package/dist/document-rejection-envelope.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOD-DOC-TOOLS-1 — the document CONTROL frame: close and kill (§16.5).
|
|
3
|
+
*
|
|
4
|
+
* A unilateral end, told to the other party.
|
|
5
|
+
*
|
|
6
|
+
* ── WHY THE PEER MUST BE TOLD, AND WHY IT IS BEST-EFFORT ──────────────────────────────────────
|
|
7
|
+
*
|
|
8
|
+
* `DocumentLifecycle` already ends a document locally without asking anyone — that is deliberate: a
|
|
9
|
+
* kill is a safety verb, and a safety verb that needs the counterparty's cooperation is not one. But
|
|
10
|
+
* a peer who is never told keeps publishing into a document that will never answer. Their updates
|
|
11
|
+
* are refused at the far end forever, and nothing on their screen explains why. So the notification
|
|
12
|
+
* is REQUIRED to be attempted and ALLOWED to fail, and the operator is told which happened.
|
|
13
|
+
*
|
|
14
|
+
* ── CLOSE AND KILL ARE DIFFERENT FRAMES OF THE SAME SHAPE ─────────────────────────────────────
|
|
15
|
+
*
|
|
16
|
+
* `close` is "I am done with this, and I expect you are too" — the document settles when both sides
|
|
17
|
+
* have said it. `kill` is "this is over now", one-sided and immediate. They travel as one frame with
|
|
18
|
+
* a verb rather than two types because the receiving side's routing, verification and settle-once
|
|
19
|
+
* rules are identical, and two decoders for one shape is how the rules drift apart.
|
|
20
|
+
*
|
|
21
|
+
* The verb is REFUSED BY VALUE on decode. A third verb from a future build must not be admitted as
|
|
22
|
+
* one of these two — a `kill` silently read as a `close` would leave a killed document waiting for
|
|
23
|
+
* a reciprocal close that is never coming.
|
|
24
|
+
*
|
|
25
|
+
* ── WHY IT IS SIGNED ──────────────────────────────────────────────────────────────────────────
|
|
26
|
+
*
|
|
27
|
+
* A kill frame ends a collaboration. Unsigned, anyone reaching the channel could end any document
|
|
28
|
+
* between any two parties, and each operator would believe the other walked away. The signature
|
|
29
|
+
* covers the document id — which commits to both parties, the properties and the nonce — and the
|
|
30
|
+
* verb, because the whole statement is the claim.
|
|
31
|
+
*/
|
|
32
|
+
import { createHash } from "node:crypto";
|
|
33
|
+
import { encodeCbor, decodeCbor } from "./cbor.js";
|
|
34
|
+
/** Domain tag in slot 0. Distinct from every other document domain. */
|
|
35
|
+
export const DOCUMENT_CONTROL_DOMAIN = "CELLO-DOCUMENT-CONTROL-v1";
|
|
36
|
+
/** The frame version, ON THE WIRE, so skew is DETECTED rather than misread as a bad signature. */
|
|
37
|
+
export const DOCUMENT_CONTROL_VERSION = 1;
|
|
38
|
+
/** Peer-controlled display text bound for an operator's screen. Capped for that reason. */
|
|
39
|
+
export const MAX_CONTROL_REASON_LENGTH = 200;
|
|
40
|
+
/** The two ways a document ends. Closed set — see the header on refusing a third by value. */
|
|
41
|
+
export const DOCUMENT_CONTROL_VERBS = ["close", "kill"];
|
|
42
|
+
const HEX32 = /^[0-9a-f]{64}$/;
|
|
43
|
+
function normalizeReason(reason) {
|
|
44
|
+
return reason === undefined || reason === "" ? null : reason;
|
|
45
|
+
}
|
|
46
|
+
export function assertDocumentControlConsistent(control) {
|
|
47
|
+
if (!DOCUMENT_CONTROL_VERBS.includes(control.verb)) {
|
|
48
|
+
throw new Error(`document_control_verb: expected one of ${DOCUMENT_CONTROL_VERBS.join(", ")}, got "${control.verb}"`);
|
|
49
|
+
}
|
|
50
|
+
if (!HEX32.test(control.document_id)) {
|
|
51
|
+
throw new Error("document_control_document_id: expected 64 lowercase hex characters");
|
|
52
|
+
}
|
|
53
|
+
const reason = normalizeReason(control.reason);
|
|
54
|
+
if (reason !== null && reason.length > MAX_CONTROL_REASON_LENGTH) {
|
|
55
|
+
throw new Error(`document_control_reason: a reason may be at most ${MAX_CONTROL_REASON_LENGTH} characters, ` +
|
|
56
|
+
`and this one is ${reason.length}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The canonical to-be-signed preimage: a fixed-order CBOR ARRAY with the domain in slot 0.
|
|
61
|
+
*
|
|
62
|
+
* An array rather than a map for the reason `cbor.ts` gives — this encoder is deliberately not
|
|
63
|
+
* deterministic for maps, so a map preimage would make the signature depend on the order the sender
|
|
64
|
+
* happened to build the object in, and two honest implementations would disagree.
|
|
65
|
+
*/
|
|
66
|
+
export function buildDocumentControlTbs(control, opts = {}) {
|
|
67
|
+
assertDocumentControlConsistent(control);
|
|
68
|
+
const preimage = encodeCbor([
|
|
69
|
+
DOCUMENT_CONTROL_DOMAIN,
|
|
70
|
+
control.control_version,
|
|
71
|
+
control.document_id,
|
|
72
|
+
control.sender_agent_id,
|
|
73
|
+
// THE VERB IS SIGNED. Unsigned, a captured `close` could be replayed as a `kill` — the peer
|
|
74
|
+
// would end a collaboration the sender only meant to wind down, with a valid signature on it.
|
|
75
|
+
control.verb,
|
|
76
|
+
normalizeReason(control.reason),
|
|
77
|
+
// BIGINT past 0xffffffff — cbor-x encodes a large JS number as IEEE float64 (`fb`) rather than
|
|
78
|
+
// uint64 (`1b`), so a canonically-encoding implementation would compute different TBS bytes and
|
|
79
|
+
// reject a GENUINE frame, surfacing as a signature failure that reads as forgery.
|
|
80
|
+
typeof control.sent_at_ms === "number" && control.sent_at_ms > 0xffffffff
|
|
81
|
+
? BigInt(control.sent_at_ms)
|
|
82
|
+
: control.sent_at_ms,
|
|
83
|
+
]);
|
|
84
|
+
if (opts.preHash === false)
|
|
85
|
+
return preimage;
|
|
86
|
+
return new Uint8Array(createHash("sha256").update(preimage).digest());
|
|
87
|
+
}
|
|
88
|
+
export function encodeDocumentControl(control) {
|
|
89
|
+
assertDocumentControlConsistent(control);
|
|
90
|
+
return encodeCbor({
|
|
91
|
+
type: control.type,
|
|
92
|
+
control_version: control.control_version,
|
|
93
|
+
document_id: control.document_id,
|
|
94
|
+
sender_agent_id: control.sender_agent_id,
|
|
95
|
+
verb: control.verb,
|
|
96
|
+
reason: normalizeReason(control.reason),
|
|
97
|
+
sent_at_ms: control.sent_at_ms,
|
|
98
|
+
signature: control.signature,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function present(map, field) {
|
|
102
|
+
if (!(field in map)) {
|
|
103
|
+
throw new Error(`document_control_missing_field: ${field} is mandatory and was not present`);
|
|
104
|
+
}
|
|
105
|
+
return map[field];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Decode and validate. Refuses rather than defaulting on every field.
|
|
109
|
+
*
|
|
110
|
+
* The one that matters most is `verb`. Defaulted or coerced, a `kill` read as a `close` leaves a
|
|
111
|
+
* killed document waiting for a reciprocal close that is never coming — the operator sees a
|
|
112
|
+
* collaboration that will not settle and no reason anywhere for why.
|
|
113
|
+
*/
|
|
114
|
+
export function decodeDocumentControl(bytes) {
|
|
115
|
+
const decoded = decodeCbor(bytes);
|
|
116
|
+
if (typeof decoded !== "object" || decoded === null || Array.isArray(decoded)) {
|
|
117
|
+
throw new Error("document_control_malformed: not a CBOR map");
|
|
118
|
+
}
|
|
119
|
+
const map = decoded;
|
|
120
|
+
if (present(map, "type") !== "document_control") {
|
|
121
|
+
throw new Error("document_control_type: expected document_control");
|
|
122
|
+
}
|
|
123
|
+
const version = present(map, "control_version");
|
|
124
|
+
if (typeof version !== "number" || !Number.isInteger(version)) {
|
|
125
|
+
throw new Error("document_control_version: must be an integer");
|
|
126
|
+
}
|
|
127
|
+
if (version !== DOCUMENT_CONTROL_VERSION) {
|
|
128
|
+
throw new Error(`document_control_version_unsupported: this build speaks version ${DOCUMENT_CONTROL_VERSION} ` +
|
|
129
|
+
`and the frame declares ${version} — the peer is running a newer CELLO and one of you needs ` +
|
|
130
|
+
`to upgrade`);
|
|
131
|
+
}
|
|
132
|
+
const documentId = present(map, "document_id");
|
|
133
|
+
if (typeof documentId !== "string" || !HEX32.test(documentId)) {
|
|
134
|
+
throw new Error("document_control_document_id: expected 64 lowercase hex characters");
|
|
135
|
+
}
|
|
136
|
+
const senderAgentId = present(map, "sender_agent_id");
|
|
137
|
+
if (typeof senderAgentId !== "string" || senderAgentId.length === 0) {
|
|
138
|
+
throw new Error("document_control_sender: must be a non-empty string");
|
|
139
|
+
}
|
|
140
|
+
const verb = present(map, "verb");
|
|
141
|
+
if (typeof verb !== "string" || !DOCUMENT_CONTROL_VERBS.includes(verb)) {
|
|
142
|
+
// REFUSED BY VALUE. A third verb from a future build must not be admitted as one of these two.
|
|
143
|
+
throw new Error(`document_control_verb_unsupported: this build understands ` +
|
|
144
|
+
`${DOCUMENT_CONTROL_VERBS.join(" and ")}, and the frame says "${String(verb)}" — the peer is ` +
|
|
145
|
+
`running a newer CELLO and one of you needs to upgrade`);
|
|
146
|
+
}
|
|
147
|
+
const reason = present(map, "reason");
|
|
148
|
+
if (reason !== null && typeof reason !== "string") {
|
|
149
|
+
throw new Error("document_control_reason: must be a string or null");
|
|
150
|
+
}
|
|
151
|
+
const sentAt = present(map, "sent_at_ms");
|
|
152
|
+
if (typeof sentAt !== "number" || !Number.isFinite(sentAt)) {
|
|
153
|
+
throw new Error("document_control_sent_at: must be a finite number");
|
|
154
|
+
}
|
|
155
|
+
const signature = present(map, "signature");
|
|
156
|
+
if (!(signature instanceof Uint8Array) || signature.length !== 64) {
|
|
157
|
+
throw new Error("document_control_signature: expected 64 bytes");
|
|
158
|
+
}
|
|
159
|
+
const control = {
|
|
160
|
+
type: "document_control",
|
|
161
|
+
control_version: version,
|
|
162
|
+
document_id: documentId,
|
|
163
|
+
sender_agent_id: senderAgentId,
|
|
164
|
+
verb: verb,
|
|
165
|
+
...(reason !== null && reason !== "" ? { reason } : {}),
|
|
166
|
+
sent_at_ms: sentAt,
|
|
167
|
+
// COPIED out of the decode buffer — cbor-x returns byte strings as VIEWS into the input, so
|
|
168
|
+
// retaining one pins the whole frame and lets a later reuse mutate a verified signature.
|
|
169
|
+
signature: Uint8Array.from(signature),
|
|
170
|
+
};
|
|
171
|
+
assertDocumentControlConsistent(control);
|
|
172
|
+
return control;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=document-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-control.js","sourceRoot":"","sources":["../src/document-control.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEnD,uEAAuE;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAEnE,kGAAkG;AAClG,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C,2FAA2F;AAC3F,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,8FAA8F;AAC9F,MAAM,CAAC,MAAM,sBAAsB,GAAG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AAU,EAAE,MAAM;QAClB,4FAA4F;QAC5F,yFAAyF;QACzF,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC;KACtC,CAAC;IACF,+BAA+B,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOD-DOC-TOOLS-1 — the PROPOSAL ack (§16.3).
|
|
3
|
+
*
|
|
4
|
+
* The consent decision, told to the party who asked for it.
|
|
5
|
+
*
|
|
6
|
+
* ── WHY THIS EXISTS ───────────────────────────────────────────────────────────────────────────
|
|
7
|
+
*
|
|
8
|
+
* Without it the proposer is never told the answer. `cello_doc_list` had to INFER acceptance from
|
|
9
|
+
* "the peer has published into it", which conflates three different situations — refused, never
|
|
10
|
+
* received, and accepted-but-untouched — into one absent flag. Two of those want the operator to
|
|
11
|
+
* act and one does not, and the surface could not tell them apart. A protocol that asks for consent
|
|
12
|
+
* and never reports it is not asking; it is announcing.
|
|
13
|
+
*
|
|
14
|
+
* ── WHY IT IS SEPARATE FROM `document_ack` ────────────────────────────────────────────────────
|
|
15
|
+
*
|
|
16
|
+
* `document_ack` settles an ENVELOPE, identified by its hash in the log. A proposal is not in the
|
|
17
|
+
* envelope log — there is no document yet, which is the whole point — so an ack shaped around an
|
|
18
|
+
* envelope hash would carry a hash of nothing, and its consumer looks the envelope up. Overloading
|
|
19
|
+
* the frame would mean one decoder branching on whether the thing it references exists, which is
|
|
20
|
+
* how a settle-once rule gets applied to the wrong table.
|
|
21
|
+
*
|
|
22
|
+
* ── WHY IT IS SIGNED, AND WHAT THE SIGNATURE COVERS ───────────────────────────────────────────
|
|
23
|
+
*
|
|
24
|
+
* A refusal ack tells the proposer to stop: no retry, no document. Unsigned, anyone reaching the
|
|
25
|
+
* channel could make a proposal appear refused by a party who never saw it, and the two operators
|
|
26
|
+
* would each believe the other had walked away. The signature covers the DOCUMENT ID — which
|
|
27
|
+
* commits to the proposer, the peer, the properties and the nonce — so an ack cannot be moved to
|
|
28
|
+
* another proposal, and the decision itself, because the whole statement is the claim.
|
|
29
|
+
*
|
|
30
|
+
* ── SETTLE ONCE ───────────────────────────────────────────────────────────────────────────────
|
|
31
|
+
*
|
|
32
|
+
* Nothing here orders two acks from one acker, and the same rule `document_ack` states applies: a
|
|
33
|
+
* second, CONTRADICTING ack is an error with both signatures retained, never an update. A peer that
|
|
34
|
+
* accepted must not be able to later claim it refused — the proposer would tear down a document the
|
|
35
|
+
* peer is still editing.
|
|
36
|
+
*/
|
|
37
|
+
/** Domain tag in slot 0. Distinct from the update, ack, proposal and rejection domains. */
|
|
38
|
+
export declare const DOCUMENT_PROPOSAL_ACK_DOMAIN = "CELLO-DOCUMENT-PROPOSAL-ACK-v1";
|
|
39
|
+
/**
|
|
40
|
+
* The frame version, ON THE WIRE.
|
|
41
|
+
*
|
|
42
|
+
* The `-v1` in the domain never travels, so a V2 acker's frame would decode cleanly as V1 and fail
|
|
43
|
+
* SIGNATURE verification — sending an operator to key management for a version-skew bug. Skew that
|
|
44
|
+
* is not SAID becomes silent loss or a misattributed error.
|
|
45
|
+
*/
|
|
46
|
+
export declare const DOCUMENT_PROPOSAL_ACK_VERSION = 1;
|
|
47
|
+
/** A refusal reason is peer-controlled text bound for an operator's screen. Capped for that reason. */
|
|
48
|
+
export declare const MAX_PROPOSAL_REFUSAL_REASON_LENGTH = 200;
|
|
49
|
+
export interface DocumentProposalAck {
|
|
50
|
+
type: "document_proposal_ack";
|
|
51
|
+
ack_version: number;
|
|
52
|
+
/** The proposal being answered. Hash of the proposal's own preimage — see `documentIdFromProposal`. */
|
|
53
|
+
document_id: string;
|
|
54
|
+
/** Who decided — the party the proposal was addressed to. */
|
|
55
|
+
acker_agent_id: string;
|
|
56
|
+
/**
|
|
57
|
+
* `true` accepted, `false` refused. Both are ANSWERS; there is no third value, because an ack
|
|
58
|
+
* that does not say which is not a decision.
|
|
59
|
+
*/
|
|
60
|
+
accepted: boolean;
|
|
61
|
+
/** Present iff `accepted` is false. The operator's words, or the machine reason that auto-refused. */
|
|
62
|
+
refusal_reason?: string;
|
|
63
|
+
decided_at_ms: number;
|
|
64
|
+
/** Ed25519 (RFC 8032) over `buildDocumentProposalAckTbs`. */
|
|
65
|
+
signature: Uint8Array;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The cross-field rules, checked on ENCODE as well as decode.
|
|
69
|
+
*
|
|
70
|
+
* On encode too, because a locally-built contradictory ack would otherwise be signed and shipped and
|
|
71
|
+
* fail only at the remote decode: the acker sees success, the proposer sees an error, and the two
|
|
72
|
+
* never meet. The rule belongs where the object is built, not only where it is read.
|
|
73
|
+
*/
|
|
74
|
+
export declare function assertDocumentProposalAckConsistent(ack: DocumentProposalAck): void;
|
|
75
|
+
/**
|
|
76
|
+
* The canonical to-be-signed preimage: a fixed-order CBOR ARRAY with the domain in slot 0.
|
|
77
|
+
*
|
|
78
|
+
* An array rather than a map for the reason `cbor.ts` gives — this encoder is deliberately not
|
|
79
|
+
* deterministic for maps, so a map preimage would make the signature depend on the order the acker
|
|
80
|
+
* happened to build the object in, and two honest implementations would disagree.
|
|
81
|
+
*
|
|
82
|
+
* `refusal_reason` occupies its slot as `null` when absent, so no field's meaning depends on
|
|
83
|
+
* whether the one before it was present.
|
|
84
|
+
*/
|
|
85
|
+
export declare function buildDocumentProposalAckTbs(ack: DocumentProposalAck, opts?: {
|
|
86
|
+
preHash?: boolean;
|
|
87
|
+
}): Uint8Array;
|
|
88
|
+
export declare function encodeDocumentProposalAck(ack: DocumentProposalAck): Uint8Array;
|
|
89
|
+
/**
|
|
90
|
+
* Decode and validate. Refuses rather than defaulting on every field.
|
|
91
|
+
*
|
|
92
|
+
* The one that matters most is `accepted`. Coerced, a truthy string like `"false"` would record a
|
|
93
|
+
* REFUSED proposal as accepted, and the proposer would keep a document, keep publishing into it,
|
|
94
|
+
* and keep delivering to a peer who declined — every update refused at the far end for a reason
|
|
95
|
+
* neither operator can see.
|
|
96
|
+
*/
|
|
97
|
+
export declare function decodeDocumentProposalAck(bytes: Uint8Array): DocumentProposalAck;
|
|
98
|
+
//# sourceMappingURL=document-proposal-ack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-proposal-ack.d.ts","sourceRoot":"","sources":["../src/document-proposal-ack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAKH,2FAA2F;AAC3F,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAE7E;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C,uGAAuG;AACvG,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAItD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,uGAAuG;IACvG,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,sGAAsG;IACtG,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,SAAS,EAAE,UAAU,CAAC;CACvB;AAOD;;;;;;GAMG;AACH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAsBlF;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,mBAAmB,EACxB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/B,UAAU,CAoBZ;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,UAAU,CAY9E;AAWD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,CAgEhF"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOD-DOC-TOOLS-1 — the PROPOSAL ack (§16.3).
|
|
3
|
+
*
|
|
4
|
+
* The consent decision, told to the party who asked for it.
|
|
5
|
+
*
|
|
6
|
+
* ── WHY THIS EXISTS ───────────────────────────────────────────────────────────────────────────
|
|
7
|
+
*
|
|
8
|
+
* Without it the proposer is never told the answer. `cello_doc_list` had to INFER acceptance from
|
|
9
|
+
* "the peer has published into it", which conflates three different situations — refused, never
|
|
10
|
+
* received, and accepted-but-untouched — into one absent flag. Two of those want the operator to
|
|
11
|
+
* act and one does not, and the surface could not tell them apart. A protocol that asks for consent
|
|
12
|
+
* and never reports it is not asking; it is announcing.
|
|
13
|
+
*
|
|
14
|
+
* ── WHY IT IS SEPARATE FROM `document_ack` ────────────────────────────────────────────────────
|
|
15
|
+
*
|
|
16
|
+
* `document_ack` settles an ENVELOPE, identified by its hash in the log. A proposal is not in the
|
|
17
|
+
* envelope log — there is no document yet, which is the whole point — so an ack shaped around an
|
|
18
|
+
* envelope hash would carry a hash of nothing, and its consumer looks the envelope up. Overloading
|
|
19
|
+
* the frame would mean one decoder branching on whether the thing it references exists, which is
|
|
20
|
+
* how a settle-once rule gets applied to the wrong table.
|
|
21
|
+
*
|
|
22
|
+
* ── WHY IT IS SIGNED, AND WHAT THE SIGNATURE COVERS ───────────────────────────────────────────
|
|
23
|
+
*
|
|
24
|
+
* A refusal ack tells the proposer to stop: no retry, no document. Unsigned, anyone reaching the
|
|
25
|
+
* channel could make a proposal appear refused by a party who never saw it, and the two operators
|
|
26
|
+
* would each believe the other had walked away. The signature covers the DOCUMENT ID — which
|
|
27
|
+
* commits to the proposer, the peer, the properties and the nonce — so an ack cannot be moved to
|
|
28
|
+
* another proposal, and the decision itself, because the whole statement is the claim.
|
|
29
|
+
*
|
|
30
|
+
* ── SETTLE ONCE ───────────────────────────────────────────────────────────────────────────────
|
|
31
|
+
*
|
|
32
|
+
* Nothing here orders two acks from one acker, and the same rule `document_ack` states applies: a
|
|
33
|
+
* second, CONTRADICTING ack is an error with both signatures retained, never an update. A peer that
|
|
34
|
+
* accepted must not be able to later claim it refused — the proposer would tear down a document the
|
|
35
|
+
* peer is still editing.
|
|
36
|
+
*/
|
|
37
|
+
import { createHash } from "node:crypto";
|
|
38
|
+
import { encodeCbor, decodeCbor } from "./cbor.js";
|
|
39
|
+
/** Domain tag in slot 0. Distinct from the update, ack, proposal and rejection domains. */
|
|
40
|
+
export const DOCUMENT_PROPOSAL_ACK_DOMAIN = "CELLO-DOCUMENT-PROPOSAL-ACK-v1";
|
|
41
|
+
/**
|
|
42
|
+
* The frame version, ON THE WIRE.
|
|
43
|
+
*
|
|
44
|
+
* The `-v1` in the domain never travels, so a V2 acker's frame would decode cleanly as V1 and fail
|
|
45
|
+
* SIGNATURE verification — sending an operator to key management for a version-skew bug. Skew that
|
|
46
|
+
* is not SAID becomes silent loss or a misattributed error.
|
|
47
|
+
*/
|
|
48
|
+
export const DOCUMENT_PROPOSAL_ACK_VERSION = 1;
|
|
49
|
+
/** A refusal reason is peer-controlled text bound for an operator's screen. Capped for that reason. */
|
|
50
|
+
export const MAX_PROPOSAL_REFUSAL_REASON_LENGTH = 200;
|
|
51
|
+
const HEX32 = /^[0-9a-f]{64}$/;
|
|
52
|
+
/** Empty string means ABSENT — see `assertDocumentProposalAckConsistent`. */
|
|
53
|
+
function normalizeReason(reason) {
|
|
54
|
+
return reason === undefined || reason === "" ? null : reason;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The cross-field rules, checked on ENCODE as well as decode.
|
|
58
|
+
*
|
|
59
|
+
* On encode too, because a locally-built contradictory ack would otherwise be signed and shipped and
|
|
60
|
+
* fail only at the remote decode: the acker sees success, the proposer sees an error, and the two
|
|
61
|
+
* never meet. The rule belongs where the object is built, not only where it is read.
|
|
62
|
+
*/
|
|
63
|
+
export function assertDocumentProposalAckConsistent(ack) {
|
|
64
|
+
const reason = normalizeReason(ack.refusal_reason);
|
|
65
|
+
if (!ack.accepted && reason === null) {
|
|
66
|
+
// A refusal with no reason leaves the proposer unable to propose anything better. That is the
|
|
67
|
+
// failure that makes people give up on a protocol rather than adjust to it.
|
|
68
|
+
throw new Error("document_proposal_ack_reason: a refusal must carry its reason");
|
|
69
|
+
}
|
|
70
|
+
if (ack.accepted && reason !== null) {
|
|
71
|
+
// A contradiction: whichever field a reader trusts, the other is lying to them.
|
|
72
|
+
throw new Error(`document_proposal_ack_reason: an acceptance must not carry a refusal reason, and this one carries "${reason}"`);
|
|
73
|
+
}
|
|
74
|
+
if (reason !== null && reason.length > MAX_PROPOSAL_REFUSAL_REASON_LENGTH) {
|
|
75
|
+
throw new Error(`document_proposal_ack_reason: a refusal reason may be at most ` +
|
|
76
|
+
`${MAX_PROPOSAL_REFUSAL_REASON_LENGTH} characters, and this one is ${reason.length}`);
|
|
77
|
+
}
|
|
78
|
+
if (!HEX32.test(ack.document_id)) {
|
|
79
|
+
throw new Error(`document_proposal_ack_document_id: expected 64 lowercase hex characters`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The canonical to-be-signed preimage: a fixed-order CBOR ARRAY with the domain in slot 0.
|
|
84
|
+
*
|
|
85
|
+
* An array rather than a map for the reason `cbor.ts` gives — this encoder is deliberately not
|
|
86
|
+
* deterministic for maps, so a map preimage would make the signature depend on the order the acker
|
|
87
|
+
* happened to build the object in, and two honest implementations would disagree.
|
|
88
|
+
*
|
|
89
|
+
* `refusal_reason` occupies its slot as `null` when absent, so no field's meaning depends on
|
|
90
|
+
* whether the one before it was present.
|
|
91
|
+
*/
|
|
92
|
+
export function buildDocumentProposalAckTbs(ack, opts = {}) {
|
|
93
|
+
assertDocumentProposalAckConsistent(ack);
|
|
94
|
+
const preimage = encodeCbor([
|
|
95
|
+
DOCUMENT_PROPOSAL_ACK_DOMAIN,
|
|
96
|
+
ack.ack_version,
|
|
97
|
+
ack.document_id,
|
|
98
|
+
ack.acker_agent_id,
|
|
99
|
+
ack.accepted,
|
|
100
|
+
normalizeReason(ack.refusal_reason),
|
|
101
|
+
// BIGINT past 0xffffffff. cbor-x encodes a JS number that large as an IEEE float64 (`fb`)
|
|
102
|
+
// rather than a uint64 (`1b`), so an implementation encoding RFC 8949-canonically would compute
|
|
103
|
+
// different TBS bytes and reject a GENUINE ack — surfacing as a signature failure, which reads
|
|
104
|
+
// as forgery. A millisecond timestamp is always that large. Four sibling builders carry this
|
|
105
|
+
// same coercion.
|
|
106
|
+
typeof ack.decided_at_ms === "number" && ack.decided_at_ms > 0xffffffff
|
|
107
|
+
? BigInt(ack.decided_at_ms)
|
|
108
|
+
: ack.decided_at_ms,
|
|
109
|
+
]);
|
|
110
|
+
if (opts.preHash === false)
|
|
111
|
+
return preimage;
|
|
112
|
+
return new Uint8Array(createHash("sha256").update(preimage).digest());
|
|
113
|
+
}
|
|
114
|
+
export function encodeDocumentProposalAck(ack) {
|
|
115
|
+
assertDocumentProposalAckConsistent(ack);
|
|
116
|
+
return encodeCbor({
|
|
117
|
+
type: ack.type,
|
|
118
|
+
ack_version: ack.ack_version,
|
|
119
|
+
document_id: ack.document_id,
|
|
120
|
+
acker_agent_id: ack.acker_agent_id,
|
|
121
|
+
accepted: ack.accepted,
|
|
122
|
+
refusal_reason: normalizeReason(ack.refusal_reason),
|
|
123
|
+
decided_at_ms: ack.decided_at_ms,
|
|
124
|
+
signature: ack.signature,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function present(map, field) {
|
|
128
|
+
// `in`, not a nullish check. A defaulted field is a claim the acker never made, and carrying
|
|
129
|
+
// their claim is this frame's entire job.
|
|
130
|
+
if (!(field in map)) {
|
|
131
|
+
throw new Error(`document_proposal_ack_missing_field: ${field} is mandatory and was not present`);
|
|
132
|
+
}
|
|
133
|
+
return map[field];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Decode and validate. Refuses rather than defaulting on every field.
|
|
137
|
+
*
|
|
138
|
+
* The one that matters most is `accepted`. Coerced, a truthy string like `"false"` would record a
|
|
139
|
+
* REFUSED proposal as accepted, and the proposer would keep a document, keep publishing into it,
|
|
140
|
+
* and keep delivering to a peer who declined — every update refused at the far end for a reason
|
|
141
|
+
* neither operator can see.
|
|
142
|
+
*/
|
|
143
|
+
export function decodeDocumentProposalAck(bytes) {
|
|
144
|
+
const decoded = decodeCbor(bytes);
|
|
145
|
+
if (typeof decoded !== "object" || decoded === null || Array.isArray(decoded)) {
|
|
146
|
+
throw new Error("document_proposal_ack_malformed: not a CBOR map");
|
|
147
|
+
}
|
|
148
|
+
const map = decoded;
|
|
149
|
+
if (present(map, "type") !== "document_proposal_ack") {
|
|
150
|
+
throw new Error(`document_proposal_ack_type: expected document_proposal_ack`);
|
|
151
|
+
}
|
|
152
|
+
const ackVersion = present(map, "ack_version");
|
|
153
|
+
if (typeof ackVersion !== "number" || !Number.isInteger(ackVersion)) {
|
|
154
|
+
throw new Error("document_proposal_ack_version: must be an integer");
|
|
155
|
+
}
|
|
156
|
+
if (ackVersion !== DOCUMENT_PROPOSAL_ACK_VERSION) {
|
|
157
|
+
// REFUSED BY VALUE, and said out loud. A frame from a future build would otherwise decode
|
|
158
|
+
// cleanly and fail signature verification, sending whoever reads the error to key management.
|
|
159
|
+
throw new Error(`document_proposal_ack_version_unsupported: this build speaks version ` +
|
|
160
|
+
`${DOCUMENT_PROPOSAL_ACK_VERSION} and the ack declares ${ackVersion} — the peer is running a ` +
|
|
161
|
+
`newer CELLO and one of you needs to upgrade`);
|
|
162
|
+
}
|
|
163
|
+
const documentId = present(map, "document_id");
|
|
164
|
+
if (typeof documentId !== "string" || !HEX32.test(documentId)) {
|
|
165
|
+
throw new Error("document_proposal_ack_document_id: expected 64 lowercase hex characters");
|
|
166
|
+
}
|
|
167
|
+
const ackerAgentId = present(map, "acker_agent_id");
|
|
168
|
+
if (typeof ackerAgentId !== "string" || ackerAgentId.length === 0) {
|
|
169
|
+
throw new Error("document_proposal_ack_acker: must be a non-empty string");
|
|
170
|
+
}
|
|
171
|
+
const accepted = present(map, "accepted");
|
|
172
|
+
if (typeof accepted !== "boolean") {
|
|
173
|
+
throw new Error("document_proposal_ack_accepted: must be a boolean, never a coerced value");
|
|
174
|
+
}
|
|
175
|
+
const refusalReason = present(map, "refusal_reason");
|
|
176
|
+
if (refusalReason !== null && typeof refusalReason !== "string") {
|
|
177
|
+
throw new Error("document_proposal_ack_reason: must be a string or null");
|
|
178
|
+
}
|
|
179
|
+
const decidedAt = present(map, "decided_at_ms");
|
|
180
|
+
if (typeof decidedAt !== "number" || !Number.isFinite(decidedAt)) {
|
|
181
|
+
throw new Error("document_proposal_ack_decided_at: must be a finite number");
|
|
182
|
+
}
|
|
183
|
+
const signature = present(map, "signature");
|
|
184
|
+
if (!(signature instanceof Uint8Array) || signature.length !== 64) {
|
|
185
|
+
throw new Error("document_proposal_ack_signature: expected 64 bytes");
|
|
186
|
+
}
|
|
187
|
+
const ack = {
|
|
188
|
+
type: "document_proposal_ack",
|
|
189
|
+
ack_version: ackVersion,
|
|
190
|
+
document_id: documentId,
|
|
191
|
+
acker_agent_id: ackerAgentId,
|
|
192
|
+
accepted,
|
|
193
|
+
...(refusalReason !== null && refusalReason !== "" ? { refusal_reason: refusalReason } : {}),
|
|
194
|
+
decided_at_ms: decidedAt,
|
|
195
|
+
// COPIED out of the decode buffer. cbor-x returns byte strings as VIEWS into the input, so
|
|
196
|
+
// retaining one pins the whole frame and lets a later reuse of that buffer mutate a signature
|
|
197
|
+
// already verified.
|
|
198
|
+
signature: Uint8Array.from(signature),
|
|
199
|
+
};
|
|
200
|
+
assertDocumentProposalAckConsistent(ack);
|
|
201
|
+
return ack;
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=document-proposal-ack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-proposal-ack.js","sourceRoot":"","sources":["../src/document-proposal-ack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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I,EAAE,mBAAmB,CAAC;IAC1B,mGAAmG;IACnG,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,kBAAkB,CAAC;IAC/B;;;;OAIG;IACH,gBAAgB,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,yFAAyF;IACzF,KAAK,EAAE,UAAU,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,SAAS,EAAE,UAAU,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,wBAAwB,EAC7B,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/B,UAAU,CA4BZ;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,wBAAwB,GAAG,MAAM,CAI5E;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI,CAoBtE;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAoB/F;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,wBAAwB,GAAG,UAAU,CAkBhF;AA6BD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,wBAAwB,CA8DlF"}
|
|
@@ -66,7 +66,18 @@ export function buildDocumentProposalTbs(env, opts = {}) {
|
|
|
66
66
|
env.properties.append_only,
|
|
67
67
|
env.starting_content,
|
|
68
68
|
env.nonce,
|
|
69
|
-
|
|
69
|
+
// BIGINT past 0xffffffff — the same coercion three sibling builders carry and which
|
|
70
|
+
// primary-transfer.ts names as a defect it shipped without. cbor-x encodes a JS number that
|
|
71
|
+
// large as an IEEE float64 (`fb`), not a uint64 (`1b`), so any implementation encoding RFC
|
|
72
|
+
// 8949-canonically would compute a DIFFERENT document_id from the same proposal — and for this
|
|
73
|
+
// envelope the id IS the hash, so the two parties would be on two documents.
|
|
74
|
+
//
|
|
75
|
+
// Fixed now rather than left as a known wart: M14 is unreleased, nothing is wired, and no
|
|
76
|
+
// proposal has ever been signed. The frozen vector below is reissued deliberately, which is
|
|
77
|
+
// exactly the case its own comment describes.
|
|
78
|
+
typeof env.proposed_at_ms === "number" && env.proposed_at_ms > 0xffffffff
|
|
79
|
+
? BigInt(env.proposed_at_ms)
|
|
80
|
+
: env.proposed_at_ms,
|
|
70
81
|
]);
|
|
71
82
|
if (opts.preHash === false)
|
|
72
83
|
return preimage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-proposal.js","sourceRoot":"","sources":["../src/document-proposal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEnD,kGAAkG;AAClG,MAAM,CAAC,MAAM,wBAAwB,GAAG,4BAA4B,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C,2FAA2F;AAC3F,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AACjD,sEAAsE;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;AA2C3C;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CACtC,GAA6B,EAC7B,OAA8B,EAAE;IAEhC,MAAM,QAAQ,GAAG,UAAU,CAAC;QAC1B,wBAAwB;QACxB,GAAG,CAAC,eAAe;QACnB,GAAG,CAAC,iBAAiB;QACrB,GAAG,CAAC,aAAa;QACjB,GAAG,CAAC,aAA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