@tinycloud/node-sdk 3.1.0-beta.4 → 3.1.0-beta.6

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 RestorableSession, l as RuntimeDelegationActivator, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, v as activateValidatedRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, z as grantAuthRequest, G as serializeDelegation } from './core-Bm76PnOz.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 RestorableSession, l as RuntimeDelegationActivator, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, v as activateValidatedRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, z as grantAuthRequest, G as serializeDelegation } from './core-BWvBTn9l.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 RestorableSession, l as RuntimeDelegationActivator, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, v as activateValidatedRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, z as grantAuthRequest, G as serializeDelegation } from './core-Bm76PnOz.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 RestorableSession, l as RuntimeDelegationActivator, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, v as activateValidatedRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, z as grantAuthRequest, G as serializeDelegation } from './core-BWvBTn9l.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
@@ -17163,6 +17163,7 @@ import {
17163
17163
  TinyCloud,
17164
17164
  activateSessionWithHost as activateSessionWithHost2,
17165
17165
  authorizationVerdictOf,
17166
+ httpResponseError,
17166
17167
  KVService as KVService2,
17167
17168
  SQLService as SQLService2,
17168
17169
  DuckDbService as DuckDbService2,
@@ -17341,6 +17342,10 @@ var MemorySessionStorage = class {
17341
17342
  // src/authorization/NodeUserAuthorization.ts
17342
17343
  var DECRYPT_ACTION = ENCRYPTION.DECRYPT;
17343
17344
  var NETWORK_CREATE_ACTION = ENCRYPTION.NETWORK_CREATE;
17345
+ function describeHostFailure(result) {
17346
+ const text = result.error?.trim();
17347
+ return text ? `${result.status} - ${text}` : `${result.status}`;
17348
+ }
17344
17349
  function canonicalizeOpenKeyManifestJson(value) {
17345
17350
  const json = JSON.stringify(value);
17346
17351
  if (json === void 0) {
@@ -17869,10 +17874,12 @@ var NodeUserAuthorization = class {
17869
17874
  return;
17870
17875
  }
17871
17876
  try {
17872
- const created = (await this.hostSpace()).success;
17873
- if (!created) {
17874
- const err = new Error(`Failed to create space: ${primarySpaceId}`);
17875
- handler.onSpaceCreationFailed?.(creationContext, err);
17877
+ const created = await this.hostSpace();
17878
+ if (!created.success) {
17879
+ const err = Object.assign(
17880
+ new Error(`Failed to create space ${primarySpaceId}: ${describeHostFailure(created)}`),
17881
+ { cause: created }
17882
+ );
17876
17883
  throw err;
17877
17884
  }
17878
17885
  } catch (error) {
@@ -17888,8 +17895,9 @@ var NodeUserAuthorization = class {
17888
17895
  this._tinyCloudSession.delegationHeader
17889
17896
  );
17890
17897
  if (!retryResult.success) {
17891
- const err = new Error(
17892
- `Failed to activate session after creating space: ${retryResult.error}`
17898
+ const err = Object.assign(
17899
+ new Error(`Failed to activate session after creating space: ${describeHostFailure(retryResult)}`),
17900
+ { cause: retryResult }
17893
17901
  );
17894
17902
  handler.onSpaceCreationFailed?.(creationContext, err);
17895
17903
  throw err;
@@ -17906,10 +17914,12 @@ var NodeUserAuthorization = class {
17906
17914
  return;
17907
17915
  }
17908
17916
  try {
17909
- const created = (await this.hostSpace()).success;
17910
- if (!created) {
17911
- const err = new Error(`Failed to create space: ${primarySpaceId}`);
17912
- handler.onSpaceCreationFailed?.(creationContext, err);
17917
+ const created = await this.hostSpace();
17918
+ if (!created.success) {
17919
+ const err = Object.assign(
17920
+ new Error(`Failed to create space ${primarySpaceId}: ${describeHostFailure(created)}`),
17921
+ { cause: created }
17922
+ );
17913
17923
  throw err;
17914
17924
  }
17915
17925
  } catch (error) {
@@ -17925,8 +17935,9 @@ var NodeUserAuthorization = class {
17925
17935
  this._tinyCloudSession.delegationHeader
17926
17936
  );
17927
17937
  if (!retryResult.success) {
17928
- const err = new Error(
17929
- `Failed to activate session after creating space: ${retryResult.error}`
17938
+ const err = Object.assign(
17939
+ new Error(`Failed to activate session after creating space: ${describeHostFailure(retryResult)}`),
17940
+ { cause: retryResult }
17930
17941
  );
17931
17942
  handler.onSpaceCreationFailed?.(creationContext, err);
17932
17943
  throw err;
@@ -17934,7 +17945,10 @@ var NodeUserAuthorization = class {
17934
17945
  handler.onSpaceCreated?.(creationContext);
17935
17946
  return;
17936
17947
  }
17937
- throw new Error(`Failed to activate session: ${result.error}`);
17948
+ throw Object.assign(
17949
+ new Error(`Failed to activate session: ${describeHostFailure(result)}`),
17950
+ { cause: result }
17951
+ );
17938
17952
  }
17939
17953
  recordActivationSkippedSpaces(result, primarySpaceId) {
17940
17954
  if (result.success) {
@@ -19421,7 +19435,7 @@ function persistedExpiry(value) {
19421
19435
  function sameInstant(left, right) {
19422
19436
  return left.getTime() === right.getTime();
19423
19437
  }
19424
- function describeHostFailure(result) {
19438
+ function describeHostFailure2(result) {
19425
19439
  const text = result.error?.trim();
19426
19440
  return text ? `${result.status} - ${text}` : `${result.status}`;
19427
19441
  }
@@ -20228,7 +20242,10 @@ var _TinyCloudNode = class _TinyCloudNode {
20228
20242
  marker
20229
20243
  );
20230
20244
  if (!written.ok) {
20231
- throw new Error(`Failed to write bootstrap completion marker: ${written.error.message}`);
20245
+ throw Object.assign(
20246
+ new Error(`Failed to write bootstrap completion marker: ${written.error.message}`),
20247
+ { cause: written.error }
20248
+ );
20232
20249
  }
20233
20250
  }
20234
20251
  isAcceptedBootstrapCompletionMarker(value) {
@@ -20274,17 +20291,23 @@ var _TinyCloudNode = class _TinyCloudNode {
20274
20291
  rawAbilities
20275
20292
  });
20276
20293
  } catch (err) {
20277
- throw new Error(
20278
- `Account bootstrap aborted: signature rejected for space "${step.space}". Cause: ${err instanceof Error ? err.message : String(err)}`
20294
+ throw Object.assign(
20295
+ new Error(
20296
+ `Account bootstrap aborted: signature rejected for space "${step.space}". Cause: ${err instanceof Error ? err.message : String(err)}`
20297
+ ),
20298
+ { cause: err }
20279
20299
  );
20280
20300
  }
20281
20301
  sessions.set(step.space, session);
20282
20302
  }
20283
20303
  for (const step of steps) {
20284
20304
  if (step.kind !== "host") continue;
20285
- const hosted = await auth.hostOwnedSpace(step.spaceId, "bootstrap-host");
20286
- if (!hosted) {
20287
- throw new Error(`Failed to host bootstrap space: ${step.spaceId}`);
20305
+ const hosted = await auth.hostOwnedSpaceResult(step.spaceId, "bootstrap-host");
20306
+ if (!hosted.success) {
20307
+ throw Object.assign(
20308
+ new Error(`Failed to host bootstrap space ${step.spaceId}: ${describeHostFailure2(hosted)}`),
20309
+ { cause: hosted }
20310
+ );
20288
20311
  }
20289
20312
  }
20290
20313
  await new Promise((resolve) => setTimeout(resolve, 100));
@@ -20296,8 +20319,11 @@ var _TinyCloudNode = class _TinyCloudNode {
20296
20319
  }
20297
20320
  const activated = await activateSessionWithHost2(host, session.delegationHeader);
20298
20321
  if (!activated.success || activated.skipped?.includes(step.spaceId)) {
20299
- throw new Error(
20300
- `Failed to activate bootstrap session for ${step.spaceId}: ${activated.error ?? "space was skipped"}`
20322
+ throw Object.assign(
20323
+ new Error(
20324
+ `Failed to activate bootstrap session for ${step.spaceId}: ${activated.success ? "space was skipped" : describeHostFailure2(activated)}`
20325
+ ),
20326
+ { cause: activated }
20301
20327
  );
20302
20328
  }
20303
20329
  this.registerBootstrapRuntimeGrant(
@@ -20310,7 +20336,7 @@ var _TinyCloudNode = class _TinyCloudNode {
20310
20336
  if (step.kind === "account-index-schema") {
20311
20337
  const ensured = await this.account.index.ensure();
20312
20338
  if (!ensured.ok) {
20313
- throw new Error(`Failed to create account index schema: ${ensured.error.message}`);
20339
+ throw Object.assign(new Error(`Failed to create account index schema: ${ensured.error.message}`), { cause: ensured.error });
20314
20340
  }
20315
20341
  }
20316
20342
  if (step.kind === "seed-spaces") {
@@ -20325,8 +20351,9 @@ var _TinyCloudNode = class _TinyCloudNode {
20325
20351
  }))
20326
20352
  );
20327
20353
  if (!registered.ok) {
20328
- throw new Error(
20329
- `Failed to seed account spaces: ${registered.error.message}`
20354
+ throw Object.assign(
20355
+ new Error(`Failed to seed account spaces: ${registered.error.message}`),
20356
+ { cause: registered.error }
20330
20357
  );
20331
20358
  }
20332
20359
  const batchError = registered.data.recoveredFromBatchError;
@@ -20347,7 +20374,7 @@ var _TinyCloudNode = class _TinyCloudNode {
20347
20374
  { assumeUnregistered: true }
20348
20375
  );
20349
20376
  if (!registered.ok) {
20350
- throw new Error(`Failed to seed bootstrap applications: ${registered.error.message}`);
20377
+ throw Object.assign(new Error(`Failed to seed bootstrap applications: ${registered.error.message}`), { cause: registered.error });
20351
20378
  }
20352
20379
  }
20353
20380
  if (step.kind === "encryption-network-create") {
@@ -20365,8 +20392,9 @@ var _TinyCloudNode = class _TinyCloudNode {
20365
20392
  ]
20366
20393
  });
20367
20394
  if (!migrated.ok) {
20368
- throw new Error(
20369
- `Failed to create secret_records schema: ${migrated.error.message}`
20395
+ throw Object.assign(
20396
+ new Error(`Failed to create secret_records schema: ${migrated.error.message}`),
20397
+ { cause: migrated.error }
20370
20398
  );
20371
20399
  }
20372
20400
  }
@@ -20711,14 +20739,14 @@ var _TinyCloudNode = class _TinyCloudNode {
20711
20739
  }
20712
20740
  if (!activation.success && activation.status !== 404) {
20713
20741
  throw Object.assign(
20714
- new Error(`Failed to check owned space ${spaceId}: ${describeHostFailure(activation)}`),
20742
+ new Error(`Failed to check owned space ${spaceId}: ${describeHostFailure2(activation)}`),
20715
20743
  { cause: activation }
20716
20744
  );
20717
20745
  }
20718
20746
  const created = await this.auth.hostOwnedSpaceResult(spaceId);
20719
20747
  if (!created.success) {
20720
20748
  throw Object.assign(
20721
- new Error(`Failed to create owned space ${spaceId}: ${describeHostFailure(created)}`),
20749
+ new Error(`Failed to create owned space ${spaceId}: ${describeHostFailure2(created)}`),
20722
20750
  { cause: created }
20723
20751
  );
20724
20752
  }
@@ -20727,7 +20755,7 @@ var _TinyCloudNode = class _TinyCloudNode {
20727
20755
  if (!retry.success || retry.skipped?.includes(spaceId)) {
20728
20756
  throw Object.assign(
20729
20757
  new Error(
20730
- `Failed to activate session after creating owned space ${spaceId}: ${retry.success ? "space was skipped" : describeHostFailure(retry)}`
20758
+ `Failed to activate session after creating owned space ${spaceId}: ${retry.success ? "space was skipped" : describeHostFailure2(retry)}`
20731
20759
  ),
20732
20760
  { cause: retry }
20733
20761
  );
@@ -20764,19 +20792,23 @@ var _TinyCloudNode = class _TinyCloudNode {
20764
20792
  if (!host) {
20765
20793
  throw new Error("Owned space hosting requires a TinyCloud host");
20766
20794
  }
20767
- const hosted = await this.auth.hostOwnedSpace(
20768
- spaceId
20769
- );
20770
- if (!hosted) {
20771
- throw new Error(`Failed to host owned space: ${spaceId}`);
20795
+ const hosted = await this.auth.hostOwnedSpaceResult(spaceId);
20796
+ if (!hosted.success) {
20797
+ throw Object.assign(
20798
+ new Error(`Failed to host owned space ${spaceId}: ${describeHostFailure2(hosted)}`),
20799
+ { cause: hosted }
20800
+ );
20772
20801
  }
20773
20802
  const activation = await activateSessionWithHost2(
20774
20803
  host,
20775
20804
  session.delegationHeader
20776
20805
  );
20777
20806
  if (!activation.success || activation.skipped?.includes(spaceId)) {
20778
- throw new Error(
20779
- `Failed to activate session for owned space ${spaceId}: ${activation.error ?? "space was skipped"}`
20807
+ throw Object.assign(
20808
+ new Error(
20809
+ `Failed to activate session for owned space ${spaceId}: ${activation.success ? "space was skipped" : describeHostFailure2(activation)}`
20810
+ ),
20811
+ { cause: activation }
20780
20812
  );
20781
20813
  }
20782
20814
  try {
@@ -21792,7 +21824,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21792
21824
  if (cached) return cached;
21793
21825
  const response = await fetch(`${this.config.host}/info`);
21794
21826
  if (!response.ok) {
21795
- throw new Error(`Failed to fetch node info: HTTP ${response.status}`);
21827
+ throw await httpResponseError(response, "Failed to fetch node info");
21796
21828
  }
21797
21829
  const info = await response.json();
21798
21830
  if (typeof info.nodeId !== "string" || info.nodeId.length === 0) {
@@ -21842,9 +21874,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21842
21874
  );
21843
21875
  if (response.status === 404) return null;
21844
21876
  if (!response.ok) {
21845
- throw new Error(
21846
- `Failed to fetch encryption network ${networkId}: HTTP ${response.status} ${await response.text()}`
21847
- );
21877
+ throw await httpResponseError(response, `Failed to fetch encryption network ${networkId}`);
21848
21878
  }
21849
21879
  const body = await response.json();
21850
21880
  return "descriptor" in body && body.descriptor ? body.descriptor : body;
@@ -22345,7 +22375,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22345
22375
  headers: { accept: "application/json", "content-type": "application/json", authorization },
22346
22376
  body: canonicalizeEncryptionJson(request)
22347
22377
  });
22348
- if (!response.ok) throw new Error(`V3 share delivery authorization failed: ${response.status}`);
22378
+ if (!response.ok) throw await httpResponseError(response, "V3 share delivery authorization failed");
22349
22379
  const verified = validateShareDeliveryAuthorizationV3Bytes(new Uint8Array(await response.arrayBuffer()), {
22350
22380
  request,
22351
22381
  senderKeyDid: this.credentialHolderDid,
@@ -22567,9 +22597,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22567
22597
  );
22568
22598
  }
22569
22599
  if (!response.ok) {
22570
- throw new Error(
22571
- `Failed to create encryption network ${networkId}: HTTP ${response.status} ${await response.text()}`
22572
- );
22600
+ throw await httpResponseError(response, `Failed to create encryption network ${networkId}`);
22573
22601
  }
22574
22602
  const created = await response.json();
22575
22603
  return created.descriptor;
@@ -22877,8 +22905,9 @@ var _TinyCloudNode = class _TinyCloudNode {
22877
22905
  delegation.delegationHeader
22878
22906
  );
22879
22907
  if (!activateResult.success) {
22880
- throw new Error(
22881
- `Failed to activate runtime permission delegation: ${activateResult.error}`
22908
+ throw Object.assign(
22909
+ new Error(`Failed to activate runtime permission delegation: ${describeHostFailure2(activateResult)}`),
22910
+ { cause: activateResult }
22882
22911
  );
22883
22912
  }
22884
22913
  this.runtimePermissionGrants = this.runtimePermissionGrants.filter(
@@ -22974,8 +23003,9 @@ var _TinyCloudNode = class _TinyCloudNode {
22974
23003
  delegatedSession.delegationHeader
22975
23004
  );
22976
23005
  if (!activateResult.success) {
22977
- throw new Error(
22978
- `Failed to activate runtime permission delegation: ${activateResult.error}`
23006
+ throw Object.assign(
23007
+ new Error(`Failed to activate runtime permission delegation: ${describeHostFailure2(activateResult)}`),
23008
+ { cause: activateResult }
22979
23009
  );
22980
23010
  }
22981
23011
  const delegation = this.runtimeDelegationFromSession(
@@ -23160,7 +23190,10 @@ var _TinyCloudNode = class _TinyCloudNode {
23160
23190
  delegationSession.delegationHeader
23161
23191
  );
23162
23192
  if (!activateResult.success) {
23163
- throw new Error(`Failed to activate public space delegation: ${activateResult.error}`);
23193
+ throw Object.assign(
23194
+ new Error(`Failed to activate public space delegation: ${describeHostFailure2(activateResult)}`),
23195
+ { cause: activateResult }
23196
+ );
23164
23197
  }
23165
23198
  if (this._capabilityRegistry && this.session) {
23166
23199
  const sessionKey = {
@@ -23513,8 +23546,9 @@ var _TinyCloudNode = class _TinyCloudNode {
23513
23546
  delegationHeader
23514
23547
  );
23515
23548
  if (!activateResult.success) {
23516
- throw new Error(
23517
- `Failed to activate delegation with host: ${activateResult.error}`
23549
+ throw Object.assign(
23550
+ new Error(`Failed to activate delegation with host: ${describeHostFailure2(activateResult)}`),
23551
+ { cause: activateResult }
23518
23552
  );
23519
23553
  }
23520
23554
  return {
@@ -23550,8 +23584,9 @@ var _TinyCloudNode = class _TinyCloudNode {
23550
23584
  delegationHeader
23551
23585
  );
23552
23586
  if (!activateResult.success) {
23553
- throw new Error(
23554
- `Failed to activate delegation with host: ${activateResult.error}`
23587
+ throw Object.assign(
23588
+ new Error(`Failed to activate delegation with host: ${describeHostFailure2(activateResult)}`),
23589
+ { cause: activateResult }
23555
23590
  );
23556
23591
  }
23557
23592
  return {
@@ -24158,7 +24193,10 @@ var _TinyCloudNode = class _TinyCloudNode {
24158
24193
  delegationSession.delegationHeader
24159
24194
  );
24160
24195
  if (!activateResult.success) {
24161
- throw new Error(`Failed to activate delegation: ${activateResult.error}`);
24196
+ throw Object.assign(
24197
+ new Error(`Failed to activate delegation: ${describeHostFailure2(activateResult)}`),
24198
+ { cause: activateResult }
24199
+ );
24162
24200
  }
24163
24201
  const result = {
24164
24202
  cid: delegationSession.delegationCid,
@@ -24308,7 +24346,10 @@ var _TinyCloudNode = class _TinyCloudNode {
24308
24346
  invokerSession.delegationHeader
24309
24347
  );
24310
24348
  if (!activateResult.success) {
24311
- throw new Error(`Failed to activate delegated session: ${activateResult.error}`);
24349
+ throw Object.assign(
24350
+ new Error(`Failed to activate delegated session: ${describeHostFailure2(activateResult)}`),
24351
+ { cause: activateResult }
24352
+ );
24312
24353
  }
24313
24354
  const session = {
24314
24355
  address: mySession.address,
@@ -24425,7 +24466,10 @@ var _TinyCloudNode = class _TinyCloudNode {
24425
24466
  subDelegationSession.delegationHeader
24426
24467
  );
24427
24468
  if (!activateResult.success) {
24428
- throw new Error(`Failed to activate sub-delegation: ${activateResult.error}`);
24469
+ throw Object.assign(
24470
+ new Error(`Failed to activate sub-delegation: ${describeHostFailure2(activateResult)}`),
24471
+ { cause: activateResult }
24472
+ );
24429
24473
  }
24430
24474
  return {
24431
24475
  cid: subDelegationSession.delegationCid,
@@ -24931,6 +24975,9 @@ async function activateValidatedRuntimeDelegation(node, delegation, options) {
24931
24975
  if (!resourcesMatch(declaredResources, signed2.resources)) {
24932
24976
  throw new Error("Runtime delegation resources do not match signed authority.");
24933
24977
  }
24978
+ if (options.authorize !== void 0 && !options.authorize(signed2.permissions)) {
24979
+ throw new Error("Runtime delegation is not authorized for this runtime.");
24980
+ }
24934
24981
  const previouslyInstalled = node.getRuntimePermissionDelegations().find((candidate) => candidate.cid === cid);
24935
24982
  if (previouslyInstalled !== void 0 && previouslyInstalled.delegationHeader.Authorization !== authorization) {
24936
24983
  throw new Error(