@tinycloud/node-sdk 3.2.0 → 3.2.1-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.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ISigner, Bytes, CapabilityPresentationEnvelopeV1, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
2
2
  export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, 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, ReplicaGrantInfo, 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
- export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, i as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, l as RestorableSession, m as RuntimeDelegationActivator, n as RuntimeDelegationRejectedError, o as RuntimeDelegationRejection, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, s as SessionGrantProof, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, x as VerifiedSessionGrant, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, G as activateValidatedRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, L as grantAuthRequest, Q as serializeDelegation, X as signedCompactUcanExpiry, Y as siweRuntimeDelegation } from './WasmKeyProvider-6_YwgSkd.cjs';
3
+ export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, i as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, l as RestorableSession, m as RuntimeDelegationActivator, n as RuntimeDelegationRejectedError, o as RuntimeDelegationRejection, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, s as SessionGrantProof, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, x as VerifiedSessionGrant, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, G as activateValidatedRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, L as grantAuthRequest, Q as serializeDelegation, X as signedCompactUcanExpiry, Y as siweRuntimeDelegation } from './WasmKeyProvider-DRlOpvpG.cjs';
4
4
  import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
5
5
  import { KVReplicaStorage } from '@tinycloud/sdk-services';
6
6
  import 'events';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ISigner, Bytes, CapabilityPresentationEnvelopeV1, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
2
2
  export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, 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, ReplicaGrantInfo, 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
- export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, i as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, l as RestorableSession, m as RuntimeDelegationActivator, n as RuntimeDelegationRejectedError, o as RuntimeDelegationRejection, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, s as SessionGrantProof, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, x as VerifiedSessionGrant, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, G as activateValidatedRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, L as grantAuthRequest, Q as serializeDelegation, X as signedCompactUcanExpiry, Y as siweRuntimeDelegation } from './WasmKeyProvider-6_YwgSkd.js';
3
+ export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, i as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, l as RestorableSession, m as RuntimeDelegationActivator, n as RuntimeDelegationRejectedError, o as RuntimeDelegationRejection, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, s as SessionGrantProof, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, x as VerifiedSessionGrant, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, G as activateValidatedRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, L as grantAuthRequest, Q as serializeDelegation, X as signedCompactUcanExpiry, Y as siweRuntimeDelegation } from './WasmKeyProvider-DRlOpvpG.js';
4
4
  import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
5
5
  import { KVReplicaStorage } from '@tinycloud/sdk-services';
6
6
  import 'events';
