@tinycloud/node-sdk 3.12.0-beta.1 → 3.12.0-beta.2

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,8 +1,8 @@
1
1
  import { ISigner, Bytes, 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, AuthorityRefusal, 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, IStorageService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, MAX_SECRET_SCOPE_LENGTH, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, ParsedNetworkId, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaLocalEraseOutcome, ReplicaPurgeError, ReplicaPurgeFailedEvent, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SECRET_SCOPE_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretPutOptions, 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, StorageAccountUsage, StorageFullEvent, StorageStatus, StorageStatusOptions, StorageUsage, StorageUsageState, StoredDelegationChain, SubscribeOptions, TC832_RESERVED_SCOPES, 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, appSecretScope, 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, storageUsageState, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
3
3
  export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider, i as isAppKeyHostBound } from './WasmKeyProvider-OA0LqmTg.cjs';
4
- export { N as NodeEventEmitterStrategy, a as NodeUserAuthorization, e as NodeUserAuthorizationAuthorizeFn, b as NodeUserAuthorizationConfig, f as OpenKeyAuthorizationResultV1, g as OpenKeyAuthorizeInput, O as OpenKeyAuthorizeTinyCloud, h as OpenKeyBridgeInput, P as PreparedOpenKeyAuthorization, c as SignStrategy, S as SpaceHosting, d as defaultSignStrategy, w as wireOpenKeyAuthorize } from './NodeUserAuthorization-BtoDI9in.cjs';
5
- export { A as ACCEPTED_MARKER_VERSIONS, h as BOOTSTRAP_COMPLETION_MARKER_KEY, i as BOOTSTRAP_COMPLETION_MARKER_VERSION, j as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, O as OwnerDelegationReceipt, k as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, c as SecretReadInput, d as SecretReadResult, T as TinyCloudNode, e as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, f as UnifiedOwnerRootReceipt, g as UnsupportedSessionRestoreError } from './TinyCloudNode-C24728N_.cjs';
4
+ export { N as NodeEventEmitterStrategy, a as NodeUserAuthorization, e as NodeUserAuthorizationAuthorizeFn, b as NodeUserAuthorizationConfig, f as OpenKeyAuthorizationResultV1, g as OpenKeyAuthorizeInput, O as OpenKeyAuthorizeTinyCloud, h as OpenKeyBridgeInput, P as PreparedOpenKeyAuthorization, c as SignStrategy, S as SpaceHosting, d as defaultSignStrategy, w as wireOpenKeyAuthorize } from './NodeUserAuthorization-B05Wjjpb.cjs';
5
+ export { A as ACCEPTED_MARKER_VERSIONS, h as BOOTSTRAP_COMPLETION_MARKER_KEY, i as BOOTSTRAP_COMPLETION_MARKER_VERSION, j as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, O as OwnerDelegationReceipt, k as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, c as SecretReadInput, d as SecretReadResult, T as TinyCloudNode, e as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, f as UnifiedOwnerRootReceipt, g as UnsupportedSessionRestoreError } from './TinyCloudNode-6_IumWu0.cjs';
6
6
  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';
7
7
  export { A as AuthDelegationArtifact, f as AuthRequestArtifact, C as CompactRuntimeDelegationInput, D as DelegationAuthority, P as PortableDelegation, g as RUNTIME_DELEGATION_REJECTIONS, h as RuntimeDelegationActivator, R as RuntimeDelegationRejectedError, a as RuntimeDelegationRejection, S as SessionGrantProof, V as ValidatedRuntimeDelegation, e as VerifiedSessionGrant, b as activateCompactRuntimeDelegation, c as activateValidatedRuntimeDelegation, d as deserializeDelegation, i as grantAuthRequest, s as serializeDelegation, j as signedCompactUcanExpiry, k as siweRuntimeDelegation } from './delegation-BQbAuKad.cjs';
8
8
  import { KVReplicaStorage } from '@tinycloud/sdk-services';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ISigner, Bytes, 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, AuthorityRefusal, 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, IStorageService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, MAX_SECRET_SCOPE_LENGTH, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, ParsedNetworkId, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaLocalEraseOutcome, ReplicaPurgeError, ReplicaPurgeFailedEvent, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SECRET_SCOPE_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretPutOptions, 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, StorageAccountUsage, StorageFullEvent, StorageStatus, StorageStatusOptions, StorageUsage, StorageUsageState, StoredDelegationChain, SubscribeOptions, TC832_RESERVED_SCOPES, 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, appSecretScope, 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, storageUsageState, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
3
3
  export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider, i as isAppKeyHostBound } from './WasmKeyProvider-OA0LqmTg.js';
