@tinycloud/node-sdk 3.1.0-beta.8 → 3.1.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/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ISigner, Bytes, CapabilityPresentationEnvelopeV1, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
2
2
  export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, ParsedNetworkId, ParsedSecretCatalogKey, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, SubscribeOptions, 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, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, isStorageFullError, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
3
- export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, i as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, l as RestorableSession, m as RuntimeDelegationActivator, n as RuntimeDelegationRejectedError, o as RuntimeDelegationRejection, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, s as SessionGrantProof, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, x as VerifiedSessionGrant, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, G as activateValidatedRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, L as grantAuthRequest, Q as serializeDelegation } from './core-CC7uDKZP.cjs';
3
+ export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, i as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, l as RestorableSession, m as RuntimeDelegationActivator, n as RuntimeDelegationRejectedError, o as RuntimeDelegationRejection, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, s as SessionGrantProof, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, x as VerifiedSessionGrant, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, G as activateValidatedRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, L as grantAuthRequest, Q as serializeDelegation } from './core-AEx5vAa8.cjs';
4
4
  import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
5
5
  import 'events';
6
6
  import '@tinycloud/sdk-services';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ISigner, Bytes, CapabilityPresentationEnvelopeV1, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
2
2
  export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, ParsedNetworkId, ParsedSecretCatalogKey, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, SubscribeOptions, 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, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, isStorageFullError, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
3
- export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, i as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, l as RestorableSession, m as RuntimeDelegationActivator, n as RuntimeDelegationRejectedError, o as RuntimeDelegationRejection, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, s as SessionGrantProof, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, x as VerifiedSessionGrant, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, G as activateValidatedRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, L as grantAuthRequest, Q as serializeDelegation } from './core-CC7uDKZP.js';
3
+ export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, i as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, l as RestorableSession, m as RuntimeDelegationActivator, n as RuntimeDelegationRejectedError, o as RuntimeDelegationRejection, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, s as SessionGrantProof, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, x as VerifiedSessionGrant, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, G as activateValidatedRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, L as grantAuthRequest, Q as serializeDelegation } from './core-AEx5vAa8.js';
4
4
  import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
5
5
  import 'events';
6
6
  import '@tinycloud/sdk-services';
