@cello-protocol/daemon 0.0.181 → 0.0.183
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/agent-id-migration.d.ts +9 -0
- package/dist/agent-id-migration.d.ts.map +1 -1
- package/dist/agent-id-migration.js +73 -1
- package/dist/agent-id-migration.js.map +1 -1
- package/dist/agent-selection.d.ts +73 -0
- package/dist/agent-selection.d.ts.map +1 -0
- package/dist/agent-selection.js +80 -0
- package/dist/agent-selection.js.map +1 -0
- package/dist/agent-settings-keys.d.ts.map +1 -1
- package/dist/agent-settings-keys.js +18 -0
- package/dist/agent-settings-keys.js.map +1 -1
- package/dist/assignment-verify.d.ts +62 -0
- package/dist/assignment-verify.d.ts.map +1 -0
- package/dist/assignment-verify.js +185 -0
- package/dist/assignment-verify.js.map +1 -0
- package/dist/backup-restore.d.ts +102 -0
- package/dist/backup-restore.d.ts.map +1 -0
- package/dist/backup-restore.js +340 -0
- package/dist/backup-restore.js.map +1 -0
- package/dist/bin/cello-daemon.js +91 -49
- package/dist/bin/cello-daemon.js.map +1 -1
- package/dist/close-commitment.d.ts +67 -0
- package/dist/close-commitment.d.ts.map +1 -0
- package/dist/close-commitment.js +78 -0
- package/dist/close-commitment.js.map +1 -0
- package/dist/close-session-handler.d.ts +20 -0
- package/dist/close-session-handler.d.ts.map +1 -1
- package/dist/close-session-handler.js +351 -58
- package/dist/close-session-handler.js.map +1 -1
- package/dist/consortium-bootstrap.d.ts +2 -0
- package/dist/consortium-bootstrap.d.ts.map +1 -1
- package/dist/consortium-bootstrap.js +182 -9
- package/dist/consortium-bootstrap.js.map +1 -1
- package/dist/content-encryption-status.d.ts +97 -0
- package/dist/content-encryption-status.d.ts.map +1 -0
- package/dist/content-encryption-status.js +122 -0
- package/dist/content-encryption-status.js.map +1 -0
- package/dist/content-park-client.d.ts +10 -0
- package/dist/content-park-client.d.ts.map +1 -1
- package/dist/content-park-client.js +84 -3
- package/dist/content-park-client.js.map +1 -1
- package/dist/content-park.d.ts.map +1 -1
- package/dist/content-park.js +323 -21
- package/dist/content-park.js.map +1 -1
- package/dist/daemon.d.ts +13 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +1168 -141
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-session-suspects.d.ts.map +1 -1
- package/dist/delivery-session-suspects.js +5 -0
- package/dist/delivery-session-suspects.js.map +1 -1
- package/dist/directory-auth-posture.d.ts +87 -0
- package/dist/directory-auth-posture.d.ts.map +1 -0
- package/dist/directory-auth-posture.js +134 -0
- package/dist/directory-auth-posture.js.map +1 -0
- package/dist/directory-bootstrap.d.ts +66 -3
- package/dist/directory-bootstrap.d.ts.map +1 -1
- package/dist/directory-bootstrap.js +133 -7
- package/dist/directory-bootstrap.js.map +1 -1
- package/dist/document-delivery-transport.d.ts +22 -2
- package/dist/document-delivery-transport.d.ts.map +1 -1
- package/dist/document-delivery-transport.js +11 -3
- package/dist/document-delivery-transport.js.map +1 -1
- package/dist/document-handlers.d.ts.map +1 -1
- package/dist/document-handlers.js +119 -0
- package/dist/document-handlers.js.map +1 -1
- package/dist/document-layer.d.ts +0 -2
- package/dist/document-layer.d.ts.map +1 -1
- package/dist/document-layer.js.map +1 -1
- package/dist/inbound-sessions.d.ts +31 -1
- package/dist/inbound-sessions.d.ts.map +1 -1
- package/dist/inbound-sessions.js +276 -16
- package/dist/inbound-sessions.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/initiate-session-handler.d.ts.map +1 -1
- package/dist/initiate-session-handler.js +34 -3
- package/dist/initiate-session-handler.js.map +1 -1
- package/dist/ipc-server.d.ts +5 -1
- package/dist/ipc-server.d.ts.map +1 -1
- package/dist/ipc-server.js +19 -3
- package/dist/ipc-server.js.map +1 -1
- package/dist/manifest-deps.d.ts +0 -11
- package/dist/manifest-deps.d.ts.map +1 -1
- package/dist/manifest-deps.js +28 -2
- package/dist/manifest-deps.js.map +1 -1
- package/dist/manifest-validity.d.ts +153 -0
- package/dist/manifest-validity.d.ts.map +1 -0
- package/dist/manifest-validity.js +268 -0
- package/dist/manifest-validity.js.map +1 -0
- package/dist/notification-handlers.d.ts.map +1 -1
- package/dist/notification-handlers.js +15 -0
- package/dist/notification-handlers.js.map +1 -1
- package/dist/outbound-sessions.d.ts +31 -0
- package/dist/outbound-sessions.d.ts.map +1 -1
- package/dist/outbound-sessions.js +217 -17
- package/dist/outbound-sessions.js.map +1 -1
- package/dist/park-envelope.d.ts +95 -1
- package/dist/park-envelope.d.ts.map +1 -1
- package/dist/park-envelope.js +195 -4
- package/dist/park-envelope.js.map +1 -1
- package/dist/refusal-reasons.d.ts +72 -0
- package/dist/refusal-reasons.d.ts.map +1 -0
- package/dist/refusal-reasons.js +69 -0
- package/dist/refusal-reasons.js.map +1 -0
- package/dist/register-handler.d.ts.map +1 -1
- package/dist/register-handler.js +76 -0
- package/dist/register-handler.js.map +1 -1
- package/dist/registration-manager.d.ts.map +1 -1
- package/dist/registration-manager.js +20 -1
- package/dist/registration-manager.js.map +1 -1
- package/dist/relay-only.d.ts +133 -0
- package/dist/relay-only.d.ts.map +1 -0
- package/dist/relay-only.js +183 -0
- package/dist/relay-only.js.map +1 -0
- package/dist/restart-seal-resolver.d.ts.map +1 -1
- package/dist/restart-seal-resolver.js +6 -0
- package/dist/restart-seal-resolver.js.map +1 -1
- package/dist/retry-queue.d.ts +49 -2
- package/dist/retry-queue.d.ts.map +1 -1
- package/dist/retry-queue.js +55 -10
- package/dist/retry-queue.js.map +1 -1
- package/dist/roster-freshness.d.ts +169 -0
- package/dist/roster-freshness.d.ts.map +1 -0
- package/dist/roster-freshness.js +249 -0
- package/dist/roster-freshness.js.map +1 -0
- package/dist/seal-certificate-pull.d.ts +17 -1
- package/dist/seal-certificate-pull.d.ts.map +1 -1
- package/dist/seal-certificate-pull.js +37 -3
- package/dist/seal-certificate-pull.js.map +1 -1
- package/dist/seal-coordinator.d.ts +17 -1
- package/dist/seal-coordinator.d.ts.map +1 -1
- package/dist/seal-coordinator.js +71 -0
- package/dist/seal-coordinator.js.map +1 -1
- package/dist/seal-failure-store.d.ts +104 -0
- package/dist/seal-failure-store.d.ts.map +1 -0
- package/dist/seal-failure-store.js +126 -0
- package/dist/seal-failure-store.js.map +1 -0
- package/dist/seal-flows.d.ts.map +1 -1
- package/dist/seal-flows.js +35 -6
- package/dist/seal-flows.js.map +1 -1
- package/dist/seal-upgrade.d.ts +20 -5
- package/dist/seal-upgrade.d.ts.map +1 -1
- package/dist/seal-upgrade.js +28 -5
- package/dist/seal-upgrade.js.map +1 -1
- package/dist/session-assignment-parser.d.ts +41 -5
- package/dist/session-assignment-parser.d.ts.map +1 -1
- package/dist/session-assignment-parser.js +77 -14
- package/dist/session-assignment-parser.js.map +1 -1
- package/dist/session-ceremony.d.ts +35 -0
- package/dist/session-ceremony.d.ts.map +1 -1
- package/dist/session-ceremony.js +97 -0
- package/dist/session-ceremony.js.map +1 -1
- package/dist/session-connection-gater.d.ts +46 -7
- package/dist/session-connection-gater.d.ts.map +1 -1
- package/dist/session-connection-gater.js +163 -12
- package/dist/session-connection-gater.js.map +1 -1
- package/dist/session-content-handlers.d.ts +12 -0
- package/dist/session-content-handlers.d.ts.map +1 -1
- package/dist/session-content-handlers.js +149 -8
- package/dist/session-content-handlers.js.map +1 -1
- package/dist/session-node-manager.d.ts +653 -40
- package/dist/session-node-manager.d.ts.map +1 -1
- package/dist/session-node-manager.js +5938 -374
- package/dist/session-node-manager.js.map +1 -1
- package/dist/session-read-handlers.d.ts +27 -0
- package/dist/session-read-handlers.d.ts.map +1 -1
- package/dist/session-read-handlers.js +127 -6
- package/dist/session-read-handlers.js.map +1 -1
- package/dist/session-relay-client.d.ts +177 -2
- package/dist/session-relay-client.d.ts.map +1 -1
- package/dist/session-relay-client.js +564 -16
- package/dist/session-relay-client.js.map +1 -1
- package/dist/session-salt-agreement.d.ts +338 -0
- package/dist/session-salt-agreement.d.ts.map +1 -0
- package/dist/session-salt-agreement.js +478 -0
- package/dist/session-salt-agreement.js.map +1 -0
- package/dist/signal-submission.d.ts.map +1 -1
- package/dist/signal-submission.js +10 -1
- package/dist/signal-submission.js.map +1 -1
- package/dist/signaling-connect.d.ts +18 -1
- package/dist/signaling-connect.d.ts.map +1 -1
- package/dist/signaling-connect.js +206 -6
- package/dist/signaling-connect.js.map +1 -1
- package/dist/types.d.ts +75 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +10 -0
- package/dist/vocabulary.js.map +1 -1
- package/dist/wire-content-hash.d.ts +68 -0
- package/dist/wire-content-hash.d.ts.map +1 -1
- package/dist/wire-content-hash.js +83 -0
- package/dist/wire-content-hash.js.map +1 -1
- package/package.json +5 -5
|
@@ -21,6 +21,89 @@
|
|
|
21
21
|
* real daemons.
|
|
22
22
|
*/
|
|
23
23
|
import { createHash } from "node:crypto";
|
|
24
|
+
import { saltedContentHash } from "@cello-protocol/crypto";
|
|
25
|
+
/**
|
|
26
|
+
* ─── THE ALGORITHM TRAVELS WITH THE HASH — `DOD-M15-SEALWIRE-1` part B1 ───────────────────────
|
|
27
|
+
*
|
|
28
|
+
* A salted content hash and an unsalted one are both 32 bytes in the same wire field. Nothing in
|
|
29
|
+
* the bytes distinguishes them, so a receiver handed one and told nothing has no way to know which
|
|
30
|
+
* it is holding — and gets `content_hash_mismatch` on every frame, which is the exact
|
|
31
|
+
* silent-discard failure this module's header says cost two real daemons.
|
|
32
|
+
*
|
|
33
|
+
* Hence a NAME on the wire, and three cases that must stay apart (Decisions Carried #15):
|
|
34
|
+
*
|
|
35
|
+
* ABSENT → `sha256`. A peer that predates the field. We know what it computed.
|
|
36
|
+
* NAMED and KNOWN → verify under that name.
|
|
37
|
+
* NAMED and UNKNOWN → **refuse.** Not a legacy peer — an unreadable one. There is no correct hash
|
|
38
|
+
* to compare against, and falling back to `sha256` would compare two
|
|
39
|
+
* unrelated values and report a TAMPER for a version skew.
|
|
40
|
+
*
|
|
41
|
+
* ⚠️ RECEIVER FIRST — the ROLLOUT ORDER, which is still the rule. Every peer must be able to
|
|
42
|
+
* understand a salted frame before any peer sends one. Reversed, the first upgraded sender breaks
|
|
43
|
+
* every conversation it has with a peer that has not upgraded.
|
|
44
|
+
*
|
|
45
|
+
* > **⛔ THIS PARAGRAPH USED TO END "`no sender salts yet`", AND THAT IS NO LONGER TRUE.** It was
|
|
46
|
+
* > written during part B1, when the receiver had been taught to read the name and nothing produced
|
|
47
|
+
* > a salted one. **B2b-2 flipped it: a session holding an agreed salt now hashes under
|
|
48
|
+
* > `HMAC_SALT_V1`.** The sentence is rewritten rather than deleted because it is exactly the shape
|
|
49
|
+
* > `DOD-M15-CLAIM-COMMENTS-1` exists to catch — a comment asserting a property the code no longer
|
|
50
|
+
* > has — and deleting it would remove the evidence that someone reasoned from it.
|
|
51
|
+
* >
|
|
52
|
+
* > It was still being read as current on 2026-08-24: a spine test's park deposit declared `sha256`
|
|
53
|
+
* > on this comment's authority, the recipient recomputed under the name it was given, and the
|
|
54
|
+
* > mismatch surfaced as `content_hash_mismatch` — **a tamper verdict on a message nobody touched**,
|
|
55
|
+
* > which is precisely the failure the ALGORITHM-TRAVELS-WITH-THE-HASH rule above exists to prevent.
|
|
56
|
+
*/
|
|
57
|
+
export const CONTENT_HASH_ALGS = {
|
|
58
|
+
/** `sha256(0x00 ‖ content)` — what every build before the salt computes, and the absent-field default. */
|
|
59
|
+
SHA256: "sha256",
|
|
60
|
+
/** `hmac-sha256(salt, 0x00 ‖ content)` — Decision #9. HMAC, never `sha256(salt ‖ content)`. */
|
|
61
|
+
HMAC_SALT_V1: "hmac-sha256-salt-v1",
|
|
62
|
+
};
|
|
63
|
+
const KNOWN_ALGS = new Set(Object.values(CONTENT_HASH_ALGS));
|
|
64
|
+
/** Whether this daemon can reproduce a hash under the given name. */
|
|
65
|
+
export function isKnownContentHashAlg(alg) {
|
|
66
|
+
return KNOWN_ALGS.has(alg);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* What a frame says it used, or a refusal naming the value.
|
|
70
|
+
*
|
|
71
|
+
* ABSENT is deliberately `undefined`/`null` ONLY — not "falsy". An empty string is a peer that sent
|
|
72
|
+
* a name we cannot read, not a peer that sent no name, and folding the two together would verify a
|
|
73
|
+
* malformed frame as legacy instead of telling its sender the frame is unreadable.
|
|
74
|
+
*/
|
|
75
|
+
export function resolveContentHashAlg(raw) {
|
|
76
|
+
if (raw === undefined || raw === null)
|
|
77
|
+
return { ok: true, alg: CONTENT_HASH_ALGS.SHA256 };
|
|
78
|
+
if (typeof raw !== "string" || !isKnownContentHashAlg(raw)) {
|
|
79
|
+
return { ok: false, value: typeof raw === "string" ? raw : `(${typeof raw})` };
|
|
80
|
+
}
|
|
81
|
+
return { ok: true, alg: raw };
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The content hash under a named algorithm.
|
|
85
|
+
*
|
|
86
|
+
* THROWS rather than substituting, in both failure cases, and that is the point of the function. A
|
|
87
|
+
* 32-byte value returned for an unknown algorithm — or an unsalted one returned because the salt was
|
|
88
|
+
* missing — flows straight into the cross-check and surfaces as `content_hash_mismatch`: a TAMPER
|
|
89
|
+
* REPORT for what is really a version skew or a missing salt. The caller must handle those as what
|
|
90
|
+
* they are.
|
|
91
|
+
*/
|
|
92
|
+
export function contentHashFor(content, opts) {
|
|
93
|
+
if (opts.alg === CONTENT_HASH_ALGS.SHA256)
|
|
94
|
+
return wireContentHash(content);
|
|
95
|
+
if (opts.alg === CONTENT_HASH_ALGS.HMAC_SALT_V1) {
|
|
96
|
+
if (!opts.salt) {
|
|
97
|
+
throw new Error(`CONTENT HASH: ${CONTENT_HASH_ALGS.HMAC_SALT_V1} was requested with no session salt. Refusing rather ` +
|
|
98
|
+
"than computing the unsalted form — that would put bytes on the wire under a label they do not match, " +
|
|
99
|
+
"and the peer would report a tamper on a message nobody touched.");
|
|
100
|
+
}
|
|
101
|
+
return saltedContentHash(opts.salt, content);
|
|
102
|
+
}
|
|
103
|
+
throw new Error(`CONTENT HASH: unknown algorithm "${opts.alg}". This daemon cannot reproduce it, so there is no value to ` +
|
|
104
|
+
"compare against. Refusing rather than falling back to sha256, which would compare two unrelated hashes " +
|
|
105
|
+
"and report a tamper for what is a version difference.");
|
|
106
|
+
}
|
|
24
107
|
/**
|
|
25
108
|
* Domain-separation prefix. Fixed at `0x00` for ALL content frames — see the header on why this is
|
|
26
109
|
* not the leaf kind.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-content-hash.js","sourceRoot":"","sources":["../src/wire-content-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"wire-content-hash.js","sourceRoot":"","sources":["../src/wire-content-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,0GAA0G;IAC1G,MAAM,EAAE,QAAQ;IAChB,+FAA+F;IAC/F,YAAY,EAAE,qBAAqB;CAC3B,CAAC;AAIX,MAAM,UAAU,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAErE,qEAAqE;AACrE,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,OAAO,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAA8B;IAE9B,IAAI,GAAG,KA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CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AACnG,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,kBAAkB,CAAC,OAAmB;IACpD,OAAO,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cello-protocol/daemon",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.183",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"@signalapp/sqlcipher": "^3.3.5",
|
|
36
36
|
"cbor-x": "^1.6.0",
|
|
37
37
|
"it-length-prefixed": "^10.0.1",
|
|
38
|
-
"@cello-protocol/
|
|
39
|
-
"@cello-protocol/protocol-types": "0.0.
|
|
40
|
-
"@cello-protocol/transport": "0.0.
|
|
41
|
-
"@cello-protocol/
|
|
38
|
+
"@cello-protocol/crypto": "0.0.60",
|
|
39
|
+
"@cello-protocol/protocol-types": "0.0.64",
|
|
40
|
+
"@cello-protocol/transport": "0.0.66",
|
|
41
|
+
"@cello-protocol/gateway": "0.0.44"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^25.6.2",
|