@interop/wallet-core 0.70.0 → 0.72.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/README.md +19 -11
- package/dist/clientAnnex/forget.d.ts.map +1 -1
- package/dist/clientAnnex/forget.js +4 -3
- package/dist/clientAnnex/forget.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +55 -35
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +87 -35
- package/dist/clientAnnex/forgetLast.js.map +1 -1
- package/dist/clientAnnex/gc.d.ts +48 -19
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +82 -31
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/grantRevocation.d.ts +137 -0
- package/dist/clientAnnex/grantRevocation.d.ts.map +1 -0
- package/dist/clientAnnex/grantRevocation.js +135 -0
- package/dist/clientAnnex/grantRevocation.js.map +1 -0
- package/dist/clientAnnex/index.d.ts +4 -2
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +2 -1
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts +0 -22
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +8 -34
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +65 -13
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +160 -67
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clientAnnex/mend.js +51 -24
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clientAnnex/selfEnroll.js +1 -1
- package/dist/clientAnnex/selfEnroll.js.map +1 -1
- package/dist/clientAnnex/zcap.js +1 -1
- package/dist/clientAnnex/zcap.js.map +1 -1
- package/dist/clients/grantState.d.ts +6 -3
- package/dist/clients/grantState.d.ts.map +1 -1
- package/dist/clients/grantState.js +6 -3
- package/dist/clients/grantState.js.map +1 -1
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +3 -0
- package/dist/clients/policy.js.map +1 -1
- package/dist/enrollment/enrollment.js +1 -1
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/keyring/fetch.d.ts +6 -2
- package/dist/keyring/fetch.d.ts.map +1 -1
- package/dist/keyring/fetch.js +7 -3
- package/dist/keyring/fetch.js.map +1 -1
- package/dist/keyring/index.d.ts +8 -6
- package/dist/keyring/index.d.ts.map +1 -1
- package/dist/keyring/index.js +8 -6
- package/dist/keyring/index.js.map +1 -1
- package/dist/keyring/kdf.d.ts +2 -2
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +2 -2
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keyring/unlockSpace.d.ts +45 -68
- package/dist/keyring/unlockSpace.d.ts.map +1 -1
- package/dist/keyring/unlockSpace.js +66 -88
- package/dist/keyring/unlockSpace.js.map +1 -1
- package/dist/keys/userKey.js +1 -1
- package/dist/keys/userKey.js.map +1 -1
- package/dist/menders/derive.d.ts +85 -0
- package/dist/menders/derive.d.ts.map +1 -0
- package/dist/menders/derive.js +138 -0
- package/dist/menders/derive.js.map +1 -0
- package/dist/menders/ids.d.ts +20 -0
- package/dist/menders/ids.d.ts.map +1 -0
- package/dist/menders/ids.js +85 -0
- package/dist/menders/ids.js.map +1 -0
- package/dist/menders/index.d.ts +42 -0
- package/dist/menders/index.d.ts.map +1 -0
- package/dist/menders/index.js +37 -0
- package/dist/menders/index.js.map +1 -0
- package/dist/menders/registry.d.ts +84 -0
- package/dist/menders/registry.d.ts.map +1 -0
- package/dist/menders/registry.js +62 -0
- package/dist/menders/registry.js.map +1 -0
- package/dist/menders/runner.d.ts +143 -0
- package/dist/menders/runner.d.ts.map +1 -0
- package/dist/menders/runner.js +222 -0
- package/dist/menders/runner.js.map +1 -0
- package/dist/menders/types.d.ts +146 -0
- package/dist/menders/types.d.ts.map +1 -0
- package/dist/menders/types.js +2 -0
- package/dist/menders/types.js.map +1 -0
- package/dist/menders/vocabulary.d.ts +88 -0
- package/dist/menders/vocabulary.d.ts.map +1 -0
- package/dist/menders/vocabulary.js +83 -0
- package/dist/menders/vocabulary.js.map +1 -0
- package/dist/recovery/index.d.ts +1 -1
- package/dist/recovery/index.js +1 -1
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +11 -17
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/resourceLog/document.d.ts.map +1 -1
- package/dist/resourceLog/document.js +30 -6
- package/dist/resourceLog/document.js.map +1 -1
- package/dist/space/activity.d.ts +70 -0
- package/dist/space/activity.d.ts.map +1 -1
- package/dist/space/activity.js +82 -0
- package/dist/space/activity.js.map +1 -1
- package/dist/space/deleteSpace.d.ts.map +1 -1
- package/dist/space/deleteSpace.js +6 -5
- package/dist/space/deleteSpace.js.map +1 -1
- package/dist/space/index.d.ts +1 -1
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +1 -1
- package/dist/space/index.js.map +1 -1
- package/dist/testing.d.ts +78 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +89 -0
- package/dist/testing.js.map +1 -0
- package/dist/unlock/index.d.ts +2 -2
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js +1 -1
- package/dist/unlock/retire.d.ts +20 -5
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingClient.d.ts +1 -1
- package/dist/unlock/standingClient.d.ts.map +1 -1
- package/dist/unlock/standingClient.js +3 -3
- package/dist/unlock/standingClient.js.map +1 -1
- package/dist/unlock/standingWebvh.d.ts +22 -2
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +22 -2
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +33 -0
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +50 -11
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/enrollClient.d.ts.map +1 -1
- package/dist/webvh/enrollClient.js +4 -16
- package/dist/webvh/enrollClient.js.map +1 -1
- package/dist/webvh/index.d.ts +14 -4
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +14 -4
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/listClients.d.ts +47 -0
- package/dist/webvh/listClients.d.ts.map +1 -1
- package/dist/webvh/listClients.js +40 -1
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/standingZcap.d.ts +66 -0
- package/dist/webvh/standingZcap.d.ts.map +1 -1
- package/dist/webvh/standingZcap.js +96 -0
- package/dist/webvh/standingZcap.js.map +1 -1
- package/dist/webvh/zcap.d.ts +1 -1
- package/dist/webvh/zcap.js +1 -1
- package/dist/webvh/zcap.js.map +1 -1
- package/package.json +18 -12
- package/dist/identity/agents.d.ts +0 -100
- package/dist/identity/agents.d.ts.map +0 -1
- package/dist/identity/agents.js +0 -120
- package/dist/identity/agents.js.map +0 -1
- package/dist/identity/index.d.ts +0 -24
- package/dist/identity/index.d.ts.map +0 -1
- package/dist/identity/index.js +0 -23
- package/dist/identity/index.js.map +0 -1
- package/dist/identity/keyResolver.d.ts +0 -30
- package/dist/identity/keyResolver.d.ts.map +0 -1
- package/dist/identity/keyResolver.js +0 -25
- package/dist/identity/keyResolver.js.map +0 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The derived sets a wallet's audit tests assert: the invariants a transient
|
|
6
|
+
* visit reaches, the gaps the registration index implies, and census
|
|
7
|
+
* completeness. Each is computed from the table and the sites alone, so a
|
|
8
|
+
* converger that quietly loses a trigger a transient visit fires, or an
|
|
9
|
+
* invariant no registration reports any more, moves a derived set and fails
|
|
10
|
+
* the wallet's pin.
|
|
11
|
+
*/
|
|
12
|
+
import { INVARIANT_IDS } from './ids.js';
|
|
13
|
+
import { heldAuthorities } from './registry.js';
|
|
14
|
+
/**
|
|
15
|
+
* The ids some site reports, whatever its trigger.
|
|
16
|
+
*/
|
|
17
|
+
function reportedIds(registry) {
|
|
18
|
+
return new Set(registry.sites().flatMap(site => site.reports));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The invariants a transient visit on a standing credential reaches. The
|
|
22
|
+
* two chain triggers are read through `dueAt` over the ladder held set; a
|
|
23
|
+
* `login-routing` site counts unless the client-key-record probe guards it;
|
|
24
|
+
* a `ceremony-tail` entry counts, every such ceremony running on any
|
|
25
|
+
* session type; and a detector no site reports (a declaration carrying
|
|
26
|
+
* `holdsWhen`) counts when it is checked at a trigger a transient visit
|
|
27
|
+
* fires and, on the chain, under an authority the ladder held set carries.
|
|
28
|
+
* An unreported declaration with no detector is reached by nothing.
|
|
29
|
+
*
|
|
30
|
+
* @param options {object}
|
|
31
|
+
* @param options.registry {MenderRegistry}
|
|
32
|
+
* @returns {ReadonlyArray<InvariantId>} in table order
|
|
33
|
+
*/
|
|
34
|
+
export function transientReachableInvariants({ registry }) {
|
|
35
|
+
const reached = new Set();
|
|
36
|
+
const held = heldAuthorities({ kind: 'ladder' });
|
|
37
|
+
for (const site of registry.dueAt({
|
|
38
|
+
held,
|
|
39
|
+
trigger: 'transient-login-chain'
|
|
40
|
+
})) {
|
|
41
|
+
for (const id of site.reports) {
|
|
42
|
+
reached.add(id);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
for (const site of registry.sites()) {
|
|
46
|
+
if (site.trigger === 'login-routing' && !site.guardedBy) {
|
|
47
|
+
for (const id of site.reports) {
|
|
48
|
+
reached.add(id);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const reported = reportedIds(registry);
|
|
53
|
+
for (const decl of registry.all()) {
|
|
54
|
+
if (decl.triggers.includes('ceremony-tail')) {
|
|
55
|
+
reached.add(decl.id);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (reported.has(decl.id) || !decl.holdsWhen) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const checkedOnVisit = decl.triggers.includes('login-routing') ||
|
|
62
|
+
(decl.triggers.includes('transient-login-chain') &&
|
|
63
|
+
held.includes(decl.authority));
|
|
64
|
+
if (checkedOnVisit) {
|
|
65
|
+
reached.add(decl.id);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return registry
|
|
69
|
+
.all()
|
|
70
|
+
.filter(decl => reached.has(decl.id))
|
|
71
|
+
.map(decl => decl.id);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The gaps the index implies. An invariant no site reports derives `none`,
|
|
75
|
+
* unless it is checked at ceremony tails alone (converged by the ceremony's
|
|
76
|
+
* own sequenced code, which is never registered). A detector is not a
|
|
77
|
+
* mender: a declaration carrying `holdsWhen` and no registration derives
|
|
78
|
+
* `none` like any other unreported one, so adding a detector never retires
|
|
79
|
+
* a gap. A declaration naming a chain or routing trigger no site backs
|
|
80
|
+
* derives `none` whatever else it names. An invariant reported only at sites
|
|
81
|
+
* a transient visit cannot reach, on an account shape the violation can
|
|
82
|
+
* stand on, derives `unreachable`. Nothing else derives a gap.
|
|
83
|
+
*
|
|
84
|
+
* @param options {object}
|
|
85
|
+
* @param options.registry {MenderRegistry}
|
|
86
|
+
* @returns {ReadonlyArray<DerivedGap>}
|
|
87
|
+
*/
|
|
88
|
+
export function deriveGaps({ registry }) {
|
|
89
|
+
const reported = reportedIds(registry);
|
|
90
|
+
const reachable = new Set(transientReachableInvariants({ registry }));
|
|
91
|
+
const gaps = [];
|
|
92
|
+
for (const decl of registry.all()) {
|
|
93
|
+
if (!reported.has(decl.id)) {
|
|
94
|
+
const tailOnly = decl.triggers.length > 0 &&
|
|
95
|
+
decl.triggers.every(trigger => trigger === 'ceremony-tail');
|
|
96
|
+
if (!tailOnly) {
|
|
97
|
+
gaps.push({ invariant: decl.id, kind: 'none' });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else if (!reachable.has(decl.id) &&
|
|
101
|
+
decl.standsOn.includes('client-less')) {
|
|
102
|
+
gaps.push({ invariant: decl.id, kind: 'unreachable' });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return gaps;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Compares the derived gaps with a wallet's declared allowlist. The
|
|
109
|
+
* derivation admits gaps and retires none: a declared row the derivation no
|
|
110
|
+
* longer produces passes, and a derived gap with no declaration fails. A
|
|
111
|
+
* derived `none` needs a declared `none` row for its invariant; a derived
|
|
112
|
+
* `unreachable` needs any declared row for it, since a declared `none` may
|
|
113
|
+
* be scoped to a different torn state of the same predicate.
|
|
114
|
+
*
|
|
115
|
+
* @param options {object}
|
|
116
|
+
* @param options.derived {ReadonlyArray<DerivedGap>}
|
|
117
|
+
* @param options.declared {ReadonlyArray<InvariantGap>}
|
|
118
|
+
* @returns {ReadonlyArray<DerivedGap>} the
|
|
119
|
+
* derived gaps no declaration covers; empty when the allowlist is complete
|
|
120
|
+
*/
|
|
121
|
+
export function undeclaredGaps({ derived, declared }) {
|
|
122
|
+
return derived.filter(({ invariant, kind }) => !declared.some(gap => gap.invariant === invariant &&
|
|
123
|
+
(kind === 'unreachable' || gap.kind === 'none')));
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Census completeness: the ids in {@link INVARIANT_IDS} the table does not
|
|
127
|
+
* declare. Duplicated ids and undeclared reports are refused by
|
|
128
|
+
* `menderRegistry` at construction, so a registry in hand has neither.
|
|
129
|
+
*
|
|
130
|
+
* @param options {object}
|
|
131
|
+
* @param options.registry {MenderRegistry}
|
|
132
|
+
* @returns {ReadonlyArray<InvariantId>} empty when the census is complete
|
|
133
|
+
*/
|
|
134
|
+
export function undeclaredInvariants({ registry }) {
|
|
135
|
+
const declared = new Set(registry.all().map(decl => decl.id));
|
|
136
|
+
return INVARIANT_IDS.filter(id => !declared.has(id));
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=derive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../../src/menders/derive.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAoB,MAAM,UAAU,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAQ/C;;GAEG;AACH,SAAS,WAAW,CAClB,QAAiD;IAEjD,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;AAChE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,4BAA4B,CAAC,EAC3C,QAAQ,EAGT;IACC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAA;IACtC,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IAChD,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC;QAChC,IAAI;QACJ,OAAO,EAAE,uBAAuB;KACjC,CAAC,EAAE,CAAC;QACH,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACjB,CAAC;IACH,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,OAAO,KAAK,eAAe,IAAI,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AI,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,CAClD,CACJ,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,QAAQ,EAGT;IACC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IAC7D,OAAO,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;AACtD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The invariant ids: the closed census both wallets declare against and the
|
|
6
|
+
* mender event channel keys on. Each names the predicate an entry makes
|
|
7
|
+
* true rather than the code that converges it, so moving a converger between
|
|
8
|
+
* modules renames nothing. The ids are code-only; nothing persists them.
|
|
9
|
+
* Numbered in the order the design table assigned them, and a new one takes
|
|
10
|
+
* the next free number rather than renumbering.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Every invariant id, in design-table order.
|
|
14
|
+
*/
|
|
15
|
+
export declare const INVARIANT_IDS: readonly ["roster-wraps-exactly-the-document-key-set", "governed-log-heads-anchor-past-the-membership-change", "collection-epochs-name-the-current-user-key", "unlock-registry-opens-under-the-current-user-key", "registry-passphrase-entry-names-the-standing-credential", "passkey-entry-carries-its-standing-configuration", "registry-lists-the-passphrase-method", "standing-delegations-verify-under-the-current-document", "registry-records-the-committed-ladder-rung", "unlock-record-points-at-the-account-did", "account-pointer-names-the-account-did", "space-controller-is-the-account-did", "roster-and-collection-epochs-exist", "registry-records-the-establishing-credential", "annex-generation-is-reachable", "generation-delegation-is-current", "acting-credential-manage-zcap-is-current", "did-web-projection-matches-the-log", "no-annex-generation-outlives-its-pointer", "app-keys-live-only-in-app-connections", "client-key-record-matches-the-pointed-account", "this-browser-is-still-an-enrolled-client", "no-client-key-record-stays-pending", "recovery-spend-is-completed", "retired-credential-leaves-no-annex-inventory", "document-lists-the-acting-credential", "keystore-controller-is-the-account-did", "account-document-publishes-an-authentication-key", "every-document-key-agreement-entry-has-a-locatable-credential", "no-unlock-space-outlives-its-credential", "no-keystore-outlives-its-account", "saved-recovery-codes-locate-their-account", "standard-collections-are-provisioned", "no-auxiliary-space-stands-unnamed"];
|
|
16
|
+
/**
|
|
17
|
+
* One id from {@link INVARIANT_IDS}.
|
|
18
|
+
*/
|
|
19
|
+
export type InvariantId = (typeof INVARIANT_IDS)[number];
|
|
20
|
+
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/menders/ids.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,i/CAqEhB,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The invariant ids: the closed census both wallets declare against and the
|
|
6
|
+
* mender event channel keys on. Each names the predicate an entry makes
|
|
7
|
+
* true rather than the code that converges it, so moving a converger between
|
|
8
|
+
* modules renames nothing. The ids are code-only; nothing persists them.
|
|
9
|
+
* Numbered in the order the design table assigned them, and a new one takes
|
|
10
|
+
* the next free number rather than renumbering.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Every invariant id, in design-table order.
|
|
14
|
+
*/
|
|
15
|
+
export const INVARIANT_IDS = [
|
|
16
|
+
// 1
|
|
17
|
+
'roster-wraps-exactly-the-document-key-set',
|
|
18
|
+
// 2
|
|
19
|
+
'governed-log-heads-anchor-past-the-membership-change',
|
|
20
|
+
// 3
|
|
21
|
+
'collection-epochs-name-the-current-user-key',
|
|
22
|
+
// 4
|
|
23
|
+
'unlock-registry-opens-under-the-current-user-key',
|
|
24
|
+
// 5
|
|
25
|
+
'registry-passphrase-entry-names-the-standing-credential',
|
|
26
|
+
// 6
|
|
27
|
+
'passkey-entry-carries-its-standing-configuration',
|
|
28
|
+
// 7
|
|
29
|
+
'registry-lists-the-passphrase-method',
|
|
30
|
+
// 8
|
|
31
|
+
'standing-delegations-verify-under-the-current-document',
|
|
32
|
+
// 9
|
|
33
|
+
'registry-records-the-committed-ladder-rung',
|
|
34
|
+
// 10
|
|
35
|
+
'unlock-record-points-at-the-account-did',
|
|
36
|
+
// 11
|
|
37
|
+
'account-pointer-names-the-account-did',
|
|
38
|
+
// 12
|
|
39
|
+
'space-controller-is-the-account-did',
|
|
40
|
+
// 13
|
|
41
|
+
'roster-and-collection-epochs-exist',
|
|
42
|
+
// 14
|
|
43
|
+
'registry-records-the-establishing-credential',
|
|
44
|
+
// 15
|
|
45
|
+
'annex-generation-is-reachable',
|
|
46
|
+
// 16
|
|
47
|
+
'generation-delegation-is-current',
|
|
48
|
+
// 17
|
|
49
|
+
'acting-credential-manage-zcap-is-current',
|
|
50
|
+
// 18
|
|
51
|
+
'did-web-projection-matches-the-log',
|
|
52
|
+
// 19
|
|
53
|
+
'no-annex-generation-outlives-its-pointer',
|
|
54
|
+
// 20
|
|
55
|
+
'app-keys-live-only-in-app-connections',
|
|
56
|
+
// 21
|
|
57
|
+
'client-key-record-matches-the-pointed-account',
|
|
58
|
+
// 22
|
|
59
|
+
'this-browser-is-still-an-enrolled-client',
|
|
60
|
+
// 23
|
|
61
|
+
'no-client-key-record-stays-pending',
|
|
62
|
+
// 24
|
|
63
|
+
'recovery-spend-is-completed',
|
|
64
|
+
// 25
|
|
65
|
+
'retired-credential-leaves-no-annex-inventory',
|
|
66
|
+
// 26
|
|
67
|
+
'document-lists-the-acting-credential',
|
|
68
|
+
// 27
|
|
69
|
+
'keystore-controller-is-the-account-did',
|
|
70
|
+
// 28
|
|
71
|
+
'account-document-publishes-an-authentication-key',
|
|
72
|
+
// 29
|
|
73
|
+
'every-document-key-agreement-entry-has-a-locatable-credential',
|
|
74
|
+
// 30
|
|
75
|
+
'no-unlock-space-outlives-its-credential',
|
|
76
|
+
// 31
|
|
77
|
+
'no-keystore-outlives-its-account',
|
|
78
|
+
// 32
|
|
79
|
+
'saved-recovery-codes-locate-their-account',
|
|
80
|
+
// 33
|
|
81
|
+
'standard-collections-are-provisioned',
|
|
82
|
+
// 34
|
|
83
|
+
'no-auxiliary-space-stands-unnamed'
|
|
84
|
+
];
|
|
85
|
+
//# sourceMappingURL=ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/menders/ids.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI;IACJ,2CAA2C;IAC3C,IAAI;IACJ,sDAAsD;IACtD,IAAI;IACJ,6CAA6C;IAC7C,IAAI;IACJ,kDAAkD;IAClD,IAAI;IACJ,yDAAyD;IACzD,IAAI;IACJ,kDAAkD;IAClD,IAAI;IACJ,sCAAsC;IACtC,IAAI;IACJ,wDAAwD;IACxD,IAAI;IACJ,4CAA4C;IAC5C,KAAK;IACL,yCAAyC;IACzC,KAAK;IACL,uCAAuC;IACvC,KAAK;IACL,qCAAqC;IACrC,KAAK;IACL,oCAAoC;IACpC,KAAK;IACL,8CAA8C;IAC9C,KAAK;IACL,+BAA+B;IAC/B,KAAK;IACL,kCAAkC;IAClC,KAAK;IACL,0CAA0C;IAC1C,KAAK;IACL,oCAAoC;IACpC,KAAK;IACL,0CAA0C;IAC1C,KAAK;IACL,uCAAuC;IACvC,KAAK;IACL,+CAA+C;IAC/C,KAAK;IACL,0CAA0C;IAC1C,KAAK;IACL,oCAAoC;IACpC,KAAK;IACL,6BAA6B;IAC7B,KAAK;IACL,8CAA8C;IAC9C,KAAK;IACL,sCAAsC;IACtC,KAAK;IACL,wCAAwC;IACxC,KAAK;IACL,kDAAkD;IAClD,KAAK;IACL,+DAA+D;IAC/D,KAAK;IACL,yCAAyC;IACzC,KAAK;IACL,kCAAkC;IAClC,KAAK;IACL,2CAA2C;IAC3C,KAAK;IACL,sCAAsC;IACtC,KAAK;IACL,mCAAmC;CAC3B,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The `@interop/wallet-core/menders` subpath: the mender registry keyed by
|
|
6
|
+
* invariant. A wallet declares its own table of invariants (data: what must
|
|
7
|
+
* hold between ceremonies) and its own registrations (code: what converges a
|
|
8
|
+
* violated one); this module carries the structure both wallets share.
|
|
9
|
+
*
|
|
10
|
+
* - the vocabularies: `AUTHORITIES`, `TRIGGERS`, `CHAIN_TRIGGERS`,
|
|
11
|
+
* `ACCOUNT_SHAPES`, `EVIDENCE`, `MEND_OUTCOMES`, `GAP_KINDS`, and
|
|
12
|
+
* `INVARIANT_IDS`, each an `as const` array with its union
|
|
13
|
+
* - the types: `InvariantDeclaration`, `RegistrationSite`, `Registration`,
|
|
14
|
+
* `MendOutcome`, `MendReportEntry`, `MendReport`, `InvariantGap`,
|
|
15
|
+
* `LoginRoute`
|
|
16
|
+
* - the readers: `menderRegistry` (`all`, `byId`, `sites`, `admits`,
|
|
17
|
+
* `dueAt`), which refuses a duplicated id, an undeclared report, or a
|
|
18
|
+
* guard on a non-routing site at construction, and `heldAuthorities`, the
|
|
19
|
+
* held set a session's account-ceremony context derives
|
|
20
|
+
* - the runner: `runMenderBlock`, one try, warn, and skip discipline over
|
|
21
|
+
* one chain trigger's registrations, `mendReportAccumulator`, the
|
|
22
|
+
* pre-session report collector its `onOutcome` feeds, and `errorNameOf`,
|
|
23
|
+
* the name a report carries for a thrown value of any shape
|
|
24
|
+
* - the derived sets a wallet's audit tests pin:
|
|
25
|
+
* `transientReachableInvariants`, `deriveGaps`, `undeclaredGaps`, and
|
|
26
|
+
* `undeclaredInvariants`
|
|
27
|
+
*
|
|
28
|
+
* Nothing here executes a ceremony. The runner calls the convergers a
|
|
29
|
+
* wallet registers and nothing else; the ceremonies stay explicit sequenced
|
|
30
|
+
* code, and the registry describes the menders from the outside.
|
|
31
|
+
*/
|
|
32
|
+
export { deriveGaps, transientReachableInvariants, undeclaredGaps, undeclaredInvariants } from './derive.js';
|
|
33
|
+
export { INVARIANT_IDS } from './ids.js';
|
|
34
|
+
export type { InvariantId } from './ids.js';
|
|
35
|
+
export { heldAuthorities, menderRegistry } from './registry.js';
|
|
36
|
+
export type { MenderRegistry, ResolvedAuthority } from './registry.js';
|
|
37
|
+
export { errorNameOf, MEND_REPORT_SHAPE_ERROR, mendReportAccumulator, runMenderBlock } from './runner.js';
|
|
38
|
+
export type { MendReportAccumulator } from './runner.js';
|
|
39
|
+
export type { InvariantDeclaration, InvariantGap, LoginRoute, MendOutcome, MendReport, MendReportEntry, Registration, RegistrationSite } from './types.js';
|
|
40
|
+
export { ACCOUNT_SHAPES, AUTHORITIES, CHAIN_TRIGGERS, EVIDENCE, GAP_KINDS, MEND_OUTCOMES, TRIGGERS } from './vocabulary.js';
|
|
41
|
+
export type { AccountShape, Authority, ChainTrigger, Evidence, GapKind, MendOutcomeKind, Trigger } from './vocabulary.js';
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EACL,UAAU,EACV,4BAA4B,EAC5B,cAAc,EACd,oBAAoB,EACrB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC/D,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,EACf,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,cAAc,EACd,WAAW,EACX,cAAc,EACd,QAAQ,EACR,SAAS,EACT,aAAa,EACb,QAAQ,EACT,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,eAAe,EACf,OAAO,EACR,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The `@interop/wallet-core/menders` subpath: the mender registry keyed by
|
|
6
|
+
* invariant. A wallet declares its own table of invariants (data: what must
|
|
7
|
+
* hold between ceremonies) and its own registrations (code: what converges a
|
|
8
|
+
* violated one); this module carries the structure both wallets share.
|
|
9
|
+
*
|
|
10
|
+
* - the vocabularies: `AUTHORITIES`, `TRIGGERS`, `CHAIN_TRIGGERS`,
|
|
11
|
+
* `ACCOUNT_SHAPES`, `EVIDENCE`, `MEND_OUTCOMES`, `GAP_KINDS`, and
|
|
12
|
+
* `INVARIANT_IDS`, each an `as const` array with its union
|
|
13
|
+
* - the types: `InvariantDeclaration`, `RegistrationSite`, `Registration`,
|
|
14
|
+
* `MendOutcome`, `MendReportEntry`, `MendReport`, `InvariantGap`,
|
|
15
|
+
* `LoginRoute`
|
|
16
|
+
* - the readers: `menderRegistry` (`all`, `byId`, `sites`, `admits`,
|
|
17
|
+
* `dueAt`), which refuses a duplicated id, an undeclared report, or a
|
|
18
|
+
* guard on a non-routing site at construction, and `heldAuthorities`, the
|
|
19
|
+
* held set a session's account-ceremony context derives
|
|
20
|
+
* - the runner: `runMenderBlock`, one try, warn, and skip discipline over
|
|
21
|
+
* one chain trigger's registrations, `mendReportAccumulator`, the
|
|
22
|
+
* pre-session report collector its `onOutcome` feeds, and `errorNameOf`,
|
|
23
|
+
* the name a report carries for a thrown value of any shape
|
|
24
|
+
* - the derived sets a wallet's audit tests pin:
|
|
25
|
+
* `transientReachableInvariants`, `deriveGaps`, `undeclaredGaps`, and
|
|
26
|
+
* `undeclaredInvariants`
|
|
27
|
+
*
|
|
28
|
+
* Nothing here executes a ceremony. The runner calls the convergers a
|
|
29
|
+
* wallet registers and nothing else; the ceremonies stay explicit sequenced
|
|
30
|
+
* code, and the registry describes the menders from the outside.
|
|
31
|
+
*/
|
|
32
|
+
export { deriveGaps, transientReachableInvariants, undeclaredGaps, undeclaredInvariants } from './derive.js';
|
|
33
|
+
export { INVARIANT_IDS } from './ids.js';
|
|
34
|
+
export { heldAuthorities, menderRegistry } from './registry.js';
|
|
35
|
+
export { errorNameOf, MEND_REPORT_SHAPE_ERROR, mendReportAccumulator, runMenderBlock } from './runner.js';
|
|
36
|
+
export { ACCOUNT_SHAPES, AUTHORITIES, CHAIN_TRIGGERS, EVIDENCE, GAP_KINDS, MEND_OUTCOMES, TRIGGERS } from './vocabulary.js';
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EACL,UAAU,EACV,4BAA4B,EAC5B,cAAc,EACd,oBAAoB,EACrB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE/D,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,EACf,MAAM,aAAa,CAAA;AAYpB,OAAO,EACL,cAAc,EACd,WAAW,EACX,cAAc,EACd,QAAQ,EACR,SAAS,EACT,aAAa,EACb,QAAQ,EACT,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The registry readers over a declaration table and its per-trigger
|
|
6
|
+
* registration sites: `all` and `byId` read declarations, `admits` is the
|
|
7
|
+
* one admission test (every reported invariant declares an authority the
|
|
8
|
+
* session holds and admits this login route), and `dueAt` reads the sites
|
|
9
|
+
* listed under one chain trigger that `admits` passes, in list order.
|
|
10
|
+
* Registration order is execution order; there is no dependency graph and
|
|
11
|
+
* no priority. The table and the sites are checked once, at construction: a
|
|
12
|
+
* duplicated declaration id, a site reporting an undeclared invariant, or a
|
|
13
|
+
* guard on a non-routing site is a `TypeError` there, so no reader meets the
|
|
14
|
+
* defect later, depending on what a login happens to hold.
|
|
15
|
+
*/
|
|
16
|
+
import type { InvariantId } from './ids.js';
|
|
17
|
+
import type { InvariantDeclaration, LoginRoute, RegistrationSite } from './types.js';
|
|
18
|
+
import type { Authority, ChainTrigger } from './vocabulary.js';
|
|
19
|
+
/**
|
|
20
|
+
* The two authorities a session's account-ceremony context resolves to; the
|
|
21
|
+
* remaining values, `none` and `account`, are the ones every resolved kind
|
|
22
|
+
* subsumes. Derived from the vocabulary, so a new authority is a compile
|
|
23
|
+
* error in `heldAuthorities` rather than a value it can never return.
|
|
24
|
+
*/
|
|
25
|
+
export type ResolvedAuthority = Exclude<Authority, 'none' | 'account'>;
|
|
26
|
+
/**
|
|
27
|
+
* The readers over one wallet's table. `Site` is the converge-free index
|
|
28
|
+
* shape or a wallet's registration type extending it, so the same readers
|
|
29
|
+
* serve the audit and the runner.
|
|
30
|
+
*/
|
|
31
|
+
export interface MenderRegistry<Site extends RegistrationSite, Deps, Ceremony extends string = string> {
|
|
32
|
+
all(): ReadonlyArray<InvariantDeclaration<Deps, Ceremony>>;
|
|
33
|
+
byId(id: InvariantId): InvariantDeclaration<Deps, Ceremony> | undefined;
|
|
34
|
+
sites(): ReadonlyArray<Site>;
|
|
35
|
+
/**
|
|
36
|
+
* Whether a site's every reported invariant declares an authority in
|
|
37
|
+
* `held` and, when a route is given, admits it. The one admission test,
|
|
38
|
+
* shared by `dueAt` and by a runner admitting a site the caller supplies.
|
|
39
|
+
*
|
|
40
|
+
* @throws {TypeError} when the site reports an undeclared invariant,
|
|
41
|
+
* reachable only for a site the registry does not index
|
|
42
|
+
*/
|
|
43
|
+
admits(options: {
|
|
44
|
+
site: RegistrationSite;
|
|
45
|
+
held: ReadonlyArray<Authority>;
|
|
46
|
+
route?: LoginRoute;
|
|
47
|
+
}): boolean;
|
|
48
|
+
dueAt(options: {
|
|
49
|
+
held: ReadonlyArray<Authority>;
|
|
50
|
+
trigger: ChainTrigger;
|
|
51
|
+
route?: LoginRoute;
|
|
52
|
+
}): ReadonlyArray<Site>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The held set a session derives from its account-ceremony context: `none`
|
|
56
|
+
* always, plus `account` and the resolved kind when a context resolves.
|
|
57
|
+
*
|
|
58
|
+
* @param options {object}
|
|
59
|
+
* @param [options.kind] {ResolvedAuthority} the resolved context kind,
|
|
60
|
+
* absent for a guest, a no-WAS session, or a transient session whose
|
|
61
|
+
* record carries no standing members
|
|
62
|
+
* @returns {ReadonlyArray<Authority>}
|
|
63
|
+
*/
|
|
64
|
+
export declare function heldAuthorities({ kind }: {
|
|
65
|
+
kind?: ResolvedAuthority;
|
|
66
|
+
}): ReadonlyArray<Authority>;
|
|
67
|
+
/**
|
|
68
|
+
* Builds the readers over one wallet's declarations and sites, checking
|
|
69
|
+
* both once: every declaration id is unique, every reported id is declared,
|
|
70
|
+
* and only a `login-routing` site carries `guardedBy`.
|
|
71
|
+
*
|
|
72
|
+
* @param options {object}
|
|
73
|
+
* @param options.declarations {ReadonlyArray<InvariantDeclaration>}
|
|
74
|
+
* @param options.sites {ReadonlyArray<RegistrationSite>} every
|
|
75
|
+
* registration site, any trigger, in execution order within a trigger
|
|
76
|
+
* @returns {MenderRegistry}
|
|
77
|
+
* @throws {TypeError} on a duplicated declaration id, an undeclared
|
|
78
|
+
* report, or a guard on a non-routing site
|
|
79
|
+
*/
|
|
80
|
+
export declare function menderRegistry<Site extends RegistrationSite, Deps, Ceremony extends string = string>({ declarations, sites }: {
|
|
81
|
+
declarations: ReadonlyArray<InvariantDeclaration<Deps, Ceremony>>;
|
|
82
|
+
sites: ReadonlyArray<Site>;
|
|
83
|
+
}): MenderRegistry<Site, Deps, Ceremony>;
|
|
84
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/menders/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EACjB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9D;;;;;GAKG;AACH,MAAM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I,CAAC,CAAA;CAC3B,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAsDvC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The held set a session derives from its account-ceremony context: `none`
|
|
3
|
+
* always, plus `account` and the resolved kind when a context resolves.
|
|
4
|
+
*
|
|
5
|
+
* @param options {object}
|
|
6
|
+
* @param [options.kind] {ResolvedAuthority} the resolved context kind,
|
|
7
|
+
* absent for a guest, a no-WAS session, or a transient session whose
|
|
8
|
+
* record carries no standing members
|
|
9
|
+
* @returns {ReadonlyArray<Authority>}
|
|
10
|
+
*/
|
|
11
|
+
export function heldAuthorities({ kind }) {
|
|
12
|
+
return kind ? ['none', 'account', kind] : ['none'];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Builds the readers over one wallet's declarations and sites, checking
|
|
16
|
+
* both once: every declaration id is unique, every reported id is declared,
|
|
17
|
+
* and only a `login-routing` site carries `guardedBy`.
|
|
18
|
+
*
|
|
19
|
+
* @param options {object}
|
|
20
|
+
* @param options.declarations {ReadonlyArray<InvariantDeclaration>}
|
|
21
|
+
* @param options.sites {ReadonlyArray<RegistrationSite>} every
|
|
22
|
+
* registration site, any trigger, in execution order within a trigger
|
|
23
|
+
* @returns {MenderRegistry}
|
|
24
|
+
* @throws {TypeError} on a duplicated declaration id, an undeclared
|
|
25
|
+
* report, or a guard on a non-routing site
|
|
26
|
+
*/
|
|
27
|
+
export function menderRegistry({ declarations, sites }) {
|
|
28
|
+
const index = new Map();
|
|
29
|
+
for (const decl of declarations) {
|
|
30
|
+
if (index.has(decl.id)) {
|
|
31
|
+
throw new TypeError(`An invariant is declared twice: ${decl.id}`);
|
|
32
|
+
}
|
|
33
|
+
index.set(decl.id, decl);
|
|
34
|
+
}
|
|
35
|
+
const requireDeclared = (id) => {
|
|
36
|
+
const decl = index.get(id);
|
|
37
|
+
if (!decl) {
|
|
38
|
+
throw new TypeError(`A registration reports an undeclared invariant: ${id}`);
|
|
39
|
+
}
|
|
40
|
+
return decl;
|
|
41
|
+
};
|
|
42
|
+
for (const site of sites) {
|
|
43
|
+
site.reports.forEach(requireDeclared);
|
|
44
|
+
const { trigger, guardedBy } = site;
|
|
45
|
+
if (guardedBy !== undefined && trigger !== 'login-routing') {
|
|
46
|
+
throw new TypeError(`A ${trigger} site carries a guard; only a login-routing site may`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const admits = ({ site, held, route }) => site.reports.every(id => {
|
|
50
|
+
const decl = requireDeclared(id);
|
|
51
|
+
return (held.includes(decl.authority) &&
|
|
52
|
+
(route === undefined || !decl.when || decl.when(route)));
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
all: () => declarations,
|
|
56
|
+
byId: id => index.get(id),
|
|
57
|
+
sites: () => sites,
|
|
58
|
+
admits,
|
|
59
|
+
dueAt: ({ held, trigger, route }) => sites.filter(site => site.trigger === trigger && admits({ site, held, route }))
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/menders/registry.ts"],"names":[],"mappings":"AAgEA;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,IAAI,EAGL;IACC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AACpD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAI5B,EACA,YAAY,EACZ,KAAK,EAIN;IACC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAqD,CAAA;IAC1E,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YACvB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AAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;QAClB,MAAM;QACN,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAClC,KAAK,CAAC,MAAM,CACV,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,IAAI,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAClE;KACJ,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The mender runner: one try, warn, and skip discipline over the
|
|
6
|
+
* registrations listed under one chain trigger. `runMenderBlock` runs them
|
|
7
|
+
* in list order, since registration order is execution order and there is
|
|
8
|
+
* no dependency graph. A seed step's failure aborts the block; a
|
|
9
|
+
* registration's failure warns through the wallet's own `Logger` and the
|
|
10
|
+
* block continues. Beside it sits `mendReportAccumulator`, the report
|
|
11
|
+
* collector a wallet creates before a `Session` exists, so the entries a
|
|
12
|
+
* routing site reports and the entries this runner reports assemble into
|
|
13
|
+
* one `MendReport`.
|
|
14
|
+
*/
|
|
15
|
+
import type { Logger } from '../log.js';
|
|
16
|
+
import type { MenderRegistry } from './registry.js';
|
|
17
|
+
import type { LoginRoute, MendReport, MendReportEntry, Registration, RegistrationSite } from './types.js';
|
|
18
|
+
import type { Authority, ChainTrigger } from './vocabulary.js';
|
|
19
|
+
/**
|
|
20
|
+
* The `errorName` a normalized entry carries when a registration resolves
|
|
21
|
+
* with entries that do not match the invariants it reports.
|
|
22
|
+
*/
|
|
23
|
+
export declare const MEND_REPORT_SHAPE_ERROR = "MendReportShapeError";
|
|
24
|
+
/**
|
|
25
|
+
* The report collector a wallet creates ahead of session assembly. A
|
|
26
|
+
* routing entry reports into it from its own call site before a `Session`
|
|
27
|
+
* exists, {@link runMenderBlock} reports the chain's entries into it
|
|
28
|
+
* through `onOutcome`, and the wallet hands `settled` to the session as its
|
|
29
|
+
* mend report.
|
|
30
|
+
*/
|
|
31
|
+
export interface MendReportAccumulator<Ceremony extends string = string> {
|
|
32
|
+
/**
|
|
33
|
+
* Records one entry. Bound to the accumulator, so it can be passed
|
|
34
|
+
* directly as {@link runMenderBlock}'s `onOutcome`.
|
|
35
|
+
*/
|
|
36
|
+
report(entry: MendReportEntry<Ceremony>): void;
|
|
37
|
+
/**
|
|
38
|
+
* Every entry recorded so far, in report order.
|
|
39
|
+
*/
|
|
40
|
+
entries(): MendReport<Ceremony>;
|
|
41
|
+
/**
|
|
42
|
+
* Resolves {@link MendReportAccumulator.settled} with the entries
|
|
43
|
+
* recorded so far. Idempotent: the first call fixes the resolved report,
|
|
44
|
+
* and a later `report` call still lands in `entries()`.
|
|
45
|
+
*/
|
|
46
|
+
settle(): MendReport<Ceremony>;
|
|
47
|
+
/**
|
|
48
|
+
* The assembled report, resolved by `settle`. It never rejects.
|
|
49
|
+
*/
|
|
50
|
+
readonly settled: Promise<MendReport<Ceremony>>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Creates a report accumulator. Generic over the wallet's ceremony-id
|
|
54
|
+
* union, which defaults to `string`.
|
|
55
|
+
*
|
|
56
|
+
* @returns {MendReportAccumulator}
|
|
57
|
+
*/
|
|
58
|
+
export declare function mendReportAccumulator<Ceremony extends string = string>(): MendReportAccumulator<Ceremony>;
|
|
59
|
+
/**
|
|
60
|
+
* Runs one registration block: the registrations listed under `trigger`
|
|
61
|
+
* whose every reported invariant declares an authority the session holds
|
|
62
|
+
* and admits this login route, in list order.
|
|
63
|
+
*
|
|
64
|
+
* The discipline, in one place. An optional `seed` registration runs first,
|
|
65
|
+
* and its failure aborts the block: nothing behind it runs, which is what a
|
|
66
|
+
* rejected chain seed does today. Past the seed, a registration that throws
|
|
67
|
+
* warns once per reported invariant with that declaration's own `warn`
|
|
68
|
+
* string, reports `failed` for each of them, and the block carries on to
|
|
69
|
+
* the next registration. Only `err.name` rides a report: a thrown error's
|
|
70
|
+
* message routinely carries a DID or a Space id, so the error itself goes
|
|
71
|
+
* to the logger alone.
|
|
72
|
+
*
|
|
73
|
+
* A registration that resolves with the wrong number of entries, or with an
|
|
74
|
+
* entry whose `invariant` is not the id it reports at that position, is a
|
|
75
|
+
* programming error. It warns and is normalized to `failed` entries
|
|
76
|
+
* carrying {@link MEND_REPORT_SHAPE_ERROR} rather than throwing, so a
|
|
77
|
+
* mismatched adapter cannot tear a login.
|
|
78
|
+
*
|
|
79
|
+
* `trigger` is one of the two chain values, so a `ceremony-tail` entry is
|
|
80
|
+
* out of reach here. Such an entry has no registration at all: its body
|
|
81
|
+
* stays inside its ceremony's sequenced code and it reports from there.
|
|
82
|
+
*
|
|
83
|
+
* `Deps` is the wallet's own type, one object per registration block,
|
|
84
|
+
* handed to the seed and to every `converge` unread. This runner never
|
|
85
|
+
* inspects it, and the raw passphrase does not cross into this package.
|
|
86
|
+
*
|
|
87
|
+
* `registrations` overrides which registrations the block runs, for a wallet
|
|
88
|
+
* that runs one trigger's list in parts (a settle point partway through, say).
|
|
89
|
+
* The same authority and route tests still admit each one, and one listed
|
|
90
|
+
* under another trigger is refused, so the override narrows the block and
|
|
91
|
+
* never widens it.
|
|
92
|
+
*
|
|
93
|
+
* A registry may index converge-free sites beside its registrations -- a
|
|
94
|
+
* wallet's routing entries, or an entry whose own call site fires it -- and
|
|
95
|
+
* such a site is never executed here, whichever list the block runs from.
|
|
96
|
+
*
|
|
97
|
+
* @param options {object}
|
|
98
|
+
* @param options.registry {MenderRegistry} the wallet's declarations and
|
|
99
|
+
* its registrations
|
|
100
|
+
* @param options.trigger {ChainTrigger} which chain is running
|
|
101
|
+
* @param options.held {ReadonlyArray<Authority>} the session's held
|
|
102
|
+
* authorities, from `heldAuthorities`
|
|
103
|
+
* @param options.route {LoginRoute} the login route each declaration's
|
|
104
|
+
* `when` predicate reads
|
|
105
|
+
* @param options.deps {Deps} passed to the seed and to every `converge`
|
|
106
|
+
* @param options.logger {Logger} the wallet's own sink, so its warn
|
|
107
|
+
* copy keeps the wallet's namespace
|
|
108
|
+
* @param [options.registrations] {ReadonlyArray<Registration>} the
|
|
109
|
+
* registrations to run, in place of the ones the registry lists under
|
|
110
|
+
* `trigger`. Each is admitted by the same authority and route tests
|
|
111
|
+
* @param [options.seed] {Registration} the step whose failure aborts the
|
|
112
|
+
* block. Admitted by the same authority and route tests as any other
|
|
113
|
+
* registration; one it does not pass is skipped rather than failed
|
|
114
|
+
* @param [options.onOutcome] {(entry: MendReportEntry) => void} called
|
|
115
|
+
* once per reported entry, in order. The single place a chain entry's
|
|
116
|
+
* outcome is reported
|
|
117
|
+
* @returns {Promise<MendReport>} the block's entries in order. It never
|
|
118
|
+
* rejects; a seed failure resolves with the seed's `failed` entries alone
|
|
119
|
+
* @throws {TypeError} when the seed or an override registration is listed
|
|
120
|
+
* under a trigger other than `trigger`, a programming error
|
|
121
|
+
*/
|
|
122
|
+
export declare function runMenderBlock<Deps, Ceremony extends string = string, Site extends RegistrationSite = Registration<Deps, Ceremony>>({ registry, trigger, held, route, deps, logger, registrations, seed, onOutcome }: {
|
|
123
|
+
registry: MenderRegistry<Site, Deps, Ceremony>;
|
|
124
|
+
trigger: ChainTrigger;
|
|
125
|
+
held: ReadonlyArray<Authority>;
|
|
126
|
+
route: LoginRoute;
|
|
127
|
+
deps: Deps;
|
|
128
|
+
logger: Logger;
|
|
129
|
+
registrations?: ReadonlyArray<Registration<Deps, Ceremony>>;
|
|
130
|
+
seed?: Registration<Deps, Ceremony>;
|
|
131
|
+
onOutcome?: (entry: MendReportEntry<Ceremony>) => void;
|
|
132
|
+
}): Promise<MendReport<Ceremony>>;
|
|
133
|
+
/**
|
|
134
|
+
* The thrown value's class name alone. Its message may carry a DID or a
|
|
135
|
+
* Space id, so a report keeps the name and the logger keeps the error. A
|
|
136
|
+
* value that is not an `Error` still yields a name, so a report site never
|
|
137
|
+
* carries `undefined` where a name belongs.
|
|
138
|
+
*
|
|
139
|
+
* @param err {unknown}
|
|
140
|
+
* @returns {string}
|
|
141
|
+
*/
|
|
142
|
+
export declare function errorNameOf(err: unknown): string;
|
|
143
|
+
//# sourceMappingURL=runner.d.ts.map
|