4
- export { N as NodeEventEmitterStrategy, a as NodeUserAuthorization, e as NodeUserAuthorizationAuthorizeFn, b as NodeUserAuthorizationConfig, f as OpenKeyAuthorizationResultV1, g as OpenKeyAuthorizeInput, O as OpenKeyAuthorizeTinyCloud, h as OpenKeyBridgeInput, P as PreparedOpenKeyAuthorization, c as SignStrategy, S as SpaceHosting, d as defaultSignStrategy, w as wireOpenKeyAuthorize } from './NodeUserAuthorization-BtoDI9in.js';
5
- export { A as ACCEPTED_MARKER_VERSIONS, h as BOOTSTRAP_COMPLETION_MARKER_KEY, i as BOOTSTRAP_COMPLETION_MARKER_VERSION, j as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, O as OwnerDelegationReceipt, k as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, c as SecretReadInput, d as SecretReadResult, T as TinyCloudNode, e as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, f as UnifiedOwnerRootReceipt, g as UnsupportedSessionRestoreError } from './TinyCloudNode-DLrINr98.js';
4
+ export { N as NodeEventEmitterStrategy, a as NodeUserAuthorization, e as NodeUserAuthorizationAuthorizeFn, b as NodeUserAuthorizationConfig, f as OpenKeyAuthorizationResultV1, g as OpenKeyAuthorizeInput, O as OpenKeyAuthorizeTinyCloud, h as OpenKeyBridgeInput, P as PreparedOpenKeyAuthorization, c as SignStrategy, S as SpaceHosting, d as defaultSignStrategy, w as wireOpenKeyAuthorize } from './NodeUserAuthorization-B05Wjjpb.js';
5
+ export { A as ACCEPTED_MARKER_VERSIONS, h as BOOTSTRAP_COMPLETION_MARKER_KEY, i as BOOTSTRAP_COMPLETION_MARKER_VERSION, j as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, O as OwnerDelegationReceipt, k as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, c as SecretReadInput, d as SecretReadResult, T as TinyCloudNode, e as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, f as UnifiedOwnerRootReceipt, g as UnsupportedSessionRestoreError } from './TinyCloudNode-CEFGtSWn.js';
6
6
  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';
7
7
  export { A as AuthDelegationArtifact, f as AuthRequestArtifact, C as CompactRuntimeDelegationInput, D as DelegationAuthority, P as PortableDelegation, g as RUNTIME_DELEGATION_REJECTIONS, h as RuntimeDelegationActivator, R as RuntimeDelegationRejectedError, a as RuntimeDelegationRejection, S as SessionGrantProof, V as ValidatedRuntimeDelegation, e as VerifiedSessionGrant, b as activateCompactRuntimeDelegation, c as activateValidatedRuntimeDelegation, d as deserializeDelegation, i as grantAuthRequest, s as serializeDelegation, j as signedCompactUcanExpiry, k as siweRuntimeDelegation } from './delegation-BQbAuKad.js';
8
8
  import { KVReplicaStorage } from '@tinycloud/sdk-services';
package/dist/index.js CHANGED
@@ -19768,23 +19768,35 @@ var NodeUserAuthorization = class {
19768
19768
  * Create the space on the TinyCloud server (host delegation).
19769
19769
  * This registers the user as the owner of the space.
19770
19770
  */
19771
- async hostSpace(targetSpaceId, purpose, signal) {
19772
- if (!this._tinyCloudSession || !this._address || !this._chainId) {
19771
+ async hostSpace(targetSpaceId, purpose, signal, assertCurrent, siweParameters) {
19772
+ const context = typeof targetSpaceId === "object" ? targetSpaceId : void 0;
19773
+ const address = context?.address ?? this._address;
19774
+ const chainId = context?.chainId ?? this._chainId;
19775
+ if (!address || chainId === void 0 || !this._tinyCloudSession) {
19773
19776
  throw new Error("Must be signed in to host space");
19774
19777
  }
19778
+ const checkCurrent = () => {
19779
+ signal?.throwIfAborted();
19780
+ assertCurrent?.();
19781
+ };
19782
+ checkCurrent();
19775
19783
  await this.ensureTinyCloudHosts();
19776
- const host = this.primaryTinyCloudHost;
19777
- const spaceId = targetSpaceId ?? this._tinyCloudSession.spaceId;
19784
+ checkCurrent();
19785
+ const host = context?.host ?? this.primaryTinyCloudHost;
19786
+ const spaceId = context?.spaceId ?? (typeof targetSpaceId === "string" ? targetSpaceId : this._tinyCloudSession.spaceId);
19778
19787
  const peerId = await fetchPeerId(host, spaceId, signal);
19779
- const siwe = this.wasm.generateHostSIWEMessage({
19780
- address: this._address,
19781
- chainId: this._chainId,
19782
- domain: this.domain,
19783
- issuedAt: (/* @__PURE__ */ new Date()).toISOString(),
19784
- spaceId,
19785
- peerId
19786
- });
19787
- if (signal?.aborted) throw signal.reason;
19788
+ checkCurrent();
19789
+ const siwe = this.wasm.generateHostSIWEMessage(
19790
+ context && siweParameters ? siweParameters(peerId) : {
19791
+ address,
19792
+ chainId,
19793
+ domain: this.domain,
19794
+ issuedAt: (/* @__PURE__ */ new Date()).toISOString(),
19795
+ spaceId,
19796
+ peerId
19797
+ }
19798
+ );
19799
+ checkCurrent();
19788
19800
  const signing = this.signMessage(siwe, purpose);
19789
19801
  let signature2;
19790
19802
  if (!signal) {
@@ -19803,8 +19815,9 @@ var NodeUserAuthorization = class {
19803
19815
  signal.removeEventListener("abort", onAbort);
19804
19816
  }
19805
19817
  }
19806
- if (signal?.aborted) throw signal.reason;
19818
+ checkCurrent();
19807
19819
  const headers = this.wasm.siweToDelegationHeaders({ siwe, signature: signature2 });
19820
+ checkCurrent();
19808
19821
  return submitHostDelegation(host, headers, signal);
19809
19822
  }
19810
19823
  /**
@@ -19866,37 +19879,30 @@ var NodeUserAuthorization = class {
19866
19879
  *
19867
19880
  * @throws Error if the creation handler fails or times out, or hosting fails
19868
19881
  */
19869
- async ensurePrimarySpaceHosted(hosting) {
19870
- if (hosting !== "not-hosted") {
19871
- return;
19872
- }
19882
+ async ensurePrimarySpaceHosted(hosting, signal) {
19873
19883
  const session = this._tinyCloudSession;
19874
- if (!session) {
19875
- throw new Error("Must be signed in to host the primary space");
19876
- }
19884
+ if (hosting !== "not-hosted") return;
19885
+ if (!session) throw new Error("Must be signed in to host the primary space");
19877
19886
  const handler = this.spaceCreationHandler ?? (this.autoCreateSpace ? new AutoApproveSpaceCreationHandler() : void 0);
19878
- if (!handler) {
19879
- return;
19880
- }
19881
- await this.ensureTinyCloudHosts();
19882
- const host = this.primaryTinyCloudHost;
19883
- const primarySpaceId = session.spaceId;
19884
- const creationContext = {
19885
- spaceId: primarySpaceId,
19886
- address: this._address,
19887
- chainId: this._chainId,
19888
- host
19889
- };
19887
+ if (!handler) return;
19890
19888
  const { createPrimarySpace } = await import("./space-hosting.js");
19891
19889
  await createPrimarySpace({
19892
19890
  handler,
19893
- context: creationContext,
19894
- guard: () => this.guardSpaceCreation(handler, creationContext),
19895
- host: () => this.hostSpace(primarySpaceId),
19891
+ session,
19892
+ currentSession: () => this._tinyCloudSession,
19893
+ signerAddress: () => this.signer.getAddress(),
19894
+ resolveHost: async () => {
19895
+ await this.ensureTinyCloudHosts();
19896
+ return this.primaryTinyCloudHost;
19897
+ },
19898
+ domain: this.domain,
19899
+ guard: (context) => this.guardSpaceCreation(handler, context),
19900
+ host: (context, assertCurrent, siweParameters) => this.hostSpace(context, void 0, signal, assertCurrent, siweParameters),
19896
19901
  onHosted: () => {
19897
19902
  this._spaceHosting = "hosted";
19898
19903
  },
19899
- activate: () => activateSessionWithHost(host, session.delegationHeader)
19904
+ activate: (context) => activateSessionWithHost(context.host, session.delegationHeader),
19905
+ signal
19900
19906
  });
19901
19907
  }
19902
19908
  /** {@link assertMayCreateSpace}, reporting a refusal to the creation handler before rethrowing it. */
@@ -22235,6 +22241,18 @@ var _TinyCloudNode = class _TinyCloudNode {
22235
22241
  return "unknown";
22236
22242
  }
22237
22243
  }
22244
+ /** Run the existing primary-space creation flow for the restored session. */
22245
+ async ensurePrimarySpaceHosted(hosting) {
22246
+ const graph = this._serviceGraph;
22247
+ const epoch = this.sessionEpoch;
22248
+ graph.assertActive();
22249
+ this.assertSessionEpoch(epoch, "Space hosting");
22250
+ const auth = this.auth;
22251
+ if (!auth || !this.session) return;
22252
+ await auth.ensurePrimarySpaceHosted(hosting, graph.signal);
22253
+ graph.assertActive();
22254
+ this.assertSessionEpoch(epoch, "Space hosting");
22255
+ }
22238
22256
  /**
22239
22257
  * The node's last answer for the primary space: recorded at sign-in from the
22240
22258
  * activation, or by {@link checkSpaceHosting}. `unknown` after a restore until