@real-life/trust-protocol 0.3.2 → 0.5.0
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/CHANGELOG.md +97 -0
- package/README.md +209 -78
- package/dist/ack.d.ts +84 -0
- package/dist/ack.d.ts.map +1 -0
- package/dist/ack.js +114 -0
- package/dist/ack.js.map +1 -0
- package/dist/adapters/vti-mediator.d.ts +169 -0
- package/dist/adapters/vti-mediator.d.ts.map +1 -0
- package/dist/adapters/vti-mediator.js +659 -0
- package/dist/adapters/vti-mediator.js.map +1 -0
- package/dist/anchor.d.ts +226 -0
- package/dist/anchor.d.ts.map +1 -0
- package/dist/anchor.js +347 -0
- package/dist/anchor.js.map +1 -0
- package/dist/{holder.d.ts → carrier-holder.d.ts} +1 -1
- package/dist/carrier-holder.d.ts.map +1 -0
- package/dist/{holder.js → carrier-holder.js} +5 -4
- package/dist/carrier-holder.js.map +1 -0
- package/dist/carrier-identity.js +4 -4
- package/dist/carrier-identity.js.map +1 -1
- package/dist/carrier.d.ts.map +1 -1
- package/dist/carrier.js +4 -3
- package/dist/carrier.js.map +1 -1
- package/dist/ceremony.d.ts +3 -2
- package/dist/ceremony.d.ts.map +1 -1
- package/dist/ceremony.js +16 -26
- package/dist/ceremony.js.map +1 -1
- package/dist/codec.d.ts +54 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +494 -0
- package/dist/codec.js.map +1 -0
- package/dist/continuity.d.ts +67 -0
- package/dist/continuity.d.ts.map +1 -0
- package/dist/continuity.js +110 -0
- package/dist/continuity.js.map +1 -0
- package/dist/core.d.ts +4 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/crypto.d.ts +23 -7
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +54 -20
- package/dist/crypto.js.map +1 -1
- package/dist/delivery.d.ts +31 -3
- package/dist/delivery.d.ts.map +1 -1
- package/dist/delivery.js +75 -28
- package/dist/delivery.js.map +1 -1
- package/dist/encounter/ceremony.d.ts +37 -0
- package/dist/encounter/ceremony.d.ts.map +1 -0
- package/dist/encounter/ceremony.js +662 -0
- package/dist/encounter/ceremony.js.map +1 -0
- package/dist/encounter.d.ts +91 -1
- package/dist/encounter.d.ts.map +1 -1
- package/dist/encounter.js +191 -12
- package/dist/encounter.js.map +1 -1
- package/dist/engine.d.ts +303 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +1509 -0
- package/dist/engine.js.map +1 -0
- package/dist/entropy.d.ts +28 -0
- package/dist/entropy.d.ts.map +1 -0
- package/dist/entropy.js +96 -0
- package/dist/entropy.js.map +1 -0
- package/dist/events.d.ts +198 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/fixtures.d.ts +30 -0
- package/dist/fixtures.d.ts.map +1 -0
- package/dist/fixtures.js +155 -0
- package/dist/fixtures.js.map +1 -0
- package/dist/forge.d.ts +47 -0
- package/dist/forge.d.ts.map +1 -0
- package/dist/forge.js +20 -0
- package/dist/forge.js.map +1 -0
- package/dist/group-star.d.ts +251 -0
- package/dist/group-star.d.ts.map +1 -0
- package/dist/group-star.js +348 -0
- package/dist/group-star.js.map +1 -0
- package/dist/holder-api.d.ts +165 -0
- package/dist/holder-api.d.ts.map +1 -0
- package/dist/holder-api.js +142 -0
- package/dist/holder-api.js.map +1 -0
- package/dist/holder-state-v1.d.ts +801 -0
- package/dist/holder-state-v1.d.ts.map +1 -0
- package/dist/holder-state-v1.js +2 -0
- package/dist/holder-state-v1.js.map +1 -0
- package/dist/holder-state-v2.d.ts +858 -0
- package/dist/holder-state-v2.d.ts.map +1 -0
- package/dist/holder-state-v2.js +2 -0
- package/dist/holder-state-v2.js.map +1 -0
- package/dist/identity-state.d.ts +43 -0
- package/dist/identity-state.d.ts.map +1 -0
- package/dist/identity-state.js +345 -0
- package/dist/identity-state.js.map +1 -0
- package/dist/identity.d.ts +24 -2
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +70 -11
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -29
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +37 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +22 -0
- package/dist/internal.js.map +1 -0
- package/dist/introduction/holder.d.ts +18 -0
- package/dist/introduction/holder.d.ts.map +1 -0
- package/dist/introduction/holder.js +764 -0
- package/dist/introduction/holder.js.map +1 -0
- package/dist/introduction.d.ts +101 -0
- package/dist/introduction.d.ts.map +1 -0
- package/dist/introduction.js +132 -0
- package/dist/introduction.js.map +1 -0
- package/dist/invariants.d.ts +43 -0
- package/dist/invariants.d.ts.map +1 -0
- package/dist/invariants.js +953 -0
- package/dist/invariants.js.map +1 -0
- package/dist/keys-seed.d.ts +7 -0
- package/dist/keys-seed.d.ts.map +1 -0
- package/dist/keys-seed.js +133 -0
- package/dist/keys-seed.js.map +1 -0
- package/dist/log-memory.d.ts +12 -0
- package/dist/log-memory.d.ts.map +1 -0
- package/dist/log-memory.js +101 -0
- package/dist/log-memory.js.map +1 -0
- package/dist/membership/holder.d.ts +33 -0
- package/dist/membership/holder.d.ts.map +1 -0
- package/dist/membership/holder.js +929 -0
- package/dist/membership/holder.js.map +1 -0
- package/dist/membership.d.ts +123 -0
- package/dist/membership.d.ts.map +1 -0
- package/dist/membership.js +180 -0
- package/dist/membership.js.map +1 -0
- package/dist/message/holder.d.ts +49 -0
- package/dist/message/holder.d.ts.map +1 -0
- package/dist/message/holder.js +290 -0
- package/dist/message/holder.js.map +1 -0
- package/dist/message.d.ts +43 -0
- package/dist/message.d.ts.map +1 -0
- package/dist/message.js +51 -0
- package/dist/message.js.map +1 -0
- package/dist/ports.d.ts +237 -0
- package/dist/ports.d.ts.map +1 -0
- package/dist/ports.js +2 -0
- package/dist/ports.js.map +1 -0
- package/dist/profile.d.ts +56 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +193 -0
- package/dist/profile.js.map +1 -0
- package/dist/prompts.d.ts +14 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +69 -0
- package/dist/prompts.js.map +1 -0
- package/dist/receive.d.ts +134 -0
- package/dist/receive.d.ts.map +1 -0
- package/dist/receive.js +317 -0
- package/dist/receive.js.map +1 -0
- package/dist/results.d.ts +173 -0
- package/dist/results.d.ts.map +1 -0
- package/dist/results.js +21 -0
- package/dist/results.js.map +1 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +45 -38
- package/dist/schemas.js.map +1 -1
- package/dist/sha256.d.ts +3 -0
- package/dist/sha256.d.ts.map +1 -0
- package/dist/sha256.js +69 -0
- package/dist/sha256.js.map +1 -0
- package/dist/star.d.ts +31 -0
- package/dist/star.d.ts.map +1 -0
- package/dist/star.js +56 -0
- package/dist/star.js.map +1 -0
- package/dist/state-builder.d.ts +42 -0
- package/dist/state-builder.d.ts.map +1 -0
- package/dist/state-builder.js +100 -0
- package/dist/state-builder.js.map +1 -0
- package/dist/state.d.ts +914 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +37 -0
- package/dist/state.js.map +1 -0
- package/dist/store-contract.d.ts +11 -0
- package/dist/store-contract.d.ts.map +1 -0
- package/dist/store-contract.js +189 -0
- package/dist/store-contract.js.map +1 -0
- package/dist/store-memory.d.ts +8 -0
- package/dist/store-memory.d.ts.map +1 -0
- package/dist/store-memory.js +17 -0
- package/dist/store-memory.js.map +1 -0
- package/dist/testing.d.ts +22 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +21 -0
- package/dist/testing.js.map +1 -0
- package/dist/trust/continuity.d.ts +71 -0
- package/dist/trust/continuity.d.ts.map +1 -0
- package/dist/trust/continuity.js +1222 -0
- package/dist/trust/continuity.js.map +1 -0
- package/dist/trust/duties.d.ts +67 -0
- package/dist/trust/duties.d.ts.map +1 -0
- package/dist/trust/duties.js +179 -0
- package/dist/trust/duties.js.map +1 -0
- package/dist/trust/entries.d.ts +139 -0
- package/dist/trust/entries.d.ts.map +1 -0
- package/dist/trust/entries.js +795 -0
- package/dist/trust/entries.js.map +1 -0
- package/dist/trust/group-star.d.ts +43 -0
- package/dist/trust/group-star.d.ts.map +1 -0
- package/dist/trust/group-star.js +188 -0
- package/dist/trust/group-star.js.map +1 -0
- package/dist/trust/mapping.d.ts +56 -0
- package/dist/trust/mapping.d.ts.map +1 -0
- package/dist/trust/mapping.js +584 -0
- package/dist/trust/mapping.js.map +1 -0
- package/dist/trust/profile.d.ts +25 -0
- package/dist/trust/profile.d.ts.map +1 -0
- package/dist/trust/profile.js +249 -0
- package/dist/trust/profile.js.map +1 -0
- package/dist/trust/star.d.ts +208 -0
- package/dist/trust/star.d.ts.map +1 -0
- package/dist/trust/star.js +588 -0
- package/dist/trust/star.js.map +1 -0
- package/dist/trust/state.d.ts +83 -0
- package/dist/trust/state.d.ts.map +1 -0
- package/dist/trust/state.js +154 -0
- package/dist/trust/state.js.map +1 -0
- package/dist/util-freeze.d.ts +3 -0
- package/dist/util-freeze.d.ts.map +1 -0
- package/dist/util-freeze.js +11 -0
- package/dist/util-freeze.js.map +1 -0
- package/dist/views.d.ts +179 -0
- package/dist/views.d.ts.map +1 -0
- package/dist/views.js +286 -0
- package/dist/views.js.map +1 -0
- package/dist/visibility.d.ts +5 -5
- package/dist/visibility.d.ts.map +1 -1
- package/dist/visibility.js +22 -28
- package/dist/visibility.js.map +1 -1
- package/dist/wire.d.ts +218 -83
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js.map +1 -1
- package/package.json +60 -10
- package/schemas/holder-state-v1.schema.json +3880 -0
- package/schemas/holder-state-v2.schema.json +4123 -0
- package/dist/holder.d.ts.map +0 -1
- package/dist/holder.js.map +0 -1
- package/dist/probe/acks.d.ts +0 -27
- package/dist/probe/acks.d.ts.map +0 -1
- package/dist/probe/acks.js +0 -152
- package/dist/probe/acks.js.map +0 -1
- package/dist/probe/continuity.d.ts +0 -20
- package/dist/probe/continuity.d.ts.map +0 -1
- package/dist/probe/continuity.js +0 -805
- package/dist/probe/continuity.js.map +0 -1
- package/dist/probe/deps.d.ts +0 -61
- package/dist/probe/deps.d.ts.map +0 -1
- package/dist/probe/deps.js +0 -54
- package/dist/probe/deps.js.map +0 -1
- package/dist/probe/encounter.d.ts +0 -26
- package/dist/probe/encounter.d.ts.map +0 -1
- package/dist/probe/encounter.js +0 -938
- package/dist/probe/encounter.js.map +0 -1
- package/dist/probe/introduce.d.ts +0 -62
- package/dist/probe/introduce.d.ts.map +0 -1
- package/dist/probe/introduce.js +0 -306
- package/dist/probe/introduce.js.map +0 -1
- package/dist/probe/membership.d.ts +0 -96
- package/dist/probe/membership.d.ts.map +0 -1
- package/dist/probe/membership.js +0 -467
- package/dist/probe/membership.js.map +0 -1
- package/dist/probe/trust.d.ts +0 -156
- package/dist/probe/trust.d.ts.map +0 -1
- package/dist/probe/trust.js +0 -1233
- package/dist/probe/trust.js.map +0 -1
- package/dist/probe.d.ts +0 -7
- package/dist/probe.d.ts.map +0 -1
- package/dist/probe.js +0 -42
- package/dist/probe.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"star.js","sourceRoot":"","sources":["../../src/trust/star.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,uEAAuE;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,iEAAiE;AACjE,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,6DAA6D;AAC7D,uEAAuE;AACvE,sEAAsE;AACtE,0EAA0E;AAC1E,uEAAuE;AACvE,yEAAyE;AACzE,+CAA+C;AAC/C,sEAAsE;AACtE,4CAA4C;AAC5C,EAAE;AACF,uEAAuE;AACvE,oEAAoE;AACpE,qEAAqE;AACrE,sEAAsE;AACtE,0EAA0E;AAC1E,qEAAqE;AACrE,oFAAoF;AACpF,uEAAuE;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,uEAAuE;A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AG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;QAC7D,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;QAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;QACrD,MAAM,OAAO,GAAa,EAAE,CAAA;QAC5B,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACrF,IAAI,CAAC,CAAC,EAAE,KAAK,MAAM;gBAAE,SAAQ;YAC7B,KAAK,MAAM,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC;gBAC7C,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBAAC,MAAK;gBAAC,CAAC;YAC3E,CAAC;QACH,CAAC;QACD,sFAAsF;QACtF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAA;IAC1E,CAAC;CACF,CAAA","sourcesContent":["// trust/star — the star on the holder (lib Stage 2, PR 4b): star@2 as the\n// registered task star/0.2 (5.1–5.2a), reconciled per recipient (5.4),\n// and the machinery the group star (trust/group-star.ts) shares with it:\n// the sender's salt scope, baseline automaton and in-flight deliveries,\n// and the receiver's assembly per (tuple, salt), on HolderState.\n//\n// Rule numbers: bare four-digit numbers are RLTP-TRU (trust-layer.md).\n//\n// What it registers (through trustModule, trust/mapping.ts):\n// sweep trust.star resume's reconciliation: per contact and live\n// relationship, the view against the baseline;\n// where they differ, the class is on and the scope\n// can issue, one production under the next salt\n// task star/0.2 (proof absent) reception: assembly, completion,\n// the accepted snapshot\n// ack star/0.2 completion of a salt by the verified acks of\n// every chunk (5660)\n//\n// The sender (5.4). The view (5610/5620) is the set of (member, anchor\n// head) over the admitted entries, member = the entry id, sorted by\n// member; every recipient gets the same view. A production takes the\n// snapshot, assigns lastSalt + 1, builds the chunks blinded under the\n// tuple's pair secret (KeyProvider.agree on the tuple's rkid), stamps one\n// fresh threadId on every chunk of the salt (entropy thread.id), and\n// commits `lastSalt`, `inflight[salt] = {view, viewDigest, digests, acked: []}` and\n// the outbox items in one transition (5090, 5110); the outbound leaves\n// only after that commit. Chunk retries are the outbox's, byte-identical\n// down to the envelope and the threadId (Delivery 4.2). Completion: the\n// verified ack of a chunk marks it acked in its inflight entry; the last\n// one runs the baseline automaton (5670): s > H sets H = s and S = the\n// view sent under s, s ≤ H changes nothing; the salt and every in-flight\n// salt at or below the new H leave `inflight`. No rollback (5680).\n//\n// Choices this file makes where note and spec leave them open:\n// - an available delivery contact (5690) is a resume. A divergence is\n// delivered once per view: no new salt while an in-flight salt above\n// H carries exactly the current view and none of its chunks has\n// failed (the outbox retries it byte-identical). A view that changes\n// again, or a delivery the outbox gives up (failed, its horizon or the\n// adapter's verdict) leaves the divergence standing, and the next\n// resume ships the current view under a fresh, higher salt (5680)\n// - completion counts verified delivery-acks only, never an adapter's\n// `delivered` report (ports.ts DeliveryReport, 5660)\n// - superseded salts are not withdrawn from the outbox: their retries\n// run to the horizon like any item (no trias state says \"superseded\"),\n// and the receiver refuses them (5150) or answers a cached duplicate\n// - needing delivery and completing are kept apart: a delivery with a\n// failed chunk no longer counts as in flight (the next resume issues a\n// fresh salt), but its inflight entry (view, digests, acked) stays as\n// long as any of its outbox items exists, so a late ack still completes\n// it (5660; the automaton then advances on s > H only, 5670). It leaves\n// when the last of its items has left the outbox (tick's key-retention):\n// at the tuple's next production and by tick (retainInflight)\n// - the star goes on every live relationship of the contact (2820), the\n// active-head tuple of each, lagging ones included (6595); a contact\n// with no entry yet is a recipient like any other (2760: every contact)\n// - the scope cannot issue once `exhausted` (set by the commit that\n// issues 10¹⁸−1, 2600) and nothing is produced; state loss (5100) is\n// not modelled: a restored state carries its lastSalt\n// - a production whose key agreement is unavailable (the counterpart key\n// invalid or the own key not released) is skipped silently and stays\n// pending\n//\n// The receiver (5.2a). One open assembly per tuple and artifact\n// (Tuple.starIn.assembly); its chunks are kept as {digest, threadId,\n// body}. The checks, in order: the arrival tuple is a live active head\n// (5360); salt above the completed high-water mark (5150) and above the\n// lower bound (5366); not below the open assembly (5340); the MAC under\n// the salt's key (5080); then against the assembly: a higher salt\n// displaces it (5330); seq above the resource limit discards (5365);\n// another threadId (5280), a repeated seq of other bytes (5260), a second\n// last (5270), a seq beyond last (5290) reject the delivery; the same\n// digest again is a repeat, acked, no change (5250). On completion the\n// union must be strictly ascending (5300, 5310). A rejection (the chunk is\n// authenticated: its MAC verified) and a resource-limit discard (5365)\n// both commit as receive.ts TaskDiscarded, disposition `discarded` with\n// reason `rejected` or `resource-limit`: the assembly is dropped and its\n// salt becomes the lower bound, so no later chunk of it is acked and the\n// delivery never completes (5366); the completed hwm stays. Checks before\n// the MAC (salt rules) and a failed MAC are plain refusals that touch\n// nothing, so an unauthenticated chunk can discard no assembly. Every other chunk before completion is acked on its\n// own (Delivery: every chunk is acked); only the completing chunk\n// changes the accepted snapshot, advances hwm (5140, 5350) and announces\n// star.accepted, all in its ack's transaction.\n//\n// Choices on the receiver side:\n// - the resource limit is a bound on seq: an open assembly holds at most\n// ASSEMBLY_LIMIT.star = 1024 chunks (≤ 1 048 576 entries); a chunk\n// with a higher seq discards the assembly (5365, 5366)\n// - `accepted` keeps the whole assembled union with its salt and the\n// matches (6160): the entry ids of the holder's other contacts one of\n// whose held anchors (the entry's anchor head, every relationship's\n// held head and both ends of every held lineage link, 6390) blinds to\n// a value in it. When the holder comes to hold new anchors for a\n// contact (the anchor mapping's acceptance: entry commit, advanced\n// head, new links), the mapping transition re-matches every accepted\n// star against them (starBlinds in its preparation, rematchStars in\n// its apply). Matches only grow: held anchors are never dropped\nimport { iso, jcs } from '../core.js'\nimport type { Json } from '../core.js'\nimport { digestDoc, xRawOfMk } from '../crypto.js'\nimport { seal } from '../delivery.js'\nimport { PLAINTEXT_MAX, blindAnchor, buildStarChunks, starChunkMacOk, starChunkOk, starKeyOf, strictlyAscending } from '../star.js'\nimport type { StarChunk } from '../star.js'\nimport { tupleByRkid } from '../receive.js'\nimport { sha256Hex } from '../sha256.js'\nimport type { Arrival, ReceivedDocument, TaskDiscarded, TaskRefusal } from '../receive.js'\nimport type { AckHandler, Applied, EventDraft, OutboundDraft, PrepareCtx, SweepHandler, TaskHandler } from '../engine.js'\nimport { triasOf } from '../state.js'\nimport type { Assembly, Contact, Dec, HolderState, Relationship, SeqIn, SeqOut, StarPair, TrustClass, Tuple } from '../state.js'\nimport { ADMISSION_BOUND, activeTuple, classOnToward, entryOf, entryRelationships, findContact } from './state.js'\n\n/** The registered task type that carries star@2 (Delivery §4.4, 5640). */\nexport const STAR_TYPE = 'https://real-life.org/trust-tasks/star/0.2'\n\n/** The receiver's resource limit (5365): the highest seq an open assembly\n * takes, per artifact. */\nexport const ASSEMBLY_LIMIT = Object.freeze({ star: 1024, groupStar: 64, probe: 64 })\n\nconst te = new TextEncoder()\nconst inc = (d: Dec): Dec => (BigInt(d) + 1n).toString()\nconst cmp = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0)\nconst refuse = (reason: TaskRefusal['reason'], ref?: string): TaskRefusal => ({ ok: false, reason, ...(ref ? { ref } : {}) })\n\n// ── the artifact descriptor shared with the group star ─────────────────\n\n/** One reconciled, chunked artifact on a tuple: its scopes and how it\n * builds and completes. V is a view element, A what a completed\n * delivery leaves behind on the receiver. */\nexport interface Artifact<V, A> {\n kind: 'star' | 'groupStar'\n type: string\n cls: TrustClass\n /** the rule a malformed chunk fails */\n malformedRef: string\n out (t: Readonly<Tuple>): SeqOut<V>\n withOut (t: Readonly<Tuple>, o: SeqOut<V>): Tuple\n inn (t: Readonly<Tuple>): SeqIn<A>\n withIn (t: Readonly<Tuple>, i: SeqIn<A>): Tuple\n /** the reconciliation view toward contact `c` on relationship `rel` (sync) */\n view (state: Readonly<HolderState>, c: Readonly<Contact>, rel: Readonly<Relationship>): V[]\n /** the view depends on state.contacts alone, the same toward every\n * recipient: computed once per contacts record */\n uniform: boolean\n /** the chunks of one production */\n build (ctx: PrepareCtx, p: { shared: Uint8Array, own: string, tuple: Readonly<Tuple>, salt: Dec, view: V[] }): Promise<Json[] | null>\n chunkOk (chunk: unknown): boolean\n macOk (ctx: PrepareCtx, p: { shared: Uint8Array, from: string, own: string, salt: Dec, chunk: Json }): Promise<boolean>\n /** the entries a chunk body carries, in order */\n entries (body: Json): Json[]\n /** the completed delivery: its union validated and evaluated */\n complete (ctx: PrepareCtx, p: { shared: Uint8Array, from: string, own: string, salt: Dec, union: Json[], rel: Readonly<Relationship>, tuple: Readonly<Tuple> }):\n Promise<{ ok: true, accepted: A, memory?: Record<string, Json> } | { ok: false, ref: string }>\n}\n\ntype Body = { salt: Dec, seq: Dec, last: boolean }\nconst bodyOf = (chunk: Json): Body & Record<string, Json> => (chunk as { body: Body & Record<string, Json> }).body\n\n// ── the sender ─────────────────────────────────────────────────────────\n\n/** One live recipient: a contact and the active-head tuple of one of its\n * live relationships (2820). */\nexport interface Recipient { contact: Contact, rel: Relationship, tuple: Tuple }\n\n/** Every contact's live relationships, by contact id, then relationship\n * order; a relationship behind two entries under the one its\n * verifications go to (2146), once. */\nexport function recipients (state: Readonly<HolderState>): Recipient[] {\n const out: Recipient[] = []\n for (const contact of Object.values(state.contacts).sort((a, b) => cmp(a.id, b.id))) {\n for (const rel of entryRelationships(state, contact)) {\n if (rel.chainedInto !== null || entryOf(state, rel)?.id !== contact.id) continue\n const tuple = activeTuple(rel)\n if (tuple && !tuple.deactivated) out.push({ contact, rel, tuple })\n }\n }\n return out\n}\n\n/** 2600: the scope has issued its maximum, or would exceed the wire domain. */\nconst canIssue = (o: Readonly<SeqOut<unknown>>): boolean => !o.exhausted && BigInt(o.lastSalt) < ADMISSION_BOUND\n\n/** An in-flight salt above H carrying exactly this view, none of whose\n * chunks has failed: the divergence is being delivered. */\nconst inFlight = (state: Readonly<HolderState>, o: Readonly<SeqOut<unknown>>, viewDigest: string): boolean =>\n Object.entries(o.inflight).some(([salt, f]) => BigInt(salt) > BigInt(o.hwm) && f.viewDigest === viewDigest && canComplete(state, f))\n\n/** A uniform view, once per contacts record (the record is replaced on\n * every change of a contact, so the cache cannot go stale). */\nconst uniformViews = new WeakMap<object, Map<string, { view: unknown[], digest: string }>>()\n\n/** The digest of a view: SHA-256 over its JCS form. Views are compared by\n * it (the baseline's snapshotDigest, an inflight entry's viewDigest),\n * never re-serialized per comparison. */\nexport const viewDigest = (view: readonly unknown[]): string => sha256Hex(jcs(view))\n\n/** The view toward a recipient and its digest. */\nfunction viewAt<V, A> (art: Artifact<V, A>, state: Readonly<HolderState>, r: Recipient): { view: V[], digest: string } {\n if (!art.uniform) { const view = art.view(state, r.contact, r.rel); return { view, digest: viewDigest(view) } }\n let byKind = uniformViews.get(state.contacts)\n if (!byKind) uniformViews.set(state.contacts, (byKind = new Map()))\n let v = byKind.get(art.kind)\n if (!v) { const view = art.view(state, r.contact, r.rel); byKind.set(art.kind, (v = { view, digest: viewDigest(view) })) }\n return v as { view: V[], digest: string }\n}\n\n/** Whether an in-flight delivery can still complete: every chunk acked,\n * or still in the outbox and not failed (an ack refers to an outbox item). */\nexport const canComplete = (state: Readonly<HolderState>, f: Readonly<{ digests: string[], acked: string[] }>): boolean =>\n f.digests.every((d) => f.acked.includes(d) || (Object.hasOwn(state.outbox, d) && triasOf(state.outbox[d]) !== 'failed'))\n\n/** The in-flight deliveries whose completion data is still needed: any\n * of their outbox items exists, failed ones included — an ack can still\n * arrive late for it (Delivery §6.1 failed → delivered) and complete the\n * salt (5660). Whether one still needs delivering is canComplete's. */\nfunction retainedInflight<V> (state: Readonly<HolderState>, o: Readonly<SeqOut<V>>): SeqOut<V>['inflight'] {\n const out: SeqOut<V>['inflight'] = {}\n for (const [s, f] of Object.entries(o.inflight)) if (f.digests.some((d) => Object.hasOwn(state.outbox, d))) out[s] = f\n return out\n}\n\n/** Every tuple's in-flight deliveries of both artifacts pruned to those\n * whose outbox items are not all gone; tick's retention (the same state\n * object where nothing is pruned). */\nexport function retainInflight (state: Readonly<HolderState>): HolderState {\n let relationships: HolderState['relationships'] | null = null\n for (const rel of Object.values(state.relationships)) {\n let changed = false\n const tuples = rel.tuples.map((t) => {\n const so = retainedInflight(state, t.starOut), go = retainedInflight(state, t.groupStarOut)\n if (Object.keys(so).length === Object.keys(t.starOut.inflight).length && Object.keys(go).length === Object.keys(t.groupStarOut.inflight).length) return t\n changed = true\n return { ...t, starOut: { ...t.starOut, inflight: so }, groupStarOut: { ...t.groupStarOut, inflight: go } }\n })\n if (changed) (relationships ??= { ...state.relationships })[rel.id] = { ...rel, tuples }\n }\n return relationships ? { ...state, relationships } : state as HolderState\n}\n\n/** Whether the artifact is owed now on this recipient (5690–5720, 5830):\n * the class on, the scope able to issue, the view diverging from the\n * baseline (absent: by definition) and not already in flight. */\nexport function owed<V, A> (art: Artifact<V, A>, state: Readonly<HolderState>, r: Recipient, digest: string): boolean {\n const o = art.out(r.tuple)\n if (!classOnToward(r.contact, art.cls) || !canIssue(o)) return false\n if (o.snapshotDigest !== null && o.snapshotDigest === digest) return false\n return !inFlight(state, o, digest)\n}\n\n/** The sweep's pending keys: one per owed recipient and view. */\nexport function pendingOf<V, A> (art: Artifact<V, A>, state: Readonly<HolderState>): string[] {\n const keys: string[] = []\n for (const r of recipients(state)) {\n if (!classOnToward(r.contact, art.cls)) continue\n const { digest } = viewAt(art, state, r)\n if (owed(art, state, r, digest)) keys.push(`${art.kind}|${r.rel.id}|${r.tuple.ownPairLabel}|${digest}`)\n }\n return keys\n}\n\n/** A production prepared against a snapshot. */\ninterface Production<V> {\n relId: string\n tuple: string\n contactId: string\n baseSalt: Dec\n salt: Dec\n view: V[]\n viewDigest: string\n outbound: OutboundDraft[]\n}\n\n/** A key agreement on the tuple's own rkid with the counterpart key, or null. */\nexport async function pairShared (ctx: PrepareCtx, t: Readonly<Tuple>, peerKeyAgreement: string = t.counterpartKeyAgreement): Promise<Uint8Array | null> {\n const x = xRawOfMk(peerKeyAgreement)\n if (!x) return null\n const a = await ctx.keys.agree(t.rkid, x, ctx.release)\n return a.status === 'available' ? a.shared : null\n}\n\n/** Seal one chunk as its own document of the salt's thread (Delivery §4.4). */\nexport async function chunkDocument (ctx: PrepareCtx, type: string, issuer: string, t: Readonly<Tuple>, contactId: string, threadId: string, chunk: Json): Promise<OutboundDraft> {\n const S = ctx.crypto.subtle\n const doc = { id: ctx.entropy.id('doc.id'), type, issuer, recipient: t.counterpartAnchor, threadId, issuedAt: iso(ctx.when), payload: chunk }\n // 5190: within the Delivery Contract's plaintext limit, by construction\n if (te.encode(jcs(doc)).length > PLAINTEXT_MAX) throw new Error(`trust: a ${type} chunk exceeds ${PLAINTEXT_MAX} bytes`)\n const envelope = await seal(doc, t.counterpartKeyAgreement, { ephSeed: ctx.entropy.bytes('seal.eph', 32), nonce: ctx.entropy.bytes('seal.nonce', 12) }, S)\n return { digest: await digestDoc(doc, S), envelope, type, threadId, recipient: { contactId, rkid: t.rkid, keyAgreement: t.counterpartKeyAgreement } }\n}\n\n/** The reconciliation sweep of one artifact (5.4, 5730). */\nexport function sweepOf<V, A> (art: Artifact<V, A>): SweepHandler<Production<V>[]> {\n return {\n pending: (state) => pendingOf(art, state),\n // contacts (views, settings), relationships (scopes), groups (the group\n // star's view) and the outbox (whether a delivery can still complete)\n reads: ['contacts', 'relationships', 'groups', 'outbox'],\n async prepare (ctx) {\n const st = ctx.snapshot\n const out: Production<V>[] = []\n for (const r of recipients(st)) {\n if (!classOnToward(r.contact, art.cls)) continue\n const { view, digest } = viewAt(art, st, r)\n if (!owed(art, st, r, digest)) continue\n const shared = await pairShared(ctx, r.tuple)\n if (!shared) continue\n const own = (await ctx.keys.anchorOf(r.tuple.ownPairLabel)).anchor\n const o = art.out(r.tuple)\n const salt = inc(o.lastSalt)\n const chunks = await art.build(ctx, { shared, own, tuple: r.tuple, salt, view })\n if (!chunks) continue\n // one salt = one thread: a fresh threadId on every chunk of it (Delivery §4.4)\n const threadId = ctx.entropy.id('thread.id')\n const outbound: OutboundDraft[] = []\n for (const chunk of chunks) outbound.push(await chunkDocument(ctx, art.type, own, r.tuple, r.contact.id, threadId, chunk))\n out.push({ relId: r.rel.id, tuple: r.tuple.ownPairLabel, contactId: r.contact.id, baseSalt: o.lastSalt, salt, view, viewDigest: digest, outbound })\n }\n return out\n },\n apply (state, prepared) {\n let cur = state as HolderState\n const outbound: OutboundDraft[] = []\n let deferred = false\n for (const p of prepared.value) {\n const rel = Object.hasOwn(cur.relationships, p.relId) ? cur.relationships[p.relId] : undefined\n const contact = findContact(cur, p.contactId)\n const tuple = rel && activeTuple(rel)\n if (!rel || !contact || !tuple || tuple.ownPairLabel !== p.tuple || rel.chainedInto !== null || tuple.deactivated || !contact.relIds.includes(rel.id) || entryOf(cur, rel)?.id !== contact.id) continue\n const r: Recipient = { contact, rel, tuple }\n const { digest } = viewAt(art, cur, r)\n // 5110: the snapshot, the salt and the commit are one step — a\n // production prepared on another view or salt is not committed\n if (art.out(tuple).lastSalt !== p.baseSalt || digest !== p.viewDigest || !owed(art, cur, r, digest)) {\n if (owed(art, cur, r, digest)) deferred = true\n continue\n }\n const o = art.out(tuple)\n const next: SeqOut<V> = {\n ...o, lastSalt: p.salt, exhausted: BigInt(p.salt) >= ADMISSION_BOUND,\n // what no ack can reach any more leaves with the next production\n inflight: { ...retainedInflight(cur, o), [p.salt]: { view: p.view, viewDigest: p.viewDigest, digests: p.outbound.map((d) => d.digest), acked: [] } },\n }\n const tuples = rel.tuples.map((t) => (t.ownPairLabel === p.tuple ? art.withOut(t, next) : t))\n cur = { ...cur, relationships: { ...cur.relationships, [rel.id]: { ...rel, tuples } } }\n outbound.push(...p.outbound)\n }\n return { state: cur, outbound, deferred }\n },\n }\n}\n\n/** Completion of a salt by the verified acks of all its chunks (5660),\n * then the baseline automaton (5670). */\nexport function ackOf<V, A> (art: Artifact<V, A>): AckHandler {\n return (state, ref) => {\n const item = state.outbox[ref]\n const at = tupleByRkid(state, item.recipient.rkid)\n if (!at) return { state: state as HolderState }\n const o = art.out(at.tuple)\n const hit = Object.entries(o.inflight).find(([, f]) => f.digests.includes(ref))\n if (!hit) return { state: state as HolderState }\n const [salt, f] = hit\n const acked = f.acked.includes(ref) ? f.acked : [...f.acked, ref]\n let next: SeqOut<V>\n if (f.digests.every((d) => acked.includes(d))) {\n const advance = BigInt(salt) > BigInt(o.hwm)\n const hwm = advance ? salt : o.hwm\n const inflight: SeqOut<V>['inflight'] = {}\n for (const [s, x] of Object.entries(o.inflight)) if (s !== salt && BigInt(s) > BigInt(hwm)) inflight[s] = x\n next = { ...o, hwm, snapshot: advance ? f.view : o.snapshot, snapshotDigest: advance ? f.viewDigest : o.snapshotDigest, inflight }\n } else next = { ...o, inflight: { ...o.inflight, [salt]: { ...f, acked } } }\n const tuples = at.rel.tuples.map((t) => (t.ownPairLabel === at.tuple.ownPairLabel ? art.withOut(t, next) : t))\n return { state: { ...state, relationships: { ...state.relationships, [at.rel.id]: { ...at.rel, tuples } } } }\n }\n}\n\n// ── the receiver ───────────────────────────────────────────────────────\n\n/** An assembly chunk as held: the document's digest and thread, the body. */\ninterface Held { digest: string, threadId: string, body: { seq: Dec, last: boolean } & Record<string, Json> }\n\n/** What one authenticated chunk does to its tuple's open assembly of one\n * artifact (5.2a; the probe under 6790 with `probe` as the salt). */\nexport type AssemblyStep =\n | { kind: 'repeat' }\n | { kind: 'reject', ref: string }\n | { kind: 'limit' }\n | { kind: 'hold', assembly: Assembly }\n | { kind: 'complete', chunks: Record<string, Json>, last: bigint }\n\n/**\n * The assembly rules after the salt checks and the MAC (5250–5290, 5330,\n * 5365): a higher salt displaces the open assembly; a seq above `limit`\n * is the resource limit; the same digest again a repeat; another thread,\n * a repeated seq of other bytes, a second last or a seq beyond last\n * reject the delivery; otherwise the chunk is held, or completes the\n * assembly with every seq up to last present.\n */\nexport function assemblyStep (open: Assembly | null, salt: Dec, body: { seq: Dec, last: boolean } & Record<string, Json>, threadId: string, digest: string, limit: number): AssemblyStep {\n const base: Assembly = open && open.salt === salt ? open : { salt, chunks: {} }\n const seq = BigInt(body.seq)\n if (seq > BigInt(limit)) return { kind: 'limit' }\n const held = Object.values(base.chunks) as unknown as Held[]\n const same = Object.hasOwn(base.chunks, body.seq) ? base.chunks[body.seq] as unknown as Held : undefined\n if (same && same.digest === digest) return { kind: 'repeat' } // 5250\n if (held.some((h) => h.threadId !== threadId)) return { kind: 'reject', ref: 'RLTP-TRU-5280' }\n if (same) return { kind: 'reject', ref: 'RLTP-TRU-5260' }\n const heldLast = held.find((h) => h.body.last)\n if (body.last && heldLast) return { kind: 'reject', ref: 'RLTP-TRU-5270' }\n const last = body.last ? seq : heldLast ? BigInt(heldLast.body.seq) : null\n if (last !== null && (seq > last || held.some((h) => BigInt(h.body.seq) > last))) return { kind: 'reject', ref: 'RLTP-TRU-5290' }\n const chunks = { ...base.chunks, [body.seq]: { digest, threadId, body } as unknown as Json }\n if (last === null) return { kind: 'hold', assembly: { salt, chunks } }\n for (let i = 1n; i <= last; i++) if (!Object.hasOwn(chunks, String(i))) return { kind: 'hold', assembly: { salt, chunks } }\n return { kind: 'complete', chunks, last }\n}\n\n/** The held bodies of a complete assembly, in seq order. */\nexport const assembledBodies = (chunks: Record<string, Json>, last: bigint): Array<Record<string, Json>> => {\n const out: Array<Record<string, Json>> = []\n for (let i = 1n; i <= last; i++) out.push((chunks[String(i)] as unknown as Held).body)\n return out\n}\n\n/** What stage 8 decided for one chunk. */\ntype ChunkPlan<A> =\n | { kind: 'hold', relId: string, tuple: string, assembly: Assembly }\n | { kind: 'repeat' }\n | { kind: 'discard', relId: string, tuple: string, salt: Dec, reason: 'resource-limit' | 'rejected', ref: string }\n | { kind: 'complete', relId: string, tuple: string, salt: Dec, accepted: A, memory?: Record<string, Json>, contactId: string }\n\n/** The arrival tuple, if it is the active head of a live relationship (6.4, 5360). */\nfunction arrivalTuple (state: Readonly<HolderState>, rkid: string): { rel: Relationship, tuple: Tuple } | null {\n const at = tupleByRkid(state, rkid)\n if (!at || at.tuple.deactivated || at.rel.chainedInto !== null || at.rel.activeHead !== at.tuple.ownPairLabel) return null\n return at\n}\n\nconst maxDec = (a: Dec, b: Dec): Dec => (BigInt(a) >= BigInt(b) ? a : b)\n\n/** The task handler of one artifact (5.2a). */\nexport function taskOf<V, A> (art: Artifact<V, A>, limit: number): TaskHandler<Json, ChunkPlan<A>> {\n return {\n proof: 'absent',\n // stage 7: the closed chunk schema (5070, 5370)\n decode (payload) {\n return art.chunkOk(payload) ? payload as Json : refuse('malformed', art.malformedRef)\n },\n // stage 8: the salt rules, the MAC, and the assembly decision\n async prepare (ctx: PrepareCtx, doc: ReceivedDocument<Json>, arrival: Arrival): Promise<ChunkPlan<A> | TaskRefusal> {\n if ((doc.ceremony as { enactment?: unknown } | undefined)?.enactment !== undefined) return refuse('validation-failed')\n const at = arrivalTuple(ctx.snapshot, arrival.rkid)\n if (!at) return refuse('validation-failed', 'RLTP-TRU-5360')\n const { rel, tuple: t } = at\n const inn = art.inn(t)\n const body = bodyOf(doc.payload)\n const salt = BigInt(body.salt)\n if (salt <= BigInt(inn.hwm)) return refuse('validation-failed', 'RLTP-TRU-5150')\n if (salt <= BigInt(inn.lowerBound)) return refuse('validation-failed', 'RLTP-TRU-5366')\n if (inn.assembly && salt < BigInt(inn.assembly.salt)) return refuse('validation-failed', 'RLTP-TRU-5340')\n const shared = await pairShared(ctx, t)\n if (!shared) return refuse('validation-failed', 'RLTP-TRU-5080')\n const own = (await ctx.keys.anchorOf(t.ownPairLabel)).anchor\n if (!(await art.macOk(ctx, { shared, from: t.counterpartAnchor, own, salt: body.salt, chunk: doc.payload }))) return refuse('validation-failed', 'RLTP-TRU-5080')\n const ids = { relId: rel.id, tuple: t.ownPairLabel }\n // the chunk is authenticated: a violation rejects the whole delivery (5260–5310)\n const reject = (ref: string): ChunkPlan<A> => ({ kind: 'discard', ...ids, salt: body.salt, reason: 'rejected', ref })\n const step = assemblyStep(inn.assembly, body.salt, body, doc.threadId, arrival.digest, limit)\n if (step.kind === 'limit') return { kind: 'discard', ...ids, salt: body.salt, reason: 'resource-limit', ref: 'RLTP-TRU-5365' }\n if (step.kind === 'repeat') return { kind: 'repeat' }\n if (step.kind === 'reject') return reject(step.ref)\n if (step.kind === 'hold') return { kind: 'hold', ...ids, assembly: step.assembly }\n // the completing chunk: the union in seq order, validated, evaluated\n const union: Json[] = assembledBodies(step.chunks, step.last).flatMap((b) => art.entries(b))\n const done = await art.complete(ctx, { shared, from: t.counterpartAnchor, own, salt: body.salt, union, rel, tuple: t })\n if (!done.ok) return reject(done.ref)\n const contactId = entryOf(ctx.snapshot, rel)?.id ?? rel.contactId\n return { kind: 'complete', ...ids, salt: body.salt, accepted: done.accepted, ...(done.memory ? { memory: done.memory } : {}), contactId }\n },\n // stage 9: the decision lands on the same snapshot\n apply (state, prepared): Applied | TaskRefusal | TaskDiscarded {\n const p = prepared.value\n if (p.kind === 'repeat') return { state: state as HolderState }\n const rel = state.relationships[p.relId]\n const t = rel.tuples.find((x) => x.ownPairLabel === p.tuple)!\n const inn = art.inn(t)\n const put = (i: SeqIn<A>, memory?: Record<string, Json>): HolderState => ({\n ...state,\n relationships: {\n ...state.relationships,\n [rel.id]: { ...rel, ...(memory ? { memory } : {}), tuples: rel.tuples.map((x) => (x.ownPairLabel === p.tuple ? art.withIn(x, i) : x)) },\n },\n })\n switch (p.kind) {\n case 'hold': return { state: put({ ...inn, assembly: p.assembly }) }\n case 'discard':\n // the resource limit or a rejected delivery: the assembly dropped,\n // its salt the lower bound (5365, 5366); the completed hwm stays\n return { discarded: true, reason: p.reason, ref: p.ref, state: put({ ...inn, assembly: null, lowerBound: maxDec(inn.lowerBound, p.salt) }) }\n case 'complete': {\n const events: EventDraft[] = [{ type: art.kind === 'star' ? 'star.accepted' : 'groupStar.accepted', contactId: p.contactId, relationshipId: rel.id, salt: p.salt }]\n return { state: put({ ...inn, hwm: p.salt, assembly: null, accepted: p.accepted }, p.memory ? { ...rel.memory, ...p.memory } : undefined), events }\n }\n }\n },\n }\n}\n\n/** A tuple with its open assemblies dropped, as its deactivation leaves\n * it (5360): for chaining and departure (PR 4c). */\nexport const discardAssemblies = (t: Readonly<Tuple>): Tuple => ({\n ...t,\n starIn: { ...t.starIn, assembly: null },\n groupStarIn: { ...t.groupStarIn, assembly: null },\n probeIn: { ...t.probeIn, assembly: null },\n})\n\n// ── the star ───────────────────────────────────────────────────────────\n\n/** The reconciliation view of 5610/5620: (member, anchor head) of every\n * admitted entry, member = the entry id, sorted by member. */\nexport function starView (state: Readonly<HolderState>): StarPair[] {\n return Object.values(state.contacts)\n .filter((c) => c.status === 'admitted' && c.anchorHead !== null)\n .map((c) => ({ member: c.id, head: c.anchorHead! }))\n .sort((a, b) => cmp(a.member, b.member))\n}\n\n/** The entry a tuple's documents come from (2145): the star's sender. */\nconst senderOf = (state: Readonly<HolderState>, rel: Readonly<Relationship>, t: Readonly<Tuple>): string =>\n findContact(state, t.entryId)?.id ?? findContact(state, rel.contactId)?.id ?? rel.contactId\n\n/** Blinded values of `anchors` under the key of every accepted star, by\n * `<relId>|<tuple>`, with the salt they were blinded for: the async half\n * of a re-match (6160), prepared where anchors are about to be held. */\nexport type StarBlinds = Record<string, { salt: Dec, blinds: string[] }>\n\nexport async function starBlinds (ctx: PrepareCtx, anchors: readonly string[]): Promise<StarBlinds> {\n const out: StarBlinds = {}\n if (!anchors.length) return out\n const S = ctx.crypto.subtle\n for (const rel of Object.values(ctx.snapshot.relationships)) {\n for (const t of rel.tuples) {\n const acc = t.starIn.accepted\n if (acc === null) continue\n const shared = await pairShared(ctx, t)\n if (!shared) continue\n const own = (await ctx.keys.anchorOf(t.ownPairLabel)).anchor\n const k = await starKeyOf(shared, t.counterpartAnchor, own, acc.salt, S)\n out[`${rel.id}|${t.ownPairLabel}`] = { salt: acc.salt, blinds: await Promise.all(anchors.map((a) => blindAnchor(k, a, S))) }\n }\n }\n return out\n}\n\n/**\n * The sync half (6160, 6390): `contactId` now holds the anchors `blinds`\n * were prepared for; every accepted star (other than the contact's own)\n * whose stored union carries one of them lists the contact among its\n * matches. Run in the transition that makes the holder hold them (the\n * anchor mapping's acceptance: a new entry, an advanced head, a new link).\n */\nexport function rematchStars (state: Readonly<HolderState>, contactId: string, blinds: StarBlinds): HolderState {\n let relationships: HolderState['relationships'] | null = null\n for (const [key, b] of Object.entries(blinds)) {\n const [relId, label] = [key.slice(0, key.indexOf('|')), key.slice(key.indexOf('|') + 1)]\n const rel = (relationships ?? state.relationships)[relId]\n const t = rel?.tuples.find((x) => x.ownPairLabel === label)\n const acc = t?.starIn.accepted\n if (!rel || !t || !acc || acc.salt !== b.salt || acc.matches.includes(contactId) || senderOf(state, rel, t) === contactId) continue\n const union = new Set(acc.blinded)\n if (!b.blinds.some((x) => union.has(x))) continue\n const matches = [...acc.matches, contactId].sort(cmp)\n relationships ??= { ...state.relationships }\n relationships[relId] = { ...rel, tuples: rel.tuples.map((x) => (x === t ? { ...x, starIn: { ...x.starIn, accepted: { ...acc, matches } } } : x)) }\n }\n return relationships ? { ...state, relationships } : state as HolderState\n}\n\n/** Every anchor the holder holds for a contact (6160, 6390): the entry's\n * head, each relationship's held head, both ends of every held link. */\nexport function heldAnchors (state: Readonly<HolderState>, c: Readonly<Contact>): string[] {\n const out = new Set<string>()\n if (c.anchorHead !== null) out.add(c.anchorHead)\n for (const r of entryRelationships(state, c)) {\n if (r.heldCounterpartHead !== null) out.add(r.heldCounterpartHead)\n for (const l of r.links) { out.add(l.prev); out.add(l.next) }\n }\n return [...out].sort()\n}\n\ntype StarAccepted = NonNullable<SeqIn<{ salt: Dec, blinded: string[], matches: string[] }>['accepted']>\n\n/** The star as an artifact (5.1–5.4). */\nexport const STAR: Artifact<StarPair, StarAccepted> = {\n kind: 'star',\n type: STAR_TYPE,\n cls: 'star',\n malformedRef: 'RLTP-TRU-5070',\n out: (t) => t.starOut,\n withOut: (t, o) => ({ ...t, starOut: o }),\n inn: (t) => t.starIn,\n withIn: (t, i) => ({ ...t, starIn: i }),\n view: (state) => starView(state),\n uniform: true,\n async build (ctx, p) {\n const S = ctx.crypto.subtle\n const k = await starKeyOf(p.shared, p.own, p.tuple.counterpartAnchor, p.salt, S)\n return (await buildStarChunks(k, p.salt, p.view.map((v) => v.head), S)) as unknown as Json[]\n },\n chunkOk: starChunkOk,\n async macOk (ctx, p) {\n const S = ctx.crypto.subtle\n return starChunkMacOk(await starKeyOf(p.shared, p.from, p.own, p.salt, S), p.chunk as unknown as StarChunk, S)\n },\n entries: (body) => (body as { blinded: Json[] }).blinded,\n async complete (ctx, p) {\n const union = p.union as string[]\n if (!strictlyAscending(union)) return { ok: false, ref: 'RLTP-TRU-5300' } // 5300 order, 5310 duplicates\n const S = ctx.crypto.subtle\n const k = await starKeyOf(p.shared, p.from, p.own, p.salt, S)\n const inStar = new Set(union)\n const sender = senderOf(ctx.snapshot, p.rel, p.tuple)\n const matches: string[] = []\n for (const c of Object.values(ctx.snapshot.contacts).sort((a, b) => cmp(a.id, b.id))) {\n if (c.id === sender) continue\n for (const a of heldAnchors(ctx.snapshot, c)) {\n if (inStar.has(await blindAnchor(k, a, S))) { matches.push(c.id); break }\n }\n }\n // the whole union is kept: anchors learned later are tested against it (rematchStars)\n return { ok: true, accepted: { salt: p.salt, blinded: union, matches } }\n },\n}\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Contact, HolderState, Relationship, Setting, TrustClass, Tuple } from '../state.js';
|
|
2
|
+
/** The deliverable set's bound, 10¹⁸−1 (2050): the wire-integer domain. */
|
|
3
|
+
export declare const ADMISSION_BOUND: bigint;
|
|
4
|
+
/** The five classes, in the table's order (2720). */
|
|
5
|
+
export declare const CLASSES: readonly TrustClass[];
|
|
6
|
+
/** 2760: star and blinded group star go to every contact, the anchor
|
|
7
|
+
* mapping to none, sealed group star and profile to the trusted contacts. */
|
|
8
|
+
export declare const classOn: (cls: TrustClass, setting: Setting, isTrusted: boolean) => boolean;
|
|
9
|
+
/** 2020: a trusted contact is one toward which the anchor mapping class is
|
|
10
|
+
* on; its default is no contact (2760), so only `on` makes one. */
|
|
11
|
+
export declare const trusted: (c: Readonly<Contact>) => boolean;
|
|
12
|
+
/** Whether `cls` is on toward the contact (2760, 2840). */
|
|
13
|
+
export declare const classOnToward: (c: Readonly<Contact>, cls: TrustClass) => boolean;
|
|
14
|
+
/** The relationship's active-head tuple (6.4). */
|
|
15
|
+
export declare const activeTuple: (r: Readonly<Relationship>) => Tuple | undefined;
|
|
16
|
+
/** A contact by entry id or alias (2140). */
|
|
17
|
+
export declare const findContact: (state: Readonly<HolderState>, id: string) => Contact | undefined;
|
|
18
|
+
/** The entry's own relationships (Contact.relIds), as present in the state. */
|
|
19
|
+
export declare const entryRelationships: (state: Readonly<HolderState>, c: Readonly<Contact>) => Relationship[];
|
|
20
|
+
/**
|
|
21
|
+
* Whether a relationship lags in its entry (Section 2, 6595): its anchor
|
|
22
|
+
* head is held in the entry as superseded, the `prev` of a link one of
|
|
23
|
+
* the entry's relationships holds. `entry` is the entry's relationships,
|
|
24
|
+
* `r` among them or not. A relationship with no anchor head never lags.
|
|
25
|
+
*/
|
|
26
|
+
export declare const lags: (r: Readonly<Relationship>, entry: readonly Readonly<Relationship>[]) => boolean;
|
|
27
|
+
/** Every tuple's place: the relationship holding the tuple with own pair
|
|
28
|
+
* label `label` (deactivated ones included). */
|
|
29
|
+
export declare function tupleByLabel(state: Readonly<HolderState>, label: string): {
|
|
30
|
+
rel: Relationship;
|
|
31
|
+
tuple: Tuple;
|
|
32
|
+
} | null;
|
|
33
|
+
/** A live relationship: not chained into another, its active head not deactivated. */
|
|
34
|
+
export declare const liveRel: (r: Readonly<Relationship>) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The entry a relationship's verifications go to (2145): the one its
|
|
37
|
+
* active tuple's entryId names, by id or alias, else the one its own
|
|
38
|
+
* identity (contactId) names. Where a relationship stands behind two
|
|
39
|
+
* entries, this is the appended tuple's (2146).
|
|
40
|
+
*/
|
|
41
|
+
export declare const entryOf: (state: Readonly<HolderState>, rel: Readonly<Relationship>) => Contact | undefined;
|
|
42
|
+
/** The entry's relationships whose verifications go to it (2145): all of
|
|
43
|
+
* them, except one that stands behind two entries and feeds the other. */
|
|
44
|
+
export declare const feeding: (state: Readonly<HolderState>, c: Readonly<Contact>) => Relationship[];
|
|
45
|
+
/** The newest of `heads` along `links` (6560): those from which no other
|
|
46
|
+
* head is reachable. One where every pair of heads lies on one chain. */
|
|
47
|
+
export declare function newestOf(heads: readonly string[], links: ReadonlyArray<{
|
|
48
|
+
prev: string;
|
|
49
|
+
next: string;
|
|
50
|
+
}>): string[];
|
|
51
|
+
/**
|
|
52
|
+
* The newest anchor heads of a set of relationships (6560): the heads from
|
|
53
|
+
* which no other head is reachable along the links they hold. One entry's
|
|
54
|
+
* relationships yield exactly one where the head rule and the binding rule
|
|
55
|
+
* admitted every merge (6605); a manual merge (6640) may yield more until
|
|
56
|
+
* its split (2080).
|
|
57
|
+
*/
|
|
58
|
+
export declare function newestHeads(rels: readonly Readonly<Relationship>[]): string[];
|
|
59
|
+
/** What an entry holds as superseded (6540): every prev of a link one of its relationships holds. */
|
|
60
|
+
export declare const supersededIn: (rels: readonly Readonly<Relationship>[]) => Set<string>;
|
|
61
|
+
/** A relationship's verified anchor set (6a.1 rung 2): its self and every anchor of its links. */
|
|
62
|
+
export declare const anchorSet: (r: Readonly<Relationship>) => Set<string>;
|
|
63
|
+
/**
|
|
64
|
+
* The binding rule (6605), entry against entry: a relationship of the one
|
|
65
|
+
* and a relationship of the other hold different pre-rotation bindings
|
|
66
|
+
* for one anchor both hold, or links from one prev to different nexts (a
|
|
67
|
+
* held link fixes the binding of its prev, 6610). Compared relationship by
|
|
68
|
+
* relationship, never combined (6610).
|
|
69
|
+
*/
|
|
70
|
+
export declare function conflicts(as: readonly Readonly<Relationship>[], bs: readonly Readonly<Relationship>[]): boolean;
|
|
71
|
+
/** The union of two binding records (6610), each list sorted and distinct. */
|
|
72
|
+
export declare function unionBindings(a: Readonly<Record<string, string[]>>, b: Readonly<Record<string, string[]>>): Record<string, string[]>;
|
|
73
|
+
/**
|
|
74
|
+
* The head rule (6530, 6540) for relationship `r` against entry `x`
|
|
75
|
+
* (relationships `xs`): (a) r's anchor head is x's or the lineage r holds
|
|
76
|
+
* carries x's as a prev, and (b) x does not hold r's anchor head as
|
|
77
|
+
* superseded, nor r's own entry x's (`ownSuperseded`). For the incoming
|
|
78
|
+
* relationship the caller passes the links its entry held before the
|
|
79
|
+
* verified mapping's lineage joined them: only what the committed mapping
|
|
80
|
+
* newly carries connects (the 6590 rationale; trust/entries.ts).
|
|
81
|
+
*/
|
|
82
|
+
export declare const joins: (r: Readonly<Relationship>, x: Readonly<Contact>, xs: readonly Readonly<Relationship>[], ownSuperseded: ReadonlySet<string>) => boolean;
|
|
83
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/trust/state.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEjG,2EAA2E;AAC3E,eAAO,MAAM,eAAe,QAAkB,CAAA;AAE9C,qDAAqD;AACrD,eAAO,MAAM,OAAO,EAAE,SAAS,UAAU,EAAwF,CAAA;A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AAG,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,SAAS,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE,eAAe,WAAW,CAAC,MAAM,CAAC,KAAG,OAGjE,CAAA"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/** The deliverable set's bound, 10¹⁸−1 (2050): the wire-integer domain. */
|
|
2
|
+
export const ADMISSION_BOUND = 10n ** 18n - 1n;
|
|
3
|
+
/** The five classes, in the table's order (2720). */
|
|
4
|
+
export const CLASSES = Object.freeze(['star', 'groupStar', 'anchorMapping', 'sealedGroupStar', 'profile']);
|
|
5
|
+
/** 2760: star and blinded group star go to every contact, the anchor
|
|
6
|
+
* mapping to none, sealed group star and profile to the trusted contacts. */
|
|
7
|
+
export const classOn = (cls, setting, isTrusted) => {
|
|
8
|
+
if (setting !== 'default')
|
|
9
|
+
return setting === 'on';
|
|
10
|
+
if (cls === 'star' || cls === 'groupStar')
|
|
11
|
+
return true;
|
|
12
|
+
if (cls === 'anchorMapping')
|
|
13
|
+
return false;
|
|
14
|
+
return isTrusted;
|
|
15
|
+
};
|
|
16
|
+
/** 2020: a trusted contact is one toward which the anchor mapping class is
|
|
17
|
+
* on; its default is no contact (2760), so only `on` makes one. */
|
|
18
|
+
export const trusted = (c) => c.settings.anchorMapping === 'on';
|
|
19
|
+
/** Whether `cls` is on toward the contact (2760, 2840). */
|
|
20
|
+
export const classOnToward = (c, cls) => classOn(cls, c.settings[cls], trusted(c));
|
|
21
|
+
/** The relationship's active-head tuple (6.4). */
|
|
22
|
+
export const activeTuple = (r) => r.tuples.find((t) => t.ownPairLabel === r.activeHead);
|
|
23
|
+
/** A contact by entry id or alias (2140). */
|
|
24
|
+
export const findContact = (state, id) => {
|
|
25
|
+
if (Object.hasOwn(state.contacts, id))
|
|
26
|
+
return state.contacts[id];
|
|
27
|
+
return Object.values(state.contacts).find((c) => c.aliases.includes(id));
|
|
28
|
+
};
|
|
29
|
+
/** The entry's own relationships (Contact.relIds), as present in the state. */
|
|
30
|
+
export const entryRelationships = (state, c) => c.relIds.filter((id) => Object.hasOwn(state.relationships, id)).map((id) => state.relationships[id]);
|
|
31
|
+
/**
|
|
32
|
+
* Whether a relationship lags in its entry (Section 2, 6595): its anchor
|
|
33
|
+
* head is held in the entry as superseded, the `prev` of a link one of
|
|
34
|
+
* the entry's relationships holds. `entry` is the entry's relationships,
|
|
35
|
+
* `r` among them or not. A relationship with no anchor head never lags.
|
|
36
|
+
*/
|
|
37
|
+
export const lags = (r, entry) => r.heldCounterpartHead !== null && entry.some((o) => o.links.some((l) => l.prev === r.heldCounterpartHead));
|
|
38
|
+
/** Every tuple's place: the relationship holding the tuple with own pair
|
|
39
|
+
* label `label` (deactivated ones included). */
|
|
40
|
+
export function tupleByLabel(state, label) {
|
|
41
|
+
for (const id of Object.keys(state.relationships).sort()) {
|
|
42
|
+
const rel = state.relationships[id];
|
|
43
|
+
const tuple = rel.tuples.find((t) => t.ownPairLabel === label);
|
|
44
|
+
if (tuple)
|
|
45
|
+
return { rel, tuple };
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
/** A live relationship: not chained into another, its active head not deactivated. */
|
|
50
|
+
export const liveRel = (r) => {
|
|
51
|
+
const t = activeTuple(r);
|
|
52
|
+
return r.chainedInto === null && t !== undefined && !t.deactivated;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The entry a relationship's verifications go to (2145): the one its
|
|
56
|
+
* active tuple's entryId names, by id or alias, else the one its own
|
|
57
|
+
* identity (contactId) names. Where a relationship stands behind two
|
|
58
|
+
* entries, this is the appended tuple's (2146).
|
|
59
|
+
*/
|
|
60
|
+
export const entryOf = (state, rel) => {
|
|
61
|
+
const t = activeTuple(rel);
|
|
62
|
+
return (t && findContact(state, t.entryId)) ?? findContact(state, rel.contactId);
|
|
63
|
+
};
|
|
64
|
+
/** The entry's relationships whose verifications go to it (2145): all of
|
|
65
|
+
* them, except one that stands behind two entries and feeds the other. */
|
|
66
|
+
export const feeding = (state, c) => entryRelationships(state, c).filter((r) => entryOf(state, r)?.id === c.id);
|
|
67
|
+
/** The newest of `heads` along `links` (6560): those from which no other
|
|
68
|
+
* head is reachable. One where every pair of heads lies on one chain. */
|
|
69
|
+
export function newestOf(heads, links) {
|
|
70
|
+
const next = new Map();
|
|
71
|
+
for (const l of links)
|
|
72
|
+
next.set(l.prev, [...(next.get(l.prev) ?? []), l.next]);
|
|
73
|
+
const reaches = (from, to) => {
|
|
74
|
+
const seen = new Set();
|
|
75
|
+
const todo = [...(next.get(from) ?? [])];
|
|
76
|
+
while (todo.length) {
|
|
77
|
+
const n = todo.pop();
|
|
78
|
+
if (n === to)
|
|
79
|
+
return true;
|
|
80
|
+
if (!seen.has(n)) {
|
|
81
|
+
seen.add(n);
|
|
82
|
+
todo.push(...(next.get(n) ?? []));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
};
|
|
87
|
+
const hs = [...new Set(heads)];
|
|
88
|
+
return hs.filter((h) => !hs.some((o) => o !== h && reaches(h, o)));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The newest anchor heads of a set of relationships (6560): the heads from
|
|
92
|
+
* which no other head is reachable along the links they hold. One entry's
|
|
93
|
+
* relationships yield exactly one where the head rule and the binding rule
|
|
94
|
+
* admitted every merge (6605); a manual merge (6640) may yield more until
|
|
95
|
+
* its split (2080).
|
|
96
|
+
*/
|
|
97
|
+
export function newestHeads(rels) {
|
|
98
|
+
return newestOf(rels.map((r) => r.heldCounterpartHead).filter((h) => h !== null), rels.flatMap((r) => r.links));
|
|
99
|
+
}
|
|
100
|
+
/** What an entry holds as superseded (6540): every prev of a link one of its relationships holds. */
|
|
101
|
+
export const supersededIn = (rels) => new Set(rels.flatMap((r) => r.links.map((l) => l.prev)));
|
|
102
|
+
/** A relationship's verified anchor set (6a.1 rung 2): its self and every anchor of its links. */
|
|
103
|
+
export const anchorSet = (r) => {
|
|
104
|
+
const out = new Set();
|
|
105
|
+
if (r.heldCounterpartHead !== null)
|
|
106
|
+
out.add(r.heldCounterpartHead);
|
|
107
|
+
for (const l of r.links) {
|
|
108
|
+
out.add(l.prev);
|
|
109
|
+
out.add(l.next);
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* The binding rule (6605), entry against entry: a relationship of the one
|
|
115
|
+
* and a relationship of the other hold different pre-rotation bindings
|
|
116
|
+
* for one anchor both hold, or links from one prev to different nexts (a
|
|
117
|
+
* held link fixes the binding of its prev, 6610). Compared relationship by
|
|
118
|
+
* relationship, never combined (6610).
|
|
119
|
+
*/
|
|
120
|
+
export function conflicts(as, bs) {
|
|
121
|
+
for (const a of as) {
|
|
122
|
+
for (const b of bs) {
|
|
123
|
+
// within one relationship too: a chain holding two bindings for one anchor (6610)
|
|
124
|
+
if (a.links.some((l) => b.links.some((m) => l.prev === m.prev && l.next !== m.next)))
|
|
125
|
+
return true;
|
|
126
|
+
for (const [anchor, commits] of Object.entries(a.bindings)) {
|
|
127
|
+
const other = Object.hasOwn(b.bindings, anchor) ? b.bindings[anchor] : [];
|
|
128
|
+
if (new Set([...commits, ...other]).size > 1)
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
/** The union of two binding records (6610), each list sorted and distinct. */
|
|
136
|
+
export function unionBindings(a, b) {
|
|
137
|
+
const out = {};
|
|
138
|
+
for (const [k, v] of [...Object.entries(a), ...Object.entries(b)])
|
|
139
|
+
out[k] = [...new Set([...(out[k] ?? []), ...v])].sort();
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The head rule (6530, 6540) for relationship `r` against entry `x`
|
|
144
|
+
* (relationships `xs`): (a) r's anchor head is x's or the lineage r holds
|
|
145
|
+
* carries x's as a prev, and (b) x does not hold r's anchor head as
|
|
146
|
+
* superseded, nor r's own entry x's (`ownSuperseded`). For the incoming
|
|
147
|
+
* relationship the caller passes the links its entry held before the
|
|
148
|
+
* verified mapping's lineage joined them: only what the committed mapping
|
|
149
|
+
* newly carries connects (the 6590 rationale; trust/entries.ts).
|
|
150
|
+
*/
|
|
151
|
+
export const joins = (r, x, xs, ownSuperseded) => r.heldCounterpartHead !== null && x.anchorHead !== null &&
|
|
152
|
+
(r.heldCounterpartHead === x.anchorHead || r.links.some((l) => l.prev === x.anchorHead)) &&
|
|
153
|
+
!supersededIn(xs).has(r.heldCounterpartHead) && !ownSuperseded.has(x.anchorHead);
|
|
154
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/trust/state.ts"],"names":[],"mappings":"AAUA,2EAA2E;AAC3E,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,IAAI,GAAG,GAAG,EAAE,CAAA;AAE9C,qDAAqD;AACrD,MAAM,CAAC,MAAM,OAAO,GAA0B,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAA;AAEjI;8EAC8E;AAC9E,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAe,EAAE,OAAgB,EAAE,SAAkB,EAAW,EAAE;IACxF,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,OAAO,KAAK,IAAI,CAAA;IAClD,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,WAAW;QAAE,OAAO,IAAI,CAAA;IACtD,IAAI,GAAG,KAAK,eAAe;QAAE,OAAO,KAAK,CAAA;IACzC,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED;oEACoE;AACpE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAoB,EAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAA;AAE3F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;IACxC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IAC1H,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAyB,EAAE,CAAoB,EAAE,EAAqC,EAAE,aAAkC,EAAW,EAAE,CAC3J,CAAC,CAAC,mBAAmB,KAAK,IAAI,IAAI,CAAC,CAAC,UAAU,KAAK,IAAI;IACvD,CAAC,CAAC,CAAC,mBAAmB,KAAK,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC;IACxF,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA","sourcesContent":["// trust/state — pure reads of the Trust Layer over HolderState (lib Stage 2,\n// PR 4a, 4c): the class resolution of Section 2a, the trusted set (2020),\n// the entry's relationships and anchor head (2145, 6560), lagging (6595),\n// the entry a relationship's verifications go to (2145, 2146) and the\n// head rule and binding rule of the net (6530–6605). No crypto, no engine; views.ts and the trust module read through here,\n// so the two cannot disagree.\n//\n// Rule numbers: bare four-digit numbers are RLTP-TRU (trust-layer.md).\nimport type { Contact, HolderState, Relationship, Setting, TrustClass, Tuple } from '../state.js'\n\n/** The deliverable set's bound, 10¹⁸−1 (2050): the wire-integer domain. */\nexport const ADMISSION_BOUND = 10n ** 18n - 1n\n\n/** The five classes, in the table's order (2720). */\nexport const CLASSES: readonly TrustClass[] = Object.freeze(['star', 'groupStar', 'anchorMapping', 'sealedGroupStar', 'profile'])\n\n/** 2760: star and blinded group star go to every contact, the anchor\n * mapping to none, sealed group star and profile to the trusted contacts. */\nexport const classOn = (cls: TrustClass, setting: Setting, isTrusted: boolean): boolean => {\n if (setting !== 'default') return setting === 'on'\n if (cls === 'star' || cls === 'groupStar') return true\n if (cls === 'anchorMapping') return false\n return isTrusted\n}\n\n/** 2020: a trusted contact is one toward which the anchor mapping class is\n * on; its default is no contact (2760), so only `on` makes one. */\nexport const trusted = (c: Readonly<Contact>): boolean => c.settings.anchorMapping === 'on'\n\n/** Whether `cls` is on toward the contact (2760, 2840). */\nexport const classOnToward = (c: Readonly<Contact>, cls: TrustClass): boolean => classOn(cls, c.settings[cls], trusted(c))\n\n/** The relationship's active-head tuple (6.4). */\nexport const activeTuple = (r: Readonly<Relationship>): Tuple | undefined => r.tuples.find((t) => t.ownPairLabel === r.activeHead)\n\n/** A contact by entry id or alias (2140). */\nexport const findContact = (state: Readonly<HolderState>, id: string): Contact | undefined => {\n if (Object.hasOwn(state.contacts, id)) return state.contacts[id]\n return Object.values(state.contacts).find((c) => c.aliases.includes(id))\n}\n\n/** The entry's own relationships (Contact.relIds), as present in the state. */\nexport const entryRelationships = (state: Readonly<HolderState>, c: Readonly<Contact>): Relationship[] =>\n c.relIds.filter((id) => Object.hasOwn(state.relationships, id)).map((id) => state.relationships[id])\n\n/**\n * Whether a relationship lags in its entry (Section 2, 6595): its anchor\n * head is held in the entry as superseded, the `prev` of a link one of\n * the entry's relationships holds. `entry` is the entry's relationships,\n * `r` among them or not. A relationship with no anchor head never lags.\n */\nexport const lags = (r: Readonly<Relationship>, entry: readonly Readonly<Relationship>[]): boolean =>\n r.heldCounterpartHead !== null && entry.some((o) => o.links.some((l) => l.prev === r.heldCounterpartHead))\n\n/** Every tuple's place: the relationship holding the tuple with own pair\n * label `label` (deactivated ones included). */\nexport function tupleByLabel (state: Readonly<HolderState>, label: string): { rel: Relationship, tuple: Tuple } | null {\n for (const id of Object.keys(state.relationships).sort()) {\n const rel = state.relationships[id]\n const tuple = rel.tuples.find((t) => t.ownPairLabel === label)\n if (tuple) return { rel, tuple }\n }\n return null\n}\n\n/** A live relationship: not chained into another, its active head not deactivated. */\nexport const liveRel = (r: Readonly<Relationship>): boolean => {\n const t = activeTuple(r)\n return r.chainedInto === null && t !== undefined && !t.deactivated\n}\n\n/**\n * The entry a relationship's verifications go to (2145): the one its\n * active tuple's entryId names, by id or alias, else the one its own\n * identity (contactId) names. Where a relationship stands behind two\n * entries, this is the appended tuple's (2146).\n */\nexport const entryOf = (state: Readonly<HolderState>, rel: Readonly<Relationship>): Contact | undefined => {\n const t = activeTuple(rel)\n return (t && findContact(state, t.entryId)) ?? findContact(state, rel.contactId)\n}\n\n/** The entry's relationships whose verifications go to it (2145): all of\n * them, except one that stands behind two entries and feeds the other. */\nexport const feeding = (state: Readonly<HolderState>, c: Readonly<Contact>): Relationship[] =>\n entryRelationships(state, c).filter((r) => entryOf(state, r)?.id === c.id)\n\n/** The newest of `heads` along `links` (6560): those from which no other\n * head is reachable. One where every pair of heads lies on one chain. */\nexport function newestOf (heads: readonly string[], links: ReadonlyArray<{ prev: string, next: string }>): string[] {\n const next = new Map<string, string[]>()\n for (const l of links) next.set(l.prev, [...(next.get(l.prev) ?? []), l.next])\n const reaches = (from: string, to: string): boolean => {\n const seen = new Set<string>()\n const todo = [...(next.get(from) ?? [])]\n while (todo.length) {\n const n = todo.pop()!\n if (n === to) return true\n if (!seen.has(n)) { seen.add(n); todo.push(...(next.get(n) ?? [])) }\n }\n return false\n }\n const hs = [...new Set(heads)]\n return hs.filter((h) => !hs.some((o) => o !== h && reaches(h, o)))\n}\n\n/**\n * The newest anchor heads of a set of relationships (6560): the heads from\n * which no other head is reachable along the links they hold. One entry's\n * relationships yield exactly one where the head rule and the binding rule\n * admitted every merge (6605); a manual merge (6640) may yield more until\n * its split (2080).\n */\nexport function newestHeads (rels: readonly Readonly<Relationship>[]): string[] {\n return newestOf(rels.map((r) => r.heldCounterpartHead).filter((h): h is string => h !== null), rels.flatMap((r) => r.links))\n}\n\n/** What an entry holds as superseded (6540): every prev of a link one of its relationships holds. */\nexport const supersededIn = (rels: readonly Readonly<Relationship>[]): Set<string> =>\n new Set(rels.flatMap((r) => r.links.map((l) => l.prev)))\n\n/** A relationship's verified anchor set (6a.1 rung 2): its self and every anchor of its links. */\nexport const anchorSet = (r: Readonly<Relationship>): Set<string> => {\n const out = new Set<string>()\n if (r.heldCounterpartHead !== null) out.add(r.heldCounterpartHead)\n for (const l of r.links) { out.add(l.prev); out.add(l.next) }\n return out\n}\n\n/**\n * The binding rule (6605), entry against entry: a relationship of the one\n * and a relationship of the other hold different pre-rotation bindings\n * for one anchor both hold, or links from one prev to different nexts (a\n * held link fixes the binding of its prev, 6610). Compared relationship by\n * relationship, never combined (6610).\n */\nexport function conflicts (as: readonly Readonly<Relationship>[], bs: readonly Readonly<Relationship>[]): boolean {\n for (const a of as) {\n for (const b of bs) {\n // within one relationship too: a chain holding two bindings for one anchor (6610)\n if (a.links.some((l) => b.links.some((m) => l.prev === m.prev && l.next !== m.next))) return true\n for (const [anchor, commits] of Object.entries(a.bindings)) {\n const other = Object.hasOwn(b.bindings, anchor) ? b.bindings[anchor] : []\n if (new Set([...commits, ...other]).size > 1) return true\n }\n }\n }\n return false\n}\n\n/** The union of two binding records (6610), each list sorted and distinct. */\nexport function unionBindings (a: Readonly<Record<string, string[]>>, b: Readonly<Record<string, string[]>>): Record<string, string[]> {\n const out: Record<string, string[]> = {}\n for (const [k, v] of [...Object.entries(a), ...Object.entries(b)]) out[k] = [...new Set([...(out[k] ?? []), ...v])].sort()\n return out\n}\n\n/**\n * The head rule (6530, 6540) for relationship `r` against entry `x`\n * (relationships `xs`): (a) r's anchor head is x's or the lineage r holds\n * carries x's as a prev, and (b) x does not hold r's anchor head as\n * superseded, nor r's own entry x's (`ownSuperseded`). For the incoming\n * relationship the caller passes the links its entry held before the\n * verified mapping's lineage joined them: only what the committed mapping\n * newly carries connects (the 6590 rationale; trust/entries.ts).\n */\nexport const joins = (r: Readonly<Relationship>, x: Readonly<Contact>, xs: readonly Readonly<Relationship>[], ownSuperseded: ReadonlySet<string>): boolean =>\n r.heldCounterpartHead !== null && x.anchorHead !== null &&\n (r.heldCounterpartHead === x.anchorHead || r.links.some((l) => l.prev === x.anchorHead)) &&\n !supersededIn(xs).has(r.heldCounterpartHead) && !ownSuperseded.has(x.anchorHead)\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util-freeze.d.ts","sourceRoot":"","sources":["../src/util-freeze.ts"],"names":[],"mappings":"AAEA,uDAAuD;AACvD,wBAAgB,UAAU,CAAC,CAAC,EAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAMtC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// util-freeze — deep freezing, shared by the engine and the views.
|
|
2
|
+
/** Freezes an object graph in place and returns it. */
|
|
3
|
+
export function freezeDeep(x) {
|
|
4
|
+
if (x !== null && typeof x === 'object' && !Object.isFrozen(x)) {
|
|
5
|
+
Object.freeze(x);
|
|
6
|
+
for (const v of Object.values(x))
|
|
7
|
+
freezeDeep(v);
|
|
8
|
+
}
|
|
9
|
+
return x;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=util-freeze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util-freeze.js","sourceRoot":"","sources":["../src/util-freeze.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,uDAAuD;AACvD,MAAM,UAAU,UAAU,CAAK,CAAI;IACjC,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAChB,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,CAAW,CAAC;YAAE,UAAU,CAAC,CAAC,CAAC,CAAA;IAC3D,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC","sourcesContent":["// util-freeze — deep freezing, shared by the engine and the views.\n\n/** Freezes an object graph in place and returns it. */\nexport function freezeDeep<T> (x: T): T {\n if (x !== null && typeof x === 'object' && !Object.isFrozen(x)) {\n Object.freeze(x)\n for (const v of Object.values(x as object)) freezeDeep(v)\n }\n return x\n}\n"]}
|