package/dist/index.js CHANGED
@@ -17201,6 +17201,7 @@ import {
17201
17201
  recapCaveatsEqual,
17202
17202
  expandPermissionEntries as expandPermissionEntriesCore,
17203
17203
  isCapabilitySubset,
17204
+ isExplicitOnlyAction,
17204
17205
  parseRecapCapabilities,
17205
17206
  SERVICE_LONG_TO_SHORT,
17206
17207
  SERVICE_SHORT_TO_LONG,
@@ -19721,15 +19722,21 @@ var _TinyCloudNode = class _TinyCloudNode {
19721
19722
  if (!this.wasmBindings.invokeAny) {
19722
19723
  throw new Error("WASM binding does not support invokeAny");
19723
19724
  }
19724
- const operations = entries.flatMap((entry) => {
19725
+ const routedEntries = entries;
19726
+ const operations = routedEntries.flatMap((entry) => {
19725
19727
  const operation = this.operationFromInvokeAnyEntry(entry);
19726
19728
  return operation ? [operation] : [];
19727
19729
  });
19728
- const grant = this.findGrantForOperations(operations);
19729
- const invocationSession = !grant || grant.provenance === "primary" ? session : grant.session;
19730
- const caveatPreservingEntries = grant ? entries.map((entry) => {
19730
+ const authorityCid = routedEntries.length === 1 ? routedEntries[0]?.revokeAuthorityCid : void 0;
19731
+ const explicitGrant = authorityCid === void 0 ? void 0 : this.runtimePermissionGrants.find((grant2) => grant2.delegation.cid === authorityCid);
19732
+ if (authorityCid !== void 0 && !explicitGrant) {
19733
+ throw new Error(`Explicit revocation authority ${authorityCid} is not installed.`);
19734
+ }
19735
+ const grant = explicitGrant ?? this.findGrantForOperations(operations);
19736
+ const invocationSession = explicitGrant ? explicitGrant.session : !grant || grant.provenance === "primary" ? session : grant.session;
19737
+ const caveatPreservingEntries = routedEntries.map(({ revokeAuthorityCid: _cid, ...entry }) => {
19731
19738
  const requested = this.operationFromInvokeAnyEntry(entry);
19732
- const granted = requested && grant.operations.find(
19739
+ const granted = grant && requested && grant.operations.find(
19733
19740
  (candidate) => this.operationCovers(candidate, requested)
19734
19741
  );
19735
19742
  if (!granted?.caveats?.length) {
@@ -19739,7 +19746,7 @@ var _TinyCloudNode = class _TinyCloudNode {
19739
19746
  throw new Error("Invocation caveats do not match signed ReCap authority.");
19740
19747
  }
19741
19748
  return { ...entry, caveats: cloneRecapCaveats(granted.caveats) };
19742
- }) : entries;
19749
+ });
19743
19750
  return this.wasmBindings.invokeAny(invocationSession, caveatPreservingEntries, facts);
19744
19751
  };
19745
19752
  this.explicitHost = config.host;
@@ -20204,12 +20211,13 @@ var _TinyCloudNode = class _TinyCloudNode {
20204
20211
  if (!auth) {
20205
20212
  throw new Error("Account bootstrap requires an active wallet session");
20206
20213
  }
20214
+ const accountSpaceId = this.ownedSpaceId(ACCOUNT_REGISTRY_SPACE2);
20207
20215
  const skipped = auth.lastActivationSkippedSpaceIds;
20216
+ if (skipped.includes(accountSpaceId)) return { action: "run", mode: "fresh" };
20208
20217
  if (skipped.some((spaceId) => enshrinedSpaceIds.has(spaceId))) {
20209
- return { action: "run", mode: "fresh" };
20218
+ return { action: "run", mode: "repair" };
20210
20219
  }
20211
20220
  try {
20212
- const accountSpaceId = this.ownedSpaceId(ACCOUNT_REGISTRY_SPACE2);
20213
20221
  const markerPermission = {
20214
20222
  service: "tinycloud.kv",
20215
20223
  space: accountSpaceId,
@@ -20221,7 +20229,7 @@ var _TinyCloudNode = class _TinyCloudNode {
20221
20229
  }
20222
20230
  const marker = await this.readBootstrapCompletionMarker();
20223
20231
  if (marker.ok) {
20224
- if (this.isAcceptedBootstrapCompletionMarker(marker.data.data)) {
20232
+ if (this.isAcceptedBootstrapCompletionMarker(marker.data.data, steps.map((step) => step.id))) {
20225
20233
  return { action: "skip" };
20226
20234
  }
20227
20235
  return { action: "run", mode: "repair" };
@@ -20271,12 +20279,16 @@ var _TinyCloudNode = class _TinyCloudNode {
20271
20279
  );
20272
20280
  }
20273
20281
  }
20274
- isAcceptedBootstrapCompletionMarker(value) {
20282
+ /**
20283
+ * A marker written before a canonical space was added triggers one bounded repair.
20284
+ */
20285
+ isAcceptedBootstrapCompletionMarker(value, canonicalStepIds) {
20275
20286
  if (typeof value !== "object" || value === null) return false;
20276
20287
  const entries = Object.entries(value);
20277
20288
  const markerValue = (name) => entries.find(([key2]) => key2 === name)?.[1];
20278
20289
  const version23 = markerValue("v");
20279
- return typeof version23 === "number" && Number.isInteger(version23) && ACCEPTED_MARKER_VERSIONS.some((acceptedVersion) => acceptedVersion === version23);
20290
+ const stepIds = markerValue("stepIds");
20291
+ return typeof version23 === "number" && Number.isInteger(version23) && ACCEPTED_MARKER_VERSIONS.some((acceptedVersion) => acceptedVersion === version23) && Array.isArray(stepIds) && canonicalStepIds.every((stepId) => stepIds.includes(stepId));
20280
20292
  }
20281
20293
  markerReadIsUnhostedSpace(meta) {
20282
20294
  return meta?.status === 404;
@@ -20363,30 +20375,39 @@ var _TinyCloudNode = class _TinyCloudNode {
20363
20375
  }
20364
20376
  }
20365
20377
  if (step.kind === "seed-spaces") {
20366
- const registered = await this.account.spaces.registerBatch(
20367
- step.spaces.map((space) => ({
20368
- spaceId: space.spaceId,
20369
- name: space.name,
20370
- ownerDid: this.did,
20371
- type: "owned",
20372
- permissions: ["*"],
20373
- status: "active"
20374
- }))
20375
- );
20376
- if (!registered.ok) {
20377
- throw Object.assign(
20378
- new Error(`Failed to seed account spaces: ${registered.error.message}`),
20379
- { cause: registered.error }
20380
- );
20381
- }
20382
- const batchError = registered.data.recoveredFromBatchError;
20383
- if (batchError) {
20384
- warnings.push({
20385
- stepId: step.id,
20386
- kind: "batch-write-reconciled",
20387
- code: batchError.code,
20388
- message: batchError.message
20389
- });
20378
+ const inputs = step.spaces.map((space) => ({
20379
+ spaceId: space.spaceId,
20380
+ name: space.name,
20381
+ ownerDid: this.did,
20382
+ type: "owned",
20383
+ permissions: ["*"],
20384
+ status: "active"
20385
+ }));
20386
+ if (mode === "fresh") {
20387
+ const registered = await this.account.spaces.registerBatch(inputs);
20388
+ if (!registered.ok) {
20389
+ throw Object.assign(
20390
+ new Error(`Failed to seed account spaces: ${registered.error.message}`),
20391
+ { cause: registered.error }
20392
+ );
20393
+ }
20394
+ const batchError = registered.data.recoveredFromBatchError;
20395
+ if (batchError) {
20396
+ warnings.push({
20397
+ stepId: step.id,
20398
+ kind: "batch-write-reconciled",
20399
+ code: batchError.code,
20400
+ message: batchError.message
20401
+ });
20402
+ }
20403
+ } else {
20404
+ const ensured = await this.account.spaces.registerMissing(inputs);
20405
+ if (!ensured.ok) {
20406
+ throw Object.assign(
20407
+ new Error(`Failed to seed account spaces: ${ensured.error.message}`),
20408
+ { cause: ensured.error }
20409
+ );
20410
+ }
20390
20411
  }
20391
20412
  }
20392
20413
  if (step.kind === "seed-applications") {
@@ -21071,6 +21092,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21071
21092
  stagedSessionExpiry,
21072
21093
  stagedRecap
21073
21094
  );
21095
+ const stagedAccountSpaceId = stagedAddress ? this.wasmBindings.makeSpaceId(stagedAddress, stagedChainId, ACCOUNT_REGISTRY_SPACE2) : void 0;
21074
21096
  const stagedGraph = this.stageRestoredServiceGraph({
21075
21097
  host: stagedHost,
21076
21098
  manager: stagedManager,
@@ -21079,6 +21101,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21079
21101
  nodeDid: stagedNodeDid,
21080
21102
  address: stagedAddress,
21081
21103
  chainId: stagedChainId,
21104
+ accountSpaceId: stagedAccountSpaceId,
21082
21105
  tinyCloudSession: stagedTcSession,
21083
21106
  sessionExpiry: stagedSessionExpiry,
21084
21107
  recap: stagedRecap
@@ -21244,6 +21267,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21244
21267
  }
21245
21268
  const delegationManager = new DelegationManager({
21246
21269
  hosts: [input.host],
21270
+ accountSpaceId: input.accountSpaceId,
21247
21271
  session: input.serviceSession,
21248
21272
  invoke: graph.invoke,
21249
21273
  invokeAny: graph.invokeAny,
@@ -22948,6 +22972,14 @@ var _TinyCloudNode = class _TinyCloudNode {
22948
22972
  delegation.delegationHeader
22949
22973
  );
22950
22974
  if (!activateResult.success) {
22975
+ if (this.operationsFromDelegation(delegation).some(
22976
+ (operation) => operation.resource?.startsWith("urn:cid:") === true && operation.service === "delegation" && operation.action === "tinycloud.delegation/revoke"
22977
+ ) && activateResult.status === 401 && /Cannot find parent delegation/i.test(activateResult.error ?? "")) {
22978
+ throw Object.assign(
22979
+ new Error("The host cannot activate a root raw-CID revoke authority without a parent delegation."),
22980
+ { code: "RAW_RECAP_RESOURCE_UNSUPPORTED", cause: activateResult }
22981
+ );
22982
+ }
22951
22983
  throw Object.assign(
22952
22984
  new Error(`Failed to activate runtime permission delegation: ${describeHostFailure2(activateResult)}`),
22953
22985
  { cause: activateResult }
@@ -22995,10 +23027,10 @@ var _TinyCloudNode = class _TinyCloudNode {
22995
23027
  }
22996
23028
  this.assertDelegationCaveatsPreservable(expanded);
22997
23029
  const rawEntries = expanded.filter(
22998
- (entry) => this.isEncryptionPermissionEntry(entry)
23030
+ (entry) => this.isEncryptionPermissionEntry(entry) || this.isRawRevocationPermissionEntry(entry)
22999
23031
  );
23000
23032
  const spaceEntries = expanded.filter(
23001
- (entry) => !this.isEncryptionPermissionEntry(entry)
23033
+ (entry) => !this.isEncryptionPermissionEntry(entry) && !this.isRawRevocationPermissionEntry(entry)
23002
23034
  );
23003
23035
  const bySpace = /* @__PURE__ */ new Map();
23004
23036
  for (const entry of spaceEntries) {
@@ -23025,17 +23057,29 @@ var _TinyCloudNode = class _TinyCloudNode {
23025
23057
  }
23026
23058
  const delegatedEntries = [...entries, ...rawForDelegation];
23027
23059
  const abilities = this.permissionsToAbilities(entries);
23028
- const prepared = this.wasmBindings.prepareSession({
23029
- abilities,
23030
- ...rawForDelegation.length > 0 ? { rawAbilities: this.permissionsToRawAbilities(rawForDelegation) } : {},
23031
- address: this.wasmBindings.ensureEip55(session.address),
23032
- chainId: session.chainId,
23033
- domain: this.siweDomain,
23034
- issuedAt: now.toISOString(),
23035
- expirationTime: expiresAt.toISOString(),
23036
- spaceId,
23037
- jwk: session.jwk
23038
- });
23060
+ const prepared = (() => {
23061
+ try {
23062
+ return this.wasmBindings.prepareSession({
23063
+ abilities,
23064
+ ...rawForDelegation.length > 0 ? { rawAbilities: this.permissionsToRawAbilities(rawForDelegation) } : {},
23065
+ address: this.wasmBindings.ensureEip55(session.address),
23066
+ chainId: session.chainId,
23067
+ domain: this.siweDomain,
23068
+ issuedAt: now.toISOString(),
23069
+ expirationTime: expiresAt.toISOString(),
23070
+ spaceId,
23071
+ jwk: session.jwk
23072
+ });
23073
+ } catch (error) {
23074
+ if (rawForDelegation.some((entry) => this.isRawRevocationPermissionEntry(entry)) && /invalid ReCap resource URI/i.test(error instanceof Error ? error.message : String(error))) {
23075
+ throw Object.assign(
23076
+ new Error("This WASM build cannot encode raw urn:cid ReCap resources."),
23077
+ { code: "RAW_RECAP_RESOURCE_UNSUPPORTED", cause: error }
23078
+ );
23079
+ }
23080
+ throw error;
23081
+ }
23082
+ })();
23039
23083
  const signature2 = await this.signer.signMessage(prepared.siwe);
23040
23084
  const delegatedSession = this.wasmBindings.completeSessionSetup({
23041
23085
  ...prepared,
@@ -23046,6 +23090,12 @@ var _TinyCloudNode = class _TinyCloudNode {
23046
23090
  delegatedSession.delegationHeader
23047
23091
  );
23048
23092
  if (!activateResult.success) {
23093
+ if (rawForDelegation.some((entry) => this.isRawRevocationPermissionEntry(entry)) && activateResult.status === 401 && /Cannot find parent delegation/i.test(activateResult.error ?? "")) {
23094
+ throw Object.assign(
23095
+ new Error("The host cannot activate a root raw-CID revoke authority without a parent delegation."),
23096
+ { code: "RAW_RECAP_RESOURCE_UNSUPPORTED", cause: activateResult }
23097
+ );
23098
+ }
23049
23099
  throw Object.assign(
23050
23100
  new Error(`Failed to activate runtime permission delegation: ${describeHostFailure2(activateResult)}`),
23051
23101
  { cause: activateResult }
@@ -23398,8 +23448,18 @@ var _TinyCloudNode = class _TinyCloudNode {
23398
23448
  * @throws {@link PermissionNotInManifestError} when any requested
23399
23449
  * entry is not a subset of the granted session capabilities and
23400
23450
  * `forceWalletSign` is not set.
23451
+ * @throws when `onPrepared` is combined with `forceWalletSign: true`,
23452
+ * before anything is signed.
23453
+ * @throws the `onPrepared` rejection, unchanged, without activating the
23454
+ * delegation.
23401
23455
  */
23402
23456
  async delegateTo(did, permissions, options) {
23457
+ const onPrepared = options?.onPrepared;
23458
+ if (onPrepared && options?.forceWalletSign) {
23459
+ throw new Error(
23460
+ "delegateTo: onPrepared cannot be combined with forceWalletSign=true; the wallet-signed path activates the delegation before it could be handed to onPrepared."
23461
+ );
23462
+ }
23403
23463
  const session = this.currentTinyCloudSession();
23404
23464
  if (!session) {
23405
23465
  throw new SessionExpiredError(/* @__PURE__ */ new Date(0));
@@ -23458,7 +23518,8 @@ var _TinyCloudNode = class _TinyCloudNode {
23458
23518
  expandedEntries,
23459
23519
  runtimeExpiration,
23460
23520
  runtimeGrant,
23461
- runtimeOperations
23521
+ runtimeOperations,
23522
+ onPrepared
23462
23523
  );
23463
23524
  return { delegation: delegation2, prompted: false };
23464
23525
  }
@@ -23468,7 +23529,8 @@ var _TinyCloudNode = class _TinyCloudNode {
23468
23529
  did,
23469
23530
  expandedEntries,
23470
23531
  effectiveExpiration,
23471
- session
23532
+ session,
23533
+ onPrepared
23472
23534
  );
23473
23535
  return { delegation, prompted: false };
23474
23536
  }
@@ -23522,7 +23584,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23522
23584
  *
23523
23585
  * @internal
23524
23586
  */
23525
- async createDelegationViaWasmPath(did, entries, expirationTime, session) {
23587
+ async createDelegationViaWasmPath(did, entries, expirationTime, session, onPrepared) {
23526
23588
  if (entries.length === 0) {
23527
23589
  throw new Error(
23528
23590
  "createDelegationViaWasmPath requires a non-empty entries array"
@@ -23585,17 +23647,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23585
23647
  });
23586
23648
  const primary = result.resources[0];
23587
23649
  const delegationHeader = { Authorization: result.delegation };
23588
- const activateResult = await activateSessionWithHost2(
23589
- this.config.host,
23590
- delegationHeader
23591
- );
23592
- if (!activateResult.success) {
23593
- throw Object.assign(
23594
- new Error(`Failed to activate delegation with host: ${describeHostFailure2(activateResult)}`),
23595
- { cause: activateResult }
23596
- );
23597
- }
23598
- return {
23650
+ const delegation = {
23599
23651
  cid: result.cid,
23600
23652
  delegationHeader,
23601
23653
  spaceId,
@@ -23609,8 +23661,22 @@ var _TinyCloudNode = class _TinyCloudNode {
23609
23661
  chainId: session.chainId,
23610
23662
  host: this.config.host
23611
23663
  };
23664
+ if (onPrepared) {
23665
+ await onPrepared(delegation);
23666
+ }
23667
+ const activateResult = await activateSessionWithHost2(
23668
+ this.config.host,
23669
+ delegationHeader
23670
+ );
23671
+ if (!activateResult.success) {
23672
+ throw Object.assign(
23673
+ new Error(`Failed to activate delegation with host: ${describeHostFailure2(activateResult)}`),
23674
+ { cause: activateResult }
23675
+ );
23676
+ }
23677
+ return delegation;
23612
23678
  }
23613
- async createDelegationViaRuntimeGrant(did, entries, expirationTime, grant, requestedOperations) {
23679
+ async createDelegationViaRuntimeGrant(did, entries, expirationTime, grant, requestedOperations, onPrepared) {
23614
23680
  this.assertRuntimeGrantCaveatsPreservable(entries, requestedOperations, grant);
23615
23681
  this.assertDelegationCaveatsPreservable(entries);
23616
23682
  const result = this.createDelegationWrapper({
@@ -23623,17 +23689,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23623
23689
  const primary = result.resources[0];
23624
23690
  const delegationHeader = { Authorization: result.delegation };
23625
23691
  const targetHost = grant.delegation.host ?? this.config.host;
23626
- const activateResult = await activateSessionWithHost2(
23627
- targetHost,
23628
- delegationHeader
23629
- );
23630
- if (!activateResult.success) {
23631
- throw Object.assign(
23632
- new Error(`Failed to activate delegation with host: ${describeHostFailure2(activateResult)}`),
23633
- { cause: activateResult }
23634
- );
23635
- }
23636
- return {
23692
+ const delegation = {
23637
23693
  cid: result.cid,
23638
23694
  delegationHeader,
23639
23695
  spaceId: grant.session.spaceId,
@@ -23647,6 +23703,20 @@ var _TinyCloudNode = class _TinyCloudNode {
23647
23703
  chainId: grant.delegation.chainId,
23648
23704
  host: targetHost
23649
23705
  };
23706
+ if (onPrepared) {
23707
+ await onPrepared(delegation);
23708
+ }
23709
+ const activateResult = await activateSessionWithHost2(
23710
+ targetHost,
23711
+ delegationHeader
23712
+ );
23713
+ if (!activateResult.success) {
23714
+ throw Object.assign(
23715
+ new Error(`Failed to activate delegation with host: ${describeHostFailure2(activateResult)}`),
23716
+ { cause: activateResult }
23717
+ );
23718
+ }
23719
+ return delegation;
23650
23720
  }
23651
23721
  resolvePermissionSpace(space, session) {
23652
23722
  if (space === void 0) {
@@ -23747,6 +23817,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23747
23817
  permissionsToAbilities(entries) {
23748
23818
  const abilities = {};
23749
23819
  for (const entry of entries) {
23820
+ if (this.isRawRevocationPermissionEntry(entry)) continue;
23750
23821
  const service = this.shortServiceName(entry.service);
23751
23822
  abilities[service] ?? (abilities[service] = {});
23752
23823
  const existing = abilities[service][entry.path] ?? [];
@@ -23764,9 +23835,16 @@ var _TinyCloudNode = class _TinyCloudNode {
23764
23835
  isEncryptionPermissionEntry(entry) {
23765
23836
  return entry.service === ENCRYPTION_PERMISSION_SERVICE2 && this.isEncryptionNetworkOperation("encryption", entry.path, entry.space);
23766
23837
  }
23838
+ isRawRevocationPermissionEntry(entry) {
23839
+ return entry.service === "tinycloud.delegation" && entry.path === "" && entry.space?.startsWith("urn:cid:") === true && entry.actions.includes("tinycloud.delegation/revoke");
23840
+ }
23767
23841
  permissionsToRawAbilities(entries) {
23768
23842
  const rawAbilities = {};
23769
23843
  for (const entry of entries) {
23844
+ if (this.isRawRevocationPermissionEntry(entry)) {
23845
+ rawAbilities[entry.space] = [...new Set(entry.actions)];
23846
+ continue;
23847
+ }
23770
23848
  if (!this.isEncryptionPermissionEntry(entry)) {
23771
23849
  continue;
23772
23850
  }
@@ -23786,7 +23864,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23786
23864
  return entries.flatMap((entry) => {
23787
23865
  const service = this.shortServiceName(entry.service);
23788
23866
  return entry.actions.map((action) => ({
23789
- ...this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId },
23867
+ ...this.isRawRevocationPermissionEntry(entry) ? { resource: entry.space } : this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId },
23790
23868
  service,
23791
23869
  path: entry.path,
23792
23870
  action,
@@ -23796,11 +23874,13 @@ var _TinyCloudNode = class _TinyCloudNode {
23796
23874
  }
23797
23875
  /** Raw network authority cannot be covered by a nested encryption space. */
23798
23876
  signedCapabilitySubset(requested, granted) {
23799
- const rawGranted = granted.filter((entry) => this.isEncryptionPermissionEntry(entry)).map((entry) => ({ ...entry, space: "encryption" }));
23800
- const spaceGranted = granted.filter((entry) => !this.isEncryptionPermissionEntry(entry));
23877
+ const rawGranted = granted.filter((entry) => this.isEncryptionPermissionEntry(entry) || this.isRawRevocationPermissionEntry(entry)).map((entry) => this.isEncryptionPermissionEntry(entry) ? { ...entry, space: "encryption" } : entry);
23878
+ const spaceGranted = granted.filter(
23879
+ (entry) => !this.isEncryptionPermissionEntry(entry) && !this.isRawRevocationPermissionEntry(entry)
23880
+ );
23801
23881
  const missing = requested.filter((entry) => {
23802
- const raw = this.isEncryptionPermissionEntry(entry);
23803
- const comparable = raw ? { ...entry, space: "encryption" } : entry;
23882
+ const raw = this.isEncryptionPermissionEntry(entry) || this.isRawRevocationPermissionEntry(entry);
23883
+ const comparable = raw && this.isEncryptionPermissionEntry(entry) ? { ...entry, space: "encryption" } : entry;
23804
23884
  return !isCapabilitySubset([comparable], raw ? rawGranted : spaceGranted).subset;
23805
23885
  });
23806
23886
  return { subset: missing.length === 0, missing };
@@ -23815,10 +23895,11 @@ var _TinyCloudNode = class _TinyCloudNode {
23815
23895
  }
23816
23896
  permissionEntriesToOperations(entries, session) {
23817
23897
  return entries.flatMap((entry) => {
23818
- const spaceId = this.resolvePermissionSpace(entry.space, session);
23898
+ const rawRevocation = this.isRawRevocationPermissionEntry(entry);
23899
+ const spaceId = rawRevocation ? void 0 : this.resolvePermissionSpace(entry.space, session);
23819
23900
  const service = this.shortServiceName(entry.service);
23820
23901
  return entry.actions.map((action) => ({
23821
- ...this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId },
23902
+ ...rawRevocation ? { resource: entry.space } : this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId },
23822
23903
  service,
23823
23904
  path: entry.path,
23824
23905
  action,
@@ -23897,7 +23978,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23897
23978
  delegatedResourcesForEntries(entries, spaceId) {
23898
23979
  return entries.map((entry) => ({
23899
23980
  service: this.shortServiceName(entry.service),
23900
- space: this.isEncryptionPermissionEntry(entry) ? "encryption" : spaceId,
23981
+ space: this.isRawRevocationPermissionEntry(entry) ? entry.space : this.isEncryptionPermissionEntry(entry) ? "encryption" : spaceId,
23901
23982
  path: entry.path,
23902
23983
  actions: [...entry.actions],
23903
23984
  ...entry.caveats === void 0 ? {} : { caveats: cloneRecapCaveats(entry.caveats) }
@@ -23907,8 +23988,9 @@ var _TinyCloudNode = class _TinyCloudNode {
23907
23988
  const resources = delegation.resources !== void 0 && delegation.resources.length > 0 ? delegation.resources : this.flatDelegationResources(delegation);
23908
23989
  return resources.flatMap((resource) => {
23909
23990
  const service = this.invocationServiceName(resource.service);
23991
+ const rawRevocation = service === "delegation" && resource.space.startsWith("urn:cid:") && resource.path === "";
23910
23992
  return resource.actions.map((action) => ({
23911
- ...this.isEncryptionNetworkOperation(service, resource.path, resource.space) ? { resource: resource.path } : { spaceId: resource.space },
23993
+ ...rawRevocation ? { resource: resource.space } : this.isEncryptionNetworkOperation(service, resource.path, resource.space) ? { resource: resource.path } : { spaceId: resource.space },
23912
23994
  service,
23913
23995
  path: resource.path,
23914
23996
  action,
@@ -23954,7 +24036,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23954
24036
  * @internal
23955
24037
  */
23956
24038
  buildActivationAbilities(delegation) {
23957
- var _a, _b, _c;
24039
+ var _a, _b, _c, _d;
23958
24040
  const resources = delegation.resources !== void 0 && delegation.resources.length > 0 ? delegation.resources : this.flatDelegationResources(delegation);
23959
24041
  const abilities = {};
23960
24042
  const rawAbilities = {};
@@ -23974,13 +24056,18 @@ var _TinyCloudNode = class _TinyCloudNode {
23974
24056
  addActions(rawAbilities[resource.path], resource.actions);
23975
24057
  continue;
23976
24058
  }
24059
+ if (service === "delegation" && resource.space.startsWith("urn:cid:") && resource.path === "") {
24060
+ rawAbilities[_b = resource.space] ?? (rawAbilities[_b] = []);
24061
+ addActions(rawAbilities[resource.space], resource.actions);
24062
+ continue;
24063
+ }
23977
24064
  if (resource.space !== delegation.spaceId) {
23978
24065
  throw new Error(
23979
24066
  `useDelegation: resource targets space '${resource.space}' but the delegation activates space '${delegation.spaceId}'. Multi-space delegations cannot be activated in a single useDelegation call.`
23980
24067
  );
23981
24068
  }
23982
24069
  abilities[service] ?? (abilities[service] = {});
23983
- (_b = abilities[service])[_c = resource.path] ?? (_b[_c] = []);
24070
+ (_c = abilities[service])[_d = resource.path] ?? (_c[_d] = []);
23984
24071
  addActions(abilities[service][resource.path], resource.actions);
23985
24072
  }
23986
24073
  return { abilities, rawAbilities };
@@ -24052,6 +24139,9 @@ var _TinyCloudNode = class _TinyCloudNode {
24052
24139
  if (grantedAction === requestedAction) {
24053
24140
  return true;
24054
24141
  }
24142
+ if (isExplicitOnlyAction(requestedAction)) {
24143
+ return false;
24144
+ }
24055
24145
  if (grantedAction.endsWith("/*")) {
24056
24146
  const prefix = grantedAction.slice(0, -2);
24057
24147
  return requestedAction.startsWith(`${prefix}/`);