@tinycloud/node-sdk 3.1.0-beta.10 → 3.1.0-beta.12

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-CMDgVfBj.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-CMDgVfBj.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
@@ -19722,15 +19722,21 @@ var _TinyCloudNode = class _TinyCloudNode {
19722
19722
  if (!this.wasmBindings.invokeAny) {
19723
19723
  throw new Error("WASM binding does not support invokeAny");
19724
19724
  }
19725
- const operations = entries.flatMap((entry) => {
19725
+ const routedEntries = entries;
19726
+ const operations = routedEntries.flatMap((entry) => {
19726
19727
  const operation = this.operationFromInvokeAnyEntry(entry);
19727
19728
  return operation ? [operation] : [];
19728
19729
  });
19729
- const grant = this.findGrantForOperations(operations);
19730
- const invocationSession = !grant || grant.provenance === "primary" ? session : grant.session;
19731
- 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 }) => {
19732
19738
  const requested = this.operationFromInvokeAnyEntry(entry);
19733
- const granted = requested && grant.operations.find(
19739
+ const granted = grant && requested && grant.operations.find(
19734
19740
  (candidate) => this.operationCovers(candidate, requested)
19735
19741
  );
19736
19742
  if (!granted?.caveats?.length) {
@@ -19740,7 +19746,7 @@ var _TinyCloudNode = class _TinyCloudNode {
19740
19746
  throw new Error("Invocation caveats do not match signed ReCap authority.");
19741
19747
  }
19742
19748
  return { ...entry, caveats: cloneRecapCaveats(granted.caveats) };
19743
- }) : entries;
19749
+ });
19744
19750
  return this.wasmBindings.invokeAny(invocationSession, caveatPreservingEntries, facts);
19745
19751
  };
19746
19752
  this.explicitHost = config.host;
