@tinycloud/operations 0.4.0-beta.9 → 0.5.0-beta.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/coverage.json +9 -0
- package/dist/artifacts.cjs +19 -4
- package/dist/artifacts.cjs.map +1 -1
- package/dist/artifacts.d.cts +1 -1
- package/dist/artifacts.d.ts +1 -1
- package/dist/artifacts.js +19 -4
- package/dist/artifacts.js.map +1 -1
- package/dist/cli-runtime.cjs +4353 -659
- package/dist/cli-runtime.cjs.map +1 -1
- package/dist/cli-runtime.d.cts +1 -1
- package/dist/cli-runtime.d.ts +1 -1
- package/dist/cli-runtime.js +4348 -654
- package/dist/cli-runtime.js.map +1 -1
- package/dist/{contract-CjuEjE-M.d.cts → contract-DfyrluLB.d.cts} +24 -2
- package/dist/{contract-CjuEjE-M.d.ts → contract-DfyrluLB.d.ts} +24 -2
- package/dist/delegation-binding.cjs +3797 -253
- package/dist/delegation-binding.cjs.map +1 -1
- package/dist/delegation-binding.d.cts +104 -60
- package/dist/delegation-binding.d.ts +104 -60
- package/dist/delegation-binding.js +3773 -238
- package/dist/delegation-binding.js.map +1 -1
- package/dist/index.cjs +4349 -658
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4343 -652
- package/dist/index.js.map +1 -1
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.d.cts +1 -1
- package/dist/profile.d.ts +1 -1
- package/dist/profile.js.map +1 -1
- package/dist/state.cjs +9 -3
- package/dist/state.cjs.map +1 -1
- package/dist/state.d.cts +7 -0
- package/dist/state.d.ts +7 -0
- package/dist/state.js +9 -3
- package/dist/state.js.map +1 -1
- package/generated/operations.json +2665 -8
- package/package.json +4 -4
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PermissionEntry, ValidatedRuntimeDelegation, RuntimeDelegationActivator, PortableDelegation } from '@tinycloud/node-sdk';
|
|
2
2
|
import { O as OperationSpaceResolver } from './authority-ofwbEqmj.cjs';
|
|
3
|
+
import { S as StoredGrantSkipReason, b as OperationWarning } from './contract-DfyrluLB.cjs';
|
|
4
|
+
export { c as STORED_GRANT_SKIP_REASONS } from './contract-DfyrluLB.cjs';
|
|
3
5
|
import '@tinycloud/sdk-core';
|
|
4
6
|
|
|
5
7
|
/** Creates the one owner-aware resolver shared by operation matching paths. */
|
|
@@ -19,55 +21,54 @@ declare function operationSpaceResolver(node: unknown, ownerSpace?: string): (sp
|
|
|
19
21
|
* own signed capabilities (`unbound-import:<cid>`).
|
|
20
22
|
* - The one-time migration of records stored before bindings existed: exactly
|
|
21
23
|
* each record's own signed capabilities (`migrated:<cid>`).
|
|
24
|
+
* - The CLI's own grants (`tc auth request --grant`, permission escalation),
|
|
25
|
+
* once checked against the request they answer: exactly each grant's own
|
|
26
|
+
* signed capabilities (`cli-grant:<cid>`). Their signed-login records carry
|
|
27
|
+
* the `siweProof` replay verifies them from.
|
|
22
28
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
29
|
+
* Signed-login records the CLI stored without a `siweProof` cannot be
|
|
30
|
+
* verified from signed bytes and are not installed by either runtime.
|
|
25
31
|
*
|
|
26
32
|
* The binding is local profile data. It stops records written by any other
|
|
27
33
|
* path from granting authority. It does not stop someone who can write the
|
|
28
34
|
* profile directory, who already holds the session key and the signed bytes.
|
|
29
35
|
*/
|
|
30
|
-
type BindingSource = "migration" | "unbound-import";
|
|
31
|
-
/** The audit note written beside a binding
|
|
36
|
+
type BindingSource = "migration" | "unbound-import" | "cli-grant";
|
|
37
|
+
/** The audit note written beside a binding the record's writer synthesized. */
|
|
32
38
|
declare const BINDING_NOTES: Record<BindingSource, string>;
|
|
33
39
|
/** The per-profile marker: present once that profile's unbound records were migrated. */
|
|
34
40
|
declare function bindingMigrationPath(profile: string): string;
|
|
35
41
|
/**
|
|
36
|
-
*
|
|
42
|
+
* Compact and signed-login records require a valid request binding and signed
|
|
43
|
+
* proof. A legacy record with no proof is classified `other` only so replay
|
|
44
|
+
* can report `proof_missing`; it never installs. Malformed headers are refused.
|
|
37
45
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* - `other` records keep the CLI's legacy replay: an unbound record whose
|
|
41
|
-
* bytes are not compact and that has no `siweProof`, which is how the CLI
|
|
42
|
-
* stores its own signed-login grants. The operations runtime never installs
|
|
43
|
-
* them.
|
|
44
|
-
* - `refused` records install nothing anywhere.
|
|
45
|
-
*
|
|
46
|
-
* A record is `refused` unless its `delegationHeader` has exactly one own
|
|
47
|
-
* key, `Authorization`, with a string value: header names are matched
|
|
48
|
-
* case-insensitively on the wire, and other value types are stringified, so
|
|
49
|
-
* any other shape could reach the node as authorization bytes this rule never
|
|
50
|
-
* read. Bytes containing a `.` are never `other`: a CACAO has none, and
|
|
51
|
-
* validated activation refuses anything compact-shaped that it cannot parse.
|
|
52
|
-
* A record with an `authorityRequest` (valid or not) is never `other`: the
|
|
53
|
-
* legacy path cannot hold it to a binding, so dropping a `siweProof` cannot
|
|
54
|
-
* route a bound signed-login delegation around its binding.
|
|
46
|
+
* A header must contain exactly one `Authorization` string key: other shapes
|
|
47
|
+
* might reach the node as authorization bytes this rule never examined.
|
|
55
48
|
*/
|
|
56
49
|
declare function storedDelegationKind(entry: unknown): "compact" | "signed-login" | "other" | "refused";
|
|
50
|
+
/** A record replays only within a valid stored request binding. */
|
|
51
|
+
declare function replayLimit(entry: unknown): readonly PermissionEntry[] | undefined;
|
|
52
|
+
/** Match node-sdk's normalization before validating a compact signature. */
|
|
53
|
+
declare function withoutBearer(authorization: string): string;
|
|
54
|
+
type StoredDelegationSource = "cli-grant" | "unbound-import" | "migration" | "request" | "legacy" | "unknown";
|
|
55
|
+
/** Constrained labels only; never publish untrusted request IDs or audit notes. */
|
|
56
|
+
declare function storedDelegationSource(entry: unknown): StoredDelegationSource;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
58
|
+
* Binds the record of one of the CLI's own grants, already checked against
|
|
59
|
+
* the request it answers, to exactly the capabilities its signed bytes grant.
|
|
60
|
+
* They are read through the validated activation replay uses (nothing is
|
|
61
|
+
* activated), so the binding is the authority replay will derive. Throws when
|
|
62
|
+
* validated activation cannot read them for `node`'s session.
|
|
62
63
|
*/
|
|
63
|
-
declare function
|
|
64
|
+
declare function bindCliGrant<T extends {
|
|
65
|
+
readonly delegation: PortableDelegation;
|
|
66
|
+
}>(node: RuntimeDelegationActivator, record: T, host: string): Promise<T & Record<"authorityRequest" | "authorityRequestAudit", unknown>>;
|
|
64
67
|
/**
|
|
65
|
-
* Validates and activates
|
|
66
|
-
*
|
|
67
|
-
* and returns its record bound to exactly the capabilities its signed bytes
|
|
68
|
-
* grant. Throws when validation or activation fails.
|
|
68
|
+
* Validates and activates an imported compact or signed-login delegation,
|
|
69
|
+
* binding its record to exactly its verified signed capabilities.
|
|
69
70
|
*/
|
|
70
|
-
declare function
|
|
71
|
+
declare function activateUnboundImport(node: RuntimeDelegationActivator, delegation: PortableDelegation, host: string): Promise<{
|
|
71
72
|
delegation: PortableDelegation;
|
|
72
73
|
permissions: PermissionEntry[];
|
|
73
74
|
} & Record<string, unknown>>;
|
|
@@ -85,46 +86,89 @@ declare function mergeDelegationsWithoutRequest(stored: readonly unknown[], inco
|
|
|
85
86
|
};
|
|
86
87
|
} & Record<string, unknown>)[]): unknown[];
|
|
87
88
|
/**
|
|
88
|
-
* Runs before replay reads the profile's records
|
|
89
|
-
*
|
|
89
|
+
* Runs migration before replay reads the profile's records. Returns whether
|
|
90
|
+
* the marker exists; replay refuses unbound records either way.
|
|
90
91
|
*
|
|
91
|
-
* Migration runs under the profile lock, and only while the
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* activation can read its signed capabilities (CID, expiry, audience and
|
|
96
|
-
* declared resources checked, nothing activated) and they form a valid
|
|
97
|
-
* binding, the record is bound to exactly those capabilities; otherwise it
|
|
98
|
-
* stays unbound, is listed in the marker's `unbound`, and installs nothing
|
|
99
|
-
* after migration. A compact record whose capabilities cannot be read could
|
|
100
|
-
* not activate for this session either. `migrate` must be false unless `node`
|
|
92
|
+
* Migration runs under the profile lock, and only while the persisted session
|
|
93
|
+
* is still the one `node` restored. Each unbound compact record is checked
|
|
94
|
+
* without activation and bound to exactly its signed capabilities, or left
|
|
95
|
+
* unbound when validation fails. `migrate` must be false unless the node
|
|
101
96
|
* holds the profile's own restored session.
|
|
102
97
|
*
|
|
103
|
-
* Migration is best-effort and restartable.
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* pre-migration rule and the next one migrates again. Records already bound
|
|
107
|
-
* by an interrupted run keep their bindings.
|
|
98
|
+
* Migration is best-effort and restartable. Bound records are written before
|
|
99
|
+
* the marker; a busy lock or failure leaves migration for a later runtime.
|
|
100
|
+
* Records already bound by an interrupted run keep their bindings.
|
|
108
101
|
*/
|
|
109
102
|
declare function prepareStoredDelegationReplay(profile: string, node: RuntimeDelegationActivator, options: {
|
|
110
103
|
readonly host: string;
|
|
111
104
|
readonly migrate: boolean;
|
|
112
105
|
}): Promise<boolean>;
|
|
113
106
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
107
|
+
* What replay did with one stored record. `skipped` records grant nothing and
|
|
108
|
+
* carry a fixed reason code that is safe to publish; `not-replayed` records
|
|
109
|
+
* are routine (expired) and give nothing to act on.
|
|
110
|
+
*/
|
|
111
|
+
type StoredDelegationReplay = {
|
|
112
|
+
readonly status: "installed";
|
|
113
|
+
readonly delegation: ValidatedRuntimeDelegation;
|
|
114
|
+
} | {
|
|
115
|
+
readonly status: "skipped";
|
|
116
|
+
readonly reason: StoredGrantSkipReason;
|
|
117
|
+
} | {
|
|
118
|
+
readonly status: "not-replayed";
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* The single stored-grant replay path for CLI and canonical runtimes.
|
|
122
|
+
* Migration runs before the store read; CID deduplication affects authority
|
|
123
|
+
* only, not the per-record fixed-code skip diagnostics.
|
|
124
|
+
*/
|
|
125
|
+
declare function replayProfileDelegations(profile: string, node: RuntimeDelegationActivator, options: {
|
|
126
|
+
readonly host: string;
|
|
127
|
+
readonly migrate: boolean;
|
|
128
|
+
readonly resolveSpace: OperationSpaceResolver;
|
|
129
|
+
}): Promise<{
|
|
130
|
+
installed: ValidatedRuntimeDelegation[];
|
|
131
|
+
warnings: OperationWarning[];
|
|
132
|
+
}>;
|
|
133
|
+
/** Return an audience only after the exact compact bytes, CID and signature verify. */
|
|
134
|
+
declare function verifiedCompactAudience(node: RuntimeDelegationActivator, delegation: PortableDelegation): string | undefined;
|
|
135
|
+
/** Only a verified signed audience and matching transport audience can identify a foreign grant. */
|
|
136
|
+
declare function storedDelegationForAnotherKey(entry: unknown, node: RuntimeDelegationActivator): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Publish a stored CID only when it matches the stored authorization bytes.
|
|
139
|
+
* Free-text and even correctly shaped CIDs of different bytes stay private.
|
|
140
|
+
*/
|
|
141
|
+
declare function verifiedStoredCid(node: RuntimeDelegationActivator, entry: unknown): string | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Replays one stored record under its binding, never installing an unbound or
|
|
144
|
+
* unproven grant. Stored bytes and node messages are never published.
|
|
121
145
|
*/
|
|
122
146
|
declare function replayStoredDelegation(node: RuntimeDelegationActivator, entry: unknown, options: {
|
|
123
147
|
readonly host: string;
|
|
124
|
-
readonly migrated: boolean;
|
|
125
148
|
readonly resolveSpace: OperationSpaceResolver;
|
|
126
|
-
}): Promise<
|
|
149
|
+
}): Promise<StoredDelegationReplay>;
|
|
150
|
+
type StoredDelegationInspection = {
|
|
151
|
+
readonly local: "verified";
|
|
152
|
+
readonly cid: string;
|
|
153
|
+
readonly effectivePermissions: readonly PermissionEntry[];
|
|
154
|
+
readonly expiry: Date;
|
|
155
|
+
} | {
|
|
156
|
+
readonly local: "refused";
|
|
157
|
+
readonly reason: StoredGrantSkipReason;
|
|
158
|
+
} | {
|
|
159
|
+
readonly local: "not_checked";
|
|
160
|
+
readonly because: "expired" | "no_session";
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Checks only local signed bytes, expiry, audience, resources and binding.
|
|
164
|
+
* The node still decides delegation-chain validity and revocation at install.
|
|
165
|
+
*/
|
|
166
|
+
declare function inspectStoredDelegation(entry: unknown, options?: {
|
|
167
|
+
readonly node?: RuntimeDelegationActivator;
|
|
168
|
+
readonly host?: string;
|
|
169
|
+
readonly resolveSpace?: OperationSpaceResolver;
|
|
170
|
+
}): Promise<StoredDelegationInspection>;
|
|
127
171
|
/** An unreadable marker counts as migrated: a damaged marker never reopens migration. */
|
|
128
172
|
declare function bindingMigrationRecorded(profile: string): Promise<boolean>;
|
|
129
173
|
|
|
130
|
-
export { BINDING_NOTES, type BindingSource,
|
|
174
|
+
export { BINDING_NOTES, type BindingSource, OperationWarning, type StoredDelegationInspection, type StoredDelegationReplay, type StoredDelegationSource, StoredGrantSkipReason, activateUnboundImport, bindCliGrant, bindingMigrationPath, bindingMigrationRecorded, inspectStoredDelegation, mergeDelegationsWithoutRequest, operationSpaceResolver, prepareStoredDelegationReplay, replayLimit, replayProfileDelegations, replayStoredDelegation, storedDelegationForAnotherKey, storedDelegationKind, storedDelegationSource, verifiedCompactAudience, verifiedStoredCid, withoutBearer };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PermissionEntry, ValidatedRuntimeDelegation, RuntimeDelegationActivator, PortableDelegation } from '@tinycloud/node-sdk';
|
|
2
2
|
import { O as OperationSpaceResolver } from './authority-ofwbEqmj.js';
|
|
3
|
+
import { S as StoredGrantSkipReason, b as OperationWarning } from './contract-DfyrluLB.js';
|
|
4
|
+
export { c as STORED_GRANT_SKIP_REASONS } from './contract-DfyrluLB.js';
|
|
3
5
|
import '@tinycloud/sdk-core';
|
|
4
6
|
|
|
5
7
|
/** Creates the one owner-aware resolver shared by operation matching paths. */
|
|
@@ -19,55 +21,54 @@ declare function operationSpaceResolver(node: unknown, ownerSpace?: string): (sp
|
|
|
19
21
|
* own signed capabilities (`unbound-import:<cid>`).
|
|
20
22
|
* - The one-time migration of records stored before bindings existed: exactly
|
|
21
23
|
* each record's own signed capabilities (`migrated:<cid>`).
|
|
24
|
+
* - The CLI's own grants (`tc auth request --grant`, permission escalation),
|
|
25
|
+
* once checked against the request they answer: exactly each grant's own
|
|
26
|
+
* signed capabilities (`cli-grant:<cid>`). Their signed-login records carry
|
|
27
|
+
* the `siweProof` replay verifies them from.
|
|
22
28
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
29
|
+
* Signed-login records the CLI stored without a `siweProof` cannot be
|
|
30
|
+
* verified from signed bytes and are not installed by either runtime.
|
|
25
31
|
*
|
|
26
32
|
* The binding is local profile data. It stops records written by any other
|
|
27
33
|
* path from granting authority. It does not stop someone who can write the
|
|
28
34
|
* profile directory, who already holds the session key and the signed bytes.
|
|
29
35
|
*/
|
|
30
|
-
type BindingSource = "migration" | "unbound-import";
|
|
31
|
-
/** The audit note written beside a binding
|
|
36
|
+
type BindingSource = "migration" | "unbound-import" | "cli-grant";
|
|
37
|
+
/** The audit note written beside a binding the record's writer synthesized. */
|
|
32
38
|
declare const BINDING_NOTES: Record<BindingSource, string>;
|
|
33
39
|
/** The per-profile marker: present once that profile's unbound records were migrated. */
|
|
34
40
|
declare function bindingMigrationPath(profile: string): string;
|
|
35
41
|
/**
|
|
36
|
-
*
|
|
42
|
+
* Compact and signed-login records require a valid request binding and signed
|
|
43
|
+
* proof. A legacy record with no proof is classified `other` only so replay
|
|
44
|
+
* can report `proof_missing`; it never installs. Malformed headers are refused.
|
|
37
45
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* - `other` records keep the CLI's legacy replay: an unbound record whose
|
|
41
|
-
* bytes are not compact and that has no `siweProof`, which is how the CLI
|
|
42
|
-
* stores its own signed-login grants. The operations runtime never installs
|
|
43
|
-
* them.
|
|
44
|
-
* - `refused` records install nothing anywhere.
|
|
45
|
-
*
|
|
46
|
-
* A record is `refused` unless its `delegationHeader` has exactly one own
|
|
47
|
-
* key, `Authorization`, with a string value: header names are matched
|
|
48
|
-
* case-insensitively on the wire, and other value types are stringified, so
|
|
49
|
-
* any other shape could reach the node as authorization bytes this rule never
|
|
50
|
-
* read. Bytes containing a `.` are never `other`: a CACAO has none, and
|
|
51
|
-
* validated activation refuses anything compact-shaped that it cannot parse.
|
|
52
|
-
* A record with an `authorityRequest` (valid or not) is never `other`: the
|
|
53
|
-
* legacy path cannot hold it to a binding, so dropping a `siweProof` cannot
|
|
54
|
-
* route a bound signed-login delegation around its binding.
|
|
46
|
+
* A header must contain exactly one `Authorization` string key: other shapes
|
|
47
|
+
* might reach the node as authorization bytes this rule never examined.
|
|
55
48
|
*/
|
|
56
49
|
declare function storedDelegationKind(entry: unknown): "compact" | "signed-login" | "other" | "refused";
|
|
50
|
+
/** A record replays only within a valid stored request binding. */
|
|
51
|
+
declare function replayLimit(entry: unknown): readonly PermissionEntry[] | undefined;
|
|
52
|
+
/** Match node-sdk's normalization before validating a compact signature. */
|
|
53
|
+
declare function withoutBearer(authorization: string): string;
|
|
54
|
+
type StoredDelegationSource = "cli-grant" | "unbound-import" | "migration" | "request" | "legacy" | "unknown";
|
|
55
|
+
/** Constrained labels only; never publish untrusted request IDs or audit notes. */
|
|
56
|
+
declare function storedDelegationSource(entry: unknown): StoredDelegationSource;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
58
|
+
* Binds the record of one of the CLI's own grants, already checked against
|
|
59
|
+
* the request it answers, to exactly the capabilities its signed bytes grant.
|
|
60
|
+
* They are read through the validated activation replay uses (nothing is
|
|
61
|
+
* activated), so the binding is the authority replay will derive. Throws when
|
|
62
|
+
* validated activation cannot read them for `node`'s session.
|
|
62
63
|
*/
|
|
63
|
-
declare function
|
|
64
|
+
declare function bindCliGrant<T extends {
|
|
65
|
+
readonly delegation: PortableDelegation;
|
|
66
|
+
}>(node: RuntimeDelegationActivator, record: T, host: string): Promise<T & Record<"authorityRequest" | "authorityRequestAudit", unknown>>;
|
|
64
67
|
/**
|
|
65
|
-
* Validates and activates
|
|
66
|
-
*
|
|
67
|
-
* and returns its record bound to exactly the capabilities its signed bytes
|
|
68
|
-
* grant. Throws when validation or activation fails.
|
|
68
|
+
* Validates and activates an imported compact or signed-login delegation,
|
|
69
|
+
* binding its record to exactly its verified signed capabilities.
|
|
69
70
|
*/
|
|
70
|
-
declare function
|
|
71
|
+
declare function activateUnboundImport(node: RuntimeDelegationActivator, delegation: PortableDelegation, host: string): Promise<{
|
|
71
72
|
delegation: PortableDelegation;
|
|
72
73
|
permissions: PermissionEntry[];
|
|
73
74
|
} & Record<string, unknown>>;
|
|
@@ -85,46 +86,89 @@ declare function mergeDelegationsWithoutRequest(stored: readonly unknown[], inco
|
|
|
85
86
|
};
|
|
86
87
|
} & Record<string, unknown>)[]): unknown[];
|
|
87
88
|
/**
|
|
88
|
-
* Runs before replay reads the profile's records
|
|
89
|
-
*
|
|
89
|
+
* Runs migration before replay reads the profile's records. Returns whether
|
|
90
|
+
* the marker exists; replay refuses unbound records either way.
|
|
90
91
|
*
|
|
91
|
-
* Migration runs under the profile lock, and only while the
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* activation can read its signed capabilities (CID, expiry, audience and
|
|
96
|
-
* declared resources checked, nothing activated) and they form a valid
|
|
97
|
-
* binding, the record is bound to exactly those capabilities; otherwise it
|
|
98
|
-
* stays unbound, is listed in the marker's `unbound`, and installs nothing
|
|
99
|
-
* after migration. A compact record whose capabilities cannot be read could
|
|
100
|
-
* not activate for this session either. `migrate` must be false unless `node`
|
|
92
|
+
* Migration runs under the profile lock, and only while the persisted session
|
|
93
|
+
* is still the one `node` restored. Each unbound compact record is checked
|
|
94
|
+
* without activation and bound to exactly its signed capabilities, or left
|
|
95
|
+
* unbound when validation fails. `migrate` must be false unless the node
|
|
101
96
|
* holds the profile's own restored session.
|
|
102
97
|
*
|
|
103
|
-
* Migration is best-effort and restartable.
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* pre-migration rule and the next one migrates again. Records already bound
|
|
107
|
-
* by an interrupted run keep their bindings.
|
|
98
|
+
* Migration is best-effort and restartable. Bound records are written before
|
|
99
|
+
* the marker; a busy lock or failure leaves migration for a later runtime.
|
|
100
|
+
* Records already bound by an interrupted run keep their bindings.
|
|
108
101
|
*/
|
|
109
102
|
declare function prepareStoredDelegationReplay(profile: string, node: RuntimeDelegationActivator, options: {
|
|
110
103
|
readonly host: string;
|
|
111
104
|
readonly migrate: boolean;
|
|
112
105
|
}): Promise<boolean>;
|
|
113
106
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
107
|
+
* What replay did with one stored record. `skipped` records grant nothing and
|
|
108
|
+
* carry a fixed reason code that is safe to publish; `not-replayed` records
|
|
109
|
+
* are routine (expired) and give nothing to act on.
|
|
110
|
+
*/
|
|
111
|
+
type StoredDelegationReplay = {
|
|
112
|
+
readonly status: "installed";
|
|
113
|
+
readonly delegation: ValidatedRuntimeDelegation;
|
|
114
|
+
} | {
|
|
115
|
+
readonly status: "skipped";
|
|
116
|
+
readonly reason: StoredGrantSkipReason;
|
|
117
|
+
} | {
|
|
118
|
+
readonly status: "not-replayed";
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* The single stored-grant replay path for CLI and canonical runtimes.
|
|
122
|
+
* Migration runs before the store read; CID deduplication affects authority
|
|
123
|
+
* only, not the per-record fixed-code skip diagnostics.
|
|
124
|
+
*/
|
|
125
|
+
declare function replayProfileDelegations(profile: string, node: RuntimeDelegationActivator, options: {
|
|
126
|
+
readonly host: string;
|
|
127
|
+
readonly migrate: boolean;
|
|
128
|
+
readonly resolveSpace: OperationSpaceResolver;
|
|
129
|
+
}): Promise<{
|
|
130
|
+
installed: ValidatedRuntimeDelegation[];
|
|
131
|
+
warnings: OperationWarning[];
|
|
132
|
+
}>;
|
|
133
|
+
/** Return an audience only after the exact compact bytes, CID and signature verify. */
|
|
134
|
+
declare function verifiedCompactAudience(node: RuntimeDelegationActivator, delegation: PortableDelegation): string | undefined;
|
|
135
|
+
/** Only a verified signed audience and matching transport audience can identify a foreign grant. */
|
|
136
|
+
declare function storedDelegationForAnotherKey(entry: unknown, node: RuntimeDelegationActivator): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Publish a stored CID only when it matches the stored authorization bytes.
|
|
139
|
+
* Free-text and even correctly shaped CIDs of different bytes stay private.
|
|
140
|
+
*/
|
|
141
|
+
declare function verifiedStoredCid(node: RuntimeDelegationActivator, entry: unknown): string | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Replays one stored record under its binding, never installing an unbound or
|
|
144
|
+
* unproven grant. Stored bytes and node messages are never published.
|
|
121
145
|
*/
|
|
122
146
|
declare function replayStoredDelegation(node: RuntimeDelegationActivator, entry: unknown, options: {
|
|
123
147
|
readonly host: string;
|
|
124
|
-
readonly migrated: boolean;
|
|
125
148
|
readonly resolveSpace: OperationSpaceResolver;
|
|
126
|
-
}): Promise<
|
|
149
|
+
}): Promise<StoredDelegationReplay>;
|
|
150
|
+
type StoredDelegationInspection = {
|
|
151
|
+
readonly local: "verified";
|
|
152
|
+
readonly cid: string;
|
|
153
|
+
readonly effectivePermissions: readonly PermissionEntry[];
|
|
154
|
+
readonly expiry: Date;
|
|
155
|
+
} | {
|
|
156
|
+
readonly local: "refused";
|
|
157
|
+
readonly reason: StoredGrantSkipReason;
|
|
158
|
+
} | {
|
|
159
|
+
readonly local: "not_checked";
|
|
160
|
+
readonly because: "expired" | "no_session";
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Checks only local signed bytes, expiry, audience, resources and binding.
|
|
164
|
+
* The node still decides delegation-chain validity and revocation at install.
|
|
165
|
+
*/
|
|
166
|
+
declare function inspectStoredDelegation(entry: unknown, options?: {
|
|
167
|
+
readonly node?: RuntimeDelegationActivator;
|
|
168
|
+
readonly host?: string;
|
|
169
|
+
readonly resolveSpace?: OperationSpaceResolver;
|
|
170
|
+
}): Promise<StoredDelegationInspection>;
|
|
127
171
|
/** An unreadable marker counts as migrated: a damaged marker never reopens migration. */
|
|
128
172
|
declare function bindingMigrationRecorded(profile: string): Promise<boolean>;
|
|
129
173
|
|
|
130
|
-
export { BINDING_NOTES, type BindingSource,
|
|
174
|
+
export { BINDING_NOTES, type BindingSource, OperationWarning, type StoredDelegationInspection, type StoredDelegationReplay, type StoredDelegationSource, StoredGrantSkipReason, activateUnboundImport, bindCliGrant, bindingMigrationPath, bindingMigrationRecorded, inspectStoredDelegation, mergeDelegationsWithoutRequest, operationSpaceResolver, prepareStoredDelegationReplay, replayLimit, replayProfileDelegations, replayStoredDelegation, storedDelegationForAnotherKey, storedDelegationKind, storedDelegationSource, verifiedCompactAudience, verifiedStoredCid, withoutBearer };
|