@tinycloud/node-sdk 3.11.1-beta.0 → 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/NodeUserAuthorization-B05Wjjpb.d.cts +900 -0
- package/dist/NodeUserAuthorization-B05Wjjpb.d.ts +900 -0
- package/dist/{TinyCloudNode-AUotFGzy.d.ts → TinyCloudNode-6_IumWu0.d.cts} +32 -875
- package/dist/{TinyCloudNode-BmpjkpWR.d.cts → TinyCloudNode-CEFGtSWn.d.ts} +32 -875
- package/dist/{authority-BYSEyjDI.d.cts → authority-DODDXxoP.d.cts} +1 -1
- package/dist/{authority-dRnJD4iL.d.ts → authority-DXpnuId1.d.ts} +1 -1
- package/dist/core.cjs +182 -109
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +5 -4
- package/dist/core.d.ts +5 -4
- package/dist/core.js +182 -109
- package/dist/core.js.map +1 -1
- package/dist/credentials-core.d.cts +1 -1
- package/dist/credentials-core.d.ts +1 -1
- package/dist/credentials.d.cts +1 -1
- package/dist/credentials.d.ts +1 -1
- package/dist/{delegation-Ckc3UETl.d.cts → delegation-BQbAuKad.d.cts} +1 -1
- package/dist/{delegation-Ckc3UETl.d.ts → delegation-BQbAuKad.d.ts} +1 -1
- package/dist/encryption-keys.d.cts +3 -2
- package/dist/encryption-keys.d.ts +3 -2
- package/dist/index.cjs +182 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +182 -109
- package/dist/index.js.map +1 -1
- package/dist/replication/authority.d.cts +4 -3
- package/dist/replication/authority.d.ts +4 -3
- package/dist/space-hosting.cjs +183 -0
- package/dist/space-hosting.cjs.map +1 -0
- package/dist/space-hosting.d.cts +84 -0
- package/dist/space-hosting.d.ts +84 -0
- package/dist/space-hosting.js +157 -0
- package/dist/space-hosting.js.map +1 -0
- 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 {
|
|
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';
|
|
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,
|
|
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 {
|
|
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';
|
|
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,
|
|
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.
|
|
@@ -19753,23 +19768,35 @@ var NodeUserAuthorization = class {
|
|
|
19753
19768
|
* Create the space on the TinyCloud server (host delegation).
|
|
19754
19769
|
* This registers the user as the owner of the space.
|
|
19755
19770
|
*/
|
|
19756
|
-
async hostSpace(targetSpaceId, purpose, signal) {
|
|
19757
|
-
|
|
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) {
|
|
19758
19776
|
throw new Error("Must be signed in to host space");
|
|
19759
19777
|
}
|
|
19778
|
+
const checkCurrent = () => {
|
|
19779
|
+
signal?.throwIfAborted();
|
|
19780
|
+
assertCurrent?.();
|
|
19781
|
+
};
|
|
19782
|
+
checkCurrent();
|
|
19760
19783
|
await this.ensureTinyCloudHosts();
|
|
19761
|
-
|
|
19762
|
-
const
|
|
19784
|
+
checkCurrent();
|
|
19785
|
+
const host = context?.host ?? this.primaryTinyCloudHost;
|
|
19786
|
+
const spaceId = context?.spaceId ?? (typeof targetSpaceId === "string" ? targetSpaceId : this._tinyCloudSession.spaceId);
|
|
19763
19787
|
const peerId = await fetchPeerId(host, spaceId, signal);
|
|
19764
|
-
|
|
19765
|
-
|
|
19766
|
-
|
|
19767
|
-
|
|
19768
|
-
|
|
19769
|
-
|
|
19770
|
-
|
|
19771
|
-
|
|
19772
|
-
|
|
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();
|
|
19773
19800
|
const signing = this.signMessage(siwe, purpose);
|
|
19774
19801
|
let signature2;
|
|
19775
19802
|
if (!signal) {
|
|
@@ -19788,8 +19815,9 @@ var NodeUserAuthorization = class {
|
|
|
19788
19815
|
signal.removeEventListener("abort", onAbort);
|
|
19789
19816
|
}
|
|
19790
19817
|
}
|
|
19791
|
-
|
|
19818
|
+
checkCurrent();
|
|
19792
19819
|
const headers = this.wasm.siweToDelegationHeaders({ siwe, signature: signature2 });
|
|
19820
|
+
checkCurrent();
|
|
19793
19821
|
return submitHostDelegation(host, headers, signal);
|
|
19794
19822
|
}
|
|
19795
19823
|
/**
|
|
@@ -19834,103 +19862,48 @@ var NodeUserAuthorization = class {
|
|
|
19834
19862
|
this._tinyCloudSession.delegationHeader
|
|
19835
19863
|
);
|
|
19836
19864
|
this.recordActivationSkippedSpaces(result, primarySpaceId);
|
|
19837
|
-
|
|
19838
|
-
|
|
19839
|
-
|
|
19840
|
-
|
|
19841
|
-
chainId: this._chainId,
|
|
19842
|
-
host
|
|
19843
|
-
};
|
|
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
|
|
19865
|
+
if (!result.success && result.status !== 404) {
|
|
19866
|
+
throw Object.assign(
|
|
19867
|
+
new Error(`Failed to activate session: ${describeHostFailure(result)}`),
|
|
19868
|
+
{ cause: result }
|
|
19918
19869
|
);
|
|
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
19870
|
}
|
|
19930
|
-
|
|
19931
|
-
|
|
19932
|
-
|
|
19933
|
-
|
|
19871
|
+
await this.ensurePrimarySpaceHosted(this._spaceHosting);
|
|
19872
|
+
}
|
|
19873
|
+
/**
|
|
19874
|
+
* The create step of {@link ensureSpaceExists}: given the node's answer for
|
|
19875
|
+
* the primary space, host it through the space creation handler when it is
|
|
19876
|
+
* `not-hosted`. Any other answer, and a missing handler, change nothing. The
|
|
19877
|
+
* caller supplies the answer (sign-in's activation, or the hosting probe);
|
|
19878
|
+
* an empty activation list is never one.
|
|
19879
|
+
*
|
|
19880
|
+
* @throws Error if the creation handler fails or times out, or hosting fails
|
|
19881
|
+
*/
|
|
19882
|
+
async ensurePrimarySpaceHosted(hosting, signal) {
|
|
19883
|
+
const session = this._tinyCloudSession;
|
|
19884
|
+
if (hosting !== "not-hosted") return;
|
|
19885
|
+
if (!session) throw new Error("Must be signed in to host the primary space");
|
|
19886
|
+
const handler = this.spaceCreationHandler ?? (this.autoCreateSpace ? new AutoApproveSpaceCreationHandler() : void 0);
|
|
19887
|
+
if (!handler) return;
|
|
19888
|
+
const { createPrimarySpace } = await import("./space-hosting.js");
|
|
19889
|
+
await createPrimarySpace({
|
|
19890
|
+
handler,
|
|
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),
|
|
19901
|
+
onHosted: () => {
|
|
19902
|
+
this._spaceHosting = "hosted";
|
|
19903
|
+
},
|
|
19904
|
+
activate: (context) => activateSessionWithHost(context.host, session.delegationHeader),
|
|
19905
|
+
signal
|
|
19906
|
+
});
|
|
19934
19907
|
}
|
|
19935
19908
|
/** {@link assertMayCreateSpace}, reporting a refusal to the creation handler before rethrowing it. */
|
|
19936
19909
|
async guardSpaceCreation(handler, context) {
|
|
@@ -19946,10 +19919,12 @@ var NodeUserAuthorization = class {
|
|
|
19946
19919
|
if (result.success) {
|
|
19947
19920
|
this._lastActivationSkippedSpaceIds = result.skipped ?? [];
|
|
19948
19921
|
this._lastActivationActivatedSpaceIds = result.activated ?? [];
|
|
19922
|
+
this._spaceHosting = this._lastActivationSkippedSpaceIds.includes(primarySpaceId) ? "not-hosted" : this._lastActivationActivatedSpaceIds.includes(primarySpaceId) ? "hosted" : "unknown";
|
|
19949
19923
|
return;
|
|
19950
19924
|
}
|
|
19951
19925
|
this._lastActivationActivatedSpaceIds = [];
|
|
19952
19926
|
this._lastActivationSkippedSpaceIds = result.status === 404 ? [primarySpaceId] : [];
|
|
19927
|
+
this._spaceHosting = result.status === 404 ? "not-hosted" : "unknown";
|
|
19953
19928
|
}
|
|
19954
19929
|
async createBootstrapSession(options) {
|
|
19955
19930
|
refuseCaveated(options.capabilityRequest.manifests);
|
|
@@ -21903,6 +21878,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21903
21878
|
* hosting is confirmed against the session that was active at the time.
|
|
21904
21879
|
*/
|
|
21905
21880
|
this.confirmedHostedSpaceIds = /* @__PURE__ */ new Set();
|
|
21881
|
+
/** The primary space's hosting answer when no authorization layer holds it (a session-only restore). */
|
|
21882
|
+
this._restoredSpaceHosting = "unknown";
|
|
21906
21883
|
/**
|
|
21907
21884
|
* Owned space ids known to be hosted for the current session: the sign-in
|
|
21908
21885
|
* activation listed them as `activated`, or this session hosted them. Unlike
|
|
@@ -22241,6 +22218,96 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
22241
22218
|
));
|
|
22242
22219
|
}
|
|
22243
22220
|
}
|
|
22221
|
+
/**
|
|
22222
|
+
* Whether the TinyCloud node hosts the primary space (the default) or a named
|
|
22223
|
+
* or full-id space: `"hosted"`, `"not-hosted"`, or `"unknown"` when the node
|
|
22224
|
+
* cannot say.
|
|
22225
|
+
*
|
|
22226
|
+
* Sends one authorized read the session already holds on that space (a kv
|
|
22227
|
+
* list under a granted prefix, else kv metadata, `tinycloud.space/info`, or
|
|
22228
|
+
* a kv get of a key that does not exist), signed for that space. A session
|
|
22229
|
+
* with no such read sends nothing and answers `unknown`. A 401/403 registers
|
|
22230
|
+
* the session delegation with the node once and asks again once. Network
|
|
22231
|
+
* failures, 5xx and a 5 s timeout answer `unknown`; this never throws.
|
|
22232
|
+
*
|
|
22233
|
+
* `hosted` is remembered for the session and `not-hosted` never is. The
|
|
22234
|
+
* answer for the primary space is also what {@link spaceHosting} reports; a
|
|
22235
|
+
* `unknown` answer leaves the previous one in place.
|
|
22236
|
+
*/
|
|
22237
|
+
async checkSpaceHosting(space) {
|
|
22238
|
+
try {
|
|
22239
|
+
return await this.probeSpaceHosting(space);
|
|
22240
|
+
} catch {
|
|
22241
|
+
return "unknown";
|
|
22242
|
+
}
|
|
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
|
+
}
|
|
22256
|
+
/**
|
|
22257
|
+
* The node's last answer for the primary space: recorded at sign-in from the
|
|
22258
|
+
* activation, or by {@link checkSpaceHosting}. `unknown` after a restore until
|
|
22259
|
+
* something asks.
|
|
22260
|
+
*/
|
|
22261
|
+
get spaceHosting() {
|
|
22262
|
+
return this.auth ? this.auth.spaceHosting : this._restoredSpaceHosting;
|
|
22263
|
+
}
|
|
22264
|
+
async probeSpaceHosting(space) {
|
|
22265
|
+
const context = this._serviceContext;
|
|
22266
|
+
const session = context?.session;
|
|
22267
|
+
const host = context?.hosts[0];
|
|
22268
|
+
if (!context || !session || !host) {
|
|
22269
|
+
return "unknown";
|
|
22270
|
+
}
|
|
22271
|
+
const spaceId = space === void 0 ? session.spaceId : space.startsWith("tinycloud:") ? space : this.ownedSpaceId(space);
|
|
22272
|
+
const graph = this._serviceGraph;
|
|
22273
|
+
const epoch = this.sessionEpoch;
|
|
22274
|
+
const assertCurrent = () => {
|
|
22275
|
+
graph.assertActive();
|
|
22276
|
+
if (epoch !== this.sessionEpoch || graph !== this._serviceGraph || this._serviceContext !== context) {
|
|
22277
|
+
throw new Error("The session changed during the hosting check.");
|
|
22278
|
+
}
|
|
22279
|
+
};
|
|
22280
|
+
const { askSpaceHosting } = await import("./space-hosting.js");
|
|
22281
|
+
assertCurrent();
|
|
22282
|
+
this.pruneExpiredRuntimePermissionGrants();
|
|
22283
|
+
const primary = this.currentTinyCloudSession();
|
|
22284
|
+
const answer = await askSpaceHosting({
|
|
22285
|
+
spaceId,
|
|
22286
|
+
operations: [
|
|
22287
|
+
...this.runtimePermissionGrants.flatMap((grant) => grant.operations),
|
|
22288
|
+
...primary ? this.recapOperationsFromSession(primary) : []
|
|
22289
|
+
],
|
|
22290
|
+
covers: (granted, requested) => this.operationCovers(granted, requested),
|
|
22291
|
+
scope: context,
|
|
22292
|
+
host,
|
|
22293
|
+
fetch: unrecordedFetchOf(context),
|
|
22294
|
+
sign: (entries) => {
|
|
22295
|
+
assertCurrent();
|
|
22296
|
+
return graph.invokeAny({ ...session, spaceId }, entries);
|
|
22297
|
+
},
|
|
22298
|
+
// A session saved but never registered on this node is refused: it registers once.
|
|
22299
|
+
activate: (signal) => {
|
|
22300
|
+
assertCurrent();
|
|
22301
|
+
return activateSessionWithHost2(host, session.delegationHeader, AbortSignal.any([signal, graph.signal]));
|
|
22302
|
+
}
|
|
22303
|
+
});
|
|
22304
|
+
assertCurrent();
|
|
22305
|
+
if (answer !== "unknown" && this.spaceIdsEqual(spaceId, session.spaceId)) {
|
|
22306
|
+
if (this.auth) this.auth.noteSpaceHosting(answer);
|
|
22307
|
+
else this._restoredSpaceHosting = answer;
|
|
22308
|
+
}
|
|
22309
|
+
return answer;
|
|
22310
|
+
}
|
|
22244
22311
|
get nodeFeatures() {
|
|
22245
22312
|
return this.auth?.nodeFeatures ?? this._restoredNodeFeatures ?? [];
|
|
22246
22313
|
}
|
|
@@ -22732,6 +22799,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
22732
22799
|
this._spaceService = void 0;
|
|
22733
22800
|
this.runtimePermissionGrants = [];
|
|
22734
22801
|
this._recapOperationsCache = void 0;
|
|
22802
|
+
this._restoredSpaceHosting = "unknown";
|
|
22735
22803
|
this.confirmedHostedSpaceIds.clear();
|
|
22736
22804
|
this.hostedOwnedSpaceIds.clear();
|
|
22737
22805
|
this.cancelOwnedSpaceHosts();
|
|
@@ -22925,6 +22993,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
22925
22993
|
const primarySession = this.currentTinyCloudSession();
|
|
22926
22994
|
if (primarySession) {
|
|
22927
22995
|
this.registerPrimarySessionGrant(primarySession);
|
|
22996
|
+
if (this.auth?.spaceHosting === "unknown") {
|
|
22997
|
+
await this.checkSpaceHosting();
|
|
22998
|
+
this.assertSessionEpoch(epoch, "Sign-in");
|
|
22999
|
+
}
|
|
22928
23000
|
}
|
|
22929
23001
|
const bootstrapped = await this.bootstrapAccountIfNeeded();
|
|
22930
23002
|
this.assertSessionEpoch(epoch, "Sign-in");
|
|
@@ -24304,6 +24376,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
24304
24376
|
this.tc = stagedGraph.core;
|
|
24305
24377
|
this._recapOperationsCache = stagedPrimary.cache;
|
|
24306
24378
|
this.runtimePermissionGrants = stagedPrimary.grants;
|
|
24379
|
+
this._restoredSpaceHosting = "unknown";
|
|
24307
24380
|
this.confirmedHostedSpaceIds.clear();
|
|
24308
24381
|
this.hostedOwnedSpaceIds.clear();
|
|
24309
24382
|
this.cancelOwnedSpaceHosts();
|