package/dist/index.js CHANGED
@@ -18476,6 +18476,11 @@ var NodeUserAuthorization = class {
18476
18476
  this._nodeFeatures = [];
18477
18477
  this._nodeFeaturesKnown = false;
18478
18478
  this._lastActivationSkippedSpaceIds = [];
18479
+ /**
18480
+ * Spaces the sign-in activation reported hosted. Only the first POST of a
18481
+ * delegation lists them: the node answers a repeat with empty lists.
18482
+ */
18483
+ this._lastActivationActivatedSpaceIds = [];
18479
18484
  this.wasm = config.wasmBindings;
18480
18485
  this.signer = config.signer;
18481
18486
  this.signStrategy = config.signStrategy ?? defaultSignStrategy;
@@ -18605,6 +18610,7 @@ var NodeUserAuthorization = class {
18605
18610
  this._nodeInfoIdentity = void 0;
18606
18611
  this.tinycloudHosts = hosts && hosts.length > 0 ? [...hosts] : void 0;
18607
18612
  this._lastActivationSkippedSpaceIds = [];
18613
+ this._lastActivationActivatedSpaceIds = [];
18608
18614
  if (!session) {
18609
18615
  this._session = void 0;
18610
18616
  this._tinyCloudSession = void 0;
@@ -18699,6 +18705,9 @@ var NodeUserAuthorization = class {
18699
18705
  get lastActivationSkippedSpaceIds() {
18700
18706
  return [...this._lastActivationSkippedSpaceIds];
18701
18707
  }
18708
+ get lastActivationActivatedSpaceIds() {
18709
+ return [...this._lastActivationActivatedSpaceIds];
18710
+ }
18702
18711
  /**
18703
18712
  * Compute the `abilities` map the WASM `prepareSession` call should
18704
18713
  * see at sign-in time.
@@ -19194,8 +19203,10 @@ var NodeUserAuthorization = class {
19194
19203
  recordActivationSkippedSpaces(result, primarySpaceId) {
19195
19204
  if (result.success) {
19196
19205
  this._lastActivationSkippedSpaceIds = result.skipped ?? [];
19206
+ this._lastActivationActivatedSpaceIds = result.activated ?? [];
19197
19207
  return;
19198
19208
  }
19209
+ this._lastActivationActivatedSpaceIds = [];
19199
19210
  this._lastActivationSkippedSpaceIds = result.status === 404 ? [primarySpaceId] : [];
19200
19211
  }
19201
19212
  async createBootstrapSession(options) {
@@ -20941,10 +20952,26 @@ var _TinyCloudNode = class _TinyCloudNode {
20941
20952
  * hosting is confirmed against the session that was active at the time.
20942
20953
  */
20943
20954
  this.confirmedHostedSpaceIds = /* @__PURE__ */ new Set();
20955
+ /**
20956
+ * Owned space ids known to be hosted for the current session: the sign-in
20957
+ * activation listed them as `activated`, or this session hosted them. Unlike
20958
+ * {@link confirmedHostedSpaceIds}, nothing here is inferred from a space being
20959
+ * merely absent from `skipped`. Read by {@link ensureOwnedSpaceHosted}.
20960
+ */
20961
+ this.hostedOwnedSpaceIds = /* @__PURE__ */ new Set();
20962
+ /**
20963
+ * In-flight host delegations, so concurrent callers share one approval per
20964
+ * space. `waiters` counts callers still waiting; the request is cancelled
20965
+ * once every caller with a signal has aborted and none waits without one.
20966
+ */
20967
+ this.ownedSpaceHosts = /* @__PURE__ */ new Map();
20944
20968
  /** Serializes account-registry writes for the active node instance. */
20945
20969
  this.accountRegistryTail = Promise.resolve();
20946
- /** Bounds best-effort registry work on the sign-in critical path. */
20947
- this.accountRegistryDeadlineMs = 4e3;
20970
+ /**
20971
+ * Hang guard for the background registry sync. It is off the sign-in path,
20972
+ * so it must outlast a slow but healthy sync (9–18 s on prod 1.20.2, TC-998).
20973
+ */
20974
+ this.accountRegistryDeadlineMs = 3e4;
20948
20975
  /**
20949
20976
  * True when the last signIn() detected an interactive signer and skipped
20950
20977
  * client-side bootstrap. Apps can read this to know whether bootstrap was
@@ -21539,6 +21566,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21539
21566
  "Cannot signIn() in session-only mode. Provide a privateKey in config to create your own space."
21540
21567
  );
21541
21568
  }
21569
+ this.pendingAccountRegistrySync?.controller.abort();
21542
21570
  await this.accountRegistryTail;
21543
21571
  await this.wasmBindings.ensureInitialized?.();
21544
21572
  const address = canonicalizeAddress2(await this.signer.getAddress());
@@ -21559,8 +21587,13 @@ var _TinyCloudNode = class _TinyCloudNode {
21559
21587
  this._serviceContext = void 0;
21560
21588
  this.runtimePermissionGrants = [];
21561
21589
  this.confirmedHostedSpaceIds.clear();
21590
+ this.hostedOwnedSpaceIds.clear();
21562
21591
  await this.tc.signIn(options);
21592
+ this.cancelOwnedSpaceHosts();
21563
21593
  this.syncResolvedHostFromAuth();
21594
+ for (const spaceId of this.auth.lastActivationActivatedSpaceIds ?? []) {
21595
+ this.hostedOwnedSpaceIds.add(spaceId);
21596
+ }
21564
21597
  this.replicationDelegateSession = void 0;
21565
21598
  this.replicationScopeError = void 0;
21566
21599
  if (this.replicationRuntime) await (await this.replicationRuntime).unbind();
@@ -21585,10 +21618,20 @@ var _TinyCloudNode = class _TinyCloudNode {
21585
21618
  }
21586
21619
  if (!bootstrapped) {
21587
21620
  this.scheduleAccountRegistrySync();
21588
- await this.accountRegistryTail;
21589
21621
  }
21590
21622
  this.notificationHandler.success("Successfully signed in");
21591
21623
  }
21624
+ /**
21625
+ * Wait for the account-registry sync that {@link signIn} starts in the
21626
+ * background (account index, this app's manifest record, space list).
21627
+ * Resolves once it has finished, failed or hit its hang guard; it never
21628
+ * rejects, and failures are logged as warnings. `signIn()` does not wait for
21629
+ * it, so call this only when you need the registry written, or before a first
21630
+ * write against a SQLite-backed node older than 1.20.2 (TC-899).
21631
+ */
21632
+ async waitForAccountRegistrySync() {
21633
+ await this.accountRegistryTail;
21634
+ }
21592
21635
  ownedSpaceId(name) {
21593
21636
  if (!this._address) {
21594
21637
  throw new Error("Cannot resolve owned space before sign-in");
@@ -21728,6 +21771,13 @@ var _TinyCloudNode = class _TinyCloudNode {
21728
21771
  * A marker written before a canonical space was added triggers one bounded repair.
21729
21772
  */
21730
21773
  isAcceptedBootstrapCompletionMarker(value, canonicalStepIds) {
21774
+ if (typeof value === "string") {
21775
+ try {
21776
+ value = JSON.parse(value);
21777
+ } catch {
21778
+ return false;
21779
+ }
21780
+ }
21731
21781
  if (typeof value !== "object" || value === null) return false;
21732
21782
  const entries = Object.entries(value);
21733
21783
  const markerValue = (name) => entries.find(([key2]) => key2 === name)?.[1];
@@ -22187,17 +22237,17 @@ var _TinyCloudNode = class _TinyCloudNode {
22187
22237
  clearTimeout(deadline);
22188
22238
  }
22189
22239
  });
22190
- this.pendingAccountRegistrySync = { session, promise };
22191
- const clearPendingSync = () => {
22240
+ this.pendingAccountRegistrySync = { session, promise, controller };
22241
+ const settle = () => {
22242
+ clearTimeout(deadline);
22192
22243
  if (this.pendingAccountRegistrySync?.promise === promise) {
22193
22244
  this.pendingAccountRegistrySync = void 0;
22194
22245
  }
22195
22246
  };
22196
- void promise.then(clearPendingSync, clearPendingSync);
22197
- void promise.then(
22198
- () => clearTimeout(deadline),
22199
- () => clearTimeout(deadline)
22200
- );
22247
+ void promise.then(settle, (error) => {
22248
+ settle();
22249
+ console.warn("TinyCloud account registry sync failed", error);
22250
+ });
22201
22251
  }
22202
22252
  enqueueAccountRegistryOperation(session, task) {
22203
22253
  const operation = this.accountRegistryTail.then(async () => {
@@ -22235,10 +22285,15 @@ var _TinyCloudNode = class _TinyCloudNode {
22235
22285
  }
22236
22286
  async withAccountRegistryRetry(task, signal) {
22237
22287
  const delays = [250, 1e3, 3e3];
22288
+ const stopped = (detail) => {
22289
+ if (signal.reason instanceof DOMException && signal.reason.name === "TimeoutError") {
22290
+ console.warn("TinyCloud account registry sync stopped: deadline exceeded", detail);
22291
+ }
22292
+ };
22238
22293
  let lastError;
22239
22294
  for (let attempt = 0; attempt < delays.length; attempt += 1) {
22240
22295
  if (signal.aborted) {
22241
- console.warn("TinyCloud account registry sync stopped: deadline exceeded", signal.reason);
22296
+ stopped(signal.reason);
22242
22297
  return;
22243
22298
  }
22244
22299
  try {
@@ -22246,7 +22301,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22246
22301
  return;
22247
22302
  } catch (error) {
22248
22303
  if (signal.aborted) {
22249
- console.warn("TinyCloud account registry sync stopped: deadline exceeded", error);
22304
+ stopped(error);
22250
22305
  return;
22251
22306
  }
22252
22307
  const verdict = authorizationVerdictOf(error);
@@ -22339,7 +22394,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22339
22394
  if (!session) {
22340
22395
  throw new Error("Owned space hosting requires an active session");
22341
22396
  }
22342
- if (this.confirmedHostedSpaceIds.has(spaceId)) {
22397
+ if (this.confirmedHostedSpaceIds.has(spaceId) || this.hostedOwnedSpaceIds.has(spaceId)) {
22343
22398
  return;
22344
22399
  }
22345
22400
  const host = this.hosts[0] ?? this.config.host;
@@ -22357,8 +22412,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22357
22412
  { cause: activation }
22358
22413
  );
22359
22414
  }
22360
- const authorization = this.auth;
22361
- const created = signal ? await authorization.hostOwnedSpaceResult(spaceId, void 0, signal) : await authorization.hostOwnedSpaceResult(spaceId);
22415
+ const created = await this.hostOwnedSpaceOnce(spaceId, signal);
22362
22416
  if (!created.success) {
22363
22417
  throw Object.assign(
22364
22418
  new Error(`Failed to create owned space ${spaceId}: ${describeHostFailure2(created)}`),
@@ -22375,7 +22429,10 @@ var _TinyCloudNode = class _TinyCloudNode {
22375
22429
  { cause: retry }
22376
22430
  );
22377
22431
  }
22378
- this.confirmedHostedSpaceIds.add(spaceId);
22432
+ if (this.auth.tinyCloudSession === session) {
22433
+ this.confirmedHostedSpaceIds.add(spaceId);
22434
+ this.hostedOwnedSpaceIds.add(spaceId);
22435
+ }
22379
22436
  }
22380
22437
  /**
22381
22438
  * Host one of this user's owned spaces by name (e.g. `"applications"`).
@@ -22407,7 +22464,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22407
22464
  if (!host) {
22408
22465
  throw new Error("Owned space hosting requires a TinyCloud host");
22409
22466
  }
22410
- const hosted = await this.auth.hostOwnedSpaceResult(spaceId);
22467
+ const hosted = await this.hostOwnedSpaceOnce(spaceId);
22411
22468
  if (!hosted.success) {
22412
22469
  throw Object.assign(
22413
22470
  new Error(`Failed to host owned space ${spaceId}: ${describeHostFailure2(hosted)}`),
@@ -22426,6 +22483,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22426
22483
  { cause: activation }
22427
22484
  );
22428
22485
  }
22486
+ if (this.auth?.tinyCloudSession === session) this.hostedOwnedSpaceIds.add(spaceId);
22429
22487
  try {
22430
22488
  await this.enqueueAccountRegistryOperation(session, async () => {
22431
22489
  await this.account.spaces.register({
@@ -22453,18 +22511,19 @@ var _TinyCloudNode = class _TinyCloudNode {
22453
22511
  * registered on the node.
22454
22512
  *
22455
22513
  * Calling this resolves `name` to the owner's owned-space URI
22456
- * (`tinycloud:pkh:eip155:<chain>:<addr>:<name>`). It first consults the
22457
- * account-space spaces registry (`account/spaces/{space_id}`, the canonical
22458
- * KV source of truth, fronted by a best-effort SQLite index): if the space is
22459
- * already registered/hosted it returns the URI WITHOUT submitting a host
22460
- * delegation, avoiding a redundant host-SIWE signature prompt for owners who
22461
- * already use the space. Only when the space is absent — or the registry
22462
- * check fails for any reason (e.g. a cold SQLite index reporting
22463
- * `no such table: spaces`) — does it fall through to {@link hostOwnedSpace}.
22514
+ * (`tinycloud:pkh:eip155:<chain>:<addr>:<name>`). It returns WITHOUT
22515
+ * submitting a host delegation when the space is known to be hosted: the
22516
+ * sign-in activation listed it as `activated` (any space the session's recap
22517
+ * covers), this session already hosted it, or the account-space spaces
22518
+ * registry (`account/spaces/{space_id}`, the canonical KV source of truth,
22519
+ * fronted by a best-effort SQLite index) has its record. Otherwise it falls
22520
+ * through to {@link hostOwnedSpace}, which asks for a signature; a host
22521
+ * already in flight for the same space (e.g. from the background registry
22522
+ * sync) is shared rather than asked for twice.
22464
22523
  *
22465
- * The registry check is purely an optimization: any failure falls back to
22466
- * hosting, and the host SIWE is idempotent server-side, so re-hosting an
22467
- * existing space remains a safe no-op. Must be called after {@link signIn}.
22524
+ * Hosting is still needed when the space really isn't hosted, or when the
22525
+ * session's recap doesn't cover it and the registry has no record; the host
22526
+ * SIWE is idempotent server-side. Must be called after {@link signIn}.
22468
22527
  *
22469
22528
  * @param name - The owned space name (e.g. `"secrets"`).
22470
22529
  * @returns The hosted owned-space URI.
@@ -22473,13 +22532,57 @@ var _TinyCloudNode = class _TinyCloudNode {
22473
22532
  if (!this.auth || !this.auth.tinyCloudSession) {
22474
22533
  throw new Error("Not signed in. Call signIn() first.");
22475
22534
  }
22476
- await this.accountRegistryTail;
22477
22535
  const spaceId = this.ownedSpaceId(name);
22478
- if (await this.isOwnedSpaceRegistered(spaceId)) {
22536
+ if (this.hostedOwnedSpaceIds.has(spaceId) || await this.isOwnedSpaceRegistered(spaceId)) {
22479
22537
  return spaceId;
22480
22538
  }
22481
22539
  return this.hostOwnedSpace(name);
22482
22540
  }
22541
+ /**
22542
+ * Submit the host delegation for an owned space, sharing one in-flight
22543
+ * request (and so one approval) between concurrent callers in this session,
22544
+ * such as the background registry sync and {@link ensureOwnedSpaceHosted}.
22545
+ * Each caller's `signal` releases only its own wait; the request itself is
22546
+ * cancelled once no caller is left waiting, or when the session is replaced
22547
+ * ({@link cancelOwnedSpaceHosts}), so a late approval is discarded.
22548
+ */
22549
+ hostOwnedSpaceOnce(spaceId, signal) {
22550
+ if (signal?.aborted) return Promise.reject(signal.reason);
22551
+ let entry = this.ownedSpaceHosts.get(spaceId);
22552
+ if (!entry) {
22553
+ const controller = new AbortController();
22554
+ const promise = this.auth.hostOwnedSpaceResult(spaceId, void 0, controller.signal);
22555
+ const created = { promise, controller, waiters: 0 };
22556
+ this.ownedSpaceHosts.set(spaceId, created);
22557
+ const forget = () => {
22558
+ if (this.ownedSpaceHosts.get(spaceId) === created) this.ownedSpaceHosts.delete(spaceId);
22559
+ };
22560
+ promise.then(forget, forget);
22561
+ entry = created;
22562
+ }
22563
+ if (!signal) {
22564
+ entry.waiters = Number.POSITIVE_INFINITY;
22565
+ return entry.promise;
22566
+ }
22567
+ entry.waiters += 1;
22568
+ const shared = entry;
22569
+ return new Promise((resolve, reject2) => {
22570
+ const onAbort = () => {
22571
+ reject2(signal.reason);
22572
+ shared.waiters -= 1;
22573
+ if (shared.waiters !== 0) return;
22574
+ shared.controller.abort(signal.reason);
22575
+ if (this.ownedSpaceHosts.get(spaceId) === shared) this.ownedSpaceHosts.delete(spaceId);
22576
+ };
22577
+ signal.addEventListener("abort", onAbort, { once: true });
22578
+ shared.promise.then(resolve, reject2).finally(() => signal.removeEventListener("abort", onAbort));
22579
+ });
22580
+ }
22581
+ /** Session replacement: cancel the replaced session's in-flight hosts and forget them. */
22582
+ cancelOwnedSpaceHosts() {
22583
+ for (const { controller } of this.ownedSpaceHosts.values()) controller.abort();
22584
+ this.ownedSpaceHosts.clear();
22585
+ }
22483
22586
  /** Resolve and authenticate the owner encoded by an owned-space URI. */
22484
22587
  credentialSpaceOwnerDid(spaceId) {
22485
22588
  const ownerDid = this.ownerDidFromSpaceId(spaceId);
@@ -22722,6 +22825,8 @@ var _TinyCloudNode = class _TinyCloudNode {
22722
22825
  sessionExpiry: stagedSessionExpiry,
22723
22826
  recap: stagedRecap
22724
22827
  });
22828
+ this.pendingAccountRegistrySync?.controller.abort();
22829
+ await this.accountRegistryTail;
22725
22830
  const oldGraph = this._serviceGraph;
22726
22831
  const oldCore = this.tc;
22727
22832
  this.sessionManager = stagedManager;
@@ -22755,6 +22860,8 @@ var _TinyCloudNode = class _TinyCloudNode {
22755
22860
  this._recapOperationsCache = stagedPrimary.cache;
22756
22861
  this.runtimePermissionGrants = stagedPrimary.grants;
22757
22862
  this.confirmedHostedSpaceIds.clear();
22863
+ this.hostedOwnedSpaceIds.clear();
22864
+ this.cancelOwnedSpaceHosts();
22758
22865
  this._restoredNodeFeatures = restoredNodeFeatures;
22759
22866
  if (this.auth) {
22760
22867
  this.auth.installRestoredSession(stagedManager, stagedTcSession, [stagedHost], restoredNodeFeatures);