@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":"receive.js","sourceRoot":"","sources":["../src/receive.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,uEAAuE;AACvE,0EAA0E;AAC1E,EAAE;AACF,4EAA4E;AAC5E,sEAAsE;AACtE,0EAA0E;AAC1E,yEAAyE;AACzE,yBAAyB;AACzB,oEAAoE;AACpE,0EAA0E;AAC1E,2BAA2B;AAC3B,kEAAkE;AAClE,uEAAuE;AACvE,uEAAuE;AACvE,yEAAyE;AACzE,oEAAoE;AACpE,iEAAiE;AACjE,0EAA0E;AAC1E,2DAA2D;AAC3D,mCAAmC;AACnC,wEAAwE;AACxE,yEAAyE;AACzE,iEAAiE;AACjE,yEAAyE;AACzE,0DAA0D;AAC1D,yEAAyE;AACzE,yEAAyE;AACzE,wDAAwD;AACxD,EA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I,EAAE,GAAG,EAAE,CAAA;IACxC,OAAO;QACL,MAAM,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;QAClH,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE;KAClG,CAAA;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAI,CAAoB,EAAE,KAAQ,EAAe,EAAE,CAChF,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA","sourcesContent":["// receive — the holder's receive core (lib Stage 2, note §4.3; Delivery\n// §6.2, §4.2, §4.4). The engine runs it as its built-in `receive`: the\n// preparation (async) walks stages 1–8, the transition (sync) is stage 9.\n//\n// 1–4 once, here, through delivery.receiveByAgreement: the key agreement\n// is the KeyProvider's `agree` under the engine's release from\n// `addresses` (a tombstone answers retired: stage 3; an rkid never\n// issued answers unknown: stage 2); the completed-effect cache is\n// `state.effects`\n// 5 the document profile (schema, calendar-valid issuedAt) and\n// recipient = the own anchor of the label the arrival rkid derives\n// under (addresses)\n// 6 dispatch by the full type URI with version: the built-in\n// delivery-ack path, else the task register, else unknown-type;\n// then the entry's proof declaration. Delivery §3 wants `proof`\n// absent on every type but delivery-ack and registry-declaration,\n// and §4.4 puts the declaration into the registry entry; the\n// profile schema can name only the types it knows, so for\n// companion types the rule is enforced here, the earliest stage at\n// which the receiver holds the entry: a mismatch is\n// failed(validation-failed)\n// 7–8 the handler's decode (malformed at 7, any other refusal at 8),\n// the core's closed acceptance binding (Delivery 4.4: the arrival\n// tuple is selected by rkid, the document's issuer is its\n// counterpart anchor), the handler's prepare, and the ack: sealed\n// here, before the transaction, from fresh entropy\n// 9 the handler's apply; the core files the effect-cache entry with\n// the ack in the same commit (the handler never writes `effects`)\n// and hands the ack out first among the outbound\n//\n// Acks (delivery-ack/0.1) are no registered task: one common path checks\n// the form (ack.ts macAckForm), then the consistency of 4.2 against the\n// outbox — `ref` is a document this holder sent on that thread, on the\n// arrival tuple (outbox item rkid = arrival rkid), the issuer is that\n// tuple's counterpart, the referenced document's type is of the\n// designated-verifier class (a MAC ack of a signature-class document is\n// the wrong class), and the MAC verifies under the arrival tuple's ack\n// key. A valid ack marks the item delivered (late after failed) and\n// earns a terminal cache entry, no ack of its own.\n//\n// The stage-9 lock set (Delivery 6.2): the engine serializes every\n// operation of a holder in one queue and commits by CAS — a strictly\n// stronger serialization than the lock set asks for (it holds every key\n// of the holder, not only the overlapping ones), which is how this\n// library implements it under Stage 2's one-writer contract. The lock set\n// — the digest, and for star and group-star chunks additionally the\n// assembly key (tuple, type, salt) of 4.4 — is held for the whole\n// evaluation; a CAS conflict re-reads and re-enters at stage 1, which\n// re-checks the cache at stage 4. The chunk types (trust/star.ts,\n// trust/group-star.ts, PR 4b) need no key of their own here: every\n// chunk of one tuple and type is evaluated against, and committed over,\n// the one state version its preparation read, so the completing chunk's\n// effect (validated assembly, accepted snapshot, completed-salt advance)\n// commits with the cache entry and the ack in one transaction.\n//\n// The lock keys a registering specification adds (Delivery RLTP-DEL-6210\n// to 6230): the relationship key of a message or an attributed invitation,\n// the holder-wide credential-digest key of every invitation, the\n// (genesis digest, inviter) key of the prelude (Membership 3950–3957,\n// 3980), and the writers that take them (a block, a chaining, a merge or\n// split, a deletion of a completion-record entry or a binding) are all\n// held by the same whole-state serialization.\n//\n// A refusal (TaskRefusal) never commits anything, at any stage. One of\n// them is transient: `rate-limited` (Delivery RLTP-DEL-5820, 6270, 6280),\n// a document beyond a bound its type declares; it earns no ack and no\n// cache entry, the carrier keeps it, and a redelivery is evaluated in\n// full. A rate the type places inside stage 9 is checked here in the\n// handler's preparation (stage 8), against the snapshot stage 9 commits\n// on — the same state, by the CAS above.\n//\n// A handler's apply may answer a TaskDiscarded: the receiver discarded an\n// open assembly and holds its salt as the lower bound (5366), for one of\n// two reasons: `resource-limit` (Trust 5365), or `rejected` — an\n// authenticated chunk (its MAC verified) violates the assembly rules\n// (5260–5310, 5500, 5510), and the spec rejects the whole delivery, so it\n// must not complete from any later chunk. That is a spec-mandated state\n// effect, not a failure of the document: its state commits and the result\n// is the disposition `discarded` with the reason and the rule — no\n// effect-cache entry (a redelivery is evaluated afresh and meets the lower\n// bound), no ack (the delivery must not complete), no event; the completed\n// high-water mark stays. A chunk that does not authenticate is a plain\n// refusal and touches nothing. DELIVERY GAP: Delivery §6.2 names no\n// disposition for a document whose processing ends in such a discard;\n// `discarded` (both reasons) is this library's, to be registered in\n// Delivery 0.82.\n//\n// A verified ack runs the ack handler a module registered for the\n// acknowledged item's type, in the ack's transaction (engine.ts\n// AckHandler): the sender side of 5660, completion by verified acks only.\n//\n// Ack class (4.4): the class follows the payload's audience class. The\n// types of SIGNATURE_CLASS carry transferable signatures (the encounter\n// carriers, the membership documents, the signed introduction artifacts,\n// the registry declaration): their ack is SIGNED, an eddsa-jcs-2022 proof\n// under the ack's issuer anchor through the KeyProvider (`sign` with the\n// arrival key's label). Every other type is designated-verifier and earns\n// the MAC form under the channel ack key of the arrival rkid and the\n// counterpart key. A received ack is checked in the form its referenced\n// outbox item's class selects; the other form is validation-failed.\n//\n// The acceptance binding before a tuple exists (PR 7): a handler with a\n// `channel` binds its document itself, from the document, where it may\n// arrive on an own key no tuple carries yet — the encounter bundle on the\n// displayed card's key (Delivery 4.1: the bundle establishes the tuple,\n// its issuer bound to card.anchor = credential.issuer), the membership\n// documents on member keys (Membership 3.1, 3.2). `channel` names the\n// counterpart's key agreement the ack is sealed to and the contact it is\n// filed under, or refuses (stage 7 for malformed, else 8). Every other\n// handler keeps the tuple binding of Delivery 4.4.\nimport { calOK, iso, makeValidator, toU } from './core.js'\nimport type { Json } from './core.js'\nimport { diSignWith, diVerify, digestDoc, xRawOfMk } from './crypto.js'\nimport { receiveByAgreement, seal } from './delivery.js'\nimport type { KeyAnswer } from './delivery.js'\nimport { ACK_TYPE, ackDocument, ackKeyOf, ackProofForm, macAck, macAckForm, macAckValid, signedAckForm } from './ack.js'\nimport { SCHEMAS } from './schemas.js'\nimport { triasOf } from './state.js'\nimport { entryOf, liveRel } from './trust/state.js'\nimport type { HolderState, Millis, OutboxItem, Relationship, StoredAck, Tuple } from './state.js'\n\n/** An ack as sealed in the preparation; the engine adds its schedule. */\nexport type SealedAck = Pick<StoredAck, 'digest' | 'envelope' | 'threadId' | 'recipient'>\nimport type { Outbound } from './ports.js'\nimport { InfraError } from './results.js'\nimport type { ReceiveFailure, ReceiveResult, ReceiveStageNo } from './results.js'\nimport type { EventDraft, PrepareCtx, Prepared } from './engine.js'\n\n// ── the task handler contract ──────────────────────────────────────────\n\n/** Where and when a document arrived: the own rkid it was sealed to, its\n * thread, its digest and the receive's `when`. */\nexport interface Arrival { rkid: string, threadId: string, digest: string, when: Millis }\n\n/** Why a task handler refuses a document; the stage follows from where:\n * decode 'malformed' → 7, decode or prepare otherwise → 8, apply → 9. */\nexport type TaskFailure = 'malformed' | 'validation-failed' | 'stale-issuance' | 'gate-future' | 'consumed-challenge' | 'rate-limited'\n\n/** A handler's refusal: nothing commits, the digest stays uncached and\n * a redelivery is evaluated afresh (Delivery 6.2 stage 4) — with one\n * narrow, enumerated exception, the Encounter aging latch: an apply that\n * refuses because its authoritative resolution found an own challenge past\n * its age bound (Encounter 5260, 5270, 5290; Delivery 4.1 check 5) returns\n * `latch`, the state with that challenge removed, and the engine commits\n * exactly it (and the raised lastWhen): no cache entry, no ack, no event;\n * the disposition stays failed. A latch that touches anything beyond\n * encounter.challenges is a programming error and throws (engine.ts). */\nexport interface TaskRefusal { ok: false, reason: TaskFailure, ref?: string, latch?: HolderState }\n\n/** A discard at a resource limit (Trust 5365/5366), answered by apply:\n * `state` commits (assembly dropped, lower bound held), the disposition\n * is `discarded`, with no cache entry, no ack and no event. */\nexport interface TaskDiscarded { discarded: true, reason: DiscardReason, state: HolderState, ref?: string }\n\n/** Why an assembly was discarded: a local resource limit (5365), or an\n * authenticated violation of the assembly rules that rejects the delivery. */\nexport type DiscardReason = 'resource-limit' | 'rejected'\n\nexport const isTaskDiscarded = (x: unknown): x is TaskDiscarded =>\n x !== null && typeof x === 'object' && (x as TaskDiscarded).discarded === true\n\n/** A received document after stage 7: the profile fields, its payload\n * as the handler's decode returned it. Read-only. */\nexport interface ReceivedDocument<T = unknown> {\n readonly id: string\n readonly type: string\n readonly issuer: string\n readonly recipient: string\n readonly threadId: string\n readonly issuedAt: string\n readonly payload: T\n readonly ceremony?: Json\n readonly proof?: Json\n}\n\n/** A sealed ack as the outbound the app sends, at the given attempt. */\nexport const ackOutbound = (a: Readonly<SealedAck>, attempt: number): Outbound =>\n structuredClone({ digest: a.digest, envelope: a.envelope, type: ACK_TYPE, threadId: a.threadId, recipient: a.recipient, attempt })\n\nconst TT = 'https://real-life.org/trust-tasks/'\n/** Signature-class types (Delivery 4.2/4.4): payloads whose authenticity\n * is a transferable signature; their acks are signed, not MACed. The\n * `x-` slugs are this library's own experimental, unregistered forms\n * for what the specifications leave to the application (the welcome until the Access envelope is\n * built; the introduction offer that conveys the target designator,\n * Trust 8.3): signed documents as well. A receiver that does not know\n * them answers unknown-type (Delivery §6.2). */\nexport const SIGNATURE_CLASS: ReadonlySet<string> = new Set([\n TT + 'encounter-bundle/0.1',\n TT + 'encounter-credential-delivery/0.1',\n TT + 'membership-invite/0.2',\n TT + 'membership-accept/0.2',\n TT + 'membership-evidence/0.1',\n TT + 'membership-evidence/0.2',\n TT + 'registry-declaration/0.1',\n TT + 'introduction-request/0.1',\n TT + 'introduction-forward/0.1',\n TT + 'introduction-reply/0.1',\n TT + 'membership-prelude-request/0.1',\n TT + 'membership-prelude-reply/0.1',\n // lib 0.4.0's prelude forms: never received any more (unknown-type), kept\n // for the class of an outbox item a codec-1 state still holds, whose\n // signed ack may yet arrive\n TT + 'x-membership-prelude-request/0.1',\n TT + 'x-membership-prelude-reply/0.1',\n TT + 'x-membership-welcome/0.1',\n TT + 'x-introduction-offer/0.1',\n])\n\n/** The counterpart a `channel` binding names: the key agreement the ack\n * is sealed to and the contact it is filed under. */\n/** The binding a document arrives under: the counterpart's key and the\n * contact; `via`, where the arrival key is no tuple's (a member key), the\n * own rkid of the tuple the contact was named through (Recipient.via). */\nexport interface Channel { keyAgreement: string, contactId: string, via?: string }\n\nexport const isTaskRefusal = (x: unknown): x is TaskRefusal =>\n x !== null && typeof x === 'object' && (x as TaskRefusal).ok === false && typeof (x as TaskRefusal).reason === 'string'\n\n// ── the plan a preparation hands to stage 9 ────────────────────────────\n\ntype Failed = Extract<ReceiveResult, { disposition: 'failed' }>\n\n/** What stages 1–8 decided, bound to the snapshot they ran against. */\nexport type ReceivePlan =\n | { kind: 'failed', result: Failed }\n | { kind: 'duplicate', digest: string }\n | { kind: 'ack', digest: string, ref: string, doc: ReceivedDocument, arrival: Arrival }\n | { kind: 'task', digest: string, type: string, doc: ReceivedDocument, arrival: Arrival, value: unknown, ack: SealedAck }\n\n/** The handler surface the core needs (engine.ts TaskHandler). */\nexport interface TaskEntry {\n proof: 'absent' | 'required'\n decode (payload: unknown): unknown\n channel? (state: Readonly<HolderState>, doc: ReceivedDocument, rkid: string): Channel | TaskRefusal\n /** may arrive on a deactivated tuple an act pinned (engine TaskHandler) */\n pinned?: true\n prepare? (ctx: PrepareCtx, doc: ReceivedDocument, arrival: Arrival): Promise<unknown>\n}\n\nconst V = makeValidator(SCHEMAS)\nconst profileOk = (doc: unknown): boolean =>\n V.validate(doc, SCHEMAS['rltp-delivery-document.schema.json'], SCHEMAS['rltp-delivery-document.schema.json']).length === 0 &&\n calOK((doc as { issuedAt?: unknown }).issuedAt)\n\nconst failed = (reason: ReceiveFailure, stage: ReceiveStageNo, extra: { digest?: string, key?: 'unknown' | 'retired', ref?: string } = {}): ReceivePlan =>\n ({ kind: 'failed', result: { disposition: 'failed', reason, stage, ...extra } })\n\n/** The tuple whose own rkid is `rkid`, with its relationship. */\nexport function tupleByRkid (state: Readonly<HolderState>, rkid: string): { rel: Relationship, tuple: Tuple } | null {\n for (const id of Object.keys(state.relationships).sort()) {\n const rel = state.relationships[id]\n for (const tuple of rel.tuples) if (tuple.rkid === rkid) return { rel, tuple }\n }\n return null\n}\n\n/** The arrival channel's ack key (4.2): X25519 of the own key behind\n * `rkid` and the counterpart key, HKDF under issuer/recipient. */\nasync function ackKey (ctx: PrepareCtx, rkid: string, counterpartKeyAgreement: string, issuer: string, recipient: string): Promise<Uint8Array | null> {\n const raw = xRawOfMk(counterpartKeyAgreement)\n if (!raw) return null\n const a = await ctx.keys.agree(rkid, raw, ctx.release)\n if (a.status !== 'available') return null\n try { return await ackKeyOf(a.shared, issuer, recipient, ctx.crypto.subtle) } catch { return null }\n}\n\n/**\n * Stages 1–8 against the preparation's snapshot. Never throws for\n * anything the envelope carries; port failures surface as InfraError.\n */\nexport async function prepareReceive (ctx: PrepareCtx, env: unknown, tasks: ReadonlyMap<string, TaskEntry>): Promise<ReceivePlan> {\n const S = ctx.crypto.subtle\n const state = ctx.snapshot\n // 1–4\n const agree = (rkid: string, epk: Uint8Array): Promise<KeyAnswer> => ctx.keys.agree(rkid, epk, ctx.release)\n const r = await receiveByAgreement(env, agree, (d) => Object.hasOwn(state.effects, d), S)\n if (r.disposition === 'duplicate-known') return { kind: 'duplicate', digest: r.digest! }\n if (r.disposition !== 'unique') {\n const stage = r.stages[r.stages.length - 1].stage\n const reason = r.disposition.slice('failed('.length, -1) as ReceiveFailure\n return failed(reason, stage, r.key ? { key: r.key } : {})\n }\n const doc = r.document as Record<string, Json>\n const digest = r.digest!\n const rkid = (env as { rkid: string }).rkid\n // 5 — profile, then recipient = own anchor under the arrival key's label\n if (!profileOk(doc)) return failed('malformed', 5, { digest })\n const release = ctx.release(rkid)\n if (release.status !== 'live') throw new InfraError('key-provider', 'agree answered for an rkid the release does not hold live')\n const own = await ctx.keys.anchorOf(release.label)\n if (doc.recipient !== own.anchor) return failed('wrong-recipient', 5, { digest })\n const at = tupleByRkid(state, rkid)\n // 6 — the built-in ack path, in the form the acked document's class selects\n if (doc.type === ACK_TYPE) {\n const signed = ackProofForm(doc) === 'signed'\n const f = signed ? signedAckForm(doc) : macAckForm(doc)\n if (!f.ok) return failed(f.reason, f.stage, { digest })\n // 8 — consistency against what this holder sent (4.2): the document on\n // that thread, sent from the arrival rkid, of the class the proof form\n // claims; the issuer its recipient (the tuple's counterpart, or the\n // anchor it went to where no tuple carried it)\n // the ref in either rendering (u or z, 4.2) names the outbox item by its digest bytes\n const ref = toU(f.ref) ?? f.ref\n const item: OutboxItem | undefined = Object.hasOwn(state.outbox, ref) ? state.outbox[ref] : undefined\n if (!item || item.threadId !== f.threadId || item.recipient.rkid !== rkid || SIGNATURE_CLASS.has(item.type) !== signed) return failed('validation-failed', 8, { digest })\n const expected = at ? at.tuple.counterpartAnchor : item.recipient.anchor\n if (expected === undefined || doc.issuer !== expected) return failed('validation-failed', 8, { digest })\n if (signed) {\n if (!(await diVerify(doc, doc.issuer as string, S))) return failed('validation-failed', 8, { digest })\n } else {\n const key = await ackKey(ctx, rkid, item.recipient.keyAgreement, doc.issuer as string, doc.recipient as string)\n if (!key || !(await macAckValid(doc, key, S))) return failed('validation-failed', 8, { digest })\n }\n const arrival: Arrival = Object.freeze({ rkid, threadId: doc.threadId as string, digest, when: ctx.when })\n return { kind: 'ack', digest, ref, doc: Object.freeze({ ...doc }) as unknown as ReceivedDocument, arrival }\n }\n // 6 — the task register, by the full type URI (no prefix, no fallback)\n const h = tasks.get(doc.type as string)\n if (!h) return failed('unknown-type', 6, { digest })\n if ((h.proof === 'absent') !== (doc.proof === undefined)) return failed('validation-failed', 6, { digest })\n // 7–8 — decode, the closed acceptance binding, the handler's preparation\n const payload = h.decode(doc.payload)\n const refused = (r: TaskRefusal, stage: ReceiveStageNo): ReceivePlan => failed(r.reason, stage, { digest, ...(r.ref !== undefined ? { ref: r.ref } : {}) })\n if (isTaskRefusal(payload)) return refused(payload, payload.reason === 'malformed' ? 7 : 8)\n const rdoc = Object.freeze({ ...doc, payload }) as ReceivedDocument\n // the binding: the arrival tuple (4.4), or the handler's own channel\n // where its document may arrive before any tuple (4.1, Membership)\n let peer: Channel\n if (h.channel) {\n const c = h.channel(state, rdoc, rkid)\n if (isTaskRefusal(c)) return refused(c, c.reason === 'malformed' ? 7 : 8)\n peer = c\n } else {\n if (!at || doc.issuer !== at.tuple.counterpartAnchor) return failed('validation-failed', 8, { digest })\n // a deactivated tuple takes nothing new (6190, 6240): the arrival tuple is\n // the active head of a live relationship, unless the handler binds its\n // artifacts to the tuples an act pinned before a chaining (8270)\n if (!h.pinned && (!liveRel(at.rel) || at.rel.activeHead !== at.tuple.ownPairLabel)) return failed('validation-failed', 8, { digest, ref: 'RLTP-TRU-6240' })\n // the entry the arrival's relationship sends under (2146), by its current id\n peer = { keyAgreement: at.tuple.counterpartKeyAgreement, contactId: entryOf(state, at.rel)?.id ?? at.rel.contactId }\n }\n const arrival: Arrival = Object.freeze({ rkid, threadId: doc.threadId as string, digest, when: ctx.when })\n const value = h.prepare ? await h.prepare(ctx, rdoc, arrival) : undefined\n if (isTaskRefusal(value)) return refused(value, 8)\n // the ack, sealed before the transaction (4.2: created inside the\n // effect's transaction — it commits with the cache entry or not at all),\n // in the form the document's class selects (4.4)\n const base = ackDocument({\n id: ctx.entropy.id('ack.id'), issuer: own.anchor, recipient: doc.issuer as string,\n threadId: arrival.threadId, issuedAt: iso(ctx.when), ref: digest,\n })\n let ackDoc: Json\n if (SIGNATURE_CLASS.has(doc.type as string)) {\n ackDoc = await diSignWith(own.anchor, (b) => ctx.keys.sign(release.label, b), base as unknown as Record<string, Json>, base.issuedAt, S) as unknown as Json\n } else {\n const key = await ackKey(ctx, rkid, peer.keyAgreement, own.anchor, doc.issuer as string)\n if (!key) return failed('validation-failed', 8, { digest })\n ackDoc = await macAck(base, key, S) as unknown as Json\n }\n const envelope = await seal(ackDoc, peer.keyAgreement, { ephSeed: ctx.entropy.bytes('seal.eph', 32), nonce: ctx.entropy.bytes('seal.nonce', 12) }, S)\n const ack: SealedAck = {\n digest: await digestDoc(ackDoc, S), envelope, threadId: arrival.threadId,\n recipient: { contactId: peer.contactId, rkid, keyAgreement: peer.keyAgreement, ...(peer.via !== undefined ? { via: peer.via } : {}) },\n }\n return { kind: 'task', digest, type: doc.type as string, doc: rdoc, arrival, value, ack }\n}\n\n/** The outbox after a valid ack of `ref` (4.2, 6.1): delivered, late after\n * failed; unchanged when already delivered. Shared with report(). */\nexport function markDelivered (state: Readonly<HolderState>, ref: string, when: Millis): { outbox: HolderState['outbox'], event: EventDraft | null } {\n const it = state.outbox[ref]\n if (it.history.some((s) => s.status === 'delivered')) return { outbox: state.outbox, event: null }\n const late = triasOf(it) === 'failed'\n const { nextAttemptAt: _, ...rest } = it\n return {\n outbox: { ...state.outbox, [ref]: { ...rest, history: [...it.history, { status: 'delivered', at: when, late }] } },\n event: { type: 'delivery.status', digest: ref, threadId: it.threadId, status: 'delivered', late },\n }\n}\n\n/** Prepared for a handler: its own value under the receive's binding. */\nexport const handlerPrepared = <P>(p: Prepared<unknown>, value: P): Prepared<P> =>\n Object.freeze({ value, version: p.version, commitSeq: p.commitSeq })\n"]}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { HolderEvent } from './events.js';
|
|
2
|
+
import type { Outbound } from './ports.js';
|
|
3
|
+
/** What resume(when) hands out: retries and due duties, in the engine's
|
|
4
|
+
* fixed order, and when to call again (absent: nothing is due). */
|
|
5
|
+
export interface ResumeResult {
|
|
6
|
+
outbound: Outbound[];
|
|
7
|
+
events: HolderEvent[];
|
|
8
|
+
nextDueAt?: number;
|
|
9
|
+
}
|
|
10
|
+
/** Why an act was refused; `ref` on the result may name the rule. */
|
|
11
|
+
export type ActError = 'unknown-contact' | 'no-own-channel' | 'tuple-deactivated' | 'already-given' | 'in-flight' | 'scope-exhausted' | 'stale-issuance' | 'actid-conflict'
|
|
12
|
+
/** a human act came without the actId the app must mint (note §4.2) */
|
|
13
|
+
| 'actid-missing' | 'log-missing'
|
|
14
|
+
/** the anchor mapping needs the holder's community anchor (register.community, Identity §5.4) */
|
|
15
|
+
| 'no-community' | 'unknown-digest'
|
|
16
|
+
/** prompt.decide: no open prompt has this id */
|
|
17
|
+
| 'unknown-prompt'
|
|
18
|
+
/** prompt.decide: the prompt's expiresAt is not after when; tick removes it */
|
|
19
|
+
| 'prompt-expired'
|
|
20
|
+
/** trust.merge: the manual merge joins at most one entry (6640), and
|
|
21
|
+
* never relationships the binding rule keeps apart (6605) */
|
|
22
|
+
| 'not-mergeable'
|
|
23
|
+
/** identity.addDevice: not a device name of 6.2 (Identity §5.5) */
|
|
24
|
+
| 'device-name-invalid'
|
|
25
|
+
/** identity.addDevice: the register already holds the name (Identity §5.5, SHOULD) */
|
|
26
|
+
| 'device-name-held'
|
|
27
|
+
/** identity.addDevice: a revoked name is never given again (Identity §5.5) */
|
|
28
|
+
| 'device-name-revoked'
|
|
29
|
+
/** identity.revokeDevice: the register holds no such device name */
|
|
30
|
+
| 'unknown-device'
|
|
31
|
+
/** identity.rotate: the log replica does not hold the lineage through the
|
|
32
|
+
* current generation (Identity §5.4, Access RLTP-ACC-5980); the rotation
|
|
33
|
+
* stays pending until it does */
|
|
34
|
+
| 'log-behind'
|
|
35
|
+
/** identity.rotate: the log's head is no generation of this register's
|
|
36
|
+
* lineage (another genesis, or a head the register does not follow) */
|
|
37
|
+
| 'log-diverged'
|
|
38
|
+
/** identity.rotate: the log answered failure; the rotation stays pending */
|
|
39
|
+
| 'log-failure'
|
|
40
|
+
/** setProfile: the body breaks 6430/6435 or its image 6475 */
|
|
41
|
+
| 'profile-invalid'
|
|
42
|
+
/** encounter: a card that fails Encounter 6 (schema, version, challenge,
|
|
43
|
+
* keys, proof) or is not of the profile the act needs (displayed for a
|
|
44
|
+
* scan, sent and addressed to an own challenge's anchor for a capture) */
|
|
45
|
+
| 'card-invalid'
|
|
46
|
+
/** encounter.scan: this displayed code was scanned already: its
|
|
47
|
+
* challenge is in a record (5.3, 5170) */
|
|
48
|
+
| 'already-scanned'
|
|
49
|
+
/** encounter.capture: the bound challenge resolves unknown (5460) */
|
|
50
|
+
| 'gate-expired'
|
|
51
|
+
/** encounter: the own challenge is future-dated beyond the skew (5390) */
|
|
52
|
+
| 'gate-future'
|
|
53
|
+
/** encounter.capture: the challenge was consumed by another enactment (5440) */
|
|
54
|
+
| 'consumed-challenge'
|
|
55
|
+
/** encounter.capture: the same counterparty with other material (5450) */
|
|
56
|
+
| 'card-mismatch'
|
|
57
|
+
/** encounter.counter: no enactment record of the contact to issue on */
|
|
58
|
+
| 'no-record'
|
|
59
|
+
/** encounter.counter: the own step credential is issued already */
|
|
60
|
+
| 'already-issued'
|
|
61
|
+
/** membership: no such group, or the holder holds no role in it the act needs */
|
|
62
|
+
| 'unknown-group'
|
|
63
|
+
/** membership.vouch: no consent pair held for this member (Access 5.3) */
|
|
64
|
+
| 'no-evidence'
|
|
65
|
+
/** membership.vouch: the admitting member's own vouch never counts beside its admission */
|
|
66
|
+
| 'own-admission'
|
|
67
|
+
/** membership.found: a genesis admits under the rule of one; a stricter rule needs policy.change */
|
|
68
|
+
| 'threshold-unsupported'
|
|
69
|
+
/** introduction: no such act, or not in a state that allows the step */
|
|
70
|
+
| 'unknown-act'
|
|
71
|
+
/** introduction.request: the mediator's ack-delay declaration is not held (Delivery 4.4) */
|
|
72
|
+
| 'no-declaration'
|
|
73
|
+
/** a message, an invitation or the start of an introduction act toward
|
|
74
|
+
* a relationship the holder has blocked (Message Tasks RLTP-MSG-6410) */
|
|
75
|
+
| 'blocked'
|
|
76
|
+
/** message.send: the tuple is not ready — no document of the
|
|
77
|
+
* counterpart was accepted on it yet (Message Tasks RLTP-MSG-5020); the
|
|
78
|
+
* app keeps the message unsent and sends it once the contact view says
|
|
79
|
+
* `canMessage` */
|
|
80
|
+
| 'not-ready'
|
|
81
|
+
/** message.send: the text is not 1 to 4096 code points, or replyTo is no
|
|
82
|
+
* lowercase UUID v4 (Message Tasks 3.2) */
|
|
83
|
+
| 'message-invalid';
|
|
84
|
+
export type ActResult =
|
|
85
|
+
/** nextDueAt: duty work this act opened or unblocked is due then (`when`:
|
|
86
|
+
* now) — call resume at that time (engine.ts) */
|
|
87
|
+
{
|
|
88
|
+
ok: true;
|
|
89
|
+
outbound: Outbound[];
|
|
90
|
+
events: HolderEvent[];
|
|
91
|
+
nextDueAt?: number;
|
|
92
|
+
} | {
|
|
93
|
+
ok: false;
|
|
94
|
+
code: ActError;
|
|
95
|
+
ref?: string;
|
|
96
|
+
};
|
|
97
|
+
/** Receiver failure dispositions (Delivery §6.2), by the stage that names them. */
|
|
98
|
+
export type ReceiveFailure = 'oversize' | 'malformed' | 'decryption-failed' | 'wrong-recipient' | 'unknown-type' | 'validation-failed' | 'stale-issuance'
|
|
99
|
+
/** transient (Delivery RLTP-DEL-5820, 6270, 6280): nothing committed, no
|
|
100
|
+
* ack, no cache entry; the carrier keeps the document and the receiver
|
|
101
|
+
* evaluates it afresh when it is delivered again — never concluded */
|
|
102
|
+
| 'rate-limited' | 'gate-future' | 'consumed-challenge';
|
|
103
|
+
export type ReceiveStageNo = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
104
|
+
/**
|
|
105
|
+
* The outcome of receive(env, when). `unique`: the effect committed,
|
|
106
|
+
* with its ack first among `outbound` where the type acknowledges (a
|
|
107
|
+
* delivery-ack itself is terminal and earns none), then the documents
|
|
108
|
+
* the effect issued. `duplicate-known`: the stored ack is re-sent
|
|
109
|
+
* byte-identical (none for a terminal document); nothing commits beyond
|
|
110
|
+
* a raised lastWhen. `failed`: nothing took effect and nothing commits.
|
|
111
|
+
* `discarded`: the document's chunk met a receiver resource limit (Trust
|
|
112
|
+
* 5365, reason `resource-limit`) or, authenticated, violated the assembly
|
|
113
|
+
* rules so that its whole delivery is rejected (5260–5310, 5500, 5510,
|
|
114
|
+
* reason `rejected`): the open assembly is dropped and its salt held as
|
|
115
|
+
* the lower bound (5366), committed; no cache entry, no ack, no event.
|
|
116
|
+
* Delivery §6.2 has no disposition for it yet (receive.ts: a gap for
|
|
117
|
+
* Delivery 0.82).
|
|
118
|
+
*/
|
|
119
|
+
export type ReceiveResult = {
|
|
120
|
+
disposition: 'unique';
|
|
121
|
+
digest: string;
|
|
122
|
+
type: string;
|
|
123
|
+
outbound: Outbound[];
|
|
124
|
+
events: HolderEvent[]; /** as on ActResult */
|
|
125
|
+
nextDueAt?: number;
|
|
126
|
+
} | {
|
|
127
|
+
disposition: 'duplicate-known';
|
|
128
|
+
digest: string;
|
|
129
|
+
outbound: Outbound[];
|
|
130
|
+
} | {
|
|
131
|
+
disposition: 'discarded';
|
|
132
|
+
digest: string;
|
|
133
|
+
type: string;
|
|
134
|
+
reason: 'resource-limit' | 'rejected';
|
|
135
|
+
ref?: string;
|
|
136
|
+
} | {
|
|
137
|
+
disposition: 'failed';
|
|
138
|
+
reason: ReceiveFailure;
|
|
139
|
+
stage: ReceiveStageNo;
|
|
140
|
+
digest?: string;
|
|
141
|
+
/** local diagnosis of a key failure, never a disposition of its own
|
|
142
|
+
* (Delivery §5, §6.2): 'unknown' — an rkid this holder never issued,
|
|
143
|
+
* failed(malformed) at stage 2; 'retired' — a tombstone (or a key
|
|
144
|
+
* marked retired), failed(decryption-failed) at stage 3 */
|
|
145
|
+
key?: 'unknown' | 'retired';
|
|
146
|
+
/** the rule the document failed, where its task handler names one
|
|
147
|
+
* (TaskRefusal.ref), e.g. RLTP-TRU-6118 */
|
|
148
|
+
ref?: string;
|
|
149
|
+
};
|
|
150
|
+
export type InfraErrorCode = 'store-read' | 'store-commit'
|
|
151
|
+
/** the commit may or may not have landed; re-read and consult the act journal */
|
|
152
|
+
| 'unknown-commit-outcome'
|
|
153
|
+
/** the store kept answering `conflict` past the retry bound (RetryPolicy.commitAttempts) */
|
|
154
|
+
| 'commit-conflict' | 'key-provider' | 'log' | 'access'
|
|
155
|
+
/** testing mode only (createHolder's `invariants: true`): a commit would
|
|
156
|
+
* break an invariant of invariants.ts; nothing committed, the
|
|
157
|
+
* violations are the cause */
|
|
158
|
+
| 'invariant-violated';
|
|
159
|
+
/** A failure of a port the host provides, never of the protocol. */
|
|
160
|
+
export declare class InfraError extends Error {
|
|
161
|
+
readonly code: InfraErrorCode;
|
|
162
|
+
constructor(code: InfraErrorCode, message?: string, options?: {
|
|
163
|
+
cause?: unknown;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/** The WebCrypto handle lacks what the library needs; raised when a
|
|
167
|
+
* holder is built, never at import (note §3 Crypto). */
|
|
168
|
+
export declare class CryptoUnavailableError extends Error {
|
|
169
|
+
/** the algorithms (or 'subtle' itself) that are missing, in a fixed order */
|
|
170
|
+
readonly missing: readonly string[];
|
|
171
|
+
constructor(missing: readonly string[]);
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C;oEACoE;AACpE,MAAM,WAAW,YAAY;IAAG,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;AAEjG,qEAAqE;AACrE,MAAM,MAAM,QAAQ,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,mBAAmB,GACnB,eAAe,GACf,WAAW,GACX,i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;GAC1F,iBAAiB,GACjB,cAAc,GACd,KAAK,GACL,QAAQ;AACV;;+BAE+B;GAC7B,oBAAoB,CAAA;AAExB,oEAAoE;AACpE,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;gBAChB,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAKnF;AAED;yDACyD;AACzD,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;gBACtB,OAAO,EAAE,SAAS,MAAM,EAAE;CAKxC"}
|
package/dist/results.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** A failure of a port the host provides, never of the protocol. */
|
|
2
|
+
export class InfraError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
constructor(code, message, options) {
|
|
5
|
+
super(message ?? code, options);
|
|
6
|
+
this.name = 'InfraError';
|
|
7
|
+
this.code = code;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** The WebCrypto handle lacks what the library needs; raised when a
|
|
11
|
+
* holder is built, never at import (note §3 Crypto). */
|
|
12
|
+
export class CryptoUnavailableError extends Error {
|
|
13
|
+
/** the algorithms (or 'subtle' itself) that are missing, in a fixed order */
|
|
14
|
+
missing;
|
|
15
|
+
constructor(missing) {
|
|
16
|
+
super(`WebCrypto lacks: ${missing.join(', ')} (needs Ed25519, X25519, HKDF, HMAC, AES-GCM, SHA-256)`);
|
|
17
|
+
this.name = 'CryptoUnavailableError';
|
|
18
|
+
this.missing = Object.freeze([...missing]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAyKA,oEAAoE;AACpE,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC1B,IAAI,CAAgB;IAC7B,YAAa,IAAoB,EAAE,OAAgB,EAAE,OAA6B;QAChF,KAAK,CAAC,OAAO,IAAI,IAAI,EAAE,OAAO,CAAC,CAAA;QAC/B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAA;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAED;yDACyD;AACzD,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,6EAA6E;IACpE,OAAO,CAAmB;IACnC,YAAa,OAA0B;QACrC,KAAK,CAAC,oBAAoB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAA;QACrG,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAA;QACpC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAA;IAC5C,CAAC;CACF","sourcesContent":["// results — one closed result type for acts, one for reception, one error\n// class for infrastructure (lib Stage 2, note §4.4).\n//\n// \"Nothing to do\" is ok with empty outbound. A committed act with open\n// follow-up work is success plus a duty. Store and provider failures are\n// InfraError; programming errors and broken invariants throw. Human text\n// is the app's, made from the code.\nimport type { HolderEvent } from './events.js'\nimport type { Outbound } from './ports.js'\n\n/** What resume(when) hands out: retries and due duties, in the engine's\n * fixed order, and when to call again (absent: nothing is due). */\nexport interface ResumeResult { outbound: Outbound[], events: HolderEvent[], nextDueAt?: number }\n\n/** Why an act was refused; `ref` on the result may name the rule. */\nexport type ActError =\n | 'unknown-contact'\n | 'no-own-channel'\n | 'tuple-deactivated'\n | 'already-given'\n | 'in-flight'\n | 'scope-exhausted'\n | 'stale-issuance'\n | 'actid-conflict'\n /** a human act came without the actId the app must mint (note §4.2) */\n | 'actid-missing'\n | 'log-missing'\n /** the anchor mapping needs the holder's community anchor (register.community, Identity §5.4) */\n | 'no-community'\n | 'unknown-digest'\n /** prompt.decide: no open prompt has this id */\n | 'unknown-prompt'\n /** prompt.decide: the prompt's expiresAt is not after when; tick removes it */\n | 'prompt-expired'\n /** trust.merge: the manual merge joins at most one entry (6640), and\n * never relationships the binding rule keeps apart (6605) */\n | 'not-mergeable'\n /** identity.addDevice: not a device name of 6.2 (Identity §5.5) */\n | 'device-name-invalid'\n /** identity.addDevice: the register already holds the name (Identity §5.5, SHOULD) */\n | 'device-name-held'\n /** identity.addDevice: a revoked name is never given again (Identity §5.5) */\n | 'device-name-revoked'\n /** identity.revokeDevice: the register holds no such device name */\n | 'unknown-device'\n /** identity.rotate: the log replica does not hold the lineage through the\n * current generation (Identity §5.4, Access RLTP-ACC-5980); the rotation\n * stays pending until it does */\n | 'log-behind'\n /** identity.rotate: the log's head is no generation of this register's\n * lineage (another genesis, or a head the register does not follow) */\n | 'log-diverged'\n /** identity.rotate: the log answered failure; the rotation stays pending */\n | 'log-failure'\n /** setProfile: the body breaks 6430/6435 or its image 6475 */\n | 'profile-invalid'\n /** encounter: a card that fails Encounter 6 (schema, version, challenge,\n * keys, proof) or is not of the profile the act needs (displayed for a\n * scan, sent and addressed to an own challenge's anchor for a capture) */\n | 'card-invalid'\n /** encounter.scan: this displayed code was scanned already: its\n * challenge is in a record (5.3, 5170) */\n | 'already-scanned'\n /** encounter.capture: the bound challenge resolves unknown (5460) */\n | 'gate-expired'\n /** encounter: the own challenge is future-dated beyond the skew (5390) */\n | 'gate-future'\n /** encounter.capture: the challenge was consumed by another enactment (5440) */\n | 'consumed-challenge'\n /** encounter.capture: the same counterparty with other material (5450) */\n | 'card-mismatch'\n /** encounter.counter: no enactment record of the contact to issue on */\n | 'no-record'\n /** encounter.counter: the own step credential is issued already */\n | 'already-issued'\n /** membership: no such group, or the holder holds no role in it the act needs */\n | 'unknown-group'\n /** membership.vouch: no consent pair held for this member (Access 5.3) */\n | 'no-evidence'\n /** membership.vouch: the admitting member's own vouch never counts beside its admission */\n | 'own-admission'\n /** membership.found: a genesis admits under the rule of one; a stricter rule needs policy.change */\n | 'threshold-unsupported'\n /** introduction: no such act, or not in a state that allows the step */\n | 'unknown-act'\n /** introduction.request: the mediator's ack-delay declaration is not held (Delivery 4.4) */\n | 'no-declaration'\n /** a message, an invitation or the start of an introduction act toward\n * a relationship the holder has blocked (Message Tasks RLTP-MSG-6410) */\n | 'blocked'\n /** message.send: the tuple is not ready — no document of the\n * counterpart was accepted on it yet (Message Tasks RLTP-MSG-5020); the\n * app keeps the message unsent and sends it once the contact view says\n * `canMessage` */\n | 'not-ready'\n /** message.send: the text is not 1 to 4096 code points, or replyTo is no\n * lowercase UUID v4 (Message Tasks 3.2) */\n | 'message-invalid'\n\nexport type ActResult =\n /** nextDueAt: duty work this act opened or unblocked is due then (`when`:\n * now) — call resume at that time (engine.ts) */\n | { ok: true, outbound: Outbound[], events: HolderEvent[], nextDueAt?: number }\n | { ok: false, code: ActError, ref?: string }\n\n/** Receiver failure dispositions (Delivery §6.2), by the stage that names them. */\nexport type ReceiveFailure =\n | 'oversize' // stage 1\n | 'malformed' // stages 2, 4, 5, 7\n | 'decryption-failed' // stage 3\n | 'wrong-recipient' // stage 5\n | 'unknown-type' // stage 6\n | 'validation-failed' // stages 6 (the entry's proof declaration), 8, 9\n | 'stale-issuance' // stages 8, 9\n /** transient (Delivery RLTP-DEL-5820, 6270, 6280): nothing committed, no\n * ack, no cache entry; the carrier keeps the document and the receiver\n * evaluates it afresh when it is delivered again — never concluded */\n | 'rate-limited' // stage 8\n | 'gate-future' // stage 9\n | 'consumed-challenge' // stage 9\n\nexport type ReceiveStageNo = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n/**\n * The outcome of receive(env, when). `unique`: the effect committed,\n * with its ack first among `outbound` where the type acknowledges (a\n * delivery-ack itself is terminal and earns none), then the documents\n * the effect issued. `duplicate-known`: the stored ack is re-sent\n * byte-identical (none for a terminal document); nothing commits beyond\n * a raised lastWhen. `failed`: nothing took effect and nothing commits.\n * `discarded`: the document's chunk met a receiver resource limit (Trust\n * 5365, reason `resource-limit`) or, authenticated, violated the assembly\n * rules so that its whole delivery is rejected (5260–5310, 5500, 5510,\n * reason `rejected`): the open assembly is dropped and its salt held as\n * the lower bound (5366), committed; no cache entry, no ack, no event.\n * Delivery §6.2 has no disposition for it yet (receive.ts: a gap for\n * Delivery 0.82).\n */\nexport type ReceiveResult =\n | { disposition: 'unique', digest: string, type: string, outbound: Outbound[], events: HolderEvent[], /** as on ActResult */ nextDueAt?: number }\n | { disposition: 'duplicate-known', digest: string, outbound: Outbound[] }\n | { disposition: 'discarded', digest: string, type: string, reason: 'resource-limit' | 'rejected', ref?: string }\n | {\n disposition: 'failed', reason: ReceiveFailure, stage: ReceiveStageNo, digest?: string,\n /** local diagnosis of a key failure, never a disposition of its own\n * (Delivery §5, §6.2): 'unknown' — an rkid this holder never issued,\n * failed(malformed) at stage 2; 'retired' — a tombstone (or a key\n * marked retired), failed(decryption-failed) at stage 3 */\n key?: 'unknown' | 'retired'\n /** the rule the document failed, where its task handler names one\n * (TaskRefusal.ref), e.g. RLTP-TRU-6118 */\n ref?: string\n }\n\nexport type InfraErrorCode =\n | 'store-read'\n | 'store-commit'\n /** the commit may or may not have landed; re-read and consult the act journal */\n | 'unknown-commit-outcome'\n /** the store kept answering `conflict` past the retry bound (RetryPolicy.commitAttempts) */\n | 'commit-conflict'\n | 'key-provider'\n | 'log'\n | 'access'\n /** testing mode only (createHolder's `invariants: true`): a commit would\n * break an invariant of invariants.ts; nothing committed, the\n * violations are the cause */\n | 'invariant-violated'\n\n/** A failure of a port the host provides, never of the protocol. */\nexport class InfraError extends Error {\n readonly code: InfraErrorCode\n constructor (code: InfraErrorCode, message?: string, options?: { cause?: unknown }) {\n super(message ?? code, options)\n this.name = 'InfraError'\n this.code = code\n }\n}\n\n/** The WebCrypto handle lacks what the library needs; raised when a\n * holder is built, never at import (note §3 Crypto). */\nexport class CryptoUnavailableError extends Error {\n /** the algorithms (or 'subtle' itself) that are missing, in a fixed order */\n readonly missing: readonly string[]\n constructor (missing: readonly string[]) {\n super(`WebCrypto lacks: ${missing.join(', ')} (needs Ed25519, X25519, HKDF, HMAC, AES-GCM, SHA-256)`)\n this.name = 'CryptoUnavailableError'\n this.missing = Object.freeze([...missing])\n }\n}\n"]}
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CA+C9E,CAAA"}
|