@tinycloud/node-sdk 3.3.0-beta.7 → 3.3.0-beta.8
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-BchWB_zv.d.cts → TinyCloudNode-CcNh20QX.d.cts} +19 -3
- package/dist/{TinyCloudNode-BchWB_zv.d.ts → TinyCloudNode-CcNh20QX.d.ts} +19 -3
- package/dist/{authority-lrA-698X.d.cts → authority-Cwotwza3.d.cts} +1 -1
- package/dist/{authority-4HXYteKF.d.ts → authority-D_u9a7Wl.d.ts} +1 -1
- package/dist/core.cjs +31 -20
- 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 +32 -20
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +31 -20
- 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 +32 -20
- 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
package/dist/core.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReplicationOptions } from '@tinycloud/sdk-core';
|
|
2
2
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CanonicalAddress, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DidCacheKeyOptions, DidEqualsOptions, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, ReceiveOptions, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, addressStorageKey, buildSpaceUri, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, canonicalizeSecretScope, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, defaultSpaceCreationHandler, didCacheKey, didEquals, disableTinyCloudDebug, enableTinyCloudDebug, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, loadManifest, makePkhSpaceId, makePublicSpaceId, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
|
|
3
3
|
import { _ as __gated_network } from './gated-network-BEF2XSTC.cjs';
|
|
4
|
-
import { _ as __authority } from './authority-
|
|
4
|
+
import { _ as __authority } from './authority-Cwotwza3.cjs';
|
|
5
5
|
import { _ as __runtime } from './runtime-D1o9Eybt.cjs';
|
|
6
6
|
import { ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
|
|
7
7
|
export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider } from './WasmKeyProvider-5Ee7fcAw.cjs';
|
|
8
|
-
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, l as NodeUserAuthorizationConfig, p as OwnerDelegationReceipt, P as PortableDelegation, u as RuntimePermissionGrantOptions, S as SecretPermissionHint, v as SecretReadInput, w as SecretReadResult, y as SignStrategy, T as TinyCloudNode, z as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, F as UnifiedOwnerRootReceipt, G as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, J as activateCompactRuntimeDelegation, L as defaultSignStrategy, M as deserializeDelegation, W as serializeDelegation } from './TinyCloudNode-
|
|
8
|
+
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, l as NodeUserAuthorizationConfig, p as OwnerDelegationReceipt, P as PortableDelegation, u as RuntimePermissionGrantOptions, S as SecretPermissionHint, v as SecretReadInput, w as SecretReadResult, y as SignStrategy, T as TinyCloudNode, z as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, F as UnifiedOwnerRootReceipt, G as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, J as activateCompactRuntimeDelegation, L as defaultSignStrategy, M as deserializeDelegation, W as serializeDelegation } from './TinyCloudNode-CcNh20QX.cjs';
|
|
9
9
|
import '@tinycloud/sdk-services';
|
|
10
10
|
import 'events';
|
|
11
11
|
|
package/dist/core.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReplicationOptions } from '@tinycloud/sdk-core';
|
|
2
2
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CanonicalAddress, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DidCacheKeyOptions, DidEqualsOptions, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, ReceiveOptions, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, addressStorageKey, buildSpaceUri, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, canonicalizeSecretScope, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, defaultSpaceCreationHandler, didCacheKey, didEquals, disableTinyCloudDebug, enableTinyCloudDebug, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, loadManifest, makePkhSpaceId, makePublicSpaceId, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
|
|
3
3
|
import { _ as __gated_network } from './gated-network-BEF2XSTC.js';
|
|
4
|
-
import { _ as __authority } from './authority-
|
|
4
|
+
import { _ as __authority } from './authority-D_u9a7Wl.js';
|
|
5
5
|
import { _ as __runtime } from './runtime-v62FzQHz.js';
|
|
6
6
|
import { ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
|
|
7
7
|
export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider } from './WasmKeyProvider-5Ee7fcAw.js';
|
|
8
|
-
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, l as NodeUserAuthorizationConfig, p as OwnerDelegationReceipt, P as PortableDelegation, u as RuntimePermissionGrantOptions, S as SecretPermissionHint, v as SecretReadInput, w as SecretReadResult, y as SignStrategy, T as TinyCloudNode, z as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, F as UnifiedOwnerRootReceipt, G as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, J as activateCompactRuntimeDelegation, L as defaultSignStrategy, M as deserializeDelegation, W as serializeDelegation } from './TinyCloudNode-
|
|
8
|
+
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, l as NodeUserAuthorizationConfig, p as OwnerDelegationReceipt, P as PortableDelegation, u as RuntimePermissionGrantOptions, S as SecretPermissionHint, v as SecretReadInput, w as SecretReadResult, y as SignStrategy, T as TinyCloudNode, z as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, F as UnifiedOwnerRootReceipt, G as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, J as activateCompactRuntimeDelegation, L as defaultSignStrategy, M as deserializeDelegation, W as serializeDelegation } from './TinyCloudNode-CcNh20QX.js';
|
|
9
9
|
import '@tinycloud/sdk-services';
|
|
10
10
|
import 'events';
|
|
11
11
|
|
package/dist/core.js
CHANGED
|
@@ -2542,6 +2542,7 @@ import {
|
|
|
2542
2542
|
validateShareDeliveryAuthorizationV3Bytes,
|
|
2543
2543
|
verifyEip191MessageSignature,
|
|
2544
2544
|
signCompactUcanRootAuthorization,
|
|
2545
|
+
markDelegationTerminal,
|
|
2545
2546
|
isStorageFullError,
|
|
2546
2547
|
STORAGE_FULL_MESSAGE,
|
|
2547
2548
|
STORAGE_WRITE_TOO_LARGE_MESSAGE,
|
|
@@ -3368,6 +3369,7 @@ function ownerPermissionsToAbilities(permissions) {
|
|
|
3368
3369
|
}
|
|
3369
3370
|
return { abilities, rawAbilities };
|
|
3370
3371
|
}
|
|
3372
|
+
var TERMINAL_DELEGATION_REQUIRES_SESSION_KEY = "disableSubDelegation requires a session-key delegation";
|
|
3371
3373
|
function base64UrlEncode(bytes) {
|
|
3372
3374
|
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
3373
3375
|
let output = "";
|
|
@@ -6953,11 +6955,12 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6953
6955
|
* Both SharingService (single-entry) and
|
|
6954
6956
|
* {@link TinyCloudNode.delegateTo} (multi-entry) drive this through
|
|
6955
6957
|
* the same code path so there's exactly one place that touches the
|
|
6956
|
-
* WASM boundary.
|
|
6958
|
+
* WASM boundary. `terminal` adds the node's terminal marker, which the
|
|
6959
|
+
* WASM builder cannot emit.
|
|
6957
6960
|
*
|
|
6958
6961
|
* @internal
|
|
6959
6962
|
*/
|
|
6960
|
-
createDelegationWrapper(params) {
|
|
6963
|
+
createDelegationWrapper(params, terminal = false) {
|
|
6961
6964
|
const wasmSession = {
|
|
6962
6965
|
delegationHeader: params.session.delegationHeader,
|
|
6963
6966
|
delegationCid: params.session.delegationCid,
|
|
@@ -6977,8 +6980,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6977
6980
|
params.notBeforeSecs
|
|
6978
6981
|
);
|
|
6979
6982
|
return {
|
|
6980
|
-
delegation: result.delegation,
|
|
6981
|
-
cid: result.cid,
|
|
6983
|
+
...terminal ? markDelegationTerminal(result.delegation, params.session.jwk) : { delegation: result.delegation, cid: result.cid },
|
|
6982
6984
|
// Rust serde `rename_all = "camelCase"` emits `delegateDid`
|
|
6983
6985
|
// (lowercase d); the TypeScript interface uses `delegateDID`
|
|
6984
6986
|
// (historical, matches Delegation.delegateDID). Normalize here.
|
|
@@ -8227,6 +8229,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8227
8229
|
effectiveExpiration = sessionExpiry;
|
|
8228
8230
|
}
|
|
8229
8231
|
if (options?.forceWalletSign) {
|
|
8232
|
+
if (options.disableSubDelegation) {
|
|
8233
|
+
throw new Error(TERMINAL_DELEGATION_REQUIRES_SESSION_KEY);
|
|
8234
|
+
}
|
|
8230
8235
|
if (expandedEntries.length > 1) {
|
|
8231
8236
|
throw new Error(
|
|
8232
8237
|
"delegateTo with forceWalletSign=true supports at most one PermissionEntry. Multi-entry requests must go through the session-key UCAN path (drop forceWalletSign) or the legacy createDelegation method."
|
|
@@ -8262,7 +8267,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8262
8267
|
plan.effectiveExpiration,
|
|
8263
8268
|
plan.grant,
|
|
8264
8269
|
plan.operations,
|
|
8265
|
-
onPrepared
|
|
8270
|
+
onPrepared,
|
|
8271
|
+
options?.disableSubDelegation === true
|
|
8266
8272
|
);
|
|
8267
8273
|
return { delegation: delegation2, prompted: false };
|
|
8268
8274
|
}
|
|
@@ -8271,7 +8277,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8271
8277
|
expandedEntries,
|
|
8272
8278
|
effectiveExpiration,
|
|
8273
8279
|
session,
|
|
8274
|
-
onPrepared
|
|
8280
|
+
onPrepared,
|
|
8281
|
+
options?.disableSubDelegation === true
|
|
8275
8282
|
);
|
|
8276
8283
|
return { delegation, prompted: false };
|
|
8277
8284
|
}
|
|
@@ -8502,7 +8509,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8502
8509
|
*
|
|
8503
8510
|
* @internal
|
|
8504
8511
|
*/
|
|
8505
|
-
async createDelegationViaWasmPath(did, entries, expirationTime, session, onPrepared) {
|
|
8512
|
+
async createDelegationViaWasmPath(did, entries, expirationTime, session, onPrepared, disableSubDelegation = false) {
|
|
8506
8513
|
if (entries.length === 0) {
|
|
8507
8514
|
throw new Error(
|
|
8508
8515
|
"createDelegationViaWasmPath requires a non-empty entries array"
|
|
@@ -8562,7 +8569,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8562
8569
|
spaceId,
|
|
8563
8570
|
abilities,
|
|
8564
8571
|
expirationSecs
|
|
8565
|
-
});
|
|
8572
|
+
}, disableSubDelegation);
|
|
8566
8573
|
const primary = result.resources[0];
|
|
8567
8574
|
const delegationHeader = { Authorization: result.delegation };
|
|
8568
8575
|
const delegation = {
|
|
@@ -8572,7 +8579,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8572
8579
|
path: primary.path,
|
|
8573
8580
|
actions: primary.actions,
|
|
8574
8581
|
resources: result.resources,
|
|
8575
|
-
disableSubDelegation
|
|
8582
|
+
disableSubDelegation,
|
|
8576
8583
|
expiry: result.expiry,
|
|
8577
8584
|
delegateDID: did,
|
|
8578
8585
|
ownerAddress: session.address,
|
|
@@ -8594,7 +8601,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8594
8601
|
}
|
|
8595
8602
|
return delegation;
|
|
8596
8603
|
}
|
|
8597
|
-
async createDelegationViaRuntimeGrant(did, entries, expirationTime, grant, requestedOperations, onPrepared) {
|
|
8604
|
+
async createDelegationViaRuntimeGrant(did, entries, expirationTime, grant, requestedOperations, onPrepared, disableSubDelegation = false) {
|
|
8598
8605
|
this.assertRuntimeGrantCaveatsPreservable(entries, requestedOperations, grant);
|
|
8599
8606
|
this.assertDelegationCaveatsPreservable(entries);
|
|
8600
8607
|
const result = this.createDelegationWrapper({
|
|
@@ -8603,7 +8610,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8603
8610
|
spaceId: grant.session.spaceId,
|
|
8604
8611
|
abilities: this.permissionsToAbilities(entries),
|
|
8605
8612
|
expirationSecs: Math.floor(expirationTime.getTime() / 1e3)
|
|
8606
|
-
});
|
|
8613
|
+
}, disableSubDelegation);
|
|
8607
8614
|
const primary = result.resources[0];
|
|
8608
8615
|
const delegationHeader = { Authorization: result.delegation };
|
|
8609
8616
|
const targetHost = grant.delegation.host ?? this.config.host;
|
|
@@ -8614,7 +8621,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8614
8621
|
path: primary.path,
|
|
8615
8622
|
actions: primary.actions,
|
|
8616
8623
|
resources: result.resources,
|
|
8617
|
-
disableSubDelegation
|
|
8624
|
+
disableSubDelegation,
|
|
8618
8625
|
expiry: result.expiry,
|
|
8619
8626
|
delegateDID: did,
|
|
8620
8627
|
ownerAddress: grant.delegation.ownerAddress,
|
|
@@ -9198,11 +9205,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9198
9205
|
params.spaceIdOverride
|
|
9199
9206
|
);
|
|
9200
9207
|
try {
|
|
9201
|
-
const result = await this.delegateTo(
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
);
|
|
9208
|
+
const result = await this.delegateTo(resolvedDelegateDID, entries, {
|
|
9209
|
+
...params.expiryMs !== void 0 ? { expiry: params.expiryMs } : {},
|
|
9210
|
+
disableSubDelegation: params.disableSubDelegation
|
|
9211
|
+
});
|
|
9206
9212
|
return result.delegation;
|
|
9207
9213
|
} catch (err2) {
|
|
9208
9214
|
if (err2 instanceof PermissionNotInManifestError) {
|
|
@@ -9223,6 +9229,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9223
9229
|
* @internal
|
|
9224
9230
|
*/
|
|
9225
9231
|
async createDelegationWalletPath(params) {
|
|
9232
|
+
if (params.disableSubDelegation) {
|
|
9233
|
+
throw new Error(TERMINAL_DELEGATION_REQUIRES_SESSION_KEY);
|
|
9234
|
+
}
|
|
9226
9235
|
if (!this.signer) {
|
|
9227
9236
|
throw new Error("Cannot createDelegation() in session-only mode. Requires wallet mode.");
|
|
9228
9237
|
}
|
|
@@ -9278,7 +9287,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9278
9287
|
spaceId: params.spaceIdOverride ?? session.spaceId,
|
|
9279
9288
|
path: params.path,
|
|
9280
9289
|
actions: params.actions,
|
|
9281
|
-
disableSubDelegation:
|
|
9290
|
+
disableSubDelegation: false,
|
|
9282
9291
|
expiry: expirationTime,
|
|
9283
9292
|
delegateDID: params.delegateDID,
|
|
9284
9293
|
ownerAddress: session.address,
|
|
@@ -9321,7 +9330,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9321
9330
|
spaceId: publicSpaceId,
|
|
9322
9331
|
path: "",
|
|
9323
9332
|
actions: [KV3.GET, KV3.PUT, KV3.METADATA],
|
|
9324
|
-
disableSubDelegation:
|
|
9333
|
+
disableSubDelegation: false,
|
|
9325
9334
|
expiry: expirationTime,
|
|
9326
9335
|
delegateDID: params.delegateDID,
|
|
9327
9336
|
ownerAddress: session.address,
|
|
@@ -9488,6 +9497,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9488
9497
|
if (parentDelegation.disableSubDelegation) {
|
|
9489
9498
|
throw new Error("Parent delegation does not allow sub-delegation");
|
|
9490
9499
|
}
|
|
9500
|
+
if (params.disableSubDelegation) {
|
|
9501
|
+
throw new Error(TERMINAL_DELEGATION_REQUIRES_SESSION_KEY);
|
|
9502
|
+
}
|
|
9491
9503
|
const parentResources = parentDelegation.resources ?? [{
|
|
9492
9504
|
service: parentDelegation.actions[0]?.split("/", 1)[0]?.replace(/^tinycloud\./, "") ?? "kv",
|
|
9493
9505
|
space: parentDelegation.spaceId,
|
|
@@ -9560,7 +9572,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9560
9572
|
spaceId: parentDelegation.spaceId,
|
|
9561
9573
|
path: requestedResources[0].path,
|
|
9562
9574
|
actions: requestedResources[0].actions,
|
|
9563
|
-
disableSubDelegation:
|
|
9575
|
+
disableSubDelegation: false,
|
|
9564
9576
|
expiry: actualExpiry,
|
|
9565
9577
|
delegateDID: params.delegateDID,
|
|
9566
9578
|
ownerAddress: parentDelegation.ownerAddress,
|