@@ -20205,12 +20211,13 @@ var _TinyCloudNode = class _TinyCloudNode {
20205
20211
  if (!auth) {
20206
20212
  throw new Error("Account bootstrap requires an active wallet session");
20207
20213
  }
20214
+ const accountSpaceId = this.ownedSpaceId(ACCOUNT_REGISTRY_SPACE2);
20208
20215
  const skipped = auth.lastActivationSkippedSpaceIds;
20216
+ if (skipped.includes(accountSpaceId)) return { action: "run", mode: "fresh" };
20209
20217
  if (skipped.some((spaceId) => enshrinedSpaceIds.has(spaceId))) {
20210
- return { action: "run", mode: "fresh" };
20218
+ return { action: "run", mode: "repair" };
20211
20219
  }
20212
20220
  try {
20213
- const accountSpaceId = this.ownedSpaceId(ACCOUNT_REGISTRY_SPACE2);
20214
20221
  const markerPermission = {
20215
20222
  service: "tinycloud.kv",
20216
20223
  space: accountSpaceId,
@@ -20222,7 +20229,7 @@ var _TinyCloudNode = class _TinyCloudNode {
20222
20229
  }
20223
20230
  const marker = await this.readBootstrapCompletionMarker();
20224
20231
  if (marker.ok) {
20225
- if (this.isAcceptedBootstrapCompletionMarker(marker.data.data)) {
20232
+ if (this.isAcceptedBootstrapCompletionMarker(marker.data.data, steps.map((step) => step.id))) {
20226
20233
  return { action: "skip" };
20227
20234
  }
20228
20235
  return { action: "run", mode: "repair" };
@@ -20272,12 +20279,16 @@ var _TinyCloudNode = class _TinyCloudNode {
20272
20279
  );
20273
20280
  }
20274
20281
  }
20275
- isAcceptedBootstrapCompletionMarker(value) {
20282
+ /**
20283
+ * A marker written before a canonical space was added triggers one bounded repair.
20284
+ */
20285
+ isAcceptedBootstrapCompletionMarker(value, canonicalStepIds) {
20276
20286
  if (typeof value !== "object" || value === null) return false;
20277
20287
  const entries = Object.entries(value);
20278
20288
  const markerValue = (name) => entries.find(([key2]) => key2 === name)?.[1];
20279
20289
  const version23 = markerValue("v");
20280
- 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));
20281
20292
  }
20282
20293
  markerReadIsUnhostedSpace(meta) {
20283
20294
  return meta?.status === 404;
@@ -20364,30 +20375,39 @@ var _TinyCloudNode = class _TinyCloudNode {
20364
20375
  }
20365
20376
  }
20366
20377
  if (step.kind === "seed-spaces") {
20367
- const registered = await this.account.spaces.registerBatch(
20368
- step.spaces.map((space) => ({
20369
- spaceId: space.spaceId,
20370
- name: space.name,
20371
- ownerDid: this.did,
20372
- type: "owned",
20373
- permissions: ["*"],
20374
- status: "active"
20375
- }))
20376
- );
20377
- if (!registered.ok) {
20378
- throw Object.assign(
20379
- new Error(`Failed to seed account spaces: ${registered.error.message}`),
20380
- { cause: registered.error }
20381
- );
20382
- }
20383
- const batchError = registered.data.recoveredFromBatchError;
20384
- if (batchError) {
20385
- warnings.push({
20386
- stepId: step.id,
20387
- kind: "batch-write-reconciled",
20388
- code: batchError.code,
20389
- message: batchError.message
20390
- });
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
+ }
20391
20411
  }
20392
20412
  }
20393
20413
  if (step.kind === "seed-applications") {
@@ -21072,6 +21092,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21072
21092
  stagedSessionExpiry,
21073
21093
  stagedRecap
21074
21094
  );
21095
+ const stagedAccountSpaceId = stagedAddress ? this.wasmBindings.makeSpaceId(stagedAddress, stagedChainId, ACCOUNT_REGISTRY_SPACE2) : void 0;
21075
21096
  const stagedGraph = this.stageRestoredServiceGraph({
21076
21097
  host: stagedHost,
21077
21098
  manager: stagedManager,
@@ -21080,6 +21101,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21080
21101
  nodeDid: stagedNodeDid,
21081
21102
  address: stagedAddress,
21082
21103
  chainId: stagedChainId,
21104
+ accountSpaceId: stagedAccountSpaceId,
21083
21105
  tinyCloudSession: stagedTcSession,
21084
21106
  sessionExpiry: stagedSessionExpiry,
21085
21107
  recap: stagedRecap
@@ -21245,6 +21267,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21245
21267
  }
21246
21268
  const delegationManager = new DelegationManager({
21247
21269
  hosts: [input.host],
21270
+ accountSpaceId: input.accountSpaceId,
21248
21271
  session: input.serviceSession,
21249
21272
  invoke: graph.invoke,
21250
21273
  invokeAny: graph.invokeAny,
@@ -22949,6 +22972,14 @@ var _TinyCloudNode = class _TinyCloudNode {
22949
22972
  delegation.delegationHeader
22950
22973
  );
22951
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
+ }
22952
22983
  throw Object.assign(
22953
22984
  new Error(`Failed to activate runtime permission delegation: ${describeHostFailure2(activateResult)}`),
22954
22985
  { cause: activateResult }
@@ -22996,10 +23027,10 @@ var _TinyCloudNode = class _TinyCloudNode {
22996
23027
  }
22997
23028
  this.assertDelegationCaveatsPreservable(expanded);
22998
23029
  const rawEntries = expanded.filter(
22999
- (entry) => this.isEncryptionPermissionEntry(entry)
23030
+ (entry) => this.isEncryptionPermissionEntry(entry) || this.isRawRevocationPermissionEntry(entry)
23000
23031
  );
23001
23032
  const spaceEntries = expanded.filter(
23002
- (entry) => !this.isEncryptionPermissionEntry(entry)
23033
+ (entry) => !this.isEncryptionPermissionEntry(entry) && !this.isRawRevocationPermissionEntry(entry)
23003
23034
  );
23004
23035
  const bySpace = /* @__PURE__ */ new Map();
23005
23036
  for (const entry of spaceEntries) {
@@ -23026,17 +23057,29 @@ var _TinyCloudNode = class _TinyCloudNode {
23026
23057
  }
23027
23058
  const delegatedEntries = [...entries, ...rawForDelegation];
23028
23059
  const abilities = this.permissionsToAbilities(entries);
23029
- const prepared = this.wasmBindings.prepareSession({
23030
- abilities,
23031
- ...rawForDelegation.length > 0 ? { rawAbilities: this.permissionsToRawAbilities(rawForDelegation) } : {},
23032
- address: this.wasmBindings.ensureEip55(session.address),
23033
- chainId: session.chainId,
23034
- domain: this.siweDomain,
23035
- issuedAt: now.toISOString(),
23036
- expirationTime: expiresAt.toISOString(),
23037
- spaceId,
23038
- jwk: session.jwk
23039
- });
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
+ })();
23040
23083
  const signature2 = await this.signer.signMessage(prepared.siwe);
23041
23084
  const delegatedSession = this.wasmBindings.completeSessionSetup({
23042
23085
  ...prepared,
@@ -23047,6 +23090,12 @@ var _TinyCloudNode = class _TinyCloudNode {
23047
23090
  delegatedSession.delegationHeader
23048
23091
  );
23049
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
+ }
23050
23099
  throw Object.assign(
23051
23100
  new Error(`Failed to activate runtime permission delegation: ${describeHostFailure2(activateResult)}`),
23052
23101
  { cause: activateResult }
@@ -23748,6 +23797,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23748
23797
  permissionsToAbilities(entries) {
23749
23798
  const abilities = {};
23750
23799
  for (const entry of entries) {
23800
+ if (this.isRawRevocationPermissionEntry(entry)) continue;
23751
23801
  const service = this.shortServiceName(entry.service);
23752
23802
  abilities[service] ?? (abilities[service] = {});
23753
23803
  const existing = abilities[service][entry.path] ?? [];
@@ -23765,9 +23815,16 @@ var _TinyCloudNode = class _TinyCloudNode {
23765
23815
  isEncryptionPermissionEntry(entry) {
23766
23816
  return entry.service === ENCRYPTION_PERMISSION_SERVICE2 && this.isEncryptionNetworkOperation("encryption", entry.path, entry.space);
23767
23817
  }
23818
+ isRawRevocationPermissionEntry(entry) {
23819
+ return entry.service === "tinycloud.delegation" && entry.path === "" && entry.space?.startsWith("urn:cid:") === true && entry.actions.includes("tinycloud.delegation/revoke");
23820
+ }
23768
23821
  permissionsToRawAbilities(entries) {
23769
23822
  const rawAbilities = {};
23770
23823
  for (const entry of entries) {
23824
+ if (this.isRawRevocationPermissionEntry(entry)) {
23825
+ rawAbilities[entry.space] = [...new Set(entry.actions)];
23826
+ continue;
23827
+ }
23771
23828
  if (!this.isEncryptionPermissionEntry(entry)) {
23772
23829
  continue;
23773
23830
  }
@@ -23787,7 +23844,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23787
23844
  return entries.flatMap((entry) => {
23788
23845
  const service = this.shortServiceName(entry.service);
23789
23846
  return entry.actions.map((action) => ({
23790
- ...this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId },
23847
+ ...this.isRawRevocationPermissionEntry(entry) ? { resource: entry.space } : this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId },
23791
23848
  service,
23792
23849
  path: entry.path,
23793
23850
  action,
@@ -23797,11 +23854,13 @@ var _TinyCloudNode = class _TinyCloudNode {
23797
23854
  }
23798
23855
  /** Raw network authority cannot be covered by a nested encryption space. */
23799
23856
  signedCapabilitySubset(requested, granted) {
23800
- const rawGranted = granted.filter((entry) => this.isEncryptionPermissionEntry(entry)).map((entry) => ({ ...entry, space: "encryption" }));
23801
- const spaceGranted = granted.filter((entry) => !this.isEncryptionPermissionEntry(entry));
23857
+ const rawGranted = granted.filter((entry) => this.isEncryptionPermissionEntry(entry) || this.isRawRevocationPermissionEntry(entry)).map((entry) => this.isEncryptionPermissionEntry(entry) ? { ...entry, space: "encryption" } : entry);
23858
+ const spaceGranted = granted.filter(
23859
+ (entry) => !this.isEncryptionPermissionEntry(entry) && !this.isRawRevocationPermissionEntry(entry)
23860
+ );
23802
23861
  const missing = requested.filter((entry) => {
23803
- const raw = this.isEncryptionPermissionEntry(entry);
23804
- const comparable = raw ? { ...entry, space: "encryption" } : entry;
23862
+ const raw = this.isEncryptionPermissionEntry(entry) || this.isRawRevocationPermissionEntry(entry);
23863
+ const comparable = raw && this.isEncryptionPermissionEntry(entry) ? { ...entry, space: "encryption" } : entry;
23805
23864
  return !isCapabilitySubset([comparable], raw ? rawGranted : spaceGranted).subset;
23806
23865
  });
23807
23866
  return { subset: missing.length === 0, missing };
@@ -23816,10 +23875,11 @@ var _TinyCloudNode = class _TinyCloudNode {
23816
23875
  }
23817
23876
  permissionEntriesToOperations(entries, session) {
23818
23877
  return entries.flatMap((entry) => {
23819
- const spaceId = this.resolvePermissionSpace(entry.space, session);
23878
+ const rawRevocation = this.isRawRevocationPermissionEntry(entry);
23879
+ const spaceId = rawRevocation ? void 0 : this.resolvePermissionSpace(entry.space, session);
23820
23880
  const service = this.shortServiceName(entry.service);
23821
23881
  return entry.actions.map((action) => ({
23822
- ...this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId },
23882
+ ...rawRevocation ? { resource: entry.space } : this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId },
23823
23883
  service,
23824
23884
  path: entry.path,
23825
23885
  action,
@@ -23898,7 +23958,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23898
23958
  delegatedResourcesForEntries(entries, spaceId) {
23899
23959
  return entries.map((entry) => ({
23900
23960
  service: this.shortServiceName(entry.service),
23901
- space: this.isEncryptionPermissionEntry(entry) ? "encryption" : spaceId,
23961
+ space: this.isRawRevocationPermissionEntry(entry) ? entry.space : this.isEncryptionPermissionEntry(entry) ? "encryption" : spaceId,
23902
23962
  path: entry.path,
23903
23963
  actions: [...entry.actions],
23904
23964
  ...entry.caveats === void 0 ? {} : { caveats: cloneRecapCaveats(entry.caveats) }
@@ -23908,8 +23968,9 @@ var _TinyCloudNode = class _TinyCloudNode {
23908
23968
  const resources = delegation.resources !== void 0 && delegation.resources.length > 0 ? delegation.resources : this.flatDelegationResources(delegation);
23909
23969
  return resources.flatMap((resource) => {
23910
23970
  const service = this.invocationServiceName(resource.service);
23971
+ const rawRevocation = service === "delegation" && resource.space.startsWith("urn:cid:") && resource.path === "";
23911
23972
  return resource.actions.map((action) => ({
23912
- ...this.isEncryptionNetworkOperation(service, resource.path, resource.space) ? { resource: resource.path } : { spaceId: resource.space },
23973
+ ...rawRevocation ? { resource: resource.space } : this.isEncryptionNetworkOperation(service, resource.path, resource.space) ? { resource: resource.path } : { spaceId: resource.space },
23913
23974
  service,
23914
23975
  path: resource.path,
23915
23976
  action,
@@ -23955,7 +24016,7 @@ var _TinyCloudNode = class _TinyCloudNode {
23955
24016
  * @internal
23956
24017
  */
23957
24018
  buildActivationAbilities(delegation) {
23958
- var _a, _b, _c;
24019
+ var _a, _b, _c, _d;
23959
24020
  const resources = delegation.resources !== void 0 && delegation.resources.length > 0 ? delegation.resources : this.flatDelegationResources(delegation);
23960
24021
  const abilities = {};
23961
24022
  const rawAbilities = {};
@@ -23975,13 +24036,18 @@ var _TinyCloudNode = class _TinyCloudNode {
23975
24036
  addActions(rawAbilities[resource.path], resource.actions);
23976
24037
  continue;
23977
24038
  }
24039
+ if (service === "delegation" && resource.space.startsWith("urn:cid:") && resource.path === "") {
24040
+ rawAbilities[_b = resource.space] ?? (rawAbilities[_b] = []);
24041
+ addActions(rawAbilities[resource.space], resource.actions);
24042
+ continue;
24043
+ }
23978
24044
  if (resource.space !== delegation.spaceId) {
23979
24045
  throw new Error(
23980
24046
  `useDelegation: resource targets space '${resource.space}' but the delegation activates space '${delegation.spaceId}'. Multi-space delegations cannot be activated in a single useDelegation call.`
23981
24047
  );
23982
24048
  }
23983
24049
  abilities[service] ?? (abilities[service] = {});
23984
- (_b = abilities[service])[_c = resource.path] ?? (_b[_c] = []);
24050
+ (_c = abilities[service])[_d = resource.path] ?? (_c[_d] = []);
23985
24051
  addActions(abilities[service][resource.path], resource.actions);
23986
24052
  }
23987
24053
  return { abilities, rawAbilities };