@tinycloud/node-sdk 3.11.1-beta.0 → 3.12.0-beta.1

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.
Files changed (35) hide show
  1. package/dist/NodeUserAuthorization-BtoDI9in.d.cts +900 -0
  2. package/dist/NodeUserAuthorization-BtoDI9in.d.ts +900 -0
  3. package/dist/{TinyCloudNode-AUotFGzy.d.ts → TinyCloudNode-C24728N_.d.cts} +30 -875
  4. package/dist/{TinyCloudNode-BmpjkpWR.d.cts → TinyCloudNode-DLrINr98.d.ts} +30 -875
  5. package/dist/{authority-dRnJD4iL.d.ts → authority-BQN2Z3st.d.ts} +1 -1
  6. package/dist/{authority-BYSEyjDI.d.cts → authority-DDdheOL6.d.cts} +1 -1
  7. package/dist/core.cjs +145 -90
  8. package/dist/core.cjs.map +1 -1
  9. package/dist/core.d.cts +5 -4
  10. package/dist/core.d.ts +5 -4
  11. package/dist/core.js +145 -90
  12. package/dist/core.js.map +1 -1
  13. package/dist/credentials-core.d.cts +1 -1
  14. package/dist/credentials-core.d.ts +1 -1
  15. package/dist/credentials.d.cts +1 -1
  16. package/dist/credentials.d.ts +1 -1
  17. package/dist/{delegation-Ckc3UETl.d.cts → delegation-BQbAuKad.d.cts} +1 -1
  18. package/dist/{delegation-Ckc3UETl.d.ts → delegation-BQbAuKad.d.ts} +1 -1
  19. package/dist/encryption-keys.d.cts +3 -2
  20. package/dist/encryption-keys.d.ts +3 -2
  21. package/dist/index.cjs +145 -90
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +4 -3
  24. package/dist/index.d.ts +4 -3
  25. package/dist/index.js +145 -90
  26. package/dist/index.js.map +1 -1
  27. package/dist/replication/authority.d.cts +4 -3
  28. package/dist/replication/authority.d.ts +4 -3
  29. package/dist/space-hosting.cjs +141 -0
  30. package/dist/space-hosting.cjs.map +1 -0
  31. package/dist/space-hosting.d.cts +69 -0
  32. package/dist/space-hosting.d.ts +69 -0
  33. package/dist/space-hosting.js +115 -0
  34. package/dist/space-hosting.js.map +1 -0
  35. package/package.json +11 -1
package/dist/index.d.cts CHANGED
@@ -1,14 +1,15 @@
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 { A as ACCEPTED_MARKER_VERSIONS, m as BOOTSTRAP_COMPLETION_MARKER_KEY, n as BOOTSTRAP_COMPLETION_MARKER_VERSION, o as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, c as NodeUserAuthorization, p as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, q as OpenKeyAuthorizationResultV1, r as OpenKeyAuthorizeInput, O as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, e as OwnerDelegationReceipt, P as PreparedOpenKeyAuthorization, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, f as SecretReadInput, g as SecretReadResult, h as SignStrategy, T as TinyCloudNode, i as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, j as UnifiedOwnerRootReceipt, k as UnsupportedSessionRestoreError, l as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-BmpjkpWR.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';
5
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';
6
- export { A as AuthDelegationArtifact, e as AuthRequestArtifact, C as CompactRuntimeDelegationInput, D as DelegationAuthority, P as PortableDelegation, f as RUNTIME_DELEGATION_REJECTIONS, g as RuntimeDelegationActivator, R as RuntimeDelegationRejectedError, a as RuntimeDelegationRejection, S as SessionGrantProof, V as ValidatedRuntimeDelegation, h 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-Ckc3UETl.cjs';
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';
7
8
  import { KVReplicaStorage } from '@tinycloud/sdk-services';
8
9
  import { ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
9
10
  export { ProfileReplicaDeferredToken, ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
10
- import '@tinycloud/sdk-services/encryption/named-keys';
11
11
  import 'events';
12
+ import '@tinycloud/sdk-services/encryption/named-keys';
12
13
 
13
14
  /**
14
15
  * Private key signer for Node.js environments.
package/dist/index.d.ts CHANGED
@@ -1,14 +1,15 @@
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 { A as ACCEPTED_MARKER_VERSIONS, m as BOOTSTRAP_COMPLETION_MARKER_KEY, n as BOOTSTRAP_COMPLETION_MARKER_VERSION, o as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, c as NodeUserAuthorization, p as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, q as OpenKeyAuthorizationResultV1, r as OpenKeyAuthorizeInput, O as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, e as OwnerDelegationReceipt, P as PreparedOpenKeyAuthorization, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, f as SecretReadInput, g as SecretReadResult, h as SignStrategy, T as TinyCloudNode, i as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, j as UnifiedOwnerRootReceipt, k as UnsupportedSessionRestoreError, l as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-AUotFGzy.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';
5
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';
6
- export { A as AuthDelegationArtifact, e as AuthRequestArtifact, C as CompactRuntimeDelegationInput, D as DelegationAuthority, P as PortableDelegation, f as RUNTIME_DELEGATION_REJECTIONS, g as RuntimeDelegationActivator, R as RuntimeDelegationRejectedError, a as RuntimeDelegationRejection, S as SessionGrantProof, V as ValidatedRuntimeDelegation, h 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-Ckc3UETl.js';
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';
7
8
  import { KVReplicaStorage } from '@tinycloud/sdk-services';
8
9
  import { ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
9
10
  export { ProfileReplicaDeferredToken, ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
10
- import '@tinycloud/sdk-services/encryption/named-keys';
11
11
  import 'events';
12
+ import '@tinycloud/sdk-services/encryption/named-keys';
12
13
 
13
14
  /**
14
15
  * Private key signer for Node.js environments.
package/dist/index.js CHANGED
@@ -19075,6 +19075,8 @@ var NodeUserAuthorization = class {
19075
19075
  * delegation lists them: the node answers a repeat with empty lists.
19076
19076
  */
19077
19077
  this._lastActivationActivatedSpaceIds = [];
19078
+ /** See {@link spaceHosting}. Written only from node answers. */
19079
+ this._spaceHosting = "unknown";
19078
19080
  this.wasm = config.wasmBindings;
19079
19081
  this.signer = config.signer;
19080
19082
  this.signStrategy = config.signStrategy ?? defaultSignStrategy;
@@ -19234,6 +19236,7 @@ var NodeUserAuthorization = class {
19234
19236
  this.registryVerdict = void 0;
19235
19237
  this._lastActivationSkippedSpaceIds = [];
19236
19238
  this._lastActivationActivatedSpaceIds = [];
19239
+ this._spaceHosting = "unknown";
19237
19240
  if (!session) {
19238
19241
  this._session = void 0;
19239
19242
  this._tinyCloudSession = void 0;
@@ -19374,6 +19377,18 @@ var NodeUserAuthorization = class {
19374
19377
  get lastActivationActivatedSpaceIds() {
19375
19378
  return [...this._lastActivationActivatedSpaceIds];
19376
19379
  }
19380
+ /**
19381
+ * The node's last answer for whether this session's primary space is hosted:
19382
+ * recorded from the sign-in activation, or by {@link noteSpaceHosting}.
19383
+ * `unknown` until one of them answers, and after a restore.
19384
+ */
19385
+ get spaceHosting() {
19386
+ return this._spaceHosting;
19387
+ }
19388
+ /** @internal Record the hosting probe's answer for the primary space. */
19389
+ noteSpaceHosting(hosting) {
19390
+ this._spaceHosting = hosting;
19391
+ }
19377
19392
  /**
19378
19393
  * Compute the `abilities` map the WASM `prepareSession` call should
19379
19394
  * see at sign-in time.
@@ -19834,103 +19849,55 @@ var NodeUserAuthorization = class {
19834
19849
  this._tinyCloudSession.delegationHeader
19835
19850
  );
19836
19851
  this.recordActivationSkippedSpaces(result, primarySpaceId);
19852
+ if (!result.success && result.status !== 404) {
19853
+ throw Object.assign(
19854
+ new Error(`Failed to activate session: ${describeHostFailure(result)}`),
19855
+ { cause: result }
19856
+ );
19857
+ }
19858
+ await this.ensurePrimarySpaceHosted(this._spaceHosting);
19859
+ }
19860
+ /**
19861
+ * The create step of {@link ensureSpaceExists}: given the node's answer for
19862
+ * the primary space, host it through the space creation handler when it is
19863
+ * `not-hosted`. Any other answer, and a missing handler, change nothing. The
19864
+ * caller supplies the answer (sign-in's activation, or the hosting probe);
19865
+ * an empty activation list is never one.
19866
+ *
19867
+ * @throws Error if the creation handler fails or times out, or hosting fails
19868
+ */
19869
+ async ensurePrimarySpaceHosted(hosting) {
19870
+ if (hosting !== "not-hosted") {
19871
+ return;
19872
+ }
19873
+ const session = this._tinyCloudSession;
19874
+ if (!session) {
19875
+ throw new Error("Must be signed in to host the primary space");
19876
+ }
19837
19877
  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;
19838
19884
  const creationContext = {
19839
19885
  spaceId: primarySpaceId,
19840
19886
  address: this._address,
19841
19887
  chainId: this._chainId,
19842
19888
  host
19843
19889
  };
19844
- if (result.success) {
19845
- const primarySkipped = result.skipped?.includes(primarySpaceId);
19846
- if (!primarySkipped) {
19847
- return;
19848
- }
19849
- if (!handler) {
19850
- return;
19851
- }
19852
- await this.guardSpaceCreation(handler, creationContext);
19853
- const confirmed = await handler.confirmSpaceCreation(creationContext);
19854
- if (!confirmed) {
19855
- return;
19856
- }
19857
- try {
19858
- const created = await this.hostSpace();
19859
- if (!created.success) {
19860
- const err2 = Object.assign(
19861
- new Error(`Failed to create space ${primarySpaceId}: ${describeHostFailure(created)}`),
19862
- { cause: created }
19863
- );
19864
- throw err2;
19865
- }
19866
- } catch (error) {
19867
- handler.onSpaceCreationFailed?.(
19868
- creationContext,
19869
- error instanceof Error ? error : new Error(String(error))
19870
- );
19871
- throw error;
19872
- }
19873
- await new Promise((resolve2) => setTimeout(resolve2, 100));
19874
- const retryResult = await activateSessionWithHost(
19875
- host,
19876
- this._tinyCloudSession.delegationHeader
19877
- );
19878
- if (!retryResult.success) {
19879
- const err2 = Object.assign(
19880
- new Error(`Failed to activate session after creating space: ${describeHostFailure(retryResult)}`),
19881
- { cause: retryResult }
19882
- );
19883
- handler.onSpaceCreationFailed?.(creationContext, err2);
19884
- throw err2;
19885
- }
19886
- handler.onSpaceCreated?.(creationContext);
19887
- return;
19888
- }
19889
- if (result.status === 404) {
19890
- if (!handler) {
19891
- return;
19892
- }
19893
- await this.guardSpaceCreation(handler, creationContext);
19894
- const confirmed = await handler.confirmSpaceCreation(creationContext);
19895
- if (!confirmed) {
19896
- return;
19897
- }
19898
- try {
19899
- const created = await this.hostSpace();
19900
- if (!created.success) {
19901
- const err2 = Object.assign(
19902
- new Error(`Failed to create space ${primarySpaceId}: ${describeHostFailure(created)}`),
19903
- { cause: created }
19904
- );
19905
- throw err2;
19906
- }
19907
- } catch (error) {
19908
- handler.onSpaceCreationFailed?.(
19909
- creationContext,
19910
- error instanceof Error ? error : new Error(String(error))
19911
- );
19912
- throw error;
19913
- }
19914
- await new Promise((resolve2) => setTimeout(resolve2, 100));
19915
- const retryResult = await activateSessionWithHost(
19916
- host,
19917
- this._tinyCloudSession.delegationHeader
19918
- );
19919
- if (!retryResult.success) {
19920
- const err2 = Object.assign(
19921
- new Error(`Failed to activate session after creating space: ${describeHostFailure(retryResult)}`),
19922
- { cause: retryResult }
19923
- );
19924
- handler.onSpaceCreationFailed?.(creationContext, err2);
19925
- throw err2;
19926
- }
19927
- handler.onSpaceCreated?.(creationContext);
19928
- return;
19929
- }
19930
- throw Object.assign(
19931
- new Error(`Failed to activate session: ${describeHostFailure(result)}`),
19932
- { cause: result }
19933
- );
19890
+ const { createPrimarySpace } = await import("./space-hosting.js");
19891
+ await createPrimarySpace({
19892
+ handler,
19893
+ context: creationContext,
19894
+ guard: () => this.guardSpaceCreation(handler, creationContext),
19895
+ host: () => this.hostSpace(primarySpaceId),
19896
+ onHosted: () => {
19897
+ this._spaceHosting = "hosted";
19898
+ },
19899
+ activate: () => activateSessionWithHost(host, session.delegationHeader)
19900
+ });
19934
19901
  }
19935
19902
  /** {@link assertMayCreateSpace}, reporting a refusal to the creation handler before rethrowing it. */
19936
19903
  async guardSpaceCreation(handler, context) {
@@ -19946,10 +19913,12 @@ var NodeUserAuthorization = class {
19946
19913
  if (result.success) {
19947
19914
  this._lastActivationSkippedSpaceIds = result.skipped ?? [];
19948
19915
  this._lastActivationActivatedSpaceIds = result.activated ?? [];
19916
+ this._spaceHosting = this._lastActivationSkippedSpaceIds.includes(primarySpaceId) ? "not-hosted" : this._lastActivationActivatedSpaceIds.includes(primarySpaceId) ? "hosted" : "unknown";
19949
19917
  return;
19950
19918
  }
19951
19919
  this._lastActivationActivatedSpaceIds = [];
19952
19920
  this._lastActivationSkippedSpaceIds = result.status === 404 ? [primarySpaceId] : [];
19921
+ this._spaceHosting = result.status === 404 ? "not-hosted" : "unknown";
19953
19922
  }
19954
19923
  async createBootstrapSession(options) {
19955
19924
  refuseCaveated(options.capabilityRequest.manifests);
@@ -21903,6 +21872,8 @@ var _TinyCloudNode = class _TinyCloudNode {
21903
21872
  * hosting is confirmed against the session that was active at the time.
21904
21873
  */
21905
21874
  this.confirmedHostedSpaceIds = /* @__PURE__ */ new Set();
21875
+ /** The primary space's hosting answer when no authorization layer holds it (a session-only restore). */
21876
+ this._restoredSpaceHosting = "unknown";
21906
21877
  /**
21907
21878
  * Owned space ids known to be hosted for the current session: the sign-in
21908
21879
  * activation listed them as `activated`, or this session hosted them. Unlike
@@ -22241,6 +22212,84 @@ var _TinyCloudNode = class _TinyCloudNode {
22241
22212
  ));
22242
22213
  }
22243
22214
  }
22215
+ /**
22216
+ * Whether the TinyCloud node hosts the primary space (the default) or a named
22217
+ * or full-id space: `"hosted"`, `"not-hosted"`, or `"unknown"` when the node
22218
+ * cannot say.
22219
+ *
22220
+ * Sends one authorized read the session already holds on that space (a kv
22221
+ * list under a granted prefix, else kv metadata, `tinycloud.space/info`, or
22222
+ * a kv get of a key that does not exist), signed for that space. A session
22223
+ * with no such read sends nothing and answers `unknown`. A 401/403 registers
22224
+ * the session delegation with the node once and asks again once. Network
22225
+ * failures, 5xx and a 5 s timeout answer `unknown`; this never throws.
22226
+ *
22227
+ * `hosted` is remembered for the session and `not-hosted` never is. The
22228
+ * answer for the primary space is also what {@link spaceHosting} reports; a
22229
+ * `unknown` answer leaves the previous one in place.
22230
+ */
22231
+ async checkSpaceHosting(space) {
22232
+ try {
22233
+ return await this.probeSpaceHosting(space);
22234
+ } catch {
22235
+ return "unknown";
22236
+ }
22237
+ }
22238
+ /**
22239
+ * The node's last answer for the primary space: recorded at sign-in from the
22240
+ * activation, or by {@link checkSpaceHosting}. `unknown` after a restore until
22241
+ * something asks.
22242
+ */
22243
+ get spaceHosting() {
22244
+ return this.auth ? this.auth.spaceHosting : this._restoredSpaceHosting;
22245
+ }
22246
+ async probeSpaceHosting(space) {
22247
+ const context = this._serviceContext;
22248
+ const session = context?.session;
22249
+ const host = context?.hosts[0];
22250
+ if (!context || !session || !host) {
22251
+ return "unknown";
22252
+ }
22253
+ const spaceId = space === void 0 ? session.spaceId : space.startsWith("tinycloud:") ? space : this.ownedSpaceId(space);
22254
+ const graph = this._serviceGraph;
22255
+ const epoch = this.sessionEpoch;
22256
+ const assertCurrent = () => {
22257
+ graph.assertActive();
22258
+ if (epoch !== this.sessionEpoch || graph !== this._serviceGraph || this._serviceContext !== context) {
22259
+ throw new Error("The session changed during the hosting check.");
22260
+ }
22261
+ };
22262
+ const { askSpaceHosting } = await import("./space-hosting.js");
22263
+ assertCurrent();
22264
+ this.pruneExpiredRuntimePermissionGrants();
22265
+ const primary = this.currentTinyCloudSession();
22266
+ const answer = await askSpaceHosting({
22267
+ spaceId,
22268
+ operations: [
22269
+ ...this.runtimePermissionGrants.flatMap((grant) => grant.operations),
22270
+ ...primary ? this.recapOperationsFromSession(primary) : []
22271
+ ],
22272
+ covers: (granted, requested) => this.operationCovers(granted, requested),
22273
+ scope: context,
22274
+ host,
22275
+ fetch: unrecordedFetchOf(context),
22276
+ sign: (entries) => {
22277
+ assertCurrent();
22278
+ return graph.invokeAny({ ...session, spaceId }, entries);
22279
+ },
22280
+ // A session saved but never registered on this node is refused: it registers once.
22281
+ activate: (signal) => {
22282
+ assertCurrent();
22283
+ return activateSessionWithHost2(host, session.delegationHeader, AbortSignal.any([signal, graph.signal]));
22284
+ }
22285
+ });
22286
+ assertCurrent();
22287
+ if (answer !== "unknown" && this.spaceIdsEqual(spaceId, session.spaceId)) {
22288
+ if (this.auth) this.auth.noteSpaceHosting(answer);
22289
+ else this._restoredSpaceHosting = answer;
22290
+ }
22291
+ return answer;
22292
+ }
22244
22293
  get nodeFeatures() {
22245
22294
  return this.auth?.nodeFeatures ?? this._restoredNodeFeatures ?? [];
22246
22295
  }
@@ -22732,6 +22781,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22732
22781
  this._spaceService = void 0;
22733
22782
  this.runtimePermissionGrants = [];
22734
22783
  this._recapOperationsCache = void 0;
22784
+ this._restoredSpaceHosting = "unknown";
22735
22785
  this.confirmedHostedSpaceIds.clear();
22736
22786
  this.hostedOwnedSpaceIds.clear();
22737
22787
  this.cancelOwnedSpaceHosts();
@@ -22925,6 +22975,10 @@ var _TinyCloudNode = class _TinyCloudNode {
22925
22975
  const primarySession = this.currentTinyCloudSession();
22926
22976
  if (primarySession) {
22927
22977
  this.registerPrimarySessionGrant(primarySession);
22978
+ if (this.auth?.spaceHosting === "unknown") {
22979
+ await this.checkSpaceHosting();
22980
+ this.assertSessionEpoch(epoch, "Sign-in");
22981
+ }
22928
22982
  }
22929
22983
  const bootstrapped = await this.bootstrapAccountIfNeeded();
22930
22984
  this.assertSessionEpoch(epoch, "Sign-in");
@@ -24304,6 +24358,7 @@ var _TinyCloudNode = class _TinyCloudNode {
24304
24358
  this.tc = stagedGraph.core;
24305
24359
  this._recapOperationsCache = stagedPrimary.cache;
24306
24360
  this.runtimePermissionGrants = stagedPrimary.grants;
24361
+ this._restoredSpaceHosting = "unknown";
24307
24362
  this.confirmedHostedSpaceIds.clear();
24308
24363
  this.hostedOwnedSpaceIds.clear();
24309
24364
  this.cancelOwnedSpaceHosts();