@real-life/trust-protocol 0.6.0 → 0.7.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.
@@ -1,6 +1,6 @@
1
1
  import type { CommitListener, EnginePorts, HolderModule, TransportEntry, TransportRefusal, TransportView } from './engine.js';
2
2
  import type { DeliveryReport } from './ports.js';
3
- import type { ActResult, ReceiveResult, ResumeResult } from './results.js';
3
+ import type { ActResult, ReceiveResult, ReplayResult, ResumeResult } from './results.js';
4
4
  import type { DeviceKeyResult } from './identity-state.js';
5
5
  import type { ProfileContent } from './profile.js';
6
6
  import type { Dec, Millis, OpaqueHolderState, PromptChoice, Setting, TrustClass } from './state.js';
@@ -156,6 +156,12 @@ export interface Holder {
156
156
  inbox(): Promise<InboxMessageView[]>;
157
157
  /** by document digest or threadId */
158
158
  deliveryStatus(digestOrThreadId: string): Promise<DeliveryStatusView>;
159
+ /** the journaled result of the human act `actId` (any of the acts above:
160
+ * for sendMessage its `message.sent` event with `mid` and `digest`), or
161
+ * `{ok: false, code: 'unknown-act'}`; a pure read that never runs the
162
+ * act, never mints a mid, commits nothing. The question an app asks
163
+ * after a crash or a lock instead of repeating the act blind */
164
+ replay(actId: string, when: Millis): Promise<ReplayResult>;
159
165
  /** what the holder keeps for transport at `when`, after this opening's
160
166
  * first completed resume (else `{ok: false, code: 'not-resumed'}`) */
161
167
  pendingTransport(when: Millis): Promise<TransportView | TransportRefusal>;
@@ -1 +1 @@
1
- {"version":3,"file":"holder-api.d.ts","sourceRoot":"","sources":["../src/holder-api.ts"],"names":[],"mappings":"AAoFA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC7H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAA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,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtF;;+DAE2D;IAC3D,KAAK,IAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACzB;AAED;;;wDAGwD;AACxD,wBAAsB,YAAY,CAAE,KAAK,EAAE,WAAW,EAAE,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqEjG"}
@@ -51,6 +51,20 @@
51
51
  // unrevoked name under an own anchor context (identity-state.ts).
52
52
  // A missing actId is refused at runtime as actid-missing.
53
53
  //
54
+ // One actId, one result: replay(actId, when) reads the journaled result of
55
+ // any of the human acts above (its events: for sendMessage `message.sent`
56
+ // with mid and digest; its commit time; its documents and whether a repeat
57
+ // would hand them out at `when`), or answers unknown-act. It runs nothing
58
+ // and commits nothing, needs no keys, and works on every opening over the
59
+ // store. A repeat of the act under the same actId answers the same events
60
+ // at any clock, across a lock and a new opening; the journal holds an act
61
+ // for the retention max(P90D, retry.horizonMs) after its commit and after
62
+ // the last step of each of its documents, in holder time (engine.ts),
63
+ // after which the actId is unknown. An app that does not
64
+ // know whether an act committed (a crash, an unknown-commit-outcome, a
65
+ // lock) asks replay; on unknown-act the act did not commit or has left
66
+ // the journal, and only the human decides to act anew.
67
+ //
54
68
  // Reading: the views (views.ts) over one snapshot each, carrying its
55
69
  // commitSeq. `subscribe` announces every commit with its commitSeq and
56
70
  // events; the app re-reads the views it shows, and a view read after the
@@ -157,6 +171,7 @@ export async function createHolder(ports, opts = {}) {
157
171
  prompts: async () => promptsView(await read()),
158
172
  inbox: async () => inboxView(await read()),
159
173
  deliveryStatus: async (x) => deliveryStatusView(await read(), x),
174
+ replay: (actId, when) => engine.replay(actId, when),
160
175
  pendingTransport: (when) => engine.pendingTransport(when),
161
176
  mayHandOver: (entry, when) => engine.mayHandOver(entry, when),
162
177
  handOver: (entry, when, start) => engine.handOver(entry, when, start),
@@ -1 +1 @@
1
- {"version":3,"file":"holder-api.js","sourceRoot":"","sources":["../src/holder-api.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,4EAA4E;AAC5E,wEAAwE;AACxE,qEAAqE;AACrE,4EAA4E;AAC5E,wEAAwE;AACxE,sEAAsE;AACtE,uEAAuE;AACvE,uEAAuE;AACvE,0EAA0E;AAC1E,wIAAwI;AACxI,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,qEAAqE;AACrE,SAAS;AACT,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,oFAAoF;AACpF,oFAAoF;AACpF,+EAA+E;AAC/E,+EAA+E;AAC/E,wEAAwE;AACxE,kEAAkE;AAClE,0DAA0D;AAC1D,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,yEAAyE;AACzE,8CAA8C;AAC9C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AACxE,0EAA0E;AAC1E,0CAA0C;AAC1C,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,2EAA2E;AAC3E,uEAAuE;AACvE,yEAAyE;AACzE,mEAAmE;AACnE,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,2EAA2E;AAC3E,4EAA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AK,EAAE,CAAS,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;QACxE,gBAAgB,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC;QACjE,WAAW,EAAE,CAAC,KAAqB,EAAE,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC;QACrF,QAAQ,EAAE,CAAC,KAAqB,EAAE,IAAY,EAAE,KAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC;QAC5G,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;QAC3B,IAAI,MAAM,KAAM,OAAO,MAAM,CAAC,MAAM,CAAA,CAAC,CAAC;KACvC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["// holder-api — createHolder, the facade over the engine (lib Stage 2,\n// note §4.1, §4.5). Domain modules (identity, encounter, trust, continuity,\n// membership, profile) register with the engine as they graduate; today\n// the facade carries the engine's built-ins, the prompts module, the\n// encounter module (encounter/ceremony.ts: show, scan, the optical leg, the\n// counter-step, the bundle and the credential delivery), the membership\n// module (membership/holder.ts: founding, the prelude and invite, the\n// accept on a group-invite prompt, admission and welcome, evidence and\n// vouches; and the in-library Access over the holder's groups where no\n// Access port is given), the introduction module (introduction/holder.ts:\n// the three roles of Trust §8 and the mediator's start), the identity module (identity-state.ts: device names, the rotation), the trust\n// module (trust/mapping.ts: the Trust act, the class settings, the anchor\n// mapping's issuance and reception, the entry commit; trust/star.ts and\n// trust/group-star.ts: the star and the group star, reconciled on resume\n// and received with their assemblies; trust/entries.ts: merge, split and\n// departure; trust/continuity.ts: the probe, the continuity mapping and\n// the chaining; trust/profile.ts: profile@1) and the modules given.\n//\n// The human acts (note §4.2) are typed methods with an options object\n// `{when, actId}`; actId is required, minted by the app when the human\n// acts, and journaled with the act's result (a repeat with the same actId\n// replays it, another input under it is actid-conflict). They wrap `act`\n// with the trust module's command names, which stays for modules and\n// tests:\n// trust(contactId, opts) trust.set {on: true} human\n// untrust(contactId, opts) trust.set {on: false} human\n// pauseTrust(contactId, paused, opts) trust.pause human\n// setClass(contactId, cls, setting, opts) trust.setClass human\n// setGroupClass(contactId, groupId, setting, opts) trust.setGroupClass human\n// merge(contactIds, opts) trust.merge human\n// depart(contactId, opts{relationshipId?}) trust.depart human\n// decide(promptId, choice, opts) prompt.decide human\n// addDevice(name, opts) identity.addDevice human\n// revokeDevice(name, opts) identity.revokeDevice human\n// rotateAnchor(opts) identity.rotate human\n// setProfile({name, image?, text?}, opts) profile.set human\n// show(opts{name?}) encounter.show human\n// scan(card, opts{name?}) encounter.scan human\n// captureSentCard(card, opts) encounter.capture human\n// counter(contactId, opts) encounter.counter human\n// foundGroup({name, vouchThreshold?, listed?}, opts) membership.found human\n// invite(groupId, contactId, opts) membership.invite human\n// vouchFor(groupId, member, opts{provenance?}) membership.vouch human\n// introduce(requesterId, targetId, opts) introduction.introduce human\n// sendMessage(contactId, text, opts{replyTo?}) message.send human\n// block(contactId, opts) message.block {blocked: true} human\n// unblock(contactId, opts) message.block {blocked: false} human\n// recover({when}) trust.recover not human\n// takeMessages(ids, {when}) message.take not human\n// and the read deviceKey(name, contextLabel): the device key of a held,\n// unrevoked name under an own anchor context (identity-state.ts).\n// A missing actId is refused at runtime as actid-missing.\n//\n// Reading: the views (views.ts) over one snapshot each, carrying its\n// commitSeq. `subscribe` announces every commit with its commitSeq and\n// events; the app re-reads the views it shows, and a view read after the\n// announcement is at that commitSeq or later.\n//\n// Delivery: `receive(env, when)` runs Delivery §6.2 in the core and\n// dispatches through the task register (receive.ts); `report` takes the\n// adapter's reports (on an ack's digest: accepted or delivered marks it\n// sent, failed gives it up, awaiting-transport records that the adapter\n// holds it); `resume` re-emits, runs due duties and re-emits unsent acks;\n// `tick` expires and retains (engine.ts).\n//\n// Custody (Delivery 0.83 RLTP-DEL-6120 to 6135): the holder keeps every\n// outbound document until a service takes it or the holder gives it up,\n// across a lock and the end of a process. One createHolder is one opening.\n// After its first resume, `pendingTransport(when)` names what is to be\n// handed over: the outbox items neither terminal nor accepted (held ones\n// included) and the unsent acks, each with its envelope, its first\n// submission and its deadline, none past it. A transport hands over only\n// such entries, through `handOver(entry, when, start)`: the check of\n// `mayHandOver` and the start of the deposit in one step of the holder's\n// queue, true only for an entry this opening issued that is still pending,\n// unchanged, before its deadline. A duplicate's stored ack past its retries\n// appears once as a `resend` entry (Delivery RLTP-DEL-6330). A document missing from the\n// view is no longer to be sent. `await close()` ends the opening at a lock or\n// the end of a process (resolved once the running operation finished, the\n// moment the next opening may start): every later call rejects with InfraError\n// 'closed', mayHandOver answers false, and nothing issued before\n// authorizes anything; the next opening is a new createHolder over the\n// same store, resumed first.\nimport { createEngine } from './engine.js'\nimport type { CommitListener, EnginePorts, HolderModule, TransportEntry, TransportRefusal, TransportView } from './engine.js'\nimport type { DeliveryReport } from './ports.js'\nimport { DECIDE, collectDecisions, promptsModule } from './prompts.js'\nimport type { ActResult, ReceiveResult, ResumeResult } from './results.js'\nimport { InfraError } from './results.js'\nimport { commitViolations } from './invariants.js'\nimport type { CommitOp } from './invariants.js'\nimport type { HolderState } from './state.js'\nimport { toOpaque } from './state.js'\nimport { trustModule } from './trust/mapping.js'\nimport { IDENTITY_COMMANDS, deviceKeyOf, identityModule } from './identity-state.js'\nimport type { DeviceKeyResult } from './identity-state.js'\nimport { PROFILE_SET } from './trust/profile.js'\nimport type { ProfileContent } from './profile.js'\nimport type { Dec, Millis, OpaqueHolderState, PromptChoice, Setting, TrustClass } from './state.js'\nimport { TRUST_COMMANDS } from './trust/mapping.js'\nimport { ENTRY_COMMANDS } from './trust/entries.js'\nimport { ENCOUNTER_COMMANDS, encounterModule } from './encounter/ceremony.js'\nimport { MEMBERSHIP_COMMANDS, localAccess, membershipModule } from './membership/holder.js'\nimport { INTRODUCTION_COMMANDS, introductionModule } from './introduction/holder.js'\nimport { MESSAGE_COMMANDS, messageModule } from './message/holder.js'\nimport type { Json } from './core.js'\nimport { contactView, contactsView, deliveryStatusView, groupsView, inboxView, profileView, promptsView } from './views.js'\nimport type { ContactView, DeliveryStatusView, GroupView, InboxMessageView, ProfileView, PromptView } from './views.js'\n\n/** The committed state and its commitSeq; the state is opaque (note §4.5):\n * apps read the views, store tooling may persist it. */\nexport interface HolderSnapshot { commitSeq: Dec, state: OpaqueHolderState }\n\nexport interface HolderOptions {\n /** domain modules to register beside the built-ins, the prompts and the trust module */\n modules?: readonly HolderModule[]\n /** testing mode: check the invariants of invariants.ts on every commit,\n * before the store's CAS; a violation throws InfraError\n * 'invariant-violated' (cause: the violations) and nothing commits */\n invariants?: boolean\n}\n\n/** The options of a human act (note §4.2): its time and the actId the app\n * mints when the human acts. */\nexport interface HumanActOptions { when: Millis, actId: string }\n\nexport interface Holder {\n /** any registered command by name, for modules and tests; apps use the typed acts */\n act (command: string, input: unknown, when: Millis, opts?: { actId?: string }): Promise<ActResult>\n /** the human's decision on an open prompt: a human act under the app's\n * actId (note §4.2); a missing actId is also refused at runtime */\n decide (promptId: string, choice: PromptChoice, opts: HumanActOptions): Promise<ActResult>\n /** the Trust act: the anchor mapping class on toward the contact (2770); human */\n trust (contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** trust withdrawn: the anchor mapping class off (2840, 2850); human */\n untrust (contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** the pause of 5.4: star and blinded group star off, or back to default; human */\n pauseTrust (contactId: string, paused: boolean, opts: HumanActOptions): Promise<ActResult>\n /** one class's setting toward the contact (2780, 2810); human */\n setClass (contactId: string, cls: TrustClass, setting: Setting, opts: HumanActOptions): Promise<ActResult>\n /** the sealed group star's setting for one group toward the contact (2830); human */\n setGroupClass (contactId: string, groupId: string, setting: Setting, opts: HumanActOptions): Promise<ActResult>\n /** the manual merge (6640): at most one of them holds an entry; human */\n merge (contactIds: string[], opts: HumanActOptions): Promise<ActResult>\n /** departure (2260): the entry, the relationships of an alias, or one\n * relationship (relationshipId); human */\n depart (contactId: string, opts: HumanActOptions & { relationshipId?: string }): Promise<ActResult>\n /** 2240: entries re-commit from verified mappings recovered without them; not human */\n recover (opts: { when: Millis }): Promise<ActResult>\n /** a device name into the register before any key derived from it is presented (Identity §5.5); human */\n addDevice (name: string, opts: HumanActOptions): Promise<ActResult>\n /** the name's revocation mark: never removed, the name never given again (Identity §5.5); human */\n revokeDevice (name: string, opts: HumanActOptions): Promise<ActResult>\n /** the community anchor's rotation (Identity §5.4): step 1 (label,\n * closure, 6596 decided) when none runs, else step 2 of the running one\n * through the Log port; resume carries step 2 on its own (identity-state.ts) */\n rotateAnchor (opts: HumanActOptions): Promise<ActResult>\n /** the own profile (Trust 6b): validated (6430, 6435, 6475), the next\n * revision of the one counter (6450), delivered on every relationship\n * the profile class is on for (6455); human */\n setProfile (content: ProfileContent, opts: HumanActOptions): Promise<ActResult>\n /** a displayed card with a fresh own challenge under a fresh pair\n * anchor (Encounter 5.3, 4.4): the event encounter.shown carries the\n * card to display; `name` the card's display name (default: the own\n * profile's); human */\n show (opts: HumanActOptions & { name?: string }): Promise<ActResult>\n /** the scanner's step on a displayed card (Encounter 5.8): the record,\n * the fresh tuple, the bundle; encounter.scanned carries the sent card\n * for the optical leg; human */\n scan (card: Json, opts: HumanActOptions & { name?: string }): Promise<ActResult>\n /** the optical leg (Encounter 5.8, 5710): a sent card shown by the scanner; human */\n captureSentCard (card: Json, opts: HumanActOptions): Promise<ActResult>\n /** the counter-step toward a contact met as displayer (Encounter 5.8 step 4); human */\n counter (contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** a group founded under a fresh pair anchor (Access 3.4.1); its rule\n * vouchThreshold (default \"1\") is group state; event group.founded; human */\n foundGroup (group: { name: string, vouchThreshold?: string, listed?: boolean }, opts: HumanActOptions): Promise<ActResult>\n /** invite a contact into a group: the prelude, then the invite on its\n * answer (Membership 1.2, 3.1); the contact decides on a group-invite\n * prompt; human */\n invite (groupId: string, contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** the mediator's act (Trust §8, this library's start of it): the\n * requester gets an offer naming the target by an opaque designator and\n * at most the `label` the human types here, with the mediator's\n * ack-delay declaration; the requester decides on an\n * `introduction` prompt, the target on another; human */\n introduce (requesterId: string, targetId: string, opts: HumanActOptions & { label?: string }): Promise<ActResult>\n /** a vouch@2 for a member anchor whose consent pair this holder holds\n * (Access 5.3, Membership 3.4); human */\n vouchFor (groupId: string, member: string, opts: HumanActOptions & { provenance?: 'met' | 'introduced' }): Promise<ActResult>\n /** a text message to the contact (Message Tasks 3, 5): 1 to 4096 code\n * points, replyTo the mid of an earlier message of the relationship. It\n * goes on a ready, unblocked relationship (canMessage); otherwise refused\n * as not-ready, blocked or no-own-channel, and the app keeps it unsent.\n * Event message.sent {mid, digest}; deliveryStatus(digest) is its sender\n * status. Undelivered, it ends as failed(expired-by-adapter-policy) at\n * the retry horizon (P7D by default, P90D at most), before its sender\n * lifetime sentAt + P179D: failed(task-expired) is not reached for a\n * message under any horizon the engine admits; human */\n sendMessage (contactId: string, text: string, opts: HumanActOptions & { replyTo?: string }): Promise<ActResult>\n /** the inbox entries the app has durably taken over leave the inbox\n * (4420); their completion record stays (4350); not human */\n takeMessages (ids: string[], opts: { when: Millis }): Promise<ActResult>\n /** the block (Message Tasks 6): set on every relationship of the\n * contact's entry. Messages, invitations and the holder's own offers on\n * them stop; the protocol steps owed continue; the contact observes\n * nothing it would not without the block. Event contact.blocked; human */\n block (contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** the block cleared on every relationship of the entry: nothing that\n * was discarded under it reappears (6510); human */\n unblock (contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** the device key of a held, unrevoked device name under an own anchor\n * context (Identity §5.5); reads, changes nothing */\n deviceKey (name: string, contextLabel: string): Promise<DeviceKeyResult>\n tick (when: Millis): Promise<ActResult>\n resume (when: Millis): Promise<ResumeResult>\n report (report: DeliveryReport, when: Millis): Promise<ActResult>\n /** an arriving envelope, as the app's transport delivered it (non-human,\n * no actId; idempotent over the document digest) */\n receive (env: unknown, when: Millis): Promise<ReceiveResult>\n /** after every commit: its commitSeq and events, the cue to re-read the views */\n subscribe (listener: CommitListener): () => void\n snapshot (): Promise<HolderSnapshot>\n contacts (): Promise<ContactView[]>\n /** by entry id or alias */\n contact (id: string): Promise<ContactView | undefined>\n groups (): Promise<GroupView[]>\n profile (): Promise<ProfileView>\n prompts (): Promise<PromptView[]>\n /** the messages accepted and not yet taken over (Message Tasks 4.5),\n * by display time; event message.received announces each */\n inbox (): Promise<InboxMessageView[]>\n /** by document digest or threadId */\n deliveryStatus (digestOrThreadId: string): Promise<DeliveryStatusView>\n /** what the holder keeps for transport at `when`, after this opening's\n * first completed resume (else `{ok: false, code: 'not-resumed'}`) */\n pendingTransport (when: Millis): Promise<TransportView | TransportRefusal>\n /** right before a hand-over: whether this opening's `entry` may go now */\n mayHandOver (entry: TransportEntry, when: Millis): Promise<boolean>\n /** the hand-over: the same check, then `start()` (which starts the\n * deposit synchronously and says whether it did) inside the holder's\n * queue; true when both said yes */\n handOver (entry: TransportEntry, when: Millis, start: () => boolean): Promise<boolean>\n /** ends this opening (a lock, the end of a process); resolves once the\n * operation running at the call has finished: after that the opening\n * commits nothing more, and the next opening may start */\n close (): Promise<void>\n readonly closed: boolean\n}\n\n/** A holder over its ports: `{store, keys, entropy?, log?, access?, retry?, crypto?}`.\n * The crypto handle (default globalThis.crypto) is resolved and probed\n * here and also feeds the default entropy; an app that injects one\n * passes the same handle to seedKeys(seed, crypto). */\nexport async function createHolder (ports: EnginePorts, opts: HolderOptions = {}): Promise<Holder> {\n const modules = [identityModule(), trustModule(), encounterModule(), membershipModule(), introductionModule(), messageModule(), ...(opts.modules ?? [])]\n const check = opts.invariants === true\n ? (before: Readonly<HolderState>, after: Readonly<HolderState>, op: CommitOp) => {\n const v = commitViolations(before, after, op)\n if (v.length) throw new InfraError('invariant-violated', `invariants broken by ${op.kind}: ${v.map((x) => `[${x.invariant}] ${x.detail}`).join('; ')}`, { cause: v })\n }\n : undefined\n const engine = await createEngine(ports, [promptsModule(collectDecisions(modules)), ...modules], { ...(check ? { check } : {}), accessFrom: localAccess })\n const read = async () => (await engine.snapshot()).state\n /** a human act: `when` and actId from the options, a missing actId refused by the engine */\n const human = (command: string, input: unknown, o: HumanActOptions | undefined) =>\n engine.act(command, input, o?.when as Millis, o?.actId === undefined ? {} : { actId: o.actId })\n return Object.freeze({\n act: (command: string, input: unknown, when: Millis, o?: { actId?: string }) => engine.act(command, input, when, o),\n decide: (promptId: string, choice: PromptChoice, o: HumanActOptions) => human(DECIDE, { promptId, choice }, o),\n trust: (contactId: string, o: HumanActOptions) => human(TRUST_COMMANDS.set, { contactId, on: true }, o),\n untrust: (contactId: string, o: HumanActOptions) => human(TRUST_COMMANDS.set, { contactId, on: false }, o),\n pauseTrust: (contactId: string, paused: boolean, o: HumanActOptions) => human(TRUST_COMMANDS.pause, { contactId, paused }, o),\n setClass: (contactId: string, cls: TrustClass, setting: Setting, o: HumanActOptions) => human(TRUST_COMMANDS.setClass, { contactId, cls, setting }, o),\n setGroupClass: (contactId: string, groupId: string, setting: Setting, o: HumanActOptions) =>\n human(TRUST_COMMANDS.setGroupClass, { contactId, groupId, setting }, o),\n merge: (contactIds: string[], o: HumanActOptions) => human(ENTRY_COMMANDS.merge, { contactIds }, o),\n depart: (contactId: string, o: HumanActOptions & { relationshipId?: string }) =>\n human(ENTRY_COMMANDS.depart, o?.relationshipId === undefined ? { contactId } : { contactId, relationshipId: o.relationshipId }, o),\n recover: (o: { when: Millis }) => engine.act(TRUST_COMMANDS.recover, {}, o?.when as Millis),\n rotateAnchor: (o: HumanActOptions) => human(IDENTITY_COMMANDS.rotate, {}, o),\n setProfile: (content: ProfileContent, o: HumanActOptions) => human(PROFILE_SET, content, o),\n show: (o: HumanActOptions & { name?: string }) => human(ENCOUNTER_COMMANDS.show, o?.name === undefined ? {} : { name: o.name }, o),\n scan: (card: Json, o: HumanActOptions & { name?: string }) => human(ENCOUNTER_COMMANDS.scan, o?.name === undefined ? { card } : { card, name: o.name }, o),\n captureSentCard: (card: Json, o: HumanActOptions) => human(ENCOUNTER_COMMANDS.capture, { card }, o),\n counter: (contactId: string, o: HumanActOptions) => human(ENCOUNTER_COMMANDS.counter, { contactId }, o),\n foundGroup: (g: { name: string, vouchThreshold?: string, listed?: boolean }, o: HumanActOptions) => human(MEMBERSHIP_COMMANDS.found, g, o),\n invite: (groupId: string, contactId: string, o: HumanActOptions) => human(MEMBERSHIP_COMMANDS.invite, { groupId, contactId }, o),\n vouchFor: (groupId: string, member: string, o: HumanActOptions & { provenance?: 'met' | 'introduced' }) =>\n human(MEMBERSHIP_COMMANDS.vouch, o?.provenance === undefined ? { groupId, member } : { groupId, member, provenance: o.provenance }, o),\n introduce: (requesterId: string, targetId: string, o: HumanActOptions & { label?: string }) =>\n human(INTRODUCTION_COMMANDS.introduce, o?.label === undefined ? { requesterId, targetId } : { requesterId, targetId, label: o.label }, o),\n sendMessage: (contactId: string, text: string, o: HumanActOptions & { replyTo?: string }) =>\n human(MESSAGE_COMMANDS.send, o?.replyTo === undefined ? { contactId, text } : { contactId, text, replyTo: o.replyTo }, o),\n takeMessages: (ids: string[], o: { when: Millis }) => engine.act(MESSAGE_COMMANDS.take, { ids }, o?.when as Millis),\n block: (contactId: string, o: HumanActOptions) => human(MESSAGE_COMMANDS.block, { contactId, blocked: true }, o),\n unblock: (contactId: string, o: HumanActOptions) => human(MESSAGE_COMMANDS.block, { contactId, blocked: false }, o),\n addDevice: (name: string, o: HumanActOptions) => human(IDENTITY_COMMANDS.addDevice, { name }, o),\n revokeDevice: (name: string, o: HumanActOptions) => human(IDENTITY_COMMANDS.revokeDevice, { name }, o),\n deviceKey: async (name: string, contextLabel: string) => deviceKeyOf(await read(), ports.keys, name, contextLabel),\n tick: (when: Millis) => engine.tick(when),\n resume: (when: Millis) => engine.resume(when),\n report: (report: DeliveryReport, when: Millis) => engine.report(report, when),\n receive: (env: unknown, when: Millis) => engine.receive(env, when),\n subscribe: (listener: CommitListener) => engine.subscribe(listener),\n snapshot: async (): Promise<HolderSnapshot> => {\n const s = await engine.snapshot()\n return Object.freeze({ commitSeq: s.commitSeq, state: toOpaque(s.state) })\n },\n contacts: async () => contactsView(await read()),\n contact: async (id: string) => contactView(await read(), id),\n groups: async () => groupsView(await read()),\n profile: async () => profileView(await read()),\n prompts: async () => promptsView(await read()),\n inbox: async () => inboxView(await read()),\n deliveryStatus: async (x: string) => deliveryStatusView(await read(), x),\n pendingTransport: (when: Millis) => engine.pendingTransport(when),\n mayHandOver: (entry: TransportEntry, when: Millis) => engine.mayHandOver(entry, when),\n handOver: (entry: TransportEntry, when: Millis, start: () => boolean) => engine.handOver(entry, when, start),\n close: () => engine.close(),\n get closed () { return engine.closed },\n })\n}\n"]}
1
+ {"version":3,"file":"holder-api.js","sourceRoot":"","sources":["../src/holder-api.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,4EAA4E;AAC5E,wEAAwE;AACxE,qEAAqE;AACrE,4EAA4E;AAC5E,wEAAwE;AACxE,sEAAsE;AACtE,uEAAuE;AACvE,uEAAuE;AACvE,0EAA0E;AAC1E,wIAAwI;AACxI,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,qEAAqE;AACrE,SAAS;AACT,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;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AAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;QAC3B,IAAI,MAAM,KAAM,OAAO,MAAM,CAAC,MAAM,CAAA,CAAC,CAAC;KACvC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["// holder-api — createHolder, the facade over the engine (lib Stage 2,\n// note §4.1, §4.5). Domain modules (identity, encounter, trust, continuity,\n// membership, profile) register with the engine as they graduate; today\n// the facade carries the engine's built-ins, the prompts module, the\n// encounter module (encounter/ceremony.ts: show, scan, the optical leg, the\n// counter-step, the bundle and the credential delivery), the membership\n// module (membership/holder.ts: founding, the prelude and invite, the\n// accept on a group-invite prompt, admission and welcome, evidence and\n// vouches; and the in-library Access over the holder's groups where no\n// Access port is given), the introduction module (introduction/holder.ts:\n// the three roles of Trust §8 and the mediator's start), the identity module (identity-state.ts: device names, the rotation), the trust\n// module (trust/mapping.ts: the Trust act, the class settings, the anchor\n// mapping's issuance and reception, the entry commit; trust/star.ts and\n// trust/group-star.ts: the star and the group star, reconciled on resume\n// and received with their assemblies; trust/entries.ts: merge, split and\n// departure; trust/continuity.ts: the probe, the continuity mapping and\n// the chaining; trust/profile.ts: profile@1) and the modules given.\n//\n// The human acts (note §4.2) are typed methods with an options object\n// `{when, actId}`; actId is required, minted by the app when the human\n// acts, and journaled with the act's result (a repeat with the same actId\n// replays it, another input under it is actid-conflict). They wrap `act`\n// with the trust module's command names, which stays for modules and\n// tests:\n// trust(contactId, opts) trust.set {on: true} human\n// untrust(contactId, opts) trust.set {on: false} human\n// pauseTrust(contactId, paused, opts) trust.pause human\n// setClass(contactId, cls, setting, opts) trust.setClass human\n// setGroupClass(contactId, groupId, setting, opts) trust.setGroupClass human\n// merge(contactIds, opts) trust.merge human\n// depart(contactId, opts{relationshipId?}) trust.depart human\n// decide(promptId, choice, opts) prompt.decide human\n// addDevice(name, opts) identity.addDevice human\n// revokeDevice(name, opts) identity.revokeDevice human\n// rotateAnchor(opts) identity.rotate human\n// setProfile({name, image?, text?}, opts) profile.set human\n// show(opts{name?}) encounter.show human\n// scan(card, opts{name?}) encounter.scan human\n// captureSentCard(card, opts) encounter.capture human\n// counter(contactId, opts) encounter.counter human\n// foundGroup({name, vouchThreshold?, listed?}, opts) membership.found human\n// invite(groupId, contactId, opts) membership.invite human\n// vouchFor(groupId, member, opts{provenance?}) membership.vouch human\n// introduce(requesterId, targetId, opts) introduction.introduce human\n// sendMessage(contactId, text, opts{replyTo?}) message.send human\n// block(contactId, opts) message.block {blocked: true} human\n// unblock(contactId, opts) message.block {blocked: false} human\n// recover({when}) trust.recover not human\n// takeMessages(ids, {when}) message.take not human\n// and the read deviceKey(name, contextLabel): the device key of a held,\n// unrevoked name under an own anchor context (identity-state.ts).\n// A missing actId is refused at runtime as actid-missing.\n//\n// One actId, one result: replay(actId, when) reads the journaled result of\n// any of the human acts above (its events: for sendMessage `message.sent`\n// with mid and digest; its commit time; its documents and whether a repeat\n// would hand them out at `when`), or answers unknown-act. It runs nothing\n// and commits nothing, needs no keys, and works on every opening over the\n// store. A repeat of the act under the same actId answers the same events\n// at any clock, across a lock and a new opening; the journal holds an act\n// for the retention max(P90D, retry.horizonMs) after its commit and after\n// the last step of each of its documents, in holder time (engine.ts),\n// after which the actId is unknown. An app that does not\n// know whether an act committed (a crash, an unknown-commit-outcome, a\n// lock) asks replay; on unknown-act the act did not commit or has left\n// the journal, and only the human decides to act anew.\n//\n// Reading: the views (views.ts) over one snapshot each, carrying its\n// commitSeq. `subscribe` announces every commit with its commitSeq and\n// events; the app re-reads the views it shows, and a view read after the\n// announcement is at that commitSeq or later.\n//\n// Delivery: `receive(env, when)` runs Delivery §6.2 in the core and\n// dispatches through the task register (receive.ts); `report` takes the\n// adapter's reports (on an ack's digest: accepted or delivered marks it\n// sent, failed gives it up, awaiting-transport records that the adapter\n// holds it); `resume` re-emits, runs due duties and re-emits unsent acks;\n// `tick` expires and retains (engine.ts).\n//\n// Custody (Delivery 0.83 RLTP-DEL-6120 to 6135): the holder keeps every\n// outbound document until a service takes it or the holder gives it up,\n// across a lock and the end of a process. One createHolder is one opening.\n// After its first resume, `pendingTransport(when)` names what is to be\n// handed over: the outbox items neither terminal nor accepted (held ones\n// included) and the unsent acks, each with its envelope, its first\n// submission and its deadline, none past it. A transport hands over only\n// such entries, through `handOver(entry, when, start)`: the check of\n// `mayHandOver` and the start of the deposit in one step of the holder's\n// queue, true only for an entry this opening issued that is still pending,\n// unchanged, before its deadline. A duplicate's stored ack past its retries\n// appears once as a `resend` entry (Delivery RLTP-DEL-6330). A document missing from the\n// view is no longer to be sent. `await close()` ends the opening at a lock or\n// the end of a process (resolved once the running operation finished, the\n// moment the next opening may start): every later call rejects with InfraError\n// 'closed', mayHandOver answers false, and nothing issued before\n// authorizes anything; the next opening is a new createHolder over the\n// same store, resumed first.\nimport { createEngine } from './engine.js'\nimport type { CommitListener, EnginePorts, HolderModule, TransportEntry, TransportRefusal, TransportView } from './engine.js'\nimport type { DeliveryReport } from './ports.js'\nimport { DECIDE, collectDecisions, promptsModule } from './prompts.js'\nimport type { ActResult, ReceiveResult, ReplayResult, ResumeResult } from './results.js'\nimport { InfraError } from './results.js'\nimport { commitViolations } from './invariants.js'\nimport type { CommitOp } from './invariants.js'\nimport type { HolderState } from './state.js'\nimport { toOpaque } from './state.js'\nimport { trustModule } from './trust/mapping.js'\nimport { IDENTITY_COMMANDS, deviceKeyOf, identityModule } from './identity-state.js'\nimport type { DeviceKeyResult } from './identity-state.js'\nimport { PROFILE_SET } from './trust/profile.js'\nimport type { ProfileContent } from './profile.js'\nimport type { Dec, Millis, OpaqueHolderState, PromptChoice, Setting, TrustClass } from './state.js'\nimport { TRUST_COMMANDS } from './trust/mapping.js'\nimport { ENTRY_COMMANDS } from './trust/entries.js'\nimport { ENCOUNTER_COMMANDS, encounterModule } from './encounter/ceremony.js'\nimport { MEMBERSHIP_COMMANDS, localAccess, membershipModule } from './membership/holder.js'\nimport { INTRODUCTION_COMMANDS, introductionModule } from './introduction/holder.js'\nimport { MESSAGE_COMMANDS, messageModule } from './message/holder.js'\nimport type { Json } from './core.js'\nimport { contactView, contactsView, deliveryStatusView, groupsView, inboxView, profileView, promptsView } from './views.js'\nimport type { ContactView, DeliveryStatusView, GroupView, InboxMessageView, ProfileView, PromptView } from './views.js'\n\n/** The committed state and its commitSeq; the state is opaque (note §4.5):\n * apps read the views, store tooling may persist it. */\nexport interface HolderSnapshot { commitSeq: Dec, state: OpaqueHolderState }\n\nexport interface HolderOptions {\n /** domain modules to register beside the built-ins, the prompts and the trust module */\n modules?: readonly HolderModule[]\n /** testing mode: check the invariants of invariants.ts on every commit,\n * before the store's CAS; a violation throws InfraError\n * 'invariant-violated' (cause: the violations) and nothing commits */\n invariants?: boolean\n}\n\n/** The options of a human act (note §4.2): its time and the actId the app\n * mints when the human acts. */\nexport interface HumanActOptions { when: Millis, actId: string }\n\nexport interface Holder {\n /** any registered command by name, for modules and tests; apps use the typed acts */\n act (command: string, input: unknown, when: Millis, opts?: { actId?: string }): Promise<ActResult>\n /** the human's decision on an open prompt: a human act under the app's\n * actId (note §4.2); a missing actId is also refused at runtime */\n decide (promptId: string, choice: PromptChoice, opts: HumanActOptions): Promise<ActResult>\n /** the Trust act: the anchor mapping class on toward the contact (2770); human */\n trust (contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** trust withdrawn: the anchor mapping class off (2840, 2850); human */\n untrust (contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** the pause of 5.4: star and blinded group star off, or back to default; human */\n pauseTrust (contactId: string, paused: boolean, opts: HumanActOptions): Promise<ActResult>\n /** one class's setting toward the contact (2780, 2810); human */\n setClass (contactId: string, cls: TrustClass, setting: Setting, opts: HumanActOptions): Promise<ActResult>\n /** the sealed group star's setting for one group toward the contact (2830); human */\n setGroupClass (contactId: string, groupId: string, setting: Setting, opts: HumanActOptions): Promise<ActResult>\n /** the manual merge (6640): at most one of them holds an entry; human */\n merge (contactIds: string[], opts: HumanActOptions): Promise<ActResult>\n /** departure (2260): the entry, the relationships of an alias, or one\n * relationship (relationshipId); human */\n depart (contactId: string, opts: HumanActOptions & { relationshipId?: string }): Promise<ActResult>\n /** 2240: entries re-commit from verified mappings recovered without them; not human */\n recover (opts: { when: Millis }): Promise<ActResult>\n /** a device name into the register before any key derived from it is presented (Identity §5.5); human */\n addDevice (name: string, opts: HumanActOptions): Promise<ActResult>\n /** the name's revocation mark: never removed, the name never given again (Identity §5.5); human */\n revokeDevice (name: string, opts: HumanActOptions): Promise<ActResult>\n /** the community anchor's rotation (Identity §5.4): step 1 (label,\n * closure, 6596 decided) when none runs, else step 2 of the running one\n * through the Log port; resume carries step 2 on its own (identity-state.ts) */\n rotateAnchor (opts: HumanActOptions): Promise<ActResult>\n /** the own profile (Trust 6b): validated (6430, 6435, 6475), the next\n * revision of the one counter (6450), delivered on every relationship\n * the profile class is on for (6455); human */\n setProfile (content: ProfileContent, opts: HumanActOptions): Promise<ActResult>\n /** a displayed card with a fresh own challenge under a fresh pair\n * anchor (Encounter 5.3, 4.4): the event encounter.shown carries the\n * card to display; `name` the card's display name (default: the own\n * profile's); human */\n show (opts: HumanActOptions & { name?: string }): Promise<ActResult>\n /** the scanner's step on a displayed card (Encounter 5.8): the record,\n * the fresh tuple, the bundle; encounter.scanned carries the sent card\n * for the optical leg; human */\n scan (card: Json, opts: HumanActOptions & { name?: string }): Promise<ActResult>\n /** the optical leg (Encounter 5.8, 5710): a sent card shown by the scanner; human */\n captureSentCard (card: Json, opts: HumanActOptions): Promise<ActResult>\n /** the counter-step toward a contact met as displayer (Encounter 5.8 step 4); human */\n counter (contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** a group founded under a fresh pair anchor (Access 3.4.1); its rule\n * vouchThreshold (default \"1\") is group state; event group.founded; human */\n foundGroup (group: { name: string, vouchThreshold?: string, listed?: boolean }, opts: HumanActOptions): Promise<ActResult>\n /** invite a contact into a group: the prelude, then the invite on its\n * answer (Membership 1.2, 3.1); the contact decides on a group-invite\n * prompt; human */\n invite (groupId: string, contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** the mediator's act (Trust §8, this library's start of it): the\n * requester gets an offer naming the target by an opaque designator and\n * at most the `label` the human types here, with the mediator's\n * ack-delay declaration; the requester decides on an\n * `introduction` prompt, the target on another; human */\n introduce (requesterId: string, targetId: string, opts: HumanActOptions & { label?: string }): Promise<ActResult>\n /** a vouch@2 for a member anchor whose consent pair this holder holds\n * (Access 5.3, Membership 3.4); human */\n vouchFor (groupId: string, member: string, opts: HumanActOptions & { provenance?: 'met' | 'introduced' }): Promise<ActResult>\n /** a text message to the contact (Message Tasks 3, 5): 1 to 4096 code\n * points, replyTo the mid of an earlier message of the relationship. It\n * goes on a ready, unblocked relationship (canMessage); otherwise refused\n * as not-ready, blocked or no-own-channel, and the app keeps it unsent.\n * Event message.sent {mid, digest}; deliveryStatus(digest) is its sender\n * status. Undelivered, it ends as failed(expired-by-adapter-policy) at\n * the retry horizon (P7D by default, P90D at most), before its sender\n * lifetime sentAt + P179D: failed(task-expired) is not reached for a\n * message under any horizon the engine admits; human */\n sendMessage (contactId: string, text: string, opts: HumanActOptions & { replyTo?: string }): Promise<ActResult>\n /** the inbox entries the app has durably taken over leave the inbox\n * (4420); their completion record stays (4350); not human */\n takeMessages (ids: string[], opts: { when: Millis }): Promise<ActResult>\n /** the block (Message Tasks 6): set on every relationship of the\n * contact's entry. Messages, invitations and the holder's own offers on\n * them stop; the protocol steps owed continue; the contact observes\n * nothing it would not without the block. Event contact.blocked; human */\n block (contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** the block cleared on every relationship of the entry: nothing that\n * was discarded under it reappears (6510); human */\n unblock (contactId: string, opts: HumanActOptions): Promise<ActResult>\n /** the device key of a held, unrevoked device name under an own anchor\n * context (Identity §5.5); reads, changes nothing */\n deviceKey (name: string, contextLabel: string): Promise<DeviceKeyResult>\n tick (when: Millis): Promise<ActResult>\n resume (when: Millis): Promise<ResumeResult>\n report (report: DeliveryReport, when: Millis): Promise<ActResult>\n /** an arriving envelope, as the app's transport delivered it (non-human,\n * no actId; idempotent over the document digest) */\n receive (env: unknown, when: Millis): Promise<ReceiveResult>\n /** after every commit: its commitSeq and events, the cue to re-read the views */\n subscribe (listener: CommitListener): () => void\n snapshot (): Promise<HolderSnapshot>\n contacts (): Promise<ContactView[]>\n /** by entry id or alias */\n contact (id: string): Promise<ContactView | undefined>\n groups (): Promise<GroupView[]>\n profile (): Promise<ProfileView>\n prompts (): Promise<PromptView[]>\n /** the messages accepted and not yet taken over (Message Tasks 4.5),\n * by display time; event message.received announces each */\n inbox (): Promise<InboxMessageView[]>\n /** by document digest or threadId */\n deliveryStatus (digestOrThreadId: string): Promise<DeliveryStatusView>\n /** the journaled result of the human act `actId` (any of the acts above:\n * for sendMessage its `message.sent` event with `mid` and `digest`), or\n * `{ok: false, code: 'unknown-act'}`; a pure read that never runs the\n * act, never mints a mid, commits nothing. The question an app asks\n * after a crash or a lock instead of repeating the act blind */\n replay (actId: string, when: Millis): Promise<ReplayResult>\n /** what the holder keeps for transport at `when`, after this opening's\n * first completed resume (else `{ok: false, code: 'not-resumed'}`) */\n pendingTransport (when: Millis): Promise<TransportView | TransportRefusal>\n /** right before a hand-over: whether this opening's `entry` may go now */\n mayHandOver (entry: TransportEntry, when: Millis): Promise<boolean>\n /** the hand-over: the same check, then `start()` (which starts the\n * deposit synchronously and says whether it did) inside the holder's\n * queue; true when both said yes */\n handOver (entry: TransportEntry, when: Millis, start: () => boolean): Promise<boolean>\n /** ends this opening (a lock, the end of a process); resolves once the\n * operation running at the call has finished: after that the opening\n * commits nothing more, and the next opening may start */\n close (): Promise<void>\n readonly closed: boolean\n}\n\n/** A holder over its ports: `{store, keys, entropy?, log?, access?, retry?, crypto?}`.\n * The crypto handle (default globalThis.crypto) is resolved and probed\n * here and also feeds the default entropy; an app that injects one\n * passes the same handle to seedKeys(seed, crypto). */\nexport async function createHolder (ports: EnginePorts, opts: HolderOptions = {}): Promise<Holder> {\n const modules = [identityModule(), trustModule(), encounterModule(), membershipModule(), introductionModule(), messageModule(), ...(opts.modules ?? [])]\n const check = opts.invariants === true\n ? (before: Readonly<HolderState>, after: Readonly<HolderState>, op: CommitOp) => {\n const v = commitViolations(before, after, op)\n if (v.length) throw new InfraError('invariant-violated', `invariants broken by ${op.kind}: ${v.map((x) => `[${x.invariant}] ${x.detail}`).join('; ')}`, { cause: v })\n }\n : undefined\n const engine = await createEngine(ports, [promptsModule(collectDecisions(modules)), ...modules], { ...(check ? { check } : {}), accessFrom: localAccess })\n const read = async () => (await engine.snapshot()).state\n /** a human act: `when` and actId from the options, a missing actId refused by the engine */\n const human = (command: string, input: unknown, o: HumanActOptions | undefined) =>\n engine.act(command, input, o?.when as Millis, o?.actId === undefined ? {} : { actId: o.actId })\n return Object.freeze({\n act: (command: string, input: unknown, when: Millis, o?: { actId?: string }) => engine.act(command, input, when, o),\n decide: (promptId: string, choice: PromptChoice, o: HumanActOptions) => human(DECIDE, { promptId, choice }, o),\n trust: (contactId: string, o: HumanActOptions) => human(TRUST_COMMANDS.set, { contactId, on: true }, o),\n untrust: (contactId: string, o: HumanActOptions) => human(TRUST_COMMANDS.set, { contactId, on: false }, o),\n pauseTrust: (contactId: string, paused: boolean, o: HumanActOptions) => human(TRUST_COMMANDS.pause, { contactId, paused }, o),\n setClass: (contactId: string, cls: TrustClass, setting: Setting, o: HumanActOptions) => human(TRUST_COMMANDS.setClass, { contactId, cls, setting }, o),\n setGroupClass: (contactId: string, groupId: string, setting: Setting, o: HumanActOptions) =>\n human(TRUST_COMMANDS.setGroupClass, { contactId, groupId, setting }, o),\n merge: (contactIds: string[], o: HumanActOptions) => human(ENTRY_COMMANDS.merge, { contactIds }, o),\n depart: (contactId: string, o: HumanActOptions & { relationshipId?: string }) =>\n human(ENTRY_COMMANDS.depart, o?.relationshipId === undefined ? { contactId } : { contactId, relationshipId: o.relationshipId }, o),\n recover: (o: { when: Millis }) => engine.act(TRUST_COMMANDS.recover, {}, o?.when as Millis),\n rotateAnchor: (o: HumanActOptions) => human(IDENTITY_COMMANDS.rotate, {}, o),\n setProfile: (content: ProfileContent, o: HumanActOptions) => human(PROFILE_SET, content, o),\n show: (o: HumanActOptions & { name?: string }) => human(ENCOUNTER_COMMANDS.show, o?.name === undefined ? {} : { name: o.name }, o),\n scan: (card: Json, o: HumanActOptions & { name?: string }) => human(ENCOUNTER_COMMANDS.scan, o?.name === undefined ? { card } : { card, name: o.name }, o),\n captureSentCard: (card: Json, o: HumanActOptions) => human(ENCOUNTER_COMMANDS.capture, { card }, o),\n counter: (contactId: string, o: HumanActOptions) => human(ENCOUNTER_COMMANDS.counter, { contactId }, o),\n foundGroup: (g: { name: string, vouchThreshold?: string, listed?: boolean }, o: HumanActOptions) => human(MEMBERSHIP_COMMANDS.found, g, o),\n invite: (groupId: string, contactId: string, o: HumanActOptions) => human(MEMBERSHIP_COMMANDS.invite, { groupId, contactId }, o),\n vouchFor: (groupId: string, member: string, o: HumanActOptions & { provenance?: 'met' | 'introduced' }) =>\n human(MEMBERSHIP_COMMANDS.vouch, o?.provenance === undefined ? { groupId, member } : { groupId, member, provenance: o.provenance }, o),\n introduce: (requesterId: string, targetId: string, o: HumanActOptions & { label?: string }) =>\n human(INTRODUCTION_COMMANDS.introduce, o?.label === undefined ? { requesterId, targetId } : { requesterId, targetId, label: o.label }, o),\n sendMessage: (contactId: string, text: string, o: HumanActOptions & { replyTo?: string }) =>\n human(MESSAGE_COMMANDS.send, o?.replyTo === undefined ? { contactId, text } : { contactId, text, replyTo: o.replyTo }, o),\n takeMessages: (ids: string[], o: { when: Millis }) => engine.act(MESSAGE_COMMANDS.take, { ids }, o?.when as Millis),\n block: (contactId: string, o: HumanActOptions) => human(MESSAGE_COMMANDS.block, { contactId, blocked: true }, o),\n unblock: (contactId: string, o: HumanActOptions) => human(MESSAGE_COMMANDS.block, { contactId, blocked: false }, o),\n addDevice: (name: string, o: HumanActOptions) => human(IDENTITY_COMMANDS.addDevice, { name }, o),\n revokeDevice: (name: string, o: HumanActOptions) => human(IDENTITY_COMMANDS.revokeDevice, { name }, o),\n deviceKey: async (name: string, contextLabel: string) => deviceKeyOf(await read(), ports.keys, name, contextLabel),\n tick: (when: Millis) => engine.tick(when),\n resume: (when: Millis) => engine.resume(when),\n report: (report: DeliveryReport, when: Millis) => engine.report(report, when),\n receive: (env: unknown, when: Millis) => engine.receive(env, when),\n subscribe: (listener: CommitListener) => engine.subscribe(listener),\n snapshot: async (): Promise<HolderSnapshot> => {\n const s = await engine.snapshot()\n return Object.freeze({ commitSeq: s.commitSeq, state: toOpaque(s.state) })\n },\n contacts: async () => contactsView(await read()),\n contact: async (id: string) => contactView(await read(), id),\n groups: async () => groupsView(await read()),\n profile: async () => profileView(await read()),\n prompts: async () => promptsView(await read()),\n inbox: async () => inboxView(await read()),\n deliveryStatus: async (x: string) => deliveryStatusView(await read(), x),\n replay: (actId: string, when: Millis) => engine.replay(actId, when),\n pendingTransport: (when: Millis) => engine.pendingTransport(when),\n mayHandOver: (entry: TransportEntry, when: Millis) => engine.mayHandOver(entry, when),\n handOver: (entry: TransportEntry, when: Millis, start: () => boolean) => engine.handOver(entry, when, start),\n close: () => engine.close(),\n get closed () { return engine.closed },\n })\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export declare function decodeState(raw: unknown): OpaqueHolderState;
23
23
  export type * from './ports.js';
24
24
  export type * from './events.js';
25
25
  export { InfraError, CryptoUnavailableError } from './results.js';
26
- export type { ActError, ActResult, ReceiveFailure, ReceiveStageNo, ReceiveResult, ResumeResult, InfraErrorCode } from './results.js';
26
+ export type { ActError, ActResult, ActReplay, ReceiveFailure, ReceiveStageNo, ReceiveResult, ReplayOutbound, ReplayResult, ResumeResult, InfraErrorCode } from './results.js';
27
27
  export { ENTROPY_PURPOSES, EntropyError, randomEntropy } from './entropy.js';
28
28
  export type { Entropy, EntropyPurpose, EntropyErrorCode, PlatformRandom } from './entropy.js';
29
29
  export { storeContract } from './store-contract.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.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OAAO,gBAAgB,CAAC,GAAG,CAAiC,CAAA;AAC9D,CAAC;AAGD,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAEjE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA","sourcesContent":["// @real-life/trust-protocol — the reference library of RLTP.\n//\n// The holder: createHolder({store, keys, entropy?, log?, access?, retry?,\n// crypto?}) — one person's device state behind the human acts, receive,\n// report, resume and tick, and the views an app reads. The ports (Store,\n// KeyProvider, Entropy, Log, Access, DeliveryReport, Outbound) are the\n// app's; seedKeys is the default KeyProvider. Beside it, the pure wire\n// builders and verifiers of every layer, byte-compatible with the shipped\n// vectors.\n//\n// core the form every artifact obeys (JCS, digests, schemas)\n// crypto the primitives, and the Data Integrity proof\n// identity context derivation under the closed registry (§6.1/§6.2),\n// device labels device/<n>/<c> (§5.5)\n// profile profile@1 (Trust §6b): k_pr, the MAC, the bounds and\n// the picture's header read before any decoding\n// encounter the ceremony's wire forms: challenges, cards, credentials,\n// and its pure checks (5.6 acceptance, the bundle's forms)\n// membership Membership 0.20's forms and checks: the prelude,\n// invite, accept, evidence, vouch@2, the member label, oids\n// message Message Tasks 0.1's forms: message@1, k_msg, the MAC\n// introduction Trust §8's artifacts and checks, the act window, the\n// registry declaration's ack-delay\n// delivery the sealed envelope and the generic receive stages 1–4\n// carrier-identity the carrier-relationship principal (Identity §7a)\n// carrier the carrier side of the port (Delivery §4.4 + §5a)\n// carrier-holder the holder side of the carrier port: proofs, verdicts,\n// recovery (§5a, §9.3)\n// visibility the Trust Layer's wire forms, pure: anchor (self-card@2,\n// anchor-rotation@2, anchor-mapping@4), star@2,\n// group-star@1, continuity-probe@1 and\n// continuity-mapping@1, delivery-ack/0.1\n// ceremony the encounter's, the group's and the introduction's\n// wire forms, pure (the same as the root's encounter,\n// membership and introduction modules, under one name)\n//\n// The holder (holder-api.ts): the typed human acts (trust, untrust,\n// pauseTrust, setClass, setGroupClass, merge, depart, decide, rotateAnchor,\n// setProfile, addDevice, revokeDevice, show, scan, captureSentCard,\n// counter, foundGroup, invite, vouchFor, introduce, sendMessage, block,\n// unblock; {when, actId}), recover, takeMessages, act, receive, tick,\n// resume, report, subscribe, snapshot, deviceKey and the views contacts,\n// contact, groups, profile, prompts, inbox, deliveryStatus;\n// `invariants: true` checks invariants.ts on every commit (testing mode).\n// Its modules: identity (Identity §2, §5.4, §5.5), trust (Trust 2, 2a,\n// 5.2–5.4, 6.1–6.5, 6a, 6b), encounter (Encounter 0.31 §5–§7), membership\n// (Membership 0.20 with an in-library Access), introduction (Trust §8) and\n// message (Message Tasks 0.1: messages, the inbox, the block).\n//\n// views the view types (ContactView, …)\n// keys-seed seedKeys — the default KeyProvider over a root seed\n// state HolderState — opaque here (note §4.5): store adapters\n// persist it, apps read the views\n// codec decodeState (to the opaque state), CODEC, StateCodecError\n// ports Store, KeyProvider, Log, Access, DeliveryReport, Outbound\n// results, events ActResult, ReceiveResult, InfraError, HolderEvent\n// entropy the Entropy port by closed purpose\n// store-contract storeContract — the test suite a Store adapter passes\n//\n// Other entry points:\n// ./testing InMemoryStore, memoryLog, scriptedEntropy, storeContract,\n// emptyState, stateBuilder, freezeDeep, sampleState,\n// openPromptModule, the invariants, forgeMapping, SCHEMAS\n// and the generated wire types\n// ./internal the structural state, encodeState and the codec chain,\n// the engine's module types, the pure view functions, the\n// modules' factories and pure reads — for the library's\n// modules and tests, not an app contract\n// ./adapters/vti-mediator the VTI mediator's reports as DeliveryReport\n//\n// Specification, schemas and vectors: https://trust-protocol.real-life.org\n\nexport * from './core.js'\nexport * from './crypto.js'\nexport * from './identity.js'\nexport * from './encounter.js'\nexport * from './membership.js'\nexport * from './message.js'\nexport * from './introduction.js'\nexport * from './delivery.js'\nexport * from './carrier-identity.js'\nexport * from './carrier.js'\nexport * from './carrier-holder.js'\nexport {\n PROFILE_TYPE, PROFILE_LIMITS, profileSchemaOk, imageDimensions, imageWithinBounds, profileProblem, profileInfo, profileKey,\n assembleProfile, profileMacOk,\n} from './profile.js'\nexport type { ProfileContent, ProfileBody, ProfileArtifact, Dimensions, ImageDimensions } from './profile.js'\nexport * as visibility from './visibility.js'\nexport * as ceremony from './ceremony.js'\nimport { decodeState as decodeStructural } from './codec.js'\nimport type { OpaqueHolderState } from './state.js'\nexport type { OpaqueHolderState as HolderState, Dec, Millis, B64u, TrustClass, Setting, PromptKind, PromptChoice, OutboxStatus } from './state.js'\nexport { CODEC, StateCodecError } from './codec.js'\nexport type { StateCodecErrorCode } from './codec.js'\n/** Load a stored state (a JSON string or a parsed value): an independent,\n * opaque copy at the current codec, or StateCodecError. */\nexport function decodeState (raw: unknown): OpaqueHolderState {\n return decodeStructural(raw) as unknown as OpaqueHolderState\n}\nexport type * from './ports.js'\nexport type * from './events.js'\nexport { InfraError, CryptoUnavailableError } from './results.js'\nexport type { ActError, ActResult, ReceiveFailure, ReceiveStageNo, ReceiveResult, ResumeResult, InfraErrorCode } from './results.js'\nexport { ENTROPY_PURPOSES, EntropyError, randomEntropy } from './entropy.js'\nexport type { Entropy, EntropyPurpose, EntropyErrorCode, PlatformRandom } from './entropy.js'\nexport { storeContract } from './store-contract.js'\nexport { seedKeys } from './keys-seed.js'\nexport { createHolder } from './holder-api.js'\nexport type { Holder, HolderOptions, HolderSnapshot, HumanActOptions } from './holder-api.js'\nexport type { DeviceKeyResult } from './identity-state.js'\nexport type { ContactView, RelationshipView, ClassView, SealedClassView, ClassesView, ContactProfileView, GroupView, ProfileView, PromptView, InboxMessageView, DeliveryItemView, DeliveryStatusView } from './views.js'\nexport type { EnginePorts, CommitListener, CryptoHandle, TransportEntry, TransportView, TransportRefusal } from './engine.js'\nexport type { ContractHarness } from './store-contract.js'\n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AA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,OAAO,EACL,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAC1H,eAAe,EAAE,YAAY,GAC9B,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAG5D,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEnD;4DAC4D;AAC5D,MAAM,UAAU,WAAW,CAAE,GAAY;IACvC,OAAO,gBAAgB,CAAC,GAAG,CAAiC,CAAA;AAC9D,CAAC;AAGD,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAEjE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA","sourcesContent":["// @real-life/trust-protocol — the reference library of RLTP.\n//\n// The holder: createHolder({store, keys, entropy?, log?, access?, retry?,\n// crypto?}) — one person's device state behind the human acts, receive,\n// report, resume and tick, and the views an app reads. The ports (Store,\n// KeyProvider, Entropy, Log, Access, DeliveryReport, Outbound) are the\n// app's; seedKeys is the default KeyProvider. Beside it, the pure wire\n// builders and verifiers of every layer, byte-compatible with the shipped\n// vectors.\n//\n// core the form every artifact obeys (JCS, digests, schemas)\n// crypto the primitives, and the Data Integrity proof\n// identity context derivation under the closed registry (§6.1/§6.2),\n// device labels device/<n>/<c> (§5.5)\n// profile profile@1 (Trust §6b): k_pr, the MAC, the bounds and\n// the picture's header read before any decoding\n// encounter the ceremony's wire forms: challenges, cards, credentials,\n// and its pure checks (5.6 acceptance, the bundle's forms)\n// membership Membership 0.20's forms and checks: the prelude,\n// invite, accept, evidence, vouch@2, the member label, oids\n// message Message Tasks 0.1's forms: message@1, k_msg, the MAC\n// introduction Trust §8's artifacts and checks, the act window, the\n// registry declaration's ack-delay\n// delivery the sealed envelope and the generic receive stages 1–4\n// carrier-identity the carrier-relationship principal (Identity §7a)\n// carrier the carrier side of the port (Delivery §4.4 + §5a)\n// carrier-holder the holder side of the carrier port: proofs, verdicts,\n// recovery (§5a, §9.3)\n// visibility the Trust Layer's wire forms, pure: anchor (self-card@2,\n// anchor-rotation@2, anchor-mapping@4), star@2,\n// group-star@1, continuity-probe@1 and\n// continuity-mapping@1, delivery-ack/0.1\n// ceremony the encounter's, the group's and the introduction's\n// wire forms, pure (the same as the root's encounter,\n// membership and introduction modules, under one name)\n//\n// The holder (holder-api.ts): the typed human acts (trust, untrust,\n// pauseTrust, setClass, setGroupClass, merge, depart, decide, rotateAnchor,\n// setProfile, addDevice, revokeDevice, show, scan, captureSentCard,\n// counter, foundGroup, invite, vouchFor, introduce, sendMessage, block,\n// unblock; {when, actId}), recover, takeMessages, act, receive, tick,\n// resume, report, subscribe, snapshot, deviceKey and the views contacts,\n// contact, groups, profile, prompts, inbox, deliveryStatus;\n// `invariants: true` checks invariants.ts on every commit (testing mode).\n// Its modules: identity (Identity §2, §5.4, §5.5), trust (Trust 2, 2a,\n// 5.2–5.4, 6.1–6.5, 6a, 6b), encounter (Encounter 0.31 §5–§7), membership\n// (Membership 0.20 with an in-library Access), introduction (Trust §8) and\n// message (Message Tasks 0.1: messages, the inbox, the block).\n//\n// views the view types (ContactView, …)\n// keys-seed seedKeys — the default KeyProvider over a root seed\n// state HolderState — opaque here (note §4.5): store adapters\n// persist it, apps read the views\n// codec decodeState (to the opaque state), CODEC, StateCodecError\n// ports Store, KeyProvider, Log, Access, DeliveryReport, Outbound\n// results, events ActResult, ReceiveResult, InfraError, HolderEvent\n// entropy the Entropy port by closed purpose\n// store-contract storeContract — the test suite a Store adapter passes\n//\n// Other entry points:\n// ./testing InMemoryStore, memoryLog, scriptedEntropy, storeContract,\n// emptyState, stateBuilder, freezeDeep, sampleState,\n// openPromptModule, the invariants, forgeMapping, SCHEMAS\n// and the generated wire types\n// ./internal the structural state, encodeState and the codec chain,\n// the engine's module types, the pure view functions, the\n// modules' factories and pure reads — for the library's\n// modules and tests, not an app contract\n// ./adapters/vti-mediator the VTI mediator's reports as DeliveryReport\n//\n// Specification, schemas and vectors: https://trust-protocol.real-life.org\n\nexport * from './core.js'\nexport * from './crypto.js'\nexport * from './identity.js'\nexport * from './encounter.js'\nexport * from './membership.js'\nexport * from './message.js'\nexport * from './introduction.js'\nexport * from './delivery.js'\nexport * from './carrier-identity.js'\nexport * from './carrier.js'\nexport * from './carrier-holder.js'\nexport {\n PROFILE_TYPE, PROFILE_LIMITS, profileSchemaOk, imageDimensions, imageWithinBounds, profileProblem, profileInfo, profileKey,\n assembleProfile, profileMacOk,\n} from './profile.js'\nexport type { ProfileContent, ProfileBody, ProfileArtifact, Dimensions, ImageDimensions } from './profile.js'\nexport * as visibility from './visibility.js'\nexport * as ceremony from './ceremony.js'\nimport { decodeState as decodeStructural } from './codec.js'\nimport type { OpaqueHolderState } from './state.js'\nexport type { OpaqueHolderState as HolderState, Dec, Millis, B64u, TrustClass, Setting, PromptKind, PromptChoice, OutboxStatus } from './state.js'\nexport { CODEC, StateCodecError } from './codec.js'\nexport type { StateCodecErrorCode } from './codec.js'\n/** Load a stored state (a JSON string or a parsed value): an independent,\n * opaque copy at the current codec, or StateCodecError. */\nexport function decodeState (raw: unknown): OpaqueHolderState {\n return decodeStructural(raw) as unknown as OpaqueHolderState\n}\nexport type * from './ports.js'\nexport type * from './events.js'\nexport { InfraError, CryptoUnavailableError } from './results.js'\nexport type { ActError, ActResult, ActReplay, ReceiveFailure, ReceiveStageNo, ReceiveResult, ReplayOutbound, ReplayResult, ResumeResult, InfraErrorCode } from './results.js'\nexport { ENTROPY_PURPOSES, EntropyError, randomEntropy } from './entropy.js'\nexport type { Entropy, EntropyPurpose, EntropyErrorCode, PlatformRandom } from './entropy.js'\nexport { storeContract } from './store-contract.js'\nexport { seedKeys } from './keys-seed.js'\nexport { createHolder } from './holder-api.js'\nexport type { Holder, HolderOptions, HolderSnapshot, HumanActOptions } from './holder-api.js'\nexport type { DeviceKeyResult } from './identity-state.js'\nexport type { ContactView, RelationshipView, ClassView, SealedClassView, ClassesView, ContactProfileView, GroupView, ProfileView, PromptView, InboxMessageView, DeliveryItemView, DeliveryStatusView } from './views.js'\nexport type { EnginePorts, CommitListener, CryptoHandle, TransportEntry, TransportView, TransportRefusal } from './engine.js'\nexport type { ContractHarness } from './store-contract.js'\n"]}
package/dist/results.d.ts CHANGED
@@ -82,8 +82,10 @@ export type ActError = 'unknown-contact' | 'no-own-channel' | 'tuple-deactivated
82
82
  * lowercase UUID v4 (Message Tasks 3.2) */
83
83
  | 'message-invalid';
84
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) */
85
+ /** nextDueAt: duty work this act opened or unblocked, or the first retry
86
+ * or send deadline of a document it issued (a repeat: of its live
87
+ * documents), is due then (`when`: now) — call resume at that time
88
+ * (engine.ts) */
87
89
  {
88
90
  ok: true;
89
91
  outbound: Outbound[];
@@ -94,6 +96,39 @@ export type ActResult =
94
96
  code: ActError;
95
97
  ref?: string;
96
98
  };
99
+ /** One document of a journaled act, as replay(actId, when) sees it:
100
+ * `live` is whether a repeat of the act at `when` would hand it out again
101
+ * (neither delivered nor failed, and not past its sender lifetime or the
102
+ * horizon at max(when, lastWhen)); deliveryStatus(digest) has the rest. */
103
+ export interface ReplayOutbound {
104
+ readonly digest: string;
105
+ readonly live: boolean;
106
+ }
107
+ /** The journaled result of one human act (note §4.2): what the act's
108
+ * commit answered. For sendMessage, the `message.sent` event carries
109
+ * `mid` and `digest`; `at` is the commit time the message's `sentAt` was
110
+ * taken from (whole seconds below it). */
111
+ export interface ActReplay {
112
+ readonly actId: string;
113
+ /** the act's commit */
114
+ readonly commitSeq: string;
115
+ /** the holder time of the act's commit (max(when, lastWhen) then) */
116
+ readonly at: number;
117
+ /** the act's events as the commit announced them */
118
+ readonly events: readonly HolderEvent[];
119
+ /** the act's documents, in the act's order */
120
+ readonly outbound: readonly ReplayOutbound[];
121
+ }
122
+ /** replay(actId, when): the journaled result, or `unknown-act` when the
123
+ * journal holds no act under the id — never committed, or past the
124
+ * journal's retention. A pure read: nothing runs, nothing commits. */
125
+ export type ReplayResult = {
126
+ readonly ok: true;
127
+ readonly result: ActReplay;
128
+ } | {
129
+ readonly ok: false;
130
+ readonly code: 'unknown-act' | 'actid-missing';
131
+ };
97
132
  /** Receiver failure dispositions (Delivery §6.2), by the stage that names them. */
98
133
  export type ReceiveFailure = 'oversize' | 'malformed' | 'decryption-failed' | 'wrong-recipient' | 'unknown-type' | 'validation-failed' | 'stale-issuance'
99
134
  /** transient (Delivery RLTP-DEL-5820, 6270, 6280): nothing committed, no
@@ -1 +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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,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 /** the holder was closed (a lock, the end of a process): it runs nothing\n * more, and nothing it issued authorizes a hand-over (Delivery\n * RLTP-DEL-6125, 6130) */\n | 'closed'\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"]}
1
+ {"version":3,"file":"results.js","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AA4MA,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, or the first retry\n * or send deadline of a document it issued (a repeat: of its live\n * documents), is due then (`when`: now) — call resume at that time\n * (engine.ts) */\n | { ok: true, outbound: Outbound[], events: HolderEvent[], nextDueAt?: number }\n | { ok: false, code: ActError, ref?: string }\n\n/** One document of a journaled act, as replay(actId, when) sees it:\n * `live` is whether a repeat of the act at `when` would hand it out again\n * (neither delivered nor failed, and not past its sender lifetime or the\n * horizon at max(when, lastWhen)); deliveryStatus(digest) has the rest. */\nexport interface ReplayOutbound { readonly digest: string, readonly live: boolean }\n\n/** The journaled result of one human act (note §4.2): what the act's\n * commit answered. For sendMessage, the `message.sent` event carries\n * `mid` and `digest`; `at` is the commit time the message's `sentAt` was\n * taken from (whole seconds below it). */\nexport interface ActReplay {\n readonly actId: string\n /** the act's commit */\n readonly commitSeq: string\n /** the holder time of the act's commit (max(when, lastWhen) then) */\n readonly at: number\n /** the act's events as the commit announced them */\n readonly events: readonly HolderEvent[]\n /** the act's documents, in the act's order */\n readonly outbound: readonly ReplayOutbound[]\n}\n\n/** replay(actId, when): the journaled result, or `unknown-act` when the\n * journal holds no act under the id — never committed, or past the\n * journal's retention. A pure read: nothing runs, nothing commits. */\nexport type ReplayResult =\n | { readonly ok: true, readonly result: ActReplay }\n | { readonly ok: false, readonly code: 'unknown-act' | 'actid-missing' }\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 /** the holder was closed (a lock, the end of a process): it runs nothing\n * more, and nothing it issued authorizes a hand-over (Delivery\n * RLTP-DEL-6125, 6130) */\n | 'closed'\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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-life/trust-protocol",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "The Real Life Trust Protocol (RLTP) \u2014 the executable form of the specification: encounters, introductions, trust disclosure, groups, continuity, and the delivery channel. Zero dependencies, WebCrypto only.",
5
5
  "license": "CC-BY-4.0",
6
6
  "type": "module",
@@ -84,7 +84,7 @@
84
84
  },
85
85
  "scripts": {
86
86
  "build": "tsc -p tsconfig.json",
87
- "test": "node --test test/vectors.test.mjs test/vectors2.test.mjs test/vectors3.test.mjs test/vectors4.test.mjs test/carrier.test.mjs test/loopback.test.mjs test/adapter-vti-mediator.test.mjs test/anchor.test.mjs test/codec.test.mjs test/codec-fixture.test.mjs test/holder-state-schema.test.mjs test/entropy.test.mjs test/entropy-lint.test.mjs test/store.test.mjs test/keys-seed.test.mjs test/engine.test.mjs test/views.test.mjs test/prompts.test.mjs test/receive.test.mjs test/duties.test.mjs test/retention.test.mjs test/crypto-lazy.test.mjs test/trust-mapping.test.mjs test/trust-admission.test.mjs test/trust-classes.test.mjs test/trust-star.test.mjs test/trust-group-star.test.mjs test/trust-continuity.test.mjs test/trust-entries.test.mjs test/trust-ported.test.mjs test/trust-duties.test.mjs test/invariants.test.mjs test/invariants-generator.test.mjs test/invariants-coverage.test.mjs test/identity.test.mjs test/profile.test.mjs test/sha256.test.mjs test/encounter-holder.test.mjs test/encounter-ported.test.mjs test/membership-holder.test.mjs test/introduction-holder.test.mjs test/block-holder.test.mjs test/message-vectors.test.mjs test/message-holder.test.mjs test/message-interleavings.test.mjs test/transport-custody.test.mjs test/transport-interleavings.test.mjs",
87
+ "test": "node --test test/vectors.test.mjs test/vectors2.test.mjs test/vectors3.test.mjs test/vectors4.test.mjs test/carrier.test.mjs test/loopback.test.mjs test/adapter-vti-mediator.test.mjs test/anchor.test.mjs test/codec.test.mjs test/codec-fixture.test.mjs test/holder-state-schema.test.mjs test/entropy.test.mjs test/entropy-lint.test.mjs test/store.test.mjs test/keys-seed.test.mjs test/engine.test.mjs test/views.test.mjs test/prompts.test.mjs test/receive.test.mjs test/duties.test.mjs test/retention.test.mjs test/crypto-lazy.test.mjs test/trust-mapping.test.mjs test/trust-admission.test.mjs test/trust-classes.test.mjs test/trust-star.test.mjs test/trust-group-star.test.mjs test/trust-continuity.test.mjs test/trust-entries.test.mjs test/trust-ported.test.mjs test/trust-duties.test.mjs test/invariants.test.mjs test/invariants-generator.test.mjs test/invariants-coverage.test.mjs test/identity.test.mjs test/profile.test.mjs test/sha256.test.mjs test/encounter-holder.test.mjs test/encounter-ported.test.mjs test/membership-holder.test.mjs test/introduction-holder.test.mjs test/block-holder.test.mjs test/message-vectors.test.mjs test/message-holder.test.mjs test/message-interleavings.test.mjs test/transport-custody.test.mjs test/transport-interleavings.test.mjs test/act-replay.test.mjs",
88
88
  "prepack": "npm run build && npm test"
89
89
  },
90
90
  "keywords": [