@tinycloud/operations 0.4.0-beta.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coverage.json +6 -0
- package/dist/artifacts.cjs +103 -6633
- 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 +84 -6614
- package/dist/artifacts.js.map +1 -1
- package/dist/cli-runtime.cjs +572 -6979
- 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 +566 -6972
- package/dist/cli-runtime.js.map +1 -1
- package/dist/{contract-xMIIMtpF.d.cts → contract-BRwWJpPs.d.cts} +24 -2
- package/dist/{contract-xMIIMtpF.d.ts → contract-BRwWJpPs.d.ts} +24 -2
- package/dist/delegation-binding.cjs +162 -6644
- package/dist/delegation-binding.cjs.map +1 -1
- package/dist/delegation-binding.d.cts +43 -13
- package/dist/delegation-binding.d.ts +43 -13
- package/dist/delegation-binding.js +147 -6630
- package/dist/delegation-binding.js.map +1 -1
- package/dist/index.cjs +571 -6981
- 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 +565 -6974
- 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 +2727 -4
- package/package.json +4 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { RuntimeDelegationActivator, PortableDelegation, PermissionEntry
|
|
1
|
+
import { ValidatedRuntimeDelegation, RuntimeDelegationActivator, PortableDelegation, PermissionEntry } from '@tinycloud/node-sdk';
|
|
2
2
|
import { O as OperationSpaceResolver } from './authority-ofwbEqmj.cjs';
|
|
3
|
+
import { S as StoredGrantSkipReason } from './contract-BRwWJpPs.cjs';
|
|
3
4
|
import '@tinycloud/sdk-core';
|
|
4
5
|
|
|
5
6
|
/** Creates the one owner-aware resolver shared by operation matching paths. */
|
|
@@ -19,16 +20,20 @@ declare function operationSpaceResolver(node: unknown, ownerSpace?: string): (sp
|
|
|
19
20
|
* own signed capabilities (`unbound-import:<cid>`).
|
|
20
21
|
* - The one-time migration of records stored before bindings existed: exactly
|
|
21
22
|
* each record's own signed capabilities (`migrated:<cid>`).
|
|
23
|
+
* - The CLI's own grants (`tc auth request --grant`, permission escalation),
|
|
24
|
+
* once checked against the request they answer: exactly each grant's own
|
|
25
|
+
* signed capabilities (`cli-grant:<cid>`). Their signed-login records carry
|
|
26
|
+
* the `siweProof` replay verifies them from.
|
|
22
27
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
28
|
+
* Signed-login records the CLI stored before it kept a `siweProof` cannot be
|
|
29
|
+
* verified here and keep their legacy CLI replay.
|
|
25
30
|
*
|
|
26
31
|
* The binding is local profile data. It stops records written by any other
|
|
27
32
|
* path from granting authority. It does not stop someone who can write the
|
|
28
33
|
* profile directory, who already holds the session key and the signed bytes.
|
|
29
34
|
*/
|
|
30
|
-
type BindingSource = "migration" | "unbound-import";
|
|
31
|
-
/** The audit note written beside a binding
|
|
35
|
+
type BindingSource = "migration" | "unbound-import" | "cli-grant";
|
|
36
|
+
/** The audit note written beside a binding the record's writer synthesized. */
|
|
32
37
|
declare const BINDING_NOTES: Record<BindingSource, string>;
|
|
33
38
|
/** The per-profile marker: present once that profile's unbound records were migrated. */
|
|
34
39
|
declare function bindingMigrationPath(profile: string): string;
|
|
@@ -38,9 +43,9 @@ declare function bindingMigrationPath(profile: string): string;
|
|
|
38
43
|
* - `compact` and `signed-login` records go through validated activation and
|
|
39
44
|
* the binding rule.
|
|
40
45
|
* - `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
|
|
42
|
-
*
|
|
43
|
-
* them.
|
|
46
|
+
* bytes are not compact and that has no `siweProof`, which is how earlier
|
|
47
|
+
* CLI releases stored their own signed-login grants. The operations runtime
|
|
48
|
+
* never installs them.
|
|
44
49
|
* - `refused` records install nothing anywhere.
|
|
45
50
|
*
|
|
46
51
|
* A record is `refused` unless its `delegationHeader` has exactly one own
|
|
@@ -61,6 +66,16 @@ declare function storedDelegationKind(entry: unknown): "compact" | "signed-login
|
|
|
61
66
|
* when the record installs nothing.
|
|
62
67
|
*/
|
|
63
68
|
declare function replayLimit(entry: unknown, migrated: boolean): readonly PermissionEntry[] | "signed" | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Binds the record of one of the CLI's own grants, already checked against
|
|
71
|
+
* the request it answers, to exactly the capabilities its signed bytes grant.
|
|
72
|
+
* They are read through the validated activation replay uses (nothing is
|
|
73
|
+
* activated), so the binding is the authority replay will derive. Throws when
|
|
74
|
+
* validated activation cannot read them for `node`'s session.
|
|
75
|
+
*/
|
|
76
|
+
declare function bindCliGrant<T extends {
|
|
77
|
+
readonly delegation: PortableDelegation;
|
|
78
|
+
}>(node: RuntimeDelegationActivator, record: T, host: string): Promise<T & Record<"authorityRequest" | "authorityRequestAudit", unknown>>;
|
|
64
79
|
/**
|
|
65
80
|
* Validates and activates a compact delegation that `tc auth import` received
|
|
66
81
|
* without a stored request, through the same validated activation replay uses,
|
|
@@ -110,21 +125,36 @@ declare function prepareStoredDelegationReplay(profile: string, node: RuntimeDel
|
|
|
110
125
|
readonly host: string;
|
|
111
126
|
readonly migrate: boolean;
|
|
112
127
|
}): Promise<boolean>;
|
|
128
|
+
/**
|
|
129
|
+
* What replay did with one stored record. `skipped` records grant nothing and
|
|
130
|
+
* carry a fixed reason code that is safe to publish; `not-replayed` records
|
|
131
|
+
* are routine (expired) and give nothing to act on.
|
|
132
|
+
*/
|
|
133
|
+
type StoredDelegationReplay = {
|
|
134
|
+
readonly status: "installed";
|
|
135
|
+
readonly delegation: ValidatedRuntimeDelegation;
|
|
136
|
+
} | {
|
|
137
|
+
readonly status: "skipped";
|
|
138
|
+
readonly reason: StoredGrantSkipReason;
|
|
139
|
+
} | {
|
|
140
|
+
readonly status: "not-replayed";
|
|
141
|
+
};
|
|
113
142
|
/**
|
|
114
143
|
* Replays one stored record under the binding rule. A record with a valid
|
|
115
144
|
* binding installs only if its signed capabilities fit inside it. Before the
|
|
116
145
|
* profile has migrated, an unbound compact record installs with its signed
|
|
117
146
|
* authority as it always did; after, it installs nothing. A signed-login
|
|
118
|
-
* record installs only with a binding.
|
|
119
|
-
* `
|
|
120
|
-
*
|
|
147
|
+
* record installs only with a binding. A record with neither compact bytes
|
|
148
|
+
* nor a `siweProof` cannot be verified here and installs nothing. Never
|
|
149
|
+
* throws, and never reports exception text: stored data is untrusted
|
|
150
|
+
* transport material, and messages can quote it or a node's response.
|
|
121
151
|
*/
|
|
122
152
|
declare function replayStoredDelegation(node: RuntimeDelegationActivator, entry: unknown, options: {
|
|
123
153
|
readonly host: string;
|
|
124
154
|
readonly migrated: boolean;
|
|
125
155
|
readonly resolveSpace: OperationSpaceResolver;
|
|
126
|
-
}): Promise<
|
|
156
|
+
}): Promise<StoredDelegationReplay>;
|
|
127
157
|
/** An unreadable marker counts as migrated: a damaged marker never reopens migration. */
|
|
128
158
|
declare function bindingMigrationRecorded(profile: string): Promise<boolean>;
|
|
129
159
|
|
|
130
|
-
export { BINDING_NOTES, type BindingSource, activateUnboundCompactImport, bindingMigrationPath, bindingMigrationRecorded, mergeDelegationsWithoutRequest, operationSpaceResolver, prepareStoredDelegationReplay, replayLimit, replayStoredDelegation, storedDelegationKind };
|
|
160
|
+
export { BINDING_NOTES, type BindingSource, type StoredDelegationReplay, activateUnboundCompactImport, bindCliGrant, bindingMigrationPath, bindingMigrationRecorded, mergeDelegationsWithoutRequest, operationSpaceResolver, prepareStoredDelegationReplay, replayLimit, replayStoredDelegation, storedDelegationKind };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { RuntimeDelegationActivator, PortableDelegation, PermissionEntry
|
|
1
|
+
import { ValidatedRuntimeDelegation, RuntimeDelegationActivator, PortableDelegation, PermissionEntry } from '@tinycloud/node-sdk';
|
|
2
2
|
import { O as OperationSpaceResolver } from './authority-ofwbEqmj.js';
|
|
3
|
+
import { S as StoredGrantSkipReason } from './contract-BRwWJpPs.js';
|
|
3
4
|
import '@tinycloud/sdk-core';
|
|
4
5
|
|
|
5
6
|
/** Creates the one owner-aware resolver shared by operation matching paths. */
|
|
@@ -19,16 +20,20 @@ declare function operationSpaceResolver(node: unknown, ownerSpace?: string): (sp
|
|
|
19
20
|
* own signed capabilities (`unbound-import:<cid>`).
|
|
20
21
|
* - The one-time migration of records stored before bindings existed: exactly
|
|
21
22
|
* each record's own signed capabilities (`migrated:<cid>`).
|
|
23
|
+
* - The CLI's own grants (`tc auth request --grant`, permission escalation),
|
|
24
|
+
* once checked against the request they answer: exactly each grant's own
|
|
25
|
+
* signed capabilities (`cli-grant:<cid>`). Their signed-login records carry
|
|
26
|
+
* the `siweProof` replay verifies them from.
|
|
22
27
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
28
|
+
* Signed-login records the CLI stored before it kept a `siweProof` cannot be
|
|
29
|
+
* verified here and keep their legacy CLI replay.
|
|
25
30
|
*
|
|
26
31
|
* The binding is local profile data. It stops records written by any other
|
|
27
32
|
* path from granting authority. It does not stop someone who can write the
|
|
28
33
|
* profile directory, who already holds the session key and the signed bytes.
|
|
29
34
|
*/
|
|
30
|
-
type BindingSource = "migration" | "unbound-import";
|
|
31
|
-
/** The audit note written beside a binding
|
|
35
|
+
type BindingSource = "migration" | "unbound-import" | "cli-grant";
|
|
36
|
+
/** The audit note written beside a binding the record's writer synthesized. */
|
|
32
37
|
declare const BINDING_NOTES: Record<BindingSource, string>;
|
|
33
38
|
/** The per-profile marker: present once that profile's unbound records were migrated. */
|
|
34
39
|
declare function bindingMigrationPath(profile: string): string;
|
|
@@ -38,9 +43,9 @@ declare function bindingMigrationPath(profile: string): string;
|
|
|
38
43
|
* - `compact` and `signed-login` records go through validated activation and
|
|
39
44
|
* the binding rule.
|
|
40
45
|
* - `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
|
|
42
|
-
*
|
|
43
|
-
* them.
|
|
46
|
+
* bytes are not compact and that has no `siweProof`, which is how earlier
|
|
47
|
+
* CLI releases stored their own signed-login grants. The operations runtime
|
|
48
|
+
* never installs them.
|
|
44
49
|
* - `refused` records install nothing anywhere.
|
|
45
50
|
*
|
|
46
51
|
* A record is `refused` unless its `delegationHeader` has exactly one own
|
|
@@ -61,6 +66,16 @@ declare function storedDelegationKind(entry: unknown): "compact" | "signed-login
|
|
|
61
66
|
* when the record installs nothing.
|
|
62
67
|
*/
|
|
63
68
|
declare function replayLimit(entry: unknown, migrated: boolean): readonly PermissionEntry[] | "signed" | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Binds the record of one of the CLI's own grants, already checked against
|
|
71
|
+
* the request it answers, to exactly the capabilities its signed bytes grant.
|
|
72
|
+
* They are read through the validated activation replay uses (nothing is
|
|
73
|
+
* activated), so the binding is the authority replay will derive. Throws when
|
|
74
|
+
* validated activation cannot read them for `node`'s session.
|
|
75
|
+
*/
|
|
76
|
+
declare function bindCliGrant<T extends {
|
|
77
|
+
readonly delegation: PortableDelegation;
|
|
78
|
+
}>(node: RuntimeDelegationActivator, record: T, host: string): Promise<T & Record<"authorityRequest" | "authorityRequestAudit", unknown>>;
|
|
64
79
|
/**
|
|
65
80
|
* Validates and activates a compact delegation that `tc auth import` received
|
|
66
81
|
* without a stored request, through the same validated activation replay uses,
|
|
@@ -110,21 +125,36 @@ declare function prepareStoredDelegationReplay(profile: string, node: RuntimeDel
|
|
|
110
125
|
readonly host: string;
|
|
111
126
|
readonly migrate: boolean;
|
|
112
127
|
}): Promise<boolean>;
|
|
128
|
+
/**
|
|
129
|
+
* What replay did with one stored record. `skipped` records grant nothing and
|
|
130
|
+
* carry a fixed reason code that is safe to publish; `not-replayed` records
|
|
131
|
+
* are routine (expired) and give nothing to act on.
|
|
132
|
+
*/
|
|
133
|
+
type StoredDelegationReplay = {
|
|
134
|
+
readonly status: "installed";
|
|
135
|
+
readonly delegation: ValidatedRuntimeDelegation;
|
|
136
|
+
} | {
|
|
137
|
+
readonly status: "skipped";
|
|
138
|
+
readonly reason: StoredGrantSkipReason;
|
|
139
|
+
} | {
|
|
140
|
+
readonly status: "not-replayed";
|
|
141
|
+
};
|
|
113
142
|
/**
|
|
114
143
|
* Replays one stored record under the binding rule. A record with a valid
|
|
115
144
|
* binding installs only if its signed capabilities fit inside it. Before the
|
|
116
145
|
* profile has migrated, an unbound compact record installs with its signed
|
|
117
146
|
* authority as it always did; after, it installs nothing. A signed-login
|
|
118
|
-
* record installs only with a binding.
|
|
119
|
-
* `
|
|
120
|
-
*
|
|
147
|
+
* record installs only with a binding. A record with neither compact bytes
|
|
148
|
+
* nor a `siweProof` cannot be verified here and installs nothing. Never
|
|
149
|
+
* throws, and never reports exception text: stored data is untrusted
|
|
150
|
+
* transport material, and messages can quote it or a node's response.
|
|
121
151
|
*/
|
|
122
152
|
declare function replayStoredDelegation(node: RuntimeDelegationActivator, entry: unknown, options: {
|
|
123
153
|
readonly host: string;
|
|
124
154
|
readonly migrated: boolean;
|
|
125
155
|
readonly resolveSpace: OperationSpaceResolver;
|
|
126
|
-
}): Promise<
|
|
156
|
+
}): Promise<StoredDelegationReplay>;
|
|
127
157
|
/** An unreadable marker counts as migrated: a damaged marker never reopens migration. */
|
|
128
158
|
declare function bindingMigrationRecorded(profile: string): Promise<boolean>;
|
|
129
159
|
|
|
130
|
-
export { BINDING_NOTES, type BindingSource, activateUnboundCompactImport, bindingMigrationPath, bindingMigrationRecorded, mergeDelegationsWithoutRequest, operationSpaceResolver, prepareStoredDelegationReplay, replayLimit, replayStoredDelegation, storedDelegationKind };
|
|
160
|
+
export { BINDING_NOTES, type BindingSource, type StoredDelegationReplay, activateUnboundCompactImport, bindCliGrant, bindingMigrationPath, bindingMigrationRecorded, mergeDelegationsWithoutRequest, operationSpaceResolver, prepareStoredDelegationReplay, replayLimit, replayStoredDelegation, storedDelegationKind };
|