@tinycloud/node-sdk 3.3.0-beta.22 → 3.3.0-beta.24
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/dist/{TinyCloudNode-BPDOmuf6.d.cts → TinyCloudNode-Cm8kblSj.d.cts} +11 -41
- package/dist/{TinyCloudNode-BPDOmuf6.d.ts → TinyCloudNode-Cm8kblSj.d.ts} +11 -41
- package/dist/{authority-C-pzOYXq.d.ts → authority-CPSGMw2l.d.ts} +1 -1
- package/dist/{authority-21H2cKmO.d.cts → authority-S-huUKlr.d.cts} +1 -1
- package/dist/core.cjs +22 -63
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +26 -66
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +22 -63
- 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 +26 -66
- package/dist/index.js.map +1 -1
- package/dist/replication/authority.d.cts +2 -2
- package/dist/replication/authority.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tinycloud_sdk_core from '@tinycloud/sdk-core';
|
|
2
|
-
import { AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, CapabilityPresentationEnvelopeV1, IUserAuthorization, ISigner, ISessionStorage, ISpaceCreationHandler, RegistryPolicy, RegistrySequenceStore, OnNodeNotFound, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ReplicationOptions, TinyCloudSession, PersistedSessionData, ClientSession, PermissionEntry, Extension, SignRequest, SpaceHostResult, SignInOptions, Delegation, DelegatedResource, TelemetryConfig, ServiceContext, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, StorageFullEvent, IStorageService, INotificationHandler, IENSResolver, KVReplicaStorage, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService,
|
|
2
|
+
import { AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, CapabilityPresentationEnvelopeV1, IUserAuthorization, ISigner, ISessionStorage, ISpaceCreationHandler, RegistryPolicy, RegistrySequenceStore, OnNodeNotFound, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ReplicationOptions, TinyCloudSession, PersistedSessionData, ClientSession, PermissionEntry, Extension, SignRequest, SpaceHostResult, SignInOptions, Delegation, DelegatedResource, TelemetryConfig, ServiceContext, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, StorageFullEvent, IStorageService, INotificationHandler, IENSResolver, KVReplicaStorage, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ServiceSession, ReplicationControl, ResolvedDelegate } from '@tinycloud/sdk-core';
|
|
3
3
|
import { ReplicaSessionStamp } from '@tinycloud/sdk-services/kv/replication';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { InvokeFunction, InvokeAnyFunction, FetchFunction } from '@tinycloud/sdk-services';
|
|
@@ -1375,6 +1375,12 @@ interface DelegateToOptions {
|
|
|
1375
1375
|
* recipient (use its session-key DID). Default false.
|
|
1376
1376
|
*/
|
|
1377
1377
|
disableSubDelegation?: boolean;
|
|
1378
|
+
/**
|
|
1379
|
+
* Throw when the node answers 200 but skips a space the delegation targets (a space it does not
|
|
1380
|
+
* host): it registers the delegation without attaching it, which otherwise looks like success.
|
|
1381
|
+
* Off by default because grants to a not-yet-hosted space (e.g. secrets) are valid. Default false.
|
|
1382
|
+
*/
|
|
1383
|
+
requireActivation?: boolean;
|
|
1378
1384
|
}
|
|
1379
1385
|
/**
|
|
1380
1386
|
* Result of {@link TinyCloudNode.delegateTo}.
|
|
@@ -1896,6 +1902,8 @@ declare class TinyCloudNode {
|
|
|
1896
1902
|
private registerPrimarySessionGrant;
|
|
1897
1903
|
private writeManifestRegistryRecords;
|
|
1898
1904
|
private createAccountRegistryServices;
|
|
1905
|
+
/** Set once per process: the registry sync was skipped for want of account access. */
|
|
1906
|
+
private static accountRegistrySkipLogged;
|
|
1899
1907
|
private scheduleAccountRegistrySync;
|
|
1900
1908
|
private enqueueAccountRegistryOperation;
|
|
1901
1909
|
/**
|
|
@@ -2467,16 +2475,8 @@ declare class TinyCloudNode {
|
|
|
2467
2475
|
* ```typescript
|
|
2468
2476
|
* const delegations = alice.delegationManager;
|
|
2469
2477
|
*
|
|
2470
|
-
* //
|
|
2471
|
-
* const
|
|
2472
|
-
* delegateDID: bob.did,
|
|
2473
|
-
* path: "shared/",
|
|
2474
|
-
* actions: ["tinycloud.kv/get", "tinycloud.kv/put"],
|
|
2475
|
-
* expiry: new Date(Date.now() + 24 * 60 * 60 * 1000), // 24 hours
|
|
2476
|
-
* });
|
|
2477
|
-
*
|
|
2478
|
-
* // List delegations
|
|
2479
|
-
* const listResult = await delegations.list();
|
|
2478
|
+
* // Query account delegations
|
|
2479
|
+
* const page = await delegations.query();
|
|
2480
2480
|
*
|
|
2481
2481
|
* // Revoke a delegation
|
|
2482
2482
|
* await delegations.revoke(delegationCid);
|
|
@@ -2567,30 +2567,6 @@ declare class TinyCloudNode {
|
|
|
2567
2567
|
* Writes require authentication (owner/delegate).
|
|
2568
2568
|
*/
|
|
2569
2569
|
get publicKV(): IKVService;
|
|
2570
|
-
/**
|
|
2571
|
-
* Create a delegation using the v2 DelegationManager.
|
|
2572
|
-
*
|
|
2573
|
-
* This is a convenience method that wraps DelegationManager.create().
|
|
2574
|
-
* For more control, use `this.delegationManager` directly.
|
|
2575
|
-
*
|
|
2576
|
-
* @param params - Delegation parameters
|
|
2577
|
-
* @returns Result containing the created Delegation
|
|
2578
|
-
*
|
|
2579
|
-
* @example
|
|
2580
|
-
* ```typescript
|
|
2581
|
-
* const result = await alice.delegate({
|
|
2582
|
-
* delegateDID: bob.did,
|
|
2583
|
-
* path: "shared/",
|
|
2584
|
-
* actions: ["tinycloud.kv/get", "tinycloud.kv/put"],
|
|
2585
|
-
* expiry: new Date(Date.now() + 24 * 60 * 60 * 1000),
|
|
2586
|
-
* });
|
|
2587
|
-
*
|
|
2588
|
-
* if (result.ok) {
|
|
2589
|
-
* console.log("Delegation created:", result.data.cid);
|
|
2590
|
-
* }
|
|
2591
|
-
* ```
|
|
2592
|
-
*/
|
|
2593
|
-
delegate(params: CreateDelegationParams): Promise<DelegationResult<Delegation>>;
|
|
2594
2570
|
/**
|
|
2595
2571
|
* Revoke a delegation with the owner wallet when available. Session-only
|
|
2596
2572
|
* clients continue to use their delegated revocation authority.
|
|
@@ -2603,12 +2579,6 @@ declare class TinyCloudNode {
|
|
|
2603
2579
|
getDelegationStatus(cid: string): Promise<DelegationResult<DelegationStatus>>;
|
|
2604
2580
|
/** Compute the canonical CID of a compact UCAN or DAG-CBOR delegation authorization. */
|
|
2605
2581
|
computeDelegationCid(authorization: string): string;
|
|
2606
|
-
/**
|
|
2607
|
-
* List all delegations for the current session's space.
|
|
2608
|
-
*
|
|
2609
|
-
* @returns Result containing an array of Delegations
|
|
2610
|
-
*/
|
|
2611
|
-
listDelegations(): Promise<DelegationResult<Delegation[]>>;
|
|
2612
2582
|
/**
|
|
2613
2583
|
* Check if the current session has permission for a path and action.
|
|
2614
2584
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tinycloud_sdk_core from '@tinycloud/sdk-core';
|
|
2
|
-
import { AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, CapabilityPresentationEnvelopeV1, IUserAuthorization, ISigner, ISessionStorage, ISpaceCreationHandler, RegistryPolicy, RegistrySequenceStore, OnNodeNotFound, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ReplicationOptions, TinyCloudSession, PersistedSessionData, ClientSession, PermissionEntry, Extension, SignRequest, SpaceHostResult, SignInOptions, Delegation, DelegatedResource, TelemetryConfig, ServiceContext, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, StorageFullEvent, IStorageService, INotificationHandler, IENSResolver, KVReplicaStorage, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService,
|
|
2
|
+
import { AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, CapabilityPresentationEnvelopeV1, IUserAuthorization, ISigner, ISessionStorage, ISpaceCreationHandler, RegistryPolicy, RegistrySequenceStore, OnNodeNotFound, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ReplicationOptions, TinyCloudSession, PersistedSessionData, ClientSession, PermissionEntry, Extension, SignRequest, SpaceHostResult, SignInOptions, Delegation, DelegatedResource, TelemetryConfig, ServiceContext, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, StorageFullEvent, IStorageService, INotificationHandler, IENSResolver, KVReplicaStorage, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ServiceSession, ReplicationControl, ResolvedDelegate } from '@tinycloud/sdk-core';
|
|
3
3
|
import { ReplicaSessionStamp } from '@tinycloud/sdk-services/kv/replication';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { InvokeFunction, InvokeAnyFunction, FetchFunction } from '@tinycloud/sdk-services';
|
|
@@ -1375,6 +1375,12 @@ interface DelegateToOptions {
|
|
|
1375
1375
|
* recipient (use its session-key DID). Default false.
|
|
1376
1376
|
*/
|
|
1377
1377
|
disableSubDelegation?: boolean;
|
|
1378
|
+
/**
|
|
1379
|
+
* Throw when the node answers 200 but skips a space the delegation targets (a space it does not
|
|
1380
|
+
* host): it registers the delegation without attaching it, which otherwise looks like success.
|
|
1381
|
+
* Off by default because grants to a not-yet-hosted space (e.g. secrets) are valid. Default false.
|
|
1382
|
+
*/
|
|
1383
|
+
requireActivation?: boolean;
|
|
1378
1384
|
}
|
|
1379
1385
|
/**
|
|
1380
1386
|
* Result of {@link TinyCloudNode.delegateTo}.
|
|
@@ -1896,6 +1902,8 @@ declare class TinyCloudNode {
|
|
|
1896
1902
|
private registerPrimarySessionGrant;
|
|
1897
1903
|
private writeManifestRegistryRecords;
|
|
1898
1904
|
private createAccountRegistryServices;
|
|
1905
|
+
/** Set once per process: the registry sync was skipped for want of account access. */
|
|
1906
|
+
private static accountRegistrySkipLogged;
|
|
1899
1907
|
private scheduleAccountRegistrySync;
|
|
1900
1908
|
private enqueueAccountRegistryOperation;
|
|
1901
1909
|
/**
|
|
@@ -2467,16 +2475,8 @@ declare class TinyCloudNode {
|
|
|
2467
2475
|
* ```typescript
|
|
2468
2476
|
* const delegations = alice.delegationManager;
|
|
2469
2477
|
*
|
|
2470
|
-
* //
|
|
2471
|
-
* const
|
|
2472
|
-
* delegateDID: bob.did,
|
|
2473
|
-
* path: "shared/",
|
|
2474
|
-
* actions: ["tinycloud.kv/get", "tinycloud.kv/put"],
|
|
2475
|
-
* expiry: new Date(Date.now() + 24 * 60 * 60 * 1000), // 24 hours
|
|
2476
|
-
* });
|
|
2477
|
-
*
|
|
2478
|
-
* // List delegations
|
|
2479
|
-
* const listResult = await delegations.list();
|
|
2478
|
+
* // Query account delegations
|
|
2479
|
+
* const page = await delegations.query();
|
|
2480
2480
|
*
|
|
2481
2481
|
* // Revoke a delegation
|
|
2482
2482
|
* await delegations.revoke(delegationCid);
|
|
@@ -2567,30 +2567,6 @@ declare class TinyCloudNode {
|
|
|
2567
2567
|
* Writes require authentication (owner/delegate).
|
|
2568
2568
|
*/
|
|
2569
2569
|
get publicKV(): IKVService;
|
|
2570
|
-
/**
|
|
2571
|
-
* Create a delegation using the v2 DelegationManager.
|
|
2572
|
-
*
|
|
2573
|
-
* This is a convenience method that wraps DelegationManager.create().
|
|
2574
|
-
* For more control, use `this.delegationManager` directly.
|
|
2575
|
-
*
|
|
2576
|
-
* @param params - Delegation parameters
|
|
2577
|
-
* @returns Result containing the created Delegation
|
|
2578
|
-
*
|
|
2579
|
-
* @example
|
|
2580
|
-
* ```typescript
|
|
2581
|
-
* const result = await alice.delegate({
|
|
2582
|
-
* delegateDID: bob.did,
|
|
2583
|
-
* path: "shared/",
|
|
2584
|
-
* actions: ["tinycloud.kv/get", "tinycloud.kv/put"],
|
|
2585
|
-
* expiry: new Date(Date.now() + 24 * 60 * 60 * 1000),
|
|
2586
|
-
* });
|
|
2587
|
-
*
|
|
2588
|
-
* if (result.ok) {
|
|
2589
|
-
* console.log("Delegation created:", result.data.cid);
|
|
2590
|
-
* }
|
|
2591
|
-
* ```
|
|
2592
|
-
*/
|
|
2593
|
-
delegate(params: CreateDelegationParams): Promise<DelegationResult<Delegation>>;
|
|
2594
2570
|
/**
|
|
2595
2571
|
* Revoke a delegation with the owner wallet when available. Session-only
|
|
2596
2572
|
* clients continue to use their delegated revocation authority.
|
|
@@ -2603,12 +2579,6 @@ declare class TinyCloudNode {
|
|
|
2603
2579
|
getDelegationStatus(cid: string): Promise<DelegationResult<DelegationStatus>>;
|
|
2604
2580
|
/** Compute the canonical CID of a compact UCAN or DAG-CBOR delegation authorization. */
|
|
2605
2581
|
computeDelegationCid(authorization: string): string;
|
|
2606
|
-
/**
|
|
2607
|
-
* List all delegations for the current session's space.
|
|
2608
|
-
*
|
|
2609
|
-
* @returns Result containing an array of Delegations
|
|
2610
|
-
*/
|
|
2611
|
-
listDelegations(): Promise<DelegationResult<Delegation[]>>;
|
|
2612
2582
|
/**
|
|
2613
2583
|
* Check if the current session has permission for a path and action.
|
|
2614
2584
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReplicationOptions, PermissionEntry, TinyCloudSession, KVReplicaStorage, ServiceContext, IWasmBindings, WasmRecapEntry } from '@tinycloud/sdk-core';
|
|
2
2
|
import { ReplicaConsentAnchor, AuthorityRefusal, ReplicationAuthority } from '@tinycloud/sdk-services';
|
|
3
3
|
import { ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
|
|
4
|
-
import { T as TinyCloudNode } from './TinyCloudNode-
|
|
4
|
+
import { T as TinyCloudNode } from './TinyCloudNode-Cm8kblSj.js';
|
|
5
5
|
|
|
6
6
|
/** Constructor-time validation; the space-dependent secrets check runs at sign-in and open. */
|
|
7
7
|
declare function assertValidReplicationConfig(replication: (ReplicationOptions & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReplicationOptions, PermissionEntry, TinyCloudSession, KVReplicaStorage, ServiceContext, IWasmBindings, WasmRecapEntry } from '@tinycloud/sdk-core';
|
|
2
2
|
import { ReplicaConsentAnchor, AuthorityRefusal, ReplicationAuthority } from '@tinycloud/sdk-services';
|
|
3
3
|
import { ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
|
|
4
|
-
import { T as TinyCloudNode } from './TinyCloudNode-
|
|
4
|
+
import { T as TinyCloudNode } from './TinyCloudNode-Cm8kblSj.cjs';
|
|
5
5
|
|
|
6
6
|
/** Constructor-time validation; the space-dependent secrets check runs at sign-in and open. */
|
|
7
7
|
declare function assertValidReplicationConfig(replication: (ReplicationOptions & {
|
package/dist/core.cjs
CHANGED
|
@@ -3326,6 +3326,12 @@ function describeHostFailure2(result) {
|
|
|
3326
3326
|
const text = result.error?.trim();
|
|
3327
3327
|
return text ? `${result.status} - ${text}` : `${result.status}`;
|
|
3328
3328
|
}
|
|
3329
|
+
function assertDelegationActivated(result, delegation, requireActivation) {
|
|
3330
|
+
const skipped = requireActivation ? (delegation.resources?.map((r) => r.space) ?? [delegation.spaceId]).filter((space) => result.skipped?.includes(space)) : [];
|
|
3331
|
+
if (result.success && skipped.length === 0) return;
|
|
3332
|
+
const detail = result.success ? `the node skipped ${[...new Set(skipped)].join(", ")} (space not hosted on the node)` : describeHostFailure2(result);
|
|
3333
|
+
throw Object.assign(new Error(`Failed to activate delegation with host: ${detail}`), { cause: result });
|
|
3334
|
+
}
|
|
3329
3335
|
function ownerDelegationPermissions(params) {
|
|
3330
3336
|
const hasPermissions = Object.prototype.hasOwnProperty.call(params, "permissions");
|
|
3331
3337
|
const hasLegacy = Object.prototype.hasOwnProperty.call(params, "path") || Object.prototype.hasOwnProperty.call(params, "actions");
|
|
@@ -3959,7 +3965,6 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3959
3965
|
if (!this.wasmBindings.computeCid) throw new Error("computeCid is unavailable");
|
|
3960
3966
|
return this.wasmBindings.computeCid(data, codec);
|
|
3961
3967
|
},
|
|
3962
|
-
// delegationManager: undefined - not needed for receive()
|
|
3963
3968
|
createKVService: (config) => {
|
|
3964
3969
|
const prefix = config.pathPrefix?.replace(/\/$/, "");
|
|
3965
3970
|
const kvService = new import_sdk_core10.KVService({ prefix });
|
|
@@ -5078,6 +5083,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
5078
5083
|
return;
|
|
5079
5084
|
}
|
|
5080
5085
|
if (!this.currentSessionCoversAccountRegistry()) {
|
|
5086
|
+
if (!_TinyCloudNode.accountRegistrySkipLogged) {
|
|
5087
|
+
_TinyCloudNode.accountRegistrySkipLogged = true;
|
|
5088
|
+
import_sdk_services2.tinyCloudDebugLogger.log("registry.skip");
|
|
5089
|
+
}
|
|
5081
5090
|
return;
|
|
5082
5091
|
}
|
|
5083
5092
|
const controller = new AbortController();
|
|
@@ -6043,7 +6052,6 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6043
6052
|
});
|
|
6044
6053
|
sharingService.updateConfig({
|
|
6045
6054
|
session: input.serviceSession,
|
|
6046
|
-
delegationManager,
|
|
6047
6055
|
sessionExpiry: input.sessionExpiry,
|
|
6048
6056
|
createDelegationWasm: (params) => {
|
|
6049
6057
|
graph.assertActive();
|
|
@@ -6983,7 +6991,6 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6983
6991
|
assertActive: () => graph.assertActive(),
|
|
6984
6992
|
keyProvider: this._keyProvider,
|
|
6985
6993
|
registry: this._capabilityRegistry,
|
|
6986
|
-
delegationManager: this._delegationManager,
|
|
6987
6994
|
sessionExpiry: this.getSessionExpiry(),
|
|
6988
6995
|
createDelegationWasm: (params) => {
|
|
6989
6996
|
graph.assertActive();
|
|
@@ -7966,16 +7973,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
7966
7973
|
* ```typescript
|
|
7967
7974
|
* const delegations = alice.delegationManager;
|
|
7968
7975
|
*
|
|
7969
|
-
* //
|
|
7970
|
-
* const
|
|
7971
|
-
* delegateDID: bob.did,
|
|
7972
|
-
* path: "shared/",
|
|
7973
|
-
* actions: ["tinycloud.kv/get", "tinycloud.kv/put"],
|
|
7974
|
-
* expiry: new Date(Date.now() + 24 * 60 * 60 * 1000), // 24 hours
|
|
7975
|
-
* });
|
|
7976
|
-
*
|
|
7977
|
-
* // List delegations
|
|
7978
|
-
* const listResult = await delegations.list();
|
|
7976
|
+
* // Query account delegations
|
|
7977
|
+
* const page = await delegations.query();
|
|
7979
7978
|
*
|
|
7980
7979
|
* // Revoke a delegation
|
|
7981
7980
|
* await delegations.revoke(delegationCid);
|
|
@@ -8176,32 +8175,6 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8176
8175
|
// ===========================================================================
|
|
8177
8176
|
// v2 Delegation Convenience Methods
|
|
8178
8177
|
// ===========================================================================
|
|
8179
|
-
/**
|
|
8180
|
-
* Create a delegation using the v2 DelegationManager.
|
|
8181
|
-
*
|
|
8182
|
-
* This is a convenience method that wraps DelegationManager.create().
|
|
8183
|
-
* For more control, use `this.delegationManager` directly.
|
|
8184
|
-
*
|
|
8185
|
-
* @param params - Delegation parameters
|
|
8186
|
-
* @returns Result containing the created Delegation
|
|
8187
|
-
*
|
|
8188
|
-
* @example
|
|
8189
|
-
* ```typescript
|
|
8190
|
-
* const result = await alice.delegate({
|
|
8191
|
-
* delegateDID: bob.did,
|
|
8192
|
-
* path: "shared/",
|
|
8193
|
-
* actions: ["tinycloud.kv/get", "tinycloud.kv/put"],
|
|
8194
|
-
* expiry: new Date(Date.now() + 24 * 60 * 60 * 1000),
|
|
8195
|
-
* });
|
|
8196
|
-
*
|
|
8197
|
-
* if (result.ok) {
|
|
8198
|
-
* console.log("Delegation created:", result.data.cid);
|
|
8199
|
-
* }
|
|
8200
|
-
* ```
|
|
8201
|
-
*/
|
|
8202
|
-
async delegate(params) {
|
|
8203
|
-
return this.delegationManager.create(params);
|
|
8204
|
-
}
|
|
8205
8178
|
/**
|
|
8206
8179
|
* Revoke a delegation with the owner wallet when available. Session-only
|
|
8207
8180
|
* clients continue to use their delegated revocation authority.
|
|
@@ -8227,14 +8200,6 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8227
8200
|
0x55n
|
|
8228
8201
|
);
|
|
8229
8202
|
}
|
|
8230
|
-
/**
|
|
8231
|
-
* List all delegations for the current session's space.
|
|
8232
|
-
*
|
|
8233
|
-
* @returns Result containing an array of Delegations
|
|
8234
|
-
*/
|
|
8235
|
-
async listDelegations() {
|
|
8236
|
-
return this.delegationManager.list();
|
|
8237
|
-
}
|
|
8238
8203
|
/**
|
|
8239
8204
|
* Check if the current session has permission for a path and action.
|
|
8240
8205
|
*
|
|
@@ -8362,7 +8327,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8362
8327
|
plan.grant,
|
|
8363
8328
|
plan.operations,
|
|
8364
8329
|
onPrepared,
|
|
8365
|
-
options?.disableSubDelegation === true
|
|
8330
|
+
options?.disableSubDelegation === true,
|
|
8331
|
+
options?.requireActivation === true
|
|
8366
8332
|
);
|
|
8367
8333
|
return { delegation: delegation2, prompted: false };
|
|
8368
8334
|
}
|
|
@@ -8372,7 +8338,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8372
8338
|
effectiveExpiration,
|
|
8373
8339
|
session,
|
|
8374
8340
|
onPrepared,
|
|
8375
|
-
options?.disableSubDelegation === true
|
|
8341
|
+
options?.disableSubDelegation === true,
|
|
8342
|
+
options?.requireActivation === true
|
|
8376
8343
|
);
|
|
8377
8344
|
return { delegation, prompted: false };
|
|
8378
8345
|
}
|
|
@@ -8603,7 +8570,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8603
8570
|
*
|
|
8604
8571
|
* @internal
|
|
8605
8572
|
*/
|
|
8606
|
-
async createDelegationViaWasmPath(did, entries, expirationTime, session, onPrepared, disableSubDelegation = false) {
|
|
8573
|
+
async createDelegationViaWasmPath(did, entries, expirationTime, session, onPrepared, disableSubDelegation = false, requireActivation = false) {
|
|
8607
8574
|
if (entries.length === 0) {
|
|
8608
8575
|
throw new Error(
|
|
8609
8576
|
"createDelegationViaWasmPath requires a non-empty entries array"
|
|
@@ -8687,15 +8654,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8687
8654
|
this.config.host,
|
|
8688
8655
|
delegationHeader
|
|
8689
8656
|
);
|
|
8690
|
-
|
|
8691
|
-
throw Object.assign(
|
|
8692
|
-
new Error(`Failed to activate delegation with host: ${describeHostFailure2(activateResult)}`),
|
|
8693
|
-
{ cause: activateResult }
|
|
8694
|
-
);
|
|
8695
|
-
}
|
|
8657
|
+
assertDelegationActivated(activateResult, delegation, requireActivation);
|
|
8696
8658
|
return delegation;
|
|
8697
8659
|
}
|
|
8698
|
-
async createDelegationViaRuntimeGrant(did, entries, expirationTime, grant, requestedOperations, onPrepared, disableSubDelegation = false) {
|
|
8660
|
+
async createDelegationViaRuntimeGrant(did, entries, expirationTime, grant, requestedOperations, onPrepared, disableSubDelegation = false, requireActivation = false) {
|
|
8699
8661
|
this.assertRuntimeGrantCaveatsPreservable(entries, requestedOperations, grant);
|
|
8700
8662
|
this.assertDelegationCaveatsPreservable(entries);
|
|
8701
8663
|
const result = this.createDelegationWrapper({
|
|
@@ -8729,12 +8691,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8729
8691
|
targetHost,
|
|
8730
8692
|
delegationHeader
|
|
8731
8693
|
);
|
|
8732
|
-
|
|
8733
|
-
throw Object.assign(
|
|
8734
|
-
new Error(`Failed to activate delegation with host: ${describeHostFailure2(activateResult)}`),
|
|
8735
|
-
{ cause: activateResult }
|
|
8736
|
-
);
|
|
8737
|
-
}
|
|
8694
|
+
assertDelegationActivated(activateResult, delegation, requireActivation);
|
|
8738
8695
|
return delegation;
|
|
8739
8696
|
}
|
|
8740
8697
|
resolvePermissionSpace(space, session) {
|
|
@@ -9681,6 +9638,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9681
9638
|
};
|
|
9682
9639
|
}
|
|
9683
9640
|
};
|
|
9641
|
+
/** Set once per process: the registry sync was skipped for want of account access. */
|
|
9642
|
+
_TinyCloudNode.accountRegistrySkipLogged = false;
|
|
9684
9643
|
// ===========================================================================
|
|
9685
9644
|
// Capability-chain delegation (spec: .claude/specs/capability-chain.md)
|
|
9686
9645
|
// ===========================================================================
|