agent-passport-system 7.0.0 → 7.2.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/SECURITY.md +11 -0
- package/dist/src/core/tool-integrity.d.ts +13 -0
- package/dist/src/core/tool-integrity.d.ts.map +1 -1
- package/dist/src/core/tool-integrity.js +1 -1
- package/dist/src/core/tool-integrity.js.map +1 -1
- package/dist/src/index.d.ts +52 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +282 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/v2/activation/canonical.d.ts +40 -0
- package/dist/src/v2/activation/canonical.d.ts.map +1 -0
- package/dist/src/v2/activation/canonical.js +64 -0
- package/dist/src/v2/activation/canonical.js.map +1 -0
- package/dist/src/v2/activation/index.d.ts +4 -0
- package/dist/src/v2/activation/index.d.ts.map +1 -0
- package/dist/src/v2/activation/index.js +11 -0
- package/dist/src/v2/activation/index.js.map +1 -0
- package/dist/src/v2/activation/types.d.ts +268 -0
- package/dist/src/v2/activation/types.d.ts.map +1 -0
- package/dist/src/v2/activation/types.js +198 -0
- package/dist/src/v2/activation/types.js.map +1 -0
- package/dist/src/v2/activation/verify.d.ts +132 -0
- package/dist/src/v2/activation/verify.d.ts.map +1 -0
- package/dist/src/v2/activation/verify.js +406 -0
- package/dist/src/v2/activation/verify.js.map +1 -0
- package/dist/src/v2/authority-revocation/canonical.d.ts +46 -0
- package/dist/src/v2/authority-revocation/canonical.d.ts.map +1 -0
- package/dist/src/v2/authority-revocation/canonical.js +68 -0
- package/dist/src/v2/authority-revocation/canonical.js.map +1 -0
- package/dist/src/v2/authority-revocation/index.d.ts +9 -0
- package/dist/src/v2/authority-revocation/index.d.ts.map +1 -0
- package/dist/src/v2/authority-revocation/index.js +11 -0
- package/dist/src/v2/authority-revocation/index.js.map +1 -0
- package/dist/src/v2/authority-revocation/issue.d.ts +54 -0
- package/dist/src/v2/authority-revocation/issue.d.ts.map +1 -0
- package/dist/src/v2/authority-revocation/issue.js +111 -0
- package/dist/src/v2/authority-revocation/issue.js.map +1 -0
- package/dist/src/v2/authority-revocation/record.d.ts +69 -0
- package/dist/src/v2/authority-revocation/record.d.ts.map +1 -0
- package/dist/src/v2/authority-revocation/record.js +51 -0
- package/dist/src/v2/authority-revocation/record.js.map +1 -0
- package/dist/src/v2/authority-revocation/resolver.d.ts +30 -0
- package/dist/src/v2/authority-revocation/resolver.d.ts.map +1 -0
- package/dist/src/v2/authority-revocation/resolver.js +52 -0
- package/dist/src/v2/authority-revocation/resolver.js.map +1 -0
- package/dist/src/v2/authority-revocation/schema.d.ts +15 -0
- package/dist/src/v2/authority-revocation/schema.d.ts.map +1 -0
- package/dist/src/v2/authority-revocation/schema.js +107 -0
- package/dist/src/v2/authority-revocation/schema.js.map +1 -0
- package/dist/src/v2/authority-revocation/store.d.ts +55 -0
- package/dist/src/v2/authority-revocation/store.d.ts.map +1 -0
- package/dist/src/v2/authority-revocation/store.js +69 -0
- package/dist/src/v2/authority-revocation/store.js.map +1 -0
- package/dist/src/v2/authority-revocation/types.d.ts +136 -0
- package/dist/src/v2/authority-revocation/types.d.ts.map +1 -0
- package/dist/src/v2/authority-revocation/types.js +11 -0
- package/dist/src/v2/authority-revocation/types.js.map +1 -0
- package/dist/src/v2/authority-revocation/verify.d.ts +38 -0
- package/dist/src/v2/authority-revocation/verify.d.ts.map +1 -0
- package/dist/src/v2/authority-revocation/verify.js +139 -0
- package/dist/src/v2/authority-revocation/verify.js.map +1 -0
- package/dist/src/v2/authority-state/fencing.d.ts +49 -0
- package/dist/src/v2/authority-state/fencing.d.ts.map +1 -0
- package/dist/src/v2/authority-state/fencing.js +92 -0
- package/dist/src/v2/authority-state/fencing.js.map +1 -0
- package/dist/src/v2/authority-state/index.d.ts +7 -0
- package/dist/src/v2/authority-state/index.d.ts.map +1 -0
- package/dist/src/v2/authority-state/index.js +14 -0
- package/dist/src/v2/authority-state/index.js.map +1 -0
- package/dist/src/v2/authority-state/marker.d.ts +70 -0
- package/dist/src/v2/authority-state/marker.d.ts.map +1 -0
- package/dist/src/v2/authority-state/marker.js +122 -0
- package/dist/src/v2/authority-state/marker.js.map +1 -0
- package/dist/src/v2/authority-state/report.d.ts +55 -0
- package/dist/src/v2/authority-state/report.d.ts.map +1 -0
- package/dist/src/v2/authority-state/report.js +51 -0
- package/dist/src/v2/authority-state/report.js.map +1 -0
- package/dist/src/v2/authority-state/retained.d.ts +82 -0
- package/dist/src/v2/authority-state/retained.d.ts.map +1 -0
- package/dist/src/v2/authority-state/retained.js +93 -0
- package/dist/src/v2/authority-state/retained.js.map +1 -0
- package/dist/src/v2/authority-state/types.d.ts +198 -0
- package/dist/src/v2/authority-state/types.d.ts.map +1 -0
- package/dist/src/v2/authority-state/types.js +103 -0
- package/dist/src/v2/authority-state/types.js.map +1 -0
- package/dist/src/v2/authority-state/withdrawal.d.ts +80 -0
- package/dist/src/v2/authority-state/withdrawal.d.ts.map +1 -0
- package/dist/src/v2/authority-state/withdrawal.js +199 -0
- package/dist/src/v2/authority-state/withdrawal.js.map +1 -0
- package/dist/src/v2/bounds/canonical.d.ts +30 -0
- package/dist/src/v2/bounds/canonical.d.ts.map +1 -0
- package/dist/src/v2/bounds/canonical.js +69 -0
- package/dist/src/v2/bounds/canonical.js.map +1 -0
- package/dist/src/v2/bounds/evaluate.d.ts +107 -0
- package/dist/src/v2/bounds/evaluate.d.ts.map +1 -0
- package/dist/src/v2/bounds/evaluate.js +315 -0
- package/dist/src/v2/bounds/evaluate.js.map +1 -0
- package/dist/src/v2/bounds/index.d.ts +6 -0
- package/dist/src/v2/bounds/index.d.ts.map +1 -0
- package/dist/src/v2/bounds/index.js +13 -0
- package/dist/src/v2/bounds/index.js.map +1 -0
- package/dist/src/v2/bounds/purpose.d.ts +2 -0
- package/dist/src/v2/bounds/purpose.d.ts.map +1 -0
- package/dist/src/v2/bounds/purpose.js +23 -0
- package/dist/src/v2/bounds/purpose.js.map +1 -0
- package/dist/src/v2/bounds/record.d.ts +78 -0
- package/dist/src/v2/bounds/record.d.ts.map +1 -0
- package/dist/src/v2/bounds/record.js +170 -0
- package/dist/src/v2/bounds/record.js.map +1 -0
- package/dist/src/v2/bounds/types.d.ts +275 -0
- package/dist/src/v2/bounds/types.d.ts.map +1 -0
- package/dist/src/v2/bounds/types.js +124 -0
- package/dist/src/v2/bounds/types.js.map +1 -0
- package/dist/src/v2/capability-binding/binding.d.ts +67 -0
- package/dist/src/v2/capability-binding/binding.d.ts.map +1 -0
- package/dist/src/v2/capability-binding/binding.js +267 -0
- package/dist/src/v2/capability-binding/binding.js.map +1 -0
- package/dist/src/v2/capability-binding/digest.d.ts +33 -0
- package/dist/src/v2/capability-binding/digest.d.ts.map +1 -0
- package/dist/src/v2/capability-binding/digest.js +55 -0
- package/dist/src/v2/capability-binding/digest.js.map +1 -0
- package/dist/src/v2/capability-binding/identifier.d.ts +103 -0
- package/dist/src/v2/capability-binding/identifier.d.ts.map +1 -0
- package/dist/src/v2/capability-binding/identifier.js +281 -0
- package/dist/src/v2/capability-binding/identifier.js.map +1 -0
- package/dist/src/v2/capability-binding/index.d.ts +6 -0
- package/dist/src/v2/capability-binding/index.d.ts.map +1 -0
- package/dist/src/v2/capability-binding/index.js +13 -0
- package/dist/src/v2/capability-binding/index.js.map +1 -0
- package/dist/src/v2/capability-binding/pins.d.ts +30 -0
- package/dist/src/v2/capability-binding/pins.d.ts.map +1 -0
- package/dist/src/v2/capability-binding/pins.js +109 -0
- package/dist/src/v2/capability-binding/pins.js.map +1 -0
- package/dist/src/v2/capability-binding/types.d.ts +213 -0
- package/dist/src/v2/capability-binding/types.d.ts.map +1 -0
- package/dist/src/v2/capability-binding/types.js +150 -0
- package/dist/src/v2/capability-binding/types.js.map +1 -0
- package/dist/src/v2/chain-selection/index.d.ts +4 -0
- package/dist/src/v2/chain-selection/index.d.ts.map +1 -0
- package/dist/src/v2/chain-selection/index.js +11 -0
- package/dist/src/v2/chain-selection/index.js.map +1 -0
- package/dist/src/v2/chain-selection/select.d.ts +62 -0
- package/dist/src/v2/chain-selection/select.d.ts.map +1 -0
- package/dist/src/v2/chain-selection/select.js +390 -0
- package/dist/src/v2/chain-selection/select.js.map +1 -0
- package/dist/src/v2/chain-selection/types.d.ts +189 -0
- package/dist/src/v2/chain-selection/types.d.ts.map +1 -0
- package/dist/src/v2/chain-selection/types.js +81 -0
- package/dist/src/v2/chain-selection/types.js.map +1 -0
- package/dist/src/v2/lifecycle-state/index.d.ts +4 -0
- package/dist/src/v2/lifecycle-state/index.d.ts.map +1 -0
- package/dist/src/v2/lifecycle-state/index.js +10 -0
- package/dist/src/v2/lifecycle-state/index.js.map +1 -0
- package/dist/src/v2/lifecycle-state/map.d.ts +52 -0
- package/dist/src/v2/lifecycle-state/map.d.ts.map +1 -0
- package/dist/src/v2/lifecycle-state/map.js +122 -0
- package/dist/src/v2/lifecycle-state/map.js.map +1 -0
- package/dist/src/v2/lifecycle-state/state.d.ts +60 -0
- package/dist/src/v2/lifecycle-state/state.d.ts.map +1 -0
- package/dist/src/v2/lifecycle-state/state.js +157 -0
- package/dist/src/v2/lifecycle-state/state.js.map +1 -0
- package/dist/src/v2/lifecycle-state/types.d.ts +163 -0
- package/dist/src/v2/lifecycle-state/types.d.ts.map +1 -0
- package/dist/src/v2/lifecycle-state/types.js +121 -0
- package/dist/src/v2/lifecycle-state/types.js.map +1 -0
- package/dist/src/v2/receipt-core/composite.d.ts +69 -3
- package/dist/src/v2/receipt-core/composite.d.ts.map +1 -1
- package/dist/src/v2/receipt-core/composite.js +75 -9
- package/dist/src/v2/receipt-core/composite.js.map +1 -1
- package/dist/src/v2/receipt-core/predecessor.d.ts +95 -0
- package/dist/src/v2/receipt-core/predecessor.d.ts.map +1 -0
- package/dist/src/v2/receipt-core/predecessor.js +115 -0
- package/dist/src/v2/receipt-core/predecessor.js.map +1 -0
- package/dist/src/v2/status-coverage/decide.d.ts +52 -0
- package/dist/src/v2/status-coverage/decide.d.ts.map +1 -0
- package/dist/src/v2/status-coverage/decide.js +398 -0
- package/dist/src/v2/status-coverage/decide.js.map +1 -0
- package/dist/src/v2/status-coverage/index.d.ts +3 -0
- package/dist/src/v2/status-coverage/index.d.ts.map +1 -0
- package/dist/src/v2/status-coverage/index.js +10 -0
- package/dist/src/v2/status-coverage/index.js.map +1 -0
- package/dist/src/v2/status-coverage/types.d.ts +258 -0
- package/dist/src/v2/status-coverage/types.d.ts.map +1 -0
- package/dist/src/v2/status-coverage/types.js +127 -0
- package/dist/src/v2/status-coverage/types.js.map +1 -0
- package/dist/src/v2/suspension/evaluate.d.ts +88 -0
- package/dist/src/v2/suspension/evaluate.d.ts.map +1 -0
- package/dist/src/v2/suspension/evaluate.js +404 -0
- package/dist/src/v2/suspension/evaluate.js.map +1 -0
- package/dist/src/v2/suspension/index.d.ts +3 -0
- package/dist/src/v2/suspension/index.d.ts.map +1 -0
- package/dist/src/v2/suspension/index.js +10 -0
- package/dist/src/v2/suspension/index.js.map +1 -0
- package/dist/src/v2/suspension/types.d.ts +243 -0
- package/dist/src/v2/suspension/types.d.ts.map +1 -0
- package/dist/src/v2/suspension/types.js +135 -0
- package/dist/src/v2/suspension/types.js.map +1 -0
- package/package.json +10 -7
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Copyright (c) 2026 Tymofii Pidlisnyi
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
//
|
|
4
|
+
// PROPOSED, OPT-IN. The marker constructor and the comparison, and nothing else.
|
|
5
|
+
// See ./types.ts for the specification position. Concept source:
|
|
6
|
+
// aeoess/agent-authority-lifecycle, invariant candidate CAND-08. Proposed.
|
|
7
|
+
import { MONOTONICITY_OUTCOMES, STATE_MARKER_SCOPES, UNPLACEABLE_DISPOSITIONS, } from './types.js';
|
|
8
|
+
/** Thrown when a caller asks for a marker the vocabulary does not allow. A shape rule
|
|
9
|
+
* broken at construction is a programming error, not a verdict. Mirrors
|
|
10
|
+
* `LifecycleStateError` in src/v2/lifecycle-state/. */
|
|
11
|
+
export class AuthorityStateError extends Error {
|
|
12
|
+
code;
|
|
13
|
+
constructor(code, message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'AuthorityStateError';
|
|
16
|
+
this.code = code;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** Canonical unsigned decimal integer. Same pattern the authority vector's spend
|
|
20
|
+
* quantities use: no sign, no leading zero, no separators. */
|
|
21
|
+
const DECIMAL = /^(0|[1-9][0-9]*)$/;
|
|
22
|
+
export function isStateMarkerScope(value) {
|
|
23
|
+
return typeof value === 'string' && STATE_MARKER_SCOPES.includes(value);
|
|
24
|
+
}
|
|
25
|
+
export function isMonotonicityOutcome(value) {
|
|
26
|
+
return typeof value === 'string' && MONOTONICITY_OUTCOMES.includes(value);
|
|
27
|
+
}
|
|
28
|
+
export function isUnplaceableDisposition(value) {
|
|
29
|
+
return typeof value === 'string' && UNPLACEABLE_DISPOSITIONS.includes(value);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build a `StateMarker`, enforcing its shape rules.
|
|
33
|
+
*
|
|
34
|
+
* 1. `value` is a canonical unsigned decimal integer, as a string. A number would lose
|
|
35
|
+
* exactness past 2^53 - 1 and would admit `1.0`, `1e3` and `-1`, none of which orders
|
|
36
|
+
* the way a generation counter has to.
|
|
37
|
+
* 2. `scope` is one of the four. There is no fifth and there is no default: which thing a
|
|
38
|
+
* generation is counted within is the choice the proposed text does not make, so it has
|
|
39
|
+
* to be stated rather than assumed.
|
|
40
|
+
* 3. `scope_ref` is present and non-empty exactly when `scope` is not `global`. A
|
|
41
|
+
* per-delegation marker that does not say which delegation cannot be compared against
|
|
42
|
+
* anything.
|
|
43
|
+
*
|
|
44
|
+
* Proposed. Concept source: aeoess/agent-authority-lifecycle, `Authority epoch`.
|
|
45
|
+
*/
|
|
46
|
+
export function stateMarker(input) {
|
|
47
|
+
if (input === null || typeof input !== 'object') {
|
|
48
|
+
throw new AuthorityStateError('MARKER_MALFORMED', 'a state marker input must be an object');
|
|
49
|
+
}
|
|
50
|
+
if (typeof input.value !== 'string' || !DECIMAL.test(input.value)) {
|
|
51
|
+
throw new AuthorityStateError('MARKER_VALUE_NONCANONICAL', 'value must be a canonical unsigned decimal integer string');
|
|
52
|
+
}
|
|
53
|
+
if (!isStateMarkerScope(input.scope)) {
|
|
54
|
+
throw new AuthorityStateError('MARKER_SCOPE_UNKNOWN', `scope must be one of ${STATE_MARKER_SCOPES.join(', ')}`);
|
|
55
|
+
}
|
|
56
|
+
if (input.scope === 'global') {
|
|
57
|
+
if (input.scope_ref !== undefined) {
|
|
58
|
+
throw new AuthorityStateError('MARKER_SCOPE_REF_NOT_ALLOWED', 'a global marker names no scope_ref');
|
|
59
|
+
}
|
|
60
|
+
return Object.freeze({ value: input.value, scope: input.scope });
|
|
61
|
+
}
|
|
62
|
+
if (typeof input.scope_ref !== 'string' || input.scope_ref.length === 0) {
|
|
63
|
+
throw new AuthorityStateError('MARKER_SCOPE_REF_REQUIRED', `a ${input.scope} marker must name the scope_ref it is counted within`);
|
|
64
|
+
}
|
|
65
|
+
return Object.freeze({ value: input.value, scope: input.scope, scope_ref: input.scope_ref });
|
|
66
|
+
}
|
|
67
|
+
/** Whether two markers are counted in the same thing and can therefore be ordered. */
|
|
68
|
+
export function sameScope(a, b) {
|
|
69
|
+
return a.scope === b.scope && (a.scope_ref ?? null) === (b.scope_ref ?? null);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Place a presented marker against what a verifier has established.
|
|
73
|
+
*
|
|
74
|
+
* | established | presented | outcome |
|
|
75
|
+
* |-------------|--------------------|---------------|
|
|
76
|
+
* | `null` | any | `unplaceable` |
|
|
77
|
+
* | any | `null` | `unplaceable` |
|
|
78
|
+
* | any | a different scope | `unplaceable` |
|
|
79
|
+
* | m | >= m | `forward` |
|
|
80
|
+
* | m | < m | `regressed` |
|
|
81
|
+
*
|
|
82
|
+
* Equal is `forward`, not a third thing: a view that has not moved has not gone backwards.
|
|
83
|
+
*
|
|
84
|
+
* `unplaceable` is where the honesty of the whole module sits. It is returned for a first
|
|
85
|
+
* read and for a cross-scope comparison, it is NOT a verdict, and nothing downstream turns
|
|
86
|
+
* it into one on its own. The proposed text gives a verifier with no prior observation
|
|
87
|
+
* nothing to compare against and does not say whether such a read is trusted or refused.
|
|
88
|
+
*
|
|
89
|
+
* Comparison is integer, through BigInt, never lexical: "10" is after "9".
|
|
90
|
+
*
|
|
91
|
+
* Never throws for a malformed marker. A marker this function cannot read is one it cannot
|
|
92
|
+
* place, which is `unplaceable`, and throwing on the read path of a state comparison would
|
|
93
|
+
* turn a data problem into a crash in a verifier.
|
|
94
|
+
*/
|
|
95
|
+
export function compareStateMarker(established, presented) {
|
|
96
|
+
if (!established || !presented)
|
|
97
|
+
return 'unplaceable';
|
|
98
|
+
if (typeof established.value !== 'string' || !DECIMAL.test(established.value))
|
|
99
|
+
return 'unplaceable';
|
|
100
|
+
if (typeof presented.value !== 'string' || !DECIMAL.test(presented.value))
|
|
101
|
+
return 'unplaceable';
|
|
102
|
+
if (!sameScope(established, presented))
|
|
103
|
+
return 'unplaceable';
|
|
104
|
+
return BigInt(presented.value) >= BigInt(established.value) ? 'forward' : 'regressed';
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The high-water mark a verifier holds after reading a presented view.
|
|
108
|
+
*
|
|
109
|
+
* It only ever moves forward. A regressed view does not lower it, an unplaceable view does
|
|
110
|
+
* not replace it, and a verifier that had none adopts the presented one. This is the
|
|
111
|
+
* "monotonicity against what the verifier has established" limb of CAND-08, which is
|
|
112
|
+
* weaker than a rule against global truth and is the honest strength available: a verifier
|
|
113
|
+
* that has never seen the newer state cannot detect a regression and is not at fault.
|
|
114
|
+
*/
|
|
115
|
+
export function advanceHighWaterMark(established, presented) {
|
|
116
|
+
if (!presented)
|
|
117
|
+
return established ?? null;
|
|
118
|
+
if (!established)
|
|
119
|
+
return presented;
|
|
120
|
+
return compareStateMarker(established, presented) === 'forward' ? presented : established;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker.js","sourceRoot":"","sources":["../../../../src/v2/authority-state/marker.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { AuthorityValidationResult } from '../authority-delegation/types.js';
|
|
2
|
+
import type { LifecycleMappingOptions } from '../lifecycle-state/map.js';
|
|
3
|
+
import type { CompositeAuthorityResult, LifecycleStateResult } from '../lifecycle-state/types.js';
|
|
4
|
+
import type { CorrectedRevocationView, MonotonicityOutcome, StateMarker } from './types.js';
|
|
5
|
+
/** A chain result, the lifecycle vocabulary's reading of it, how the state view placed, and
|
|
6
|
+
* the correction records that reference any revocation behind it.
|
|
7
|
+
*
|
|
8
|
+
* Four fields, four separate claims, none merged into another. `chain` is byte for byte
|
|
9
|
+
* what `verifyAuthorityDelegationChain` returned and a caller that reads only that field
|
|
10
|
+
* sees exactly today's behaviour. */
|
|
11
|
+
export interface AuthorityStateReport<TChain> extends CompositeAuthorityResult<TChain> {
|
|
12
|
+
/** How the presented state view placed against the verifier's established mark, or
|
|
13
|
+
* `undefined` when no state comparison ran. */
|
|
14
|
+
readonly monotonicity?: MonotonicityOutcome;
|
|
15
|
+
/** The mark the verifier holds after this read. */
|
|
16
|
+
readonly highWaterMarkAfter?: StateMarker | null;
|
|
17
|
+
/** Revocations behind this result together with the withdrawals referencing them. Empty
|
|
18
|
+
* or absent when none was submitted. A non-empty `accepted` list NEVER implies the chain
|
|
19
|
+
* result would have been different. */
|
|
20
|
+
readonly corrections?: readonly CorrectedRevocationView[];
|
|
21
|
+
}
|
|
22
|
+
export interface AuthorityStateReportInput<TChain> {
|
|
23
|
+
readonly chain: TChain;
|
|
24
|
+
readonly lifecycle?: LifecycleStateResult;
|
|
25
|
+
readonly monotonicity?: MonotonicityOutcome;
|
|
26
|
+
readonly highWaterMarkAfter?: StateMarker | null;
|
|
27
|
+
readonly corrections?: readonly CorrectedRevocationView[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Assemble the report.
|
|
31
|
+
*
|
|
32
|
+
* A pure structural constructor. It computes no verdict, consults no record and cannot
|
|
33
|
+
* change one: every field is what its own module already concluded. That is the shape of
|
|
34
|
+
* the doctrine it encodes. A later finding is a new record that references an earlier one
|
|
35
|
+
* and states its own effect, so the correction sits BESIDE the chain result rather than
|
|
36
|
+
* inside it, and a reader can present both and their relation.
|
|
37
|
+
*/
|
|
38
|
+
export declare function authorityStateReport<TChain>(input: AuthorityStateReportInput<TChain>): AuthorityStateReport<TChain>;
|
|
39
|
+
/**
|
|
40
|
+
* The common case, in one call: take a chain result, express it in the lifecycle vocabulary
|
|
41
|
+
* and attach the state findings.
|
|
42
|
+
*
|
|
43
|
+
* Convenience over `mapAuthorityValidationToLifecycle` plus `authorityStateReport`, with no
|
|
44
|
+
* behaviour of its own. Read-only: the chain result is not mutated and is carried through
|
|
45
|
+
* unchanged.
|
|
46
|
+
*
|
|
47
|
+
* The property worth stating: for a chain whose root is revoked, the lifecycle verdict is
|
|
48
|
+
* `invalid` with reason `REVOKED` whether or not `corrections` carries an accepted
|
|
49
|
+
* withdrawal. An accepted correction does not move the verdict one step toward valid. It is
|
|
50
|
+
* reported, and reporting it is the whole of its effect here.
|
|
51
|
+
*/
|
|
52
|
+
export declare function reportAuthorityState(chain: AuthorityValidationResult, input?: Omit<AuthorityStateReportInput<AuthorityValidationResult>, 'chain' | 'lifecycle'> & {
|
|
53
|
+
readonly lifecycleOptions?: LifecycleMappingOptions;
|
|
54
|
+
}): AuthorityStateReport<AuthorityValidationResult>;
|
|
55
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../src/v2/authority-state/report.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAA;AAEjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,KAAK,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACjG,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE3F;;;;;sCAKsC;AACtC,MAAM,WAAW,oBAAoB,CAAC,MAAM,CAAE,SAAQ,wBAAwB,CAAC,MAAM,CAAC;IACpF;oDACgD;IAChD,QAAQ,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAA;IAC3C,mDAAmD;IACnD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAChD;;4CAEwC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAA;CAC1D;AAED,MAAM,WAAW,yBAAyB,CAAC,MAAM;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAA;IACzC,QAAQ,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAA;IAC3C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAChD,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAA;CAC1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EACzC,KAAK,EAAE,yBAAyB,CAAC,MAAM,CAAC,GACvC,oBAAoB,CAAC,MAAM,CAAC,CAa9B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,yBAAyB,EAChC,KAAK,GAAE,IAAI,CAAC,yBAAyB,CAAC,yBAAyB,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC,GAAG;IACzF,QAAQ,CAAC,gBAAgB,CAAC,EAAE,uBAAuB,CAAA;CAC/C,GACL,oBAAoB,CAAC,yBAAyB,CAAC,CAQjD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Copyright (c) 2026 Tymofii Pidlisnyi
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
//
|
|
4
|
+
// PROPOSED, OPT-IN. Reporting a chain result, a lifecycle verdict, the monotonicity finding
|
|
5
|
+
// and any correction records TOGETHER, without any of them rewriting another.
|
|
6
|
+
// See ./types.ts for the specification position. Proposed.
|
|
7
|
+
import { mapAuthorityValidationToLifecycle } from '../lifecycle-state/map.js';
|
|
8
|
+
/**
|
|
9
|
+
* Assemble the report.
|
|
10
|
+
*
|
|
11
|
+
* A pure structural constructor. It computes no verdict, consults no record and cannot
|
|
12
|
+
* change one: every field is what its own module already concluded. That is the shape of
|
|
13
|
+
* the doctrine it encodes. A later finding is a new record that references an earlier one
|
|
14
|
+
* and states its own effect, so the correction sits BESIDE the chain result rather than
|
|
15
|
+
* inside it, and a reader can present both and their relation.
|
|
16
|
+
*/
|
|
17
|
+
export function authorityStateReport(input) {
|
|
18
|
+
const report = { chain: input.chain };
|
|
19
|
+
if (input.lifecycle !== undefined)
|
|
20
|
+
report.lifecycle = input.lifecycle;
|
|
21
|
+
if (input.monotonicity !== undefined)
|
|
22
|
+
report.monotonicity = input.monotonicity;
|
|
23
|
+
if (input.highWaterMarkAfter !== undefined)
|
|
24
|
+
report.highWaterMarkAfter = input.highWaterMarkAfter;
|
|
25
|
+
if (input.corrections !== undefined)
|
|
26
|
+
report.corrections = Object.freeze([...input.corrections]);
|
|
27
|
+
return Object.freeze(report);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The common case, in one call: take a chain result, express it in the lifecycle vocabulary
|
|
31
|
+
* and attach the state findings.
|
|
32
|
+
*
|
|
33
|
+
* Convenience over `mapAuthorityValidationToLifecycle` plus `authorityStateReport`, with no
|
|
34
|
+
* behaviour of its own. Read-only: the chain result is not mutated and is carried through
|
|
35
|
+
* unchanged.
|
|
36
|
+
*
|
|
37
|
+
* The property worth stating: for a chain whose root is revoked, the lifecycle verdict is
|
|
38
|
+
* `invalid` with reason `REVOKED` whether or not `corrections` carries an accepted
|
|
39
|
+
* withdrawal. An accepted correction does not move the verdict one step toward valid. It is
|
|
40
|
+
* reported, and reporting it is the whole of its effect here.
|
|
41
|
+
*/
|
|
42
|
+
export function reportAuthorityState(chain, input = {}) {
|
|
43
|
+
return authorityStateReport({
|
|
44
|
+
chain,
|
|
45
|
+
lifecycle: mapAuthorityValidationToLifecycle(chain, input.lifecycleOptions ?? {}),
|
|
46
|
+
monotonicity: input.monotonicity,
|
|
47
|
+
highWaterMarkAfter: input.highWaterMarkAfter,
|
|
48
|
+
corrections: input.corrections,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../../src/v2/authority-state/report.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,sCAAsC;AACtC,EAAE;AACF,4FAA4F;AAC5F,8EAA8E;AAC9E,2DAA2D;AAG3D,OAAO,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAA;AA+B7E;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAwC;IAExC,MAAM,MAAM,GAMR,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAA;IAC1B,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAA;IACrE,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS;QAAE,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAA;IAC9E,IAAI,KAAK,CAAC,kBAAkB,KAAK,SAAS;QAAE,MAAM,CAAC,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,CAAA;IAChG,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;IAC/F,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC9B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAgC,EAChC,KAAK,GAED,EAAE;IAEN,OAAO,oBAAoB,CAAC;QAC1B,KAAK;QACL,SAAS,EAAE,iCAAiC,CAAC,KAAK,EAAE,KAAK,CAAC,gBAAgB,IAAI,EAAE,CAAC;QACjF,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;QAC5C,WAAW,EAAE,KAAK,CAAC,WAAW;KAC/B,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { AuthorityDelegationV1, RevocationResolution } from '../authority-delegation/types.js';
|
|
2
|
+
import type { AuthorityRevocationVerificationOptions } from '../authority-revocation/verify.js';
|
|
3
|
+
import type { MonotonicityOutcome, RetainedAuthorityState, StateMarker, UnplaceableDisposition } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* What the records a verifier RETAINED say about one delegation.
|
|
6
|
+
*
|
|
7
|
+
* Two answers only.
|
|
8
|
+
*
|
|
9
|
+
* - `revoked`, when one retained record verifies against this delegation under
|
|
10
|
+
* `verifyAuthorityRevocation`. The record is re-verified here rather than trusted: a
|
|
11
|
+
* record that reached the retained set by some other route cannot assert a revocation,
|
|
12
|
+
* which is the same discipline `createAuthorityRevocationResolver` applies to a stored
|
|
13
|
+
* record.
|
|
14
|
+
* - `unknown`, for everything else.
|
|
15
|
+
*
|
|
16
|
+
* NEVER `active`. A retained record set is not a store: it says nothing about the
|
|
17
|
+
* delegations it does not mention, so its silence is ignorance and not a finding. That is
|
|
18
|
+
* L7 ("a revocation answer that is unavailable or stale is indeterminate. It does not
|
|
19
|
+
* become active"), and it is why the two-verifier split in `RetainedAuthorityState` has
|
|
20
|
+
* any content at all. A verifier that kept the records answers `revoked`. A verifier that
|
|
21
|
+
* kept only the number answers `unknown`, which the chain verifier turns into
|
|
22
|
+
* `indeterminate` with `REVOCATION_UNKNOWN`. Those are different verifiers and reporting
|
|
23
|
+
* the same thing for both would be the error.
|
|
24
|
+
*
|
|
25
|
+
* Never throws. A retained set that cannot be read is one that establishes nothing.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveUnderRetainedState(delegation: AuthorityDelegationV1, retained: RetainedAuthorityState, options: AuthorityRevocationVerificationOptions): RevocationResolution;
|
|
28
|
+
export interface MonotonicRevocationResolverOptions {
|
|
29
|
+
/** The resolver for the state view actually presented, typically
|
|
30
|
+
* `createAuthorityRevocationResolver(store, options)`. Consulted only when the presented
|
|
31
|
+
* view is not behind what the verifier has established. */
|
|
32
|
+
readonly presented: (delegation: AuthorityDelegationV1) => RevocationResolution;
|
|
33
|
+
/** The marker the presented view carries, or `null` when it carries none. */
|
|
34
|
+
readonly presentedMarker: StateMarker | null;
|
|
35
|
+
/** What this verifier has established: the records it kept and the newest marker it saw. */
|
|
36
|
+
readonly retained: RetainedAuthorityState;
|
|
37
|
+
/** Key resolution for re-verifying retained records. */
|
|
38
|
+
readonly verification: AuthorityRevocationVerificationOptions;
|
|
39
|
+
/** REQUIRED, with no default. What to do when the presented view cannot be placed
|
|
40
|
+
* against an established mark, which happens on a first read and on a cross-scope
|
|
41
|
+
* comparison.
|
|
42
|
+
*
|
|
43
|
+
* `read_presented` reads the view as current. `refuse` answers `unknown` for every
|
|
44
|
+
* delegation, which the chain verifier turns into `indeterminate`. Both are defensible,
|
|
45
|
+
* the outcomes differ, and neither the proposed text nor draft-03 chooses between them,
|
|
46
|
+
* so this module does not choose either. The absence of a default is the point. */
|
|
47
|
+
readonly onUnplaceable: UnplaceableDisposition;
|
|
48
|
+
}
|
|
49
|
+
export interface MonotonicRevocationResolver {
|
|
50
|
+
/** The one-argument callable `verifyAuthorityDelegationChain` already takes. Pass it
|
|
51
|
+
* straight through as `resolveRevocation`. */
|
|
52
|
+
readonly resolve: (delegation: AuthorityDelegationV1) => RevocationResolution;
|
|
53
|
+
/** How the presented view placed against the established mark. Reported so a caller can
|
|
54
|
+
* say WHY it answered as it did, rather than only what it answered. */
|
|
55
|
+
readonly monotonicity: MonotonicityOutcome;
|
|
56
|
+
/** The mark the verifier holds after this read. Only ever moves forward. */
|
|
57
|
+
readonly highWaterMarkAfter: StateMarker | null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Compose a presented state view, an established high-water mark and a retained record set
|
|
61
|
+
* into the resolver the chain verifier already takes.
|
|
62
|
+
*
|
|
63
|
+
* | monotonicity | what `resolve` consults |
|
|
64
|
+
* |---------------|---------------------------------------------------------------------|
|
|
65
|
+
* | `forward` | the presented view, normally |
|
|
66
|
+
* | `regressed` | the retained records ONLY: `revoked` or `unknown`, never `active` |
|
|
67
|
+
* | `unplaceable` | the presented view, or nothing, per `onUnplaceable` |
|
|
68
|
+
*
|
|
69
|
+
* The regressed row is CAND-08: a restore, a snapshot mount or a lagging replica presents
|
|
70
|
+
* state from before a revocation, and this refuses to read it as current rather than
|
|
71
|
+
* resolving the disagreement by recency of write. What it does NOT do is claim a revocation
|
|
72
|
+
* it cannot establish. A verifier that retained the record reports `revoked`; one that
|
|
73
|
+
* retained only the mark reports `unknown`, and `unknown` is not established, not false.
|
|
74
|
+
*
|
|
75
|
+
* Nothing here changes the chain verdict directly. The chain verifier decides that, from
|
|
76
|
+
* the answer this resolver gives it, exactly as it does today.
|
|
77
|
+
*
|
|
78
|
+
* Pure: no clock, no network, no randomness, no I/O. The marker and the record set are
|
|
79
|
+
* caller supplied, and `presented` is a caller-supplied callback.
|
|
80
|
+
*/
|
|
81
|
+
export declare function createMonotonicRevocationResolver(options: MonotonicRevocationResolverOptions): MonotonicRevocationResolver;
|
|
82
|
+
//# sourceMappingURL=retained.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retained.d.ts","sourceRoot":"","sources":["../../../../src/v2/authority-state/retained.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAEnG,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,mCAAmC,CAAA;AAE/F,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,WAAW,EACX,sBAAsB,EACvB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,qBAAqB,EACjC,QAAQ,EAAE,sBAAsB,EAChC,OAAO,EAAE,sCAAsC,GAC9C,oBAAoB,CAUtB;AAED,MAAM,WAAW,kCAAkC;IACjD;;gEAE4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,qBAAqB,KAAK,oBAAoB,CAAA;IAC/E,6EAA6E;IAC7E,QAAQ,CAAC,eAAe,EAAE,WAAW,GAAG,IAAI,CAAA;IAC5C,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAA;IACzC,wDAAwD;IACxD,QAAQ,CAAC,YAAY,EAAE,sCAAsC,CAAA;IAC7D;;;;;;;wFAOoF;IACpF,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAA;CAC/C;AAED,MAAM,WAAW,2BAA2B;IAC1C;mDAC+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE,qBAAqB,KAAK,oBAAoB,CAAA;IAC7E;4EACwE;IACxE,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAA;IAC1C,4EAA4E;IAC5E,QAAQ,CAAC,kBAAkB,EAAE,WAAW,GAAG,IAAI,CAAA;CAChD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,kCAAkC,GAC1C,2BAA2B,CAoB7B"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Copyright (c) 2026 Tymofii Pidlisnyi
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
//
|
|
4
|
+
// PROPOSED, OPT-IN. Resolving revocation state under a retained high-water mark.
|
|
5
|
+
// See ./types.ts for the specification position. Concept source:
|
|
6
|
+
// aeoess/agent-authority-lifecycle, invariant candidate CAND-08 and invariants L7 and L11.
|
|
7
|
+
// Proposed.
|
|
8
|
+
//
|
|
9
|
+
// WHAT THIS DOES NOT TOUCH. `AuthorityChainVerificationOptions` is unchanged. The existing
|
|
10
|
+
// `createAuthorityRevocationResolver` is unchanged, and its one-argument shape is the shape
|
|
11
|
+
// this module produces too: everything new closes over its own state and hands the chain
|
|
12
|
+
// verifier back the same callable it already takes. That was the alternative to widening
|
|
13
|
+
// the resolver signature, and widening it would have been a breaking change to an exported
|
|
14
|
+
// API for the sake of a proposed feature.
|
|
15
|
+
import { verifyAuthorityRevocation } from '../authority-revocation/verify.js';
|
|
16
|
+
import { advanceHighWaterMark, compareStateMarker } from './marker.js';
|
|
17
|
+
/**
|
|
18
|
+
* What the records a verifier RETAINED say about one delegation.
|
|
19
|
+
*
|
|
20
|
+
* Two answers only.
|
|
21
|
+
*
|
|
22
|
+
* - `revoked`, when one retained record verifies against this delegation under
|
|
23
|
+
* `verifyAuthorityRevocation`. The record is re-verified here rather than trusted: a
|
|
24
|
+
* record that reached the retained set by some other route cannot assert a revocation,
|
|
25
|
+
* which is the same discipline `createAuthorityRevocationResolver` applies to a stored
|
|
26
|
+
* record.
|
|
27
|
+
* - `unknown`, for everything else.
|
|
28
|
+
*
|
|
29
|
+
* NEVER `active`. A retained record set is not a store: it says nothing about the
|
|
30
|
+
* delegations it does not mention, so its silence is ignorance and not a finding. That is
|
|
31
|
+
* L7 ("a revocation answer that is unavailable or stale is indeterminate. It does not
|
|
32
|
+
* become active"), and it is why the two-verifier split in `RetainedAuthorityState` has
|
|
33
|
+
* any content at all. A verifier that kept the records answers `revoked`. A verifier that
|
|
34
|
+
* kept only the number answers `unknown`, which the chain verifier turns into
|
|
35
|
+
* `indeterminate` with `REVOCATION_UNKNOWN`. Those are different verifiers and reporting
|
|
36
|
+
* the same thing for both would be the error.
|
|
37
|
+
*
|
|
38
|
+
* Never throws. A retained set that cannot be read is one that establishes nothing.
|
|
39
|
+
*/
|
|
40
|
+
export function resolveUnderRetainedState(delegation, retained, options) {
|
|
41
|
+
try {
|
|
42
|
+
const records = retained?.records ?? [];
|
|
43
|
+
for (const record of records) {
|
|
44
|
+
if (verifyAuthorityRevocation(record, delegation, options).state === 'valid')
|
|
45
|
+
return 'revoked';
|
|
46
|
+
}
|
|
47
|
+
return 'unknown';
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return 'unknown';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Compose a presented state view, an established high-water mark and a retained record set
|
|
55
|
+
* into the resolver the chain verifier already takes.
|
|
56
|
+
*
|
|
57
|
+
* | monotonicity | what `resolve` consults |
|
|
58
|
+
* |---------------|---------------------------------------------------------------------|
|
|
59
|
+
* | `forward` | the presented view, normally |
|
|
60
|
+
* | `regressed` | the retained records ONLY: `revoked` or `unknown`, never `active` |
|
|
61
|
+
* | `unplaceable` | the presented view, or nothing, per `onUnplaceable` |
|
|
62
|
+
*
|
|
63
|
+
* The regressed row is CAND-08: a restore, a snapshot mount or a lagging replica presents
|
|
64
|
+
* state from before a revocation, and this refuses to read it as current rather than
|
|
65
|
+
* resolving the disagreement by recency of write. What it does NOT do is claim a revocation
|
|
66
|
+
* it cannot establish. A verifier that retained the record reports `revoked`; one that
|
|
67
|
+
* retained only the mark reports `unknown`, and `unknown` is not established, not false.
|
|
68
|
+
*
|
|
69
|
+
* Nothing here changes the chain verdict directly. The chain verifier decides that, from
|
|
70
|
+
* the answer this resolver gives it, exactly as it does today.
|
|
71
|
+
*
|
|
72
|
+
* Pure: no clock, no network, no randomness, no I/O. The marker and the record set are
|
|
73
|
+
* caller supplied, and `presented` is a caller-supplied callback.
|
|
74
|
+
*/
|
|
75
|
+
export function createMonotonicRevocationResolver(options) {
|
|
76
|
+
const monotonicity = compareStateMarker(options.retained?.highWaterMark ?? null, options.presentedMarker);
|
|
77
|
+
const highWaterMarkAfter = advanceHighWaterMark(options.retained?.highWaterMark ?? null, options.presentedMarker);
|
|
78
|
+
const resolve = (delegation) => {
|
|
79
|
+
if (monotonicity === 'regressed') {
|
|
80
|
+
return resolveUnderRetainedState(delegation, options.retained, options.verification);
|
|
81
|
+
}
|
|
82
|
+
if (monotonicity === 'unplaceable' && options.onUnplaceable === 'refuse')
|
|
83
|
+
return 'unknown';
|
|
84
|
+
try {
|
|
85
|
+
return options.presented(delegation);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return 'unknown';
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return Object.freeze({ resolve, monotonicity, highWaterMarkAfter });
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=retained.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retained.js","sourceRoot":"","sources":["../../../../src/v2/authority-state/retained.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,sCAAsC;AACtC,EAAE;AACF,iFAAiF;AACjF,iEAAiE;AACjE,2FAA2F;AAC3F,YAAY;AACZ,EAAE;AACF,2FAA2F;AAC3F,4FAA4F;AAC5F,yFAAyF;AACzF,yFAAyF;AACzF,2FAA2F;AAC3F,0CAA0C;AAG1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAE7E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAQtE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAAiC,EACjC,QAAgC,EAChC,OAA+C;IAE/C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,QAAQ,EAAE,OAAO,IAAI,EAAE,CAAA;QACvC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,yBAAyB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,KAAK,OAAO;gBAAE,OAAO,SAAS,CAAA;QAChG,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAmCD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,iCAAiC,CAC/C,OAA2C;IAE3C,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,IAAI,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IACzG,MAAM,kBAAkB,GAAG,oBAAoB,CAC7C,OAAO,CAAC,QAAQ,EAAE,aAAa,IAAI,IAAI,EACvC,OAAO,CAAC,eAAe,CACxB,CAAA;IAED,MAAM,OAAO,GAAG,CAAC,UAAiC,EAAwB,EAAE;QAC1E,IAAI,YAAY,KAAK,WAAW,EAAE,CAAC;YACjC,OAAO,yBAAyB,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;QACtF,CAAC;QACD,IAAI,YAAY,KAAK,aAAa,IAAI,OAAO,CAAC,aAAa,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAA;QAC1F,IAAI,CAAC;YACH,OAAO,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC,CAAA;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC,CAAA;AACrE,CAAC"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { AuthorityRevocationV1 } from '../authority-revocation/types.js';
|
|
2
|
+
/** What a marker is counted within. Comparing two markers from different scopes orders
|
|
3
|
+
* nothing, so the comparison reports `unplaceable` rather than inventing an order.
|
|
4
|
+
*
|
|
5
|
+
* The proposed text names none of these. They exist because the fixture that forced this
|
|
6
|
+
* module had to pick one (it picked a global integer on a state view) and recorded that
|
|
7
|
+
* the choice was not read from the text. Carrying the scope makes that choice visible in
|
|
8
|
+
* the record instead of implicit in the deployment. Proposed. */
|
|
9
|
+
export declare const STATE_MARKER_SCOPES: readonly ['global', 'per_delegation', 'per_principal', 'per_store'];
|
|
10
|
+
export type StateMarkerScope = (typeof STATE_MARKER_SCOPES)[number];
|
|
11
|
+
/** A monotonic generation marker on authority state.
|
|
12
|
+
*
|
|
13
|
+
* `value` is a canonical unsigned decimal integer, the same convention the seven-facet
|
|
14
|
+
* authority vector already uses for spend quantities: no sign, no leading zero, no
|
|
15
|
+
* separators, arbitrary width. It is a string rather than a number so a marker past
|
|
16
|
+
* 2^53 - 1 stays exact, and it is compared as an integer, never lexically.
|
|
17
|
+
*
|
|
18
|
+
* Nothing here is signed and nothing here is a wire field. No delegation, revocation or
|
|
19
|
+
* store in this SDK carries a marker, and none is being given one: a marker is state the
|
|
20
|
+
* caller has about a state source, handed in at comparison time. Proposed. */
|
|
21
|
+
export interface StateMarker {
|
|
22
|
+
readonly value: string;
|
|
23
|
+
readonly scope: StateMarkerScope;
|
|
24
|
+
/** Which delegation, principal or store this marker is counted within. Required on every
|
|
25
|
+
* scope except `global`, where it is absent. */
|
|
26
|
+
readonly scope_ref?: string;
|
|
27
|
+
}
|
|
28
|
+
/** The result of placing a presented marker against what a verifier has established.
|
|
29
|
+
*
|
|
30
|
+
* - `forward` the presented marker advanced, or held equal. Read the view normally.
|
|
31
|
+
* - `regressed` the presented marker went backwards against an established high-water
|
|
32
|
+
* mark. CAND-08's refusal case.
|
|
33
|
+
* - `unplaceable` there is nothing to compare against, or the two markers are counted in
|
|
34
|
+
* different scopes. **Deliberately not a verdict.** A high-water mark has
|
|
35
|
+
* to start somewhere and neither the proposed text nor draft-03 says
|
|
36
|
+
* whether a first read is trusted or refused. Both are defensible and the
|
|
37
|
+
* outcomes differ, so this module reports the fact and the caller
|
|
38
|
+
* decides. See `UnplaceableDisposition`. */
|
|
39
|
+
export declare const MONOTONICITY_OUTCOMES: readonly ['forward', 'regressed', 'unplaceable'];
|
|
40
|
+
export type MonotonicityOutcome = (typeof MONOTONICITY_OUTCOMES)[number];
|
|
41
|
+
/** What a caller wants done with an `unplaceable` presented view. Required, with no
|
|
42
|
+
* default, because the SDK picking one would be the SDK deciding a question its own
|
|
43
|
+
* concept source records as undecided. */
|
|
44
|
+
export declare const UNPLACEABLE_DISPOSITIONS: readonly ['read_presented', 'refuse'];
|
|
45
|
+
export type UnplaceableDisposition = (typeof UNPLACEABLE_DISPOSITIONS)[number];
|
|
46
|
+
/** What a verifier has established about authority state, as TWO separate inputs.
|
|
47
|
+
*
|
|
48
|
+
* Splitting them is the whole point of this type. Two verifiers can hold the same
|
|
49
|
+
* high-water mark and give different answers about the same restored view: the one that
|
|
50
|
+
* retained the revocation records it observed can establish a revocation from records and
|
|
51
|
+
* answers `revoked`, and the one that retained only the number cannot, and answers
|
|
52
|
+
* `unknown`, which draft-03 section 3.3 makes indeterminate. The proposed text does not
|
|
53
|
+
* distinguish those two verifiers at all, and the distinction turns out to be the
|
|
54
|
+
* substance of the rollback question. An API taking "the epoch" as one value cannot
|
|
55
|
+
* express it.
|
|
56
|
+
*
|
|
57
|
+
* `records` is not a store and does not behave like one. It can answer `revoked` and it
|
|
58
|
+
* can answer `unknown`. It can never answer `active`: a retained record set says nothing
|
|
59
|
+
* about the delegations it does not mention, which is the same reason absence from an
|
|
60
|
+
* `AuthorityRevocationStore` is `unknown` rather than `active`. */
|
|
61
|
+
export interface RetainedAuthorityState {
|
|
62
|
+
/** Revocation records the verifier retained at its high-water mark. Each is re-verified
|
|
63
|
+
* against the delegation in front of it before it can produce a `revoked` answer, so a
|
|
64
|
+
* record that reached this array by some other route still cannot assert one. */
|
|
65
|
+
readonly records: readonly AuthorityRevocationV1[];
|
|
66
|
+
/** The newest marker this verifier has established, or `null` if it has established
|
|
67
|
+
* none. */
|
|
68
|
+
readonly highWaterMark: StateMarker | null;
|
|
69
|
+
}
|
|
70
|
+
/** Why a fenced write was refused.
|
|
71
|
+
*
|
|
72
|
+
* - `stale_fencing_token` the token went backwards against the highest already seen.
|
|
73
|
+
* The only one of the three the source states.
|
|
74
|
+
* - `fencing_scope_mismatch` the token is counted in a different scope from the log's, so
|
|
75
|
+
* it cannot be ordered against what the log holds.
|
|
76
|
+
* - `fencing_token_unreadable` the token is absent or not a well-formed `StateMarker`.
|
|
77
|
+
*
|
|
78
|
+
* A write path that cannot order a token is not fenced, so the second and third refuse
|
|
79
|
+
* rather than guess. Neither is in any source; both are this module's choice. */
|
|
80
|
+
export declare const FENCED_WRITE_REFUSAL_CODES: readonly ['stale_fencing_token', 'fencing_scope_mismatch', 'fencing_token_unreadable'];
|
|
81
|
+
export type FencedWriteRefusalCode = (typeof FENCED_WRITE_REFUSAL_CODES)[number];
|
|
82
|
+
/** An authority-state write carrying the token of whoever claims to be the current
|
|
83
|
+
* publisher. */
|
|
84
|
+
export interface FencedWrite<T> {
|
|
85
|
+
readonly token: StateMarker;
|
|
86
|
+
readonly payload: T;
|
|
87
|
+
}
|
|
88
|
+
/** What a fenced log reports about one write.
|
|
89
|
+
*
|
|
90
|
+
* An EQUAL token is accepted, and that is not an oversight. The rule the source states is
|
|
91
|
+
* about tokens going backwards, and an equal token has not gone backwards: it is the same
|
|
92
|
+
* holder retrying, which makes a retry idempotent. */
|
|
93
|
+
export type FencedWriteOutcome<T> = {
|
|
94
|
+
readonly accepted: true;
|
|
95
|
+
readonly published: StateMarker;
|
|
96
|
+
readonly payload: T;
|
|
97
|
+
} | {
|
|
98
|
+
readonly accepted: false;
|
|
99
|
+
readonly code: FencedWriteRefusalCode;
|
|
100
|
+
readonly published: StateMarker | null;
|
|
101
|
+
};
|
|
102
|
+
/** The record type a withdrawal carries.
|
|
103
|
+
*
|
|
104
|
+
* `proposed:` is load-bearing. Record fields, failure-class names and verifier semantics
|
|
105
|
+
* are conformance vocabulary reserved to the maintainer, and neither draft-03 nor the
|
|
106
|
+
* proposed text defines a record for withdrawing a recorded revocation or says what a
|
|
107
|
+
* verifier should do with one. This is a placeholder to argue about, not APS vocabulary. */
|
|
108
|
+
export declare const REVOCATION_WITHDRAWAL_RECORD_TYPE: 'proposed:aps:revocation-withdrawal:v0';
|
|
109
|
+
export declare const REVOCATION_WITHDRAWAL_VERSION: '0';
|
|
110
|
+
/** A record stating that a recorded revocation was published in error.
|
|
111
|
+
*
|
|
112
|
+
* It REFERENCES the revocation and never removes it. Inside an `AuthorityRevocationStore`
|
|
113
|
+
* irreversibility is already structural: the store exposes `track`, `tracks`, `get` and
|
|
114
|
+
* `insertVerifiedRevocation`, there is no removal method, and this module does not add
|
|
115
|
+
* one. Draft-03 section 3.5 states "Revocation is irreversible", and a removal method
|
|
116
|
+
* would be one call away from breaking it.
|
|
117
|
+
*
|
|
118
|
+
* NOT AUTHENTICATED BY THIS MODULE. There is no canonical preimage here, no signature
|
|
119
|
+
* field, and no verification function, deliberately: minting the signed form of a record
|
|
120
|
+
* type is the vocabulary decision this module is not entitled to make. A caller hands in a
|
|
121
|
+
* withdrawal it has already authenticated, exactly as `insertVerifiedRevocation` takes a
|
|
122
|
+
* revocation `recordAuthorityRevocation` has already verified. Whoever reaches
|
|
123
|
+
* `evaluateRevocationWithdrawal` is the party asserting the record is genuine. */
|
|
124
|
+
export interface RevocationWithdrawalV0 {
|
|
125
|
+
readonly record_type: typeof REVOCATION_WITHDRAWAL_RECORD_TYPE;
|
|
126
|
+
readonly version: typeof REVOCATION_WITHDRAWAL_VERSION;
|
|
127
|
+
/** The revocation this record withdraws: `sha256:<64 lowercase hex>`. */
|
|
128
|
+
readonly revocation_id: string;
|
|
129
|
+
/** The delegation that revocation named. Carried so a withdrawal that names a revocation
|
|
130
|
+
* of a different delegation is refusable without a second lookup. */
|
|
131
|
+
readonly delegation_id: string;
|
|
132
|
+
/** Who states the withdrawal. Whether this party may is NOT decided here. */
|
|
133
|
+
readonly withdrawn_by: string;
|
|
134
|
+
/** Canonical UTC-millisecond time, supplied by the caller, never read from a clock. */
|
|
135
|
+
readonly withdrawn_at: string;
|
|
136
|
+
/** Machine-readable ground. No grammar is fixed for one and none is invented here. */
|
|
137
|
+
readonly reason_code: string;
|
|
138
|
+
/** OPTIONAL free-text detail. Absent means the key is not present at all. */
|
|
139
|
+
readonly detail?: string;
|
|
140
|
+
}
|
|
141
|
+
/** What an injected standing resolver may answer.
|
|
142
|
+
*
|
|
143
|
+
* `unknown` is a first-class answer and is not `no_standing`. A verifier that cannot
|
|
144
|
+
* establish whether the withdrawer had standing has not established that they lacked it,
|
|
145
|
+
* and the refusal reason says which of the two happened. */
|
|
146
|
+
export declare const WITHDRAWAL_STANDINGS: readonly ['has_standing', 'no_standing', 'unknown'];
|
|
147
|
+
export type WithdrawalStanding = (typeof WITHDRAWAL_STANDINGS)[number];
|
|
148
|
+
/** Decides whether a withdrawal's author may withdraw this revocation.
|
|
149
|
+
*
|
|
150
|
+
* Injected, never hardcoded, and never read from the withdrawal record itself. Draft-03
|
|
151
|
+
* section 3.5 states "Any delegation MAY be revoked by its issuer" and the SDK enforces
|
|
152
|
+
* `revoker === issuer` for a revocation. Nothing anywhere states who may WITHDRAW one.
|
|
153
|
+
* `withdrawalSignerIsRevoker` is supplied as one resolver, is what the forcing fixture
|
|
154
|
+
* chose, and is a choice rather than a rule read from any text. */
|
|
155
|
+
export type WithdrawalStandingResolver = (withdrawal: RevocationWithdrawalV0, revocation: AuthorityRevocationV1) => WithdrawalStanding;
|
|
156
|
+
/** Why a withdrawal was accepted or refused. Stable, module-local codes. */
|
|
157
|
+
export declare const WITHDRAWAL_OUTCOME_CODES: readonly [
|
|
158
|
+
/** Accepted as a record. Accepted never means the revocation is gone. */
|
|
159
|
+
'WITHDRAWAL_ACCEPTED',
|
|
160
|
+
/** The record is not a well-formed `RevocationWithdrawalV0`. */
|
|
161
|
+
'WITHDRAWAL_SCHEMA_INVALID',
|
|
162
|
+
/** No revocation in the held set carries the `revocation_id` this record names. */
|
|
163
|
+
'WITHDRAWAL_NAMES_NO_HELD_REVOCATION',
|
|
164
|
+
/** The named revocation exists but is a revocation of a different delegation. */
|
|
165
|
+
'WITHDRAWAL_TARGET_MISMATCH',
|
|
166
|
+
/** The resolver established that this party may not withdraw this revocation. */
|
|
167
|
+
'WITHDRAWAL_SIGNER_WITHOUT_STANDING',
|
|
168
|
+
/** The resolver could not establish standing either way. Not the same finding as the
|
|
169
|
+
* one above, and reported as `not_established` rather than as a denial. */
|
|
170
|
+
'WITHDRAWAL_STANDING_NOT_ESTABLISHED'];
|
|
171
|
+
export type WithdrawalOutcomeCode = (typeof WITHDRAWAL_OUTCOME_CODES)[number];
|
|
172
|
+
/** What `evaluateRevocationWithdrawal` concludes about one withdrawal record. */
|
|
173
|
+
export interface WithdrawalEvaluation {
|
|
174
|
+
readonly accepted: boolean;
|
|
175
|
+
readonly reason_code: WithdrawalOutcomeCode;
|
|
176
|
+
/** What the resolver answered, or `null` when evaluation refused before asking it. */
|
|
177
|
+
readonly standing: WithdrawalStanding | null;
|
|
178
|
+
/** The record evaluated, unchanged. */
|
|
179
|
+
readonly withdrawal: RevocationWithdrawalV0;
|
|
180
|
+
}
|
|
181
|
+
/** The current position of one revocation together with every withdrawal referencing it.
|
|
182
|
+
*
|
|
183
|
+
* This is CAND-02 made into a shape. The revocation is present, unchanged, whether or not
|
|
184
|
+
* a withdrawal was accepted. A later finding is a new record that references the earlier
|
|
185
|
+
* one and states its own effect; it is never an edit of the earlier one and never its
|
|
186
|
+
* removal. A verifier that must report "revoked, and the revoker later said this was
|
|
187
|
+
* recorded in error" reports exactly this. */
|
|
188
|
+
export interface CorrectedRevocationView {
|
|
189
|
+
/** The revocation record, byte for byte what it was. */
|
|
190
|
+
readonly revocation: AuthorityRevocationV1;
|
|
191
|
+
/** Accepted withdrawals, in the order supplied. Non-empty does NOT make the revocation
|
|
192
|
+
* ineffective and does NOT change any chain verdict. */
|
|
193
|
+
readonly accepted: readonly WithdrawalEvaluation[];
|
|
194
|
+
/** Refused withdrawals, each with the code saying why. A withdrawal that changes nothing
|
|
195
|
+
* in silence is indistinguishable from one that was never submitted. */
|
|
196
|
+
readonly refused: readonly WithdrawalEvaluation[];
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/v2/authority-state/types.ts"],"names":[],"mappings":"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"}
|