@real-life/trust-protocol 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +187 -78
- package/dist/ack.d.ts +84 -0
- package/dist/ack.d.ts.map +1 -0
- package/dist/ack.js +114 -0
- package/dist/ack.js.map +1 -0
- package/dist/adapters/vti-mediator.d.ts +154 -0
- package/dist/adapters/vti-mediator.d.ts.map +1 -0
- package/dist/adapters/vti-mediator.js +621 -0
- package/dist/adapters/vti-mediator.js.map +1 -0
- package/dist/anchor.d.ts +226 -0
- package/dist/anchor.d.ts.map +1 -0
- package/dist/anchor.js +347 -0
- package/dist/anchor.js.map +1 -0
- package/dist/{holder.d.ts → carrier-holder.d.ts} +1 -1
- package/dist/carrier-holder.d.ts.map +1 -0
- package/dist/{holder.js → carrier-holder.js} +5 -4
- package/dist/carrier-holder.js.map +1 -0
- package/dist/carrier-identity.js +4 -4
- package/dist/carrier-identity.js.map +1 -1
- package/dist/carrier.d.ts.map +1 -1
- package/dist/carrier.js +4 -3
- package/dist/carrier.js.map +1 -1
- package/dist/ceremony.d.ts +3 -2
- package/dist/ceremony.d.ts.map +1 -1
- package/dist/ceremony.js +16 -26
- package/dist/ceremony.js.map +1 -1
- package/dist/codec.d.ts +46 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +410 -0
- package/dist/codec.js.map +1 -0
- package/dist/continuity.d.ts +67 -0
- package/dist/continuity.d.ts.map +1 -0
- package/dist/continuity.js +110 -0
- package/dist/continuity.js.map +1 -0
- package/dist/core.d.ts +4 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/crypto.d.ts +23 -7
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +54 -20
- package/dist/crypto.js.map +1 -1
- package/dist/delivery.d.ts +31 -3
- package/dist/delivery.d.ts.map +1 -1
- package/dist/delivery.js +75 -28
- package/dist/delivery.js.map +1 -1
- package/dist/encounter/ceremony.d.ts +37 -0
- package/dist/encounter/ceremony.d.ts.map +1 -0
- package/dist/encounter/ceremony.js +662 -0
- package/dist/encounter/ceremony.js.map +1 -0
- package/dist/encounter.d.ts +91 -1
- package/dist/encounter.d.ts.map +1 -1
- package/dist/encounter.js +191 -12
- package/dist/encounter.js.map +1 -1
- package/dist/engine.d.ts +291 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +1395 -0
- package/dist/engine.js.map +1 -0
- package/dist/entropy.d.ts +28 -0
- package/dist/entropy.d.ts.map +1 -0
- package/dist/entropy.js +96 -0
- package/dist/entropy.js.map +1 -0
- package/dist/events.d.ts +177 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/fixtures.d.ts +30 -0
- package/dist/fixtures.d.ts.map +1 -0
- package/dist/fixtures.js +155 -0
- package/dist/fixtures.js.map +1 -0
- package/dist/forge.d.ts +47 -0
- package/dist/forge.d.ts.map +1 -0
- package/dist/forge.js +20 -0
- package/dist/forge.js.map +1 -0
- package/dist/group-star.d.ts +251 -0
- package/dist/group-star.d.ts.map +1 -0
- package/dist/group-star.js +348 -0
- package/dist/group-star.js.map +1 -0
- package/dist/holder-api.d.ts +137 -0
- package/dist/holder-api.d.ts.map +1 -0
- package/dist/holder-api.js +132 -0
- package/dist/holder-api.js.map +1 -0
- package/dist/holder-state-v1.d.ts +801 -0
- package/dist/holder-state-v1.d.ts.map +1 -0
- package/dist/holder-state-v1.js +2 -0
- package/dist/holder-state-v1.js.map +1 -0
- package/dist/identity-state.d.ts +43 -0
- package/dist/identity-state.d.ts.map +1 -0
- package/dist/identity-state.js +345 -0
- package/dist/identity-state.js.map +1 -0
- package/dist/identity.d.ts +24 -2
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +70 -11
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +77 -29
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +36 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +22 -0
- package/dist/internal.js.map +1 -0
- package/dist/introduction/holder.d.ts +18 -0
- package/dist/introduction/holder.d.ts.map +1 -0
- package/dist/introduction/holder.js +757 -0
- package/dist/introduction/holder.js.map +1 -0
- package/dist/introduction.d.ts +101 -0
- package/dist/introduction.d.ts.map +1 -0
- package/dist/introduction.js +132 -0
- package/dist/introduction.js.map +1 -0
- package/dist/invariants.d.ts +43 -0
- package/dist/invariants.d.ts.map +1 -0
- package/dist/invariants.js +883 -0
- package/dist/invariants.js.map +1 -0
- package/dist/keys-seed.d.ts +7 -0
- package/dist/keys-seed.d.ts.map +1 -0
- package/dist/keys-seed.js +133 -0
- package/dist/keys-seed.js.map +1 -0
- package/dist/log-memory.d.ts +12 -0
- package/dist/log-memory.d.ts.map +1 -0
- package/dist/log-memory.js +101 -0
- package/dist/log-memory.js.map +1 -0
- package/dist/membership/holder.d.ts +35 -0
- package/dist/membership/holder.d.ts.map +1 -0
- package/dist/membership/holder.js +852 -0
- package/dist/membership/holder.js.map +1 -0
- package/dist/membership.d.ts +92 -0
- package/dist/membership.d.ts.map +1 -0
- package/dist/membership.js +157 -0
- package/dist/membership.js.map +1 -0
- package/dist/ports.d.ts +237 -0
- package/dist/ports.d.ts.map +1 -0
- package/dist/ports.js +2 -0
- package/dist/ports.js.map +1 -0
- package/dist/profile.d.ts +56 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +193 -0
- package/dist/profile.js.map +1 -0
- package/dist/prompts.d.ts +14 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +69 -0
- package/dist/prompts.js.map +1 -0
- package/dist/receive.d.ts +133 -0
- package/dist/receive.d.ts.map +1 -0
- package/dist/receive.js +298 -0
- package/dist/receive.js.map +1 -0
- package/dist/results.d.ts +158 -0
- package/dist/results.d.ts.map +1 -0
- package/dist/results.js +21 -0
- package/dist/results.js.map +1 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +42 -38
- package/dist/schemas.js.map +1 -1
- package/dist/sha256.d.ts +3 -0
- package/dist/sha256.d.ts.map +1 -0
- package/dist/sha256.js +69 -0
- package/dist/sha256.js.map +1 -0
- package/dist/star.d.ts +31 -0
- package/dist/star.d.ts.map +1 -0
- package/dist/star.js +56 -0
- package/dist/star.js.map +1 -0
- package/dist/state-builder.d.ts +42 -0
- package/dist/state-builder.d.ts.map +1 -0
- package/dist/state-builder.js +100 -0
- package/dist/state-builder.js.map +1 -0
- package/dist/state.d.ts +853 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +36 -0
- package/dist/state.js.map +1 -0
- package/dist/store-contract.d.ts +11 -0
- package/dist/store-contract.d.ts.map +1 -0
- package/dist/store-contract.js +189 -0
- package/dist/store-contract.js.map +1 -0
- package/dist/store-memory.d.ts +8 -0
- package/dist/store-memory.d.ts.map +1 -0
- package/dist/store-memory.js +17 -0
- package/dist/store-memory.js.map +1 -0
- package/dist/testing.d.ts +22 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +21 -0
- package/dist/testing.js.map +1 -0
- package/dist/trust/continuity.d.ts +71 -0
- package/dist/trust/continuity.d.ts.map +1 -0
- package/dist/trust/continuity.js +1216 -0
- package/dist/trust/continuity.js.map +1 -0
- package/dist/trust/duties.d.ts +67 -0
- package/dist/trust/duties.d.ts.map +1 -0
- package/dist/trust/duties.js +179 -0
- package/dist/trust/duties.js.map +1 -0
- package/dist/trust/entries.d.ts +139 -0
- package/dist/trust/entries.d.ts.map +1 -0
- package/dist/trust/entries.js +694 -0
- package/dist/trust/entries.js.map +1 -0
- package/dist/trust/group-star.d.ts +43 -0
- package/dist/trust/group-star.d.ts.map +1 -0
- package/dist/trust/group-star.js +188 -0
- package/dist/trust/group-star.js.map +1 -0
- package/dist/trust/mapping.d.ts +56 -0
- package/dist/trust/mapping.d.ts.map +1 -0
- package/dist/trust/mapping.js +584 -0
- package/dist/trust/mapping.js.map +1 -0
- package/dist/trust/profile.d.ts +25 -0
- package/dist/trust/profile.d.ts.map +1 -0
- package/dist/trust/profile.js +249 -0
- package/dist/trust/profile.js.map +1 -0
- package/dist/trust/star.d.ts +208 -0
- package/dist/trust/star.d.ts.map +1 -0
- package/dist/trust/star.js +588 -0
- package/dist/trust/star.js.map +1 -0
- package/dist/trust/state.d.ts +83 -0
- package/dist/trust/state.d.ts.map +1 -0
- package/dist/trust/state.js +154 -0
- package/dist/trust/state.js.map +1 -0
- package/dist/util-freeze.d.ts +3 -0
- package/dist/util-freeze.d.ts.map +1 -0
- package/dist/util-freeze.js +11 -0
- package/dist/util-freeze.js.map +1 -0
- package/dist/views.d.ts +147 -0
- package/dist/views.d.ts.map +1 -0
- package/dist/views.js +268 -0
- package/dist/views.js.map +1 -0
- package/dist/visibility.d.ts +5 -5
- package/dist/visibility.d.ts.map +1 -1
- package/dist/visibility.js +22 -28
- package/dist/visibility.js.map +1 -1
- package/dist/wire.d.ts +178 -84
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js.map +1 -1
- package/package.json +58 -11
- package/schemas/holder-state-v1.schema.json +3880 -0
- package/dist/holder.d.ts.map +0 -1
- package/dist/holder.js.map +0 -1
- package/dist/probe/acks.d.ts +0 -27
- package/dist/probe/acks.d.ts.map +0 -1
- package/dist/probe/acks.js +0 -152
- package/dist/probe/acks.js.map +0 -1
- package/dist/probe/continuity.d.ts +0 -20
- package/dist/probe/continuity.d.ts.map +0 -1
- package/dist/probe/continuity.js +0 -805
- package/dist/probe/continuity.js.map +0 -1
- package/dist/probe/deps.d.ts +0 -61
- package/dist/probe/deps.d.ts.map +0 -1
- package/dist/probe/deps.js +0 -54
- package/dist/probe/deps.js.map +0 -1
- package/dist/probe/encounter.d.ts +0 -26
- package/dist/probe/encounter.d.ts.map +0 -1
- package/dist/probe/encounter.js +0 -938
- package/dist/probe/encounter.js.map +0 -1
- package/dist/probe/introduce.d.ts +0 -70
- package/dist/probe/introduce.d.ts.map +0 -1
- package/dist/probe/introduce.js +0 -295
- package/dist/probe/introduce.js.map +0 -1
- package/dist/probe/membership.d.ts +0 -90
- package/dist/probe/membership.d.ts.map +0 -1
- package/dist/probe/membership.js +0 -450
- package/dist/probe/membership.js.map +0 -1
- package/dist/probe/trust.d.ts +0 -156
- package/dist/probe/trust.d.ts.map +0 -1
- package/dist/probe/trust.js +0 -1233
- package/dist/probe/trust.js.map +0 -1
- package/dist/probe.d.ts +0 -7
- package/dist/probe.d.ts.map +0 -1
- package/dist/probe.js +0 -42
- package/dist/probe.js.map +0 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { HolderEvent } from './events.js';
|
|
2
|
+
import type { Outbound } from './ports.js';
|
|
3
|
+
/** What resume(when) hands out: retries and due duties, in the engine's
|
|
4
|
+
* fixed order, and when to call again (absent: nothing is due). */
|
|
5
|
+
export interface ResumeResult {
|
|
6
|
+
outbound: Outbound[];
|
|
7
|
+
events: HolderEvent[];
|
|
8
|
+
nextDueAt?: number;
|
|
9
|
+
}
|
|
10
|
+
/** Why an act was refused; `ref` on the result may name the rule. */
|
|
11
|
+
export type ActError = 'unknown-contact' | 'no-own-channel' | 'tuple-deactivated' | 'already-given' | 'in-flight' | 'scope-exhausted' | 'stale-issuance' | 'actid-conflict'
|
|
12
|
+
/** a human act came without the actId the app must mint (note §4.2) */
|
|
13
|
+
| 'actid-missing' | 'log-missing'
|
|
14
|
+
/** the anchor mapping needs the holder's community anchor (register.community, Identity §5.4) */
|
|
15
|
+
| 'no-community' | 'unknown-digest'
|
|
16
|
+
/** prompt.decide: no open prompt has this id */
|
|
17
|
+
| 'unknown-prompt'
|
|
18
|
+
/** prompt.decide: the prompt's expiresAt is not after when; tick removes it */
|
|
19
|
+
| 'prompt-expired'
|
|
20
|
+
/** trust.merge: the manual merge joins at most one entry (6640), and
|
|
21
|
+
* never relationships the binding rule keeps apart (6605) */
|
|
22
|
+
| 'not-mergeable'
|
|
23
|
+
/** identity.addDevice: not a device name of 6.2 (Identity §5.5) */
|
|
24
|
+
| 'device-name-invalid'
|
|
25
|
+
/** identity.addDevice: the register already holds the name (Identity §5.5, SHOULD) */
|
|
26
|
+
| 'device-name-held'
|
|
27
|
+
/** identity.addDevice: a revoked name is never given again (Identity §5.5) */
|
|
28
|
+
| 'device-name-revoked'
|
|
29
|
+
/** identity.revokeDevice: the register holds no such device name */
|
|
30
|
+
| 'unknown-device'
|
|
31
|
+
/** identity.rotate: the log replica does not hold the lineage through the
|
|
32
|
+
* current generation (Identity §5.4, Access RLTP-ACC-5980); the rotation
|
|
33
|
+
* stays pending until it does */
|
|
34
|
+
| 'log-behind'
|
|
35
|
+
/** identity.rotate: the log's head is no generation of this register's
|
|
36
|
+
* lineage (another genesis, or a head the register does not follow) */
|
|
37
|
+
| 'log-diverged'
|
|
38
|
+
/** identity.rotate: the log answered failure; the rotation stays pending */
|
|
39
|
+
| 'log-failure'
|
|
40
|
+
/** setProfile: the body breaks 6430/6435 or its image 6475 */
|
|
41
|
+
| 'profile-invalid'
|
|
42
|
+
/** encounter: a card that fails Encounter 6 (schema, version, challenge,
|
|
43
|
+
* keys, proof) or is not of the profile the act needs (displayed for a
|
|
44
|
+
* scan, sent and addressed to an own challenge's anchor for a capture) */
|
|
45
|
+
| 'card-invalid'
|
|
46
|
+
/** encounter.scan: this displayed code was scanned already: its
|
|
47
|
+
* challenge is in a record (5.3, 5170) */
|
|
48
|
+
| 'already-scanned'
|
|
49
|
+
/** encounter.capture: the bound challenge resolves unknown (5460) */
|
|
50
|
+
| 'gate-expired'
|
|
51
|
+
/** encounter: the own challenge is future-dated beyond the skew (5390) */
|
|
52
|
+
| 'gate-future'
|
|
53
|
+
/** encounter.capture: the challenge was consumed by another enactment (5440) */
|
|
54
|
+
| 'consumed-challenge'
|
|
55
|
+
/** encounter.capture: the same counterparty with other material (5450) */
|
|
56
|
+
| 'card-mismatch'
|
|
57
|
+
/** encounter.counter: no enactment record of the contact to issue on */
|
|
58
|
+
| 'no-record'
|
|
59
|
+
/** encounter.counter: the own step credential is issued already */
|
|
60
|
+
| 'already-issued'
|
|
61
|
+
/** membership: no such group, or the holder holds no role in it the act needs */
|
|
62
|
+
| 'unknown-group'
|
|
63
|
+
/** membership.vouch: no consent pair held for this member (Access 5.3) */
|
|
64
|
+
| 'no-evidence'
|
|
65
|
+
/** membership.vouch: the admitting member's own vouch never counts beside its admission */
|
|
66
|
+
| 'own-admission'
|
|
67
|
+
/** membership.found: a genesis admits under the rule of one; a stricter rule needs policy.change */
|
|
68
|
+
| 'threshold-unsupported'
|
|
69
|
+
/** introduction: no such act, or not in a state that allows the step */
|
|
70
|
+
| 'unknown-act'
|
|
71
|
+
/** introduction.request: the mediator's ack-delay declaration is not held (Delivery 4.4) */
|
|
72
|
+
| 'no-declaration';
|
|
73
|
+
export type ActResult =
|
|
74
|
+
/** nextDueAt: duty work this act opened or unblocked is due then (`when`:
|
|
75
|
+
* now) — call resume at that time (engine.ts) */
|
|
76
|
+
{
|
|
77
|
+
ok: true;
|
|
78
|
+
outbound: Outbound[];
|
|
79
|
+
events: HolderEvent[];
|
|
80
|
+
nextDueAt?: number;
|
|
81
|
+
} | {
|
|
82
|
+
ok: false;
|
|
83
|
+
code: ActError;
|
|
84
|
+
ref?: string;
|
|
85
|
+
};
|
|
86
|
+
/** Receiver failure dispositions (Delivery §6.2), by the stage that names them. */
|
|
87
|
+
export type ReceiveFailure = 'oversize' | 'malformed' | 'decryption-failed' | 'wrong-recipient' | 'unknown-type' | 'validation-failed' | 'stale-issuance' | 'gate-future' | 'consumed-challenge';
|
|
88
|
+
export type ReceiveStageNo = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
89
|
+
/**
|
|
90
|
+
* The outcome of receive(env, when). `unique`: the effect committed,
|
|
91
|
+
* with its ack first among `outbound` where the type acknowledges (a
|
|
92
|
+
* delivery-ack itself is terminal and earns none), then the documents
|
|
93
|
+
* the effect issued. `duplicate-known`: the stored ack is re-sent
|
|
94
|
+
* byte-identical (none for a terminal document); nothing commits beyond
|
|
95
|
+
* a raised lastWhen. `failed`: nothing took effect and nothing commits.
|
|
96
|
+
* `discarded`: the document's chunk met a receiver resource limit (Trust
|
|
97
|
+
* 5365, reason `resource-limit`) or, authenticated, violated the assembly
|
|
98
|
+
* rules so that its whole delivery is rejected (5260–5310, 5500, 5510,
|
|
99
|
+
* reason `rejected`): the open assembly is dropped and its salt held as
|
|
100
|
+
* the lower bound (5366), committed; no cache entry, no ack, no event.
|
|
101
|
+
* Delivery §6.2 has no disposition for it yet (receive.ts: a gap for
|
|
102
|
+
* Delivery 0.82).
|
|
103
|
+
*/
|
|
104
|
+
export type ReceiveResult = {
|
|
105
|
+
disposition: 'unique';
|
|
106
|
+
digest: string;
|
|
107
|
+
type: string;
|
|
108
|
+
outbound: Outbound[];
|
|
109
|
+
events: HolderEvent[]; /** as on ActResult */
|
|
110
|
+
nextDueAt?: number;
|
|
111
|
+
} | {
|
|
112
|
+
disposition: 'duplicate-known';
|
|
113
|
+
digest: string;
|
|
114
|
+
outbound: Outbound[];
|
|
115
|
+
} | {
|
|
116
|
+
disposition: 'discarded';
|
|
117
|
+
digest: string;
|
|
118
|
+
type: string;
|
|
119
|
+
reason: 'resource-limit' | 'rejected';
|
|
120
|
+
ref?: string;
|
|
121
|
+
} | {
|
|
122
|
+
disposition: 'failed';
|
|
123
|
+
reason: ReceiveFailure;
|
|
124
|
+
stage: ReceiveStageNo;
|
|
125
|
+
digest?: string;
|
|
126
|
+
/** local diagnosis of a key failure, never a disposition of its own
|
|
127
|
+
* (Delivery §5, §6.2): 'unknown' — an rkid this holder never issued,
|
|
128
|
+
* failed(malformed) at stage 2; 'retired' — a tombstone (or a key
|
|
129
|
+
* marked retired), failed(decryption-failed) at stage 3 */
|
|
130
|
+
key?: 'unknown' | 'retired';
|
|
131
|
+
/** the rule the document failed, where its task handler names one
|
|
132
|
+
* (TaskRefusal.ref), e.g. RLTP-TRU-6118 */
|
|
133
|
+
ref?: string;
|
|
134
|
+
};
|
|
135
|
+
export type InfraErrorCode = 'store-read' | 'store-commit'
|
|
136
|
+
/** the commit may or may not have landed; re-read and consult the act journal */
|
|
137
|
+
| 'unknown-commit-outcome'
|
|
138
|
+
/** the store kept answering `conflict` past the retry bound (RetryPolicy.commitAttempts) */
|
|
139
|
+
| 'commit-conflict' | 'key-provider' | 'log' | 'access'
|
|
140
|
+
/** testing mode only (createHolder's `invariants: true`): a commit would
|
|
141
|
+
* break an invariant of invariants.ts; nothing committed, the
|
|
142
|
+
* violations are the cause */
|
|
143
|
+
| 'invariant-violated';
|
|
144
|
+
/** A failure of a port the host provides, never of the protocol. */
|
|
145
|
+
export declare class InfraError extends Error {
|
|
146
|
+
readonly code: InfraErrorCode;
|
|
147
|
+
constructor(code: InfraErrorCode, message?: string, options?: {
|
|
148
|
+
cause?: unknown;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/** The WebCrypto handle lacks what the library needs; raised when a
|
|
152
|
+
* holder is built, never at import (note §3 Crypto). */
|
|
153
|
+
export declare class CryptoUnavailableError extends Error {
|
|
154
|
+
/** the algorithms (or 'subtle' itself) that are missing, in a fixed order */
|
|
155
|
+
readonly missing: readonly string[];
|
|
156
|
+
constructor(missing: readonly string[]);
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C;oEACoE;AACpE,MAAM,WAAW,YAAY;IAAG,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;AAEjG,qEAAqE;AACrE,MAAM,MA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Ac,GACd,KAAK,GACL,QAAQ;AACV;;+BAE+B;GAC7B,oBAAoB,CAAA;AAExB,oEAAoE;AACpE,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;gBAChB,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAKnF;AAED;yDACyD;AACzD,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;gBACtB,OAAO,EAAE,SAAS,MAAM,EAAE;CAKxC"}
|
package/dist/results.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** A failure of a port the host provides, never of the protocol. */
|
|
2
|
+
export class InfraError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
constructor(code, message, options) {
|
|
5
|
+
super(message ?? code, options);
|
|
6
|
+
this.name = 'InfraError';
|
|
7
|
+
this.code = code;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** The WebCrypto handle lacks what the library needs; raised when a
|
|
11
|
+
* holder is built, never at import (note §3 Crypto). */
|
|
12
|
+
export class CryptoUnavailableError extends Error {
|
|
13
|
+
/** the algorithms (or 'subtle' itself) that are missing, in a fixed order */
|
|
14
|
+
missing;
|
|
15
|
+
constructor(missing) {
|
|
16
|
+
super(`WebCrypto lacks: ${missing.join(', ')} (needs Ed25519, X25519, HKDF, HMAC, AES-GCM, SHA-256)`);
|
|
17
|
+
this.name = 'CryptoUnavailableError';
|
|
18
|
+
this.missing = Object.freeze([...missing]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AA0JA,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\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' // stage 8\n | 'gate-future' // stage 9\n | 'consumed-challenge' // stage 9\n\nexport type ReceiveStageNo = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n/**\n * The outcome of receive(env, when). `unique`: the effect committed,\n * with its ack first among `outbound` where the type acknowledges (a\n * delivery-ack itself is terminal and earns none), then the documents\n * the effect issued. `duplicate-known`: the stored ack is re-sent\n * byte-identical (none for a terminal document); nothing commits beyond\n * a raised lastWhen. `failed`: nothing took effect and nothing commits.\n * `discarded`: the document's chunk met a receiver resource limit (Trust\n * 5365, reason `resource-limit`) or, authenticated, violated the assembly\n * rules so that its whole delivery is rejected (5260–5310, 5500, 5510,\n * reason `rejected`): the open assembly is dropped and its salt held as\n * the lower bound (5366), committed; no cache entry, no ack, no event.\n * Delivery §6.2 has no disposition for it yet (receive.ts: a gap for\n * Delivery 0.82).\n */\nexport type ReceiveResult =\n | { disposition: 'unique', digest: string, type: string, outbound: Outbound[], events: HolderEvent[], /** as on ActResult */ nextDueAt?: number }\n | { disposition: 'duplicate-known', digest: string, outbound: Outbound[] }\n | { disposition: 'discarded', digest: string, type: string, reason: 'resource-limit' | 'rejected', ref?: string }\n | {\n disposition: 'failed', reason: ReceiveFailure, stage: ReceiveStageNo, digest?: string,\n /** local diagnosis of a key failure, never a disposition of its own\n * (Delivery §5, §6.2): 'unknown' — an rkid this holder never issued,\n * failed(malformed) at stage 2; 'retired' — a tombstone (or a key\n * marked retired), failed(decryption-failed) at stage 3 */\n key?: 'unknown' | 'retired'\n /** the rule the document failed, where its task handler names one\n * (TaskRefusal.ref), e.g. RLTP-TRU-6118 */\n ref?: string\n }\n\nexport type InfraErrorCode =\n | 'store-read'\n | 'store-commit'\n /** the commit may or may not have landed; re-read and consult the act journal */\n | 'unknown-commit-outcome'\n /** the store kept answering `conflict` past the retry bound (RetryPolicy.commitAttempts) */\n | 'commit-conflict'\n | 'key-provider'\n | 'log'\n | 'access'\n /** testing mode only (createHolder's `invariants: true`): a commit would\n * break an invariant of invariants.ts; nothing committed, the\n * violations are the cause */\n | 'invariant-violated'\n\n/** A failure of a port the host provides, never of the protocol. */\nexport class InfraError extends Error {\n readonly code: InfraErrorCode\n constructor (code: InfraErrorCode, message?: string, options?: { cause?: unknown }) {\n super(message ?? code, options)\n this.name = 'InfraError'\n this.code = code\n }\n}\n\n/** The WebCrypto handle lacks what the library needs; raised when a\n * holder is built, never at import (note §3 Crypto). */\nexport class CryptoUnavailableError extends Error {\n /** the algorithms (or 'subtle' itself) that are missing, in a fixed order */\n readonly missing: readonly string[]\n constructor (missing: readonly string[]) {\n super(`WebCrypto lacks: ${missing.join(', ')} (needs Ed25519, X25519, HKDF, HMAC, AES-GCM, SHA-256)`)\n this.name = 'CryptoUnavailableError'\n this.missing = Object.freeze([...missing])\n }\n}\n"]}
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CA4C9E,CAAA"}
|