@tinycloud/node-sdk 3.8.0-beta.0 → 3.8.0-beta.10

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 (39) hide show
  1. package/dist/{TinyCloudNode-BtKzLDJX.d.ts → TinyCloudNode-DnD-SH6t.d.ts} +27 -4
  2. package/dist/{TinyCloudNode-ggmlnSfI.d.cts → TinyCloudNode-Dy65bxqs.d.cts} +27 -4
  3. package/dist/{authority-sJ6buHMj.d.ts → authority-BQnTX3fI.d.ts} +21 -5
  4. package/dist/{authority-_SYAE-uV.d.cts → authority-Rbye1U4o.d.cts} +21 -5
  5. package/dist/core.cjs +196 -29
  6. package/dist/core.cjs.map +1 -1
  7. package/dist/core.d.cts +5 -4
  8. package/dist/core.d.ts +5 -4
  9. package/dist/core.js +190 -25
  10. package/dist/core.js.map +1 -1
  11. package/dist/credentials-core.d.cts +1 -1
  12. package/dist/credentials-core.d.ts +1 -1
  13. package/dist/credentials.d.cts +1 -1
  14. package/dist/credentials.d.ts +1 -1
  15. package/dist/{delegation-0LKZkmP2.d.cts → delegation-Ckc3UETl.d.cts} +1 -1
  16. package/dist/{delegation-0LKZkmP2.d.ts → delegation-Ckc3UETl.d.ts} +1 -1
  17. package/dist/encryption-keys.d.cts +2 -2
  18. package/dist/encryption-keys.d.ts +2 -2
  19. package/dist/index.cjs +249 -41
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +4 -3
  22. package/dist/index.d.ts +4 -3
  23. package/dist/index.js +236 -28
  24. package/dist/index.js.map +1 -1
  25. package/dist/replication/authority.cjs +43 -1
  26. package/dist/replication/authority.cjs.map +1 -1
  27. package/dist/replication/authority.d.cts +4 -3
  28. package/dist/replication/authority.d.ts +4 -3
  29. package/dist/replication/authority.js +42 -1
  30. package/dist/replication/authority.js.map +1 -1
  31. package/dist/replication/runtime.cjs +1 -0
  32. package/dist/replication/runtime.cjs.map +1 -1
  33. package/dist/replication/runtime.d.cts +1 -1
  34. package/dist/replication/runtime.d.ts +1 -1
  35. package/dist/replication/runtime.js +1 -0
  36. package/dist/replication/runtime.js.map +1 -1
  37. package/dist/{runtime-v62FzQHz.d.ts → runtime-CO4VXnPq.d.ts} +2 -1
  38. package/dist/{runtime-D1o9Eybt.d.cts → runtime-mRhSu-vJ.d.cts} +2 -1
  39. package/package.json +4 -4
package/dist/index.d.cts CHANGED
@@ -1,12 +1,13 @@
1
1
  import { ISigner, Bytes, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
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, 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';
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 } from './WasmKeyProvider-5Ee7fcAw.cjs';
4
- export { A as ACCEPTED_MARKER_VERSIONS, l as BOOTSTRAP_COMPLETION_MARKER_KEY, m as BOOTSTRAP_COMPLETION_MARKER_VERSION, n 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, o as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, p as OpenKeyAuthorizationResultV1, q as OpenKeyAuthorizeInput, r as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, O as OwnerDelegationReceipt, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, e as SecretReadInput, f as SecretReadResult, g as SignStrategy, T as TinyCloudNode, h as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, i as UnifiedOwnerRootReceipt, j as UnsupportedSessionRestoreError, k as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-ggmlnSfI.cjs';
4
+ export { A as ACCEPTED_MARKER_VERSIONS, l as BOOTSTRAP_COMPLETION_MARKER_KEY, m as BOOTSTRAP_COMPLETION_MARKER_VERSION, n 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, o as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, p as OpenKeyAuthorizationResultV1, q as OpenKeyAuthorizeInput, r as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, O as OwnerDelegationReceipt, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, e as SecretReadInput, f as SecretReadResult, g as SignStrategy, T as TinyCloudNode, h as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, i as UnifiedOwnerRootReceipt, j as UnsupportedSessionRestoreError, k as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-Dy65bxqs.cjs';
5
5
  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, b as AuthRequestArtifact, C as CompactRuntimeDelegationInput, D as DelegationAuthority, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, c as RuntimeDelegationActivator, e as RuntimeDelegationRejectedError, f as RuntimeDelegationRejection, S as SessionGrantProof, V as ValidatedRuntimeDelegation, g as VerifiedSessionGrant, a as activateCompactRuntimeDelegation, h as activateValidatedRuntimeDelegation, d as deserializeDelegation, i as grantAuthRequest, s as serializeDelegation, j as signedCompactUcanExpiry, k as siweRuntimeDelegation } from './delegation-0LKZkmP2.cjs';
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
7
  import { KVReplicaStorage } from '@tinycloud/sdk-services';
8
8
  import { ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
9
9
  export { ProfileReplicaDeferredToken, ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
10
+ import '@tinycloud/sdk-services/encryption/named-keys';
10
11
  import 'events';
11
12
 
12
13
  /**
package/dist/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import { ISigner, Bytes, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
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, 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';
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 } from './WasmKeyProvider-5Ee7fcAw.js';
4
- export { A as ACCEPTED_MARKER_VERSIONS, l as BOOTSTRAP_COMPLETION_MARKER_KEY, m as BOOTSTRAP_COMPLETION_MARKER_VERSION, n 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, o as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, p as OpenKeyAuthorizationResultV1, q as OpenKeyAuthorizeInput, r as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, O as OwnerDelegationReceipt, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, e as SecretReadInput, f as SecretReadResult, g as SignStrategy, T as TinyCloudNode, h as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, i as UnifiedOwnerRootReceipt, j as UnsupportedSessionRestoreError, k as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-BtKzLDJX.js';
4
+ export { A as ACCEPTED_MARKER_VERSIONS, l as BOOTSTRAP_COMPLETION_MARKER_KEY, m as BOOTSTRAP_COMPLETION_MARKER_VERSION, n 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, o as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, p as OpenKeyAuthorizationResultV1, q as OpenKeyAuthorizeInput, r as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, O as OwnerDelegationReceipt, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, e as SecretReadInput, f as SecretReadResult, g as SignStrategy, T as TinyCloudNode, h as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, i as UnifiedOwnerRootReceipt, j as UnsupportedSessionRestoreError, k as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-DnD-SH6t.js';
5
5
  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, b as AuthRequestArtifact, C as CompactRuntimeDelegationInput, D as DelegationAuthority, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, c as RuntimeDelegationActivator, e as RuntimeDelegationRejectedError, f as RuntimeDelegationRejection, S as SessionGrantProof, V as ValidatedRuntimeDelegation, g as VerifiedSessionGrant, a as activateCompactRuntimeDelegation, h as activateValidatedRuntimeDelegation, d as deserializeDelegation, i as grantAuthRequest, s as serializeDelegation, j as signedCompactUcanExpiry, k as siweRuntimeDelegation } from './delegation-0LKZkmP2.js';
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
7
  import { KVReplicaStorage } from '@tinycloud/sdk-services';
8
8
  import { ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
9
9
  export { ProfileReplicaDeferredToken, ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
10
+ import '@tinycloud/sdk-services/encryption/named-keys';
10
11
  import 'events';
11
12
 
12
13
  /**
package/dist/index.js CHANGED
@@ -17064,7 +17064,7 @@ function augmentSignInEntriesWithReplication(input) {
17064
17064
  }
17065
17065
  eligiblePaths.push(path);
17066
17066
  }
17067
- if (eligiblePaths.length === replication.prefixes.length && eligiblePaths.length > 0 && hasUnrestrictedGetCoverage(input.entries, input.primarySpaceId, "")) {
17067
+ if (replication.syncScope !== "prefixes" && eligiblePaths.length === replication.prefixes.length && eligiblePaths.length > 0 && hasUnrestrictedGetCoverage(input.entries, input.primarySpaceId, "")) {
17068
17068
  return [{
17069
17069
  service: KV_SERVICE,
17070
17070
  space: input.primarySpaceId,
@@ -17096,6 +17096,12 @@ var init_authority_sign_in = __esm({
17096
17096
  import { MAX_GRANT_TTL_MS } from "@tinycloud/sdk-services/kv/replication/grantPolicyConstants";
17097
17097
  import { assertFolderPrefix as assertPureFolderPrefix, kvPrefixCovers } from "@tinycloud/sdk-services/kv/replication/prefix";
17098
17098
  function assertValidReplicationConfig(replication) {
17099
+ if (replication?.syncScope !== void 0 && replication.syncScope !== "prefixes") {
17100
+ throw new TypeError('replication.syncScope must be "prefixes"');
17101
+ }
17102
+ if (replication?.contentFetch !== void 0 && replication.contentFetch !== "eager" && replication.contentFetch !== "lazy") {
17103
+ throw new TypeError('replication.contentFetch must be "eager" or "lazy"');
17104
+ }
17099
17105
  if (replication === void 0 || !replication.enabled) return;
17100
17106
  if (replication.storage === void 0 || replication.storage === null) {
17101
17107
  throw new TypeError("replication.enabled requires replication.storage");
@@ -17148,6 +17154,7 @@ function resolvedOptions(options) {
17148
17154
  maxStalenessMs: options.maxStalenessMs ?? 12e4,
17149
17155
  staleSyncTimeoutMs: options.staleSyncTimeoutMs ?? 5e3,
17150
17156
  allowSecrets: options.allowSecrets === true,
17157
+ contentFetch: options.contentFetch ?? "eager",
17151
17158
  verify: options.verify === true
17152
17159
  };
17153
17160
  }
@@ -17418,6 +17425,7 @@ __export(authority_exports, {
17418
17425
  assertValidReplicationConfig: () => assertValidReplicationConfig,
17419
17426
  augmentSignInEntriesWithReplication: () => augmentSignInEntriesWithReplication,
17420
17427
  createReplicationAuthority: () => createReplicationAuthority,
17428
+ eraseReplicaLocalCopy: () => eraseReplicaLocalCopy,
17421
17429
  establishReplicaSessionStamp: () => establishReplicaSessionStamp,
17422
17430
  hasUnrestrictedGetCoverage: () => hasUnrestrictedGetCoverage,
17423
17431
  mintNodeReplicationGrant: () => mintNodeReplicationGrant,
@@ -17458,6 +17466,38 @@ function reportReplicaDenial(result, reason, onEvent, context) {
17458
17466
  } catch {
17459
17467
  }
17460
17468
  }
17469
+ async function eraseReplicaLocalCopy(lifecycle, trigger, denyStatus, handlers) {
17470
+ if (lifecycle?.kind !== "indexeddb" || lifecycle.eraseLocalCopy === void 0) return void 0;
17471
+ let outcome = { status: "failed", code: "STORAGE_ERROR", marker: false };
17472
+ for (let attempt = 0; attempt <= ERASE_RETRY_DELAYS_MS.length; attempt++) {
17473
+ if (attempt > 0) await new Promise((resolve2) => setTimeout(resolve2, ERASE_RETRY_DELAYS_MS[attempt - 1]));
17474
+ try {
17475
+ outcome = await lifecycle.eraseLocalCopy({ signal: AbortSignal.timeout(ERASE_ATTEMPT_MS) });
17476
+ } catch {
17477
+ outcome = { status: "failed", code: "STORAGE_ERROR", marker: false };
17478
+ }
17479
+ if (outcome.status !== "failed") break;
17480
+ }
17481
+ const keysKept = denyStatus === "marker" || denyStatus === "unguarded";
17482
+ const purge = outcome.status === "erased" ? { ok: true } : { ok: false, retryNow: outcome.status === "failed" };
17483
+ if (outcome.status === "erased" || outcome.status === "refused" && !keysKept) return { outcome, purge };
17484
+ const logoutPending = outcome.status === "failed" && outcome.marker;
17485
+ const event = {
17486
+ type: "replica.purge.failed",
17487
+ trigger,
17488
+ reason: logoutPending ? "logout_pending" : "gate_unavailable",
17489
+ code: outcome.code,
17490
+ retryNow: outcome.status === "failed"
17491
+ };
17492
+ for (const handler of handlers) {
17493
+ try {
17494
+ handler(event);
17495
+ } catch (error) {
17496
+ console.error('Error in "replica.purge.failed" handler:', error);
17497
+ }
17498
+ }
17499
+ return logoutPending ? { outcome, purge, logoutPending } : { outcome, purge };
17500
+ }
17461
17501
  function verifiedOwnerConsentAnchor(session, wasmBindings, exactVerifiedRecap2) {
17462
17502
  if (typeof session.siwe !== "string" || typeof session.signature !== "string" || typeof session.address !== "string" || typeof session.chainId !== "number") return null;
17463
17503
  try {
@@ -17716,13 +17756,15 @@ function createReplicationAuthority(host) {
17716
17756
  };
17717
17757
  return authority;
17718
17758
  }
17719
- var parseUcanGrant, KV_GET2, KV_SYNC2, KV_SERVICE2, AUTHORITY_EXPIRY_MARGIN_MS;
17759
+ var parseUcanGrant, ERASE_RETRY_DELAYS_MS, ERASE_ATTEMPT_MS, KV_GET2, KV_SYNC2, KV_SERVICE2, AUTHORITY_EXPIRY_MARGIN_MS;
17720
17760
  var init_authority = __esm({
17721
17761
  "src/replication/authority.ts"() {
17722
17762
  "use strict";
17723
17763
  init_config();
17724
17764
  init_authority_sign_in();
17725
17765
  parseUcanGrant = replicaParseUcanGrant;
17766
+ ERASE_RETRY_DELAYS_MS = [150, 450];
17767
+ ERASE_ATTEMPT_MS = 3e3;
17726
17768
  KV_GET2 = KV4.GET;
17727
17769
  KV_SYNC2 = KV4.SYNC;
17728
17770
  KV_SERVICE2 = "tinycloud.kv";
@@ -18745,9 +18787,9 @@ import {
18745
18787
  tinyCloudDebugLogger
18746
18788
  } from "@tinycloud/sdk-services";
18747
18789
  import { RequestLog, observeReplicaReads, readOnlyRequestLog } from "@tinycloud/sdk-services/telemetry/requestLog";
18790
+ import { parseEncryptionResource as parseEncryptionResource2 } from "@tinycloud/sdk-services/encryption/resource";
18748
18791
 
18749
18792
  // src/authorization/NodeUserAuthorization.ts
18750
- init_authority_sign_in();
18751
18793
  import { createHash } from "crypto";
18752
18794
  import { SiweMessage } from "siwe";
18753
18795
  import {
@@ -18756,10 +18798,10 @@ import {
18756
18798
  activateSessionWithHost,
18757
18799
  checkNodeInfo,
18758
18800
  AutoApproveSpaceCreationHandler,
18801
+ ManifestValidationError,
18759
18802
  DEFAULT_MANIFEST_SPACE,
18760
18803
  ENCRYPTION_PERMISSION_SERVICE,
18761
18804
  composeManifestRequest,
18762
- parseNetworkId,
18763
18805
  principalDidEquals as principalDidEquals2,
18764
18806
  resourceCapabilitiesToAbilitiesMap,
18765
18807
  resourceCapabilitiesToSpaceAbilitiesMap,
@@ -18787,6 +18829,35 @@ import {
18787
18829
  HOOKS,
18788
18830
  ENCRYPTION
18789
18831
  } from "@tinycloud/sdk-core";
18832
+ import { parseEncryptionResource } from "@tinycloud/sdk-services/encryption/resource";
18833
+ import { parseNetworkId } from "@tinycloud/sdk-services";
18834
+
18835
+ // src/authorization/appKeyHostBinding.ts
18836
+ var DOMAIN_LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
18837
+ var IPV4 = /^\d+\.\d+\.\d+\.\d+$/;
18838
+ var APP_ID = /^[a-z0-9][a-z0-9._-]{0,63}$/;
18839
+ function appKeyHostBinding(domain, appId) {
18840
+ if (!APP_ID.test(appId)) return false;
18841
+ if (domain.endsWith(":")) return false;
18842
+ let url;
18843
+ try {
18844
+ url = new URL(`https://${domain}`);
18845
+ } catch {
18846
+ return false;
18847
+ }
18848
+ if (url.protocol !== "https:" || url.port !== "" || url.username !== "" || url.password !== "") return false;
18849
+ if (url.pathname !== "/" || url.search !== "" || url.hash !== "") return false;
18850
+ const host = url.hostname;
18851
+ if (host.startsWith("[") || host.endsWith(".") || IPV4.test(host)) return false;
18852
+ const labels = host.split(".");
18853
+ if (labels.length < 2 || labels[labels.length - 1] === "localhost") return false;
18854
+ if (!labels.every((label) => DOMAIN_LABEL.test(label))) return false;
18855
+ const reversed = labels.reverse().join(".");
18856
+ return appId === reversed || appId.startsWith(`${reversed}.`);
18857
+ }
18858
+
18859
+ // src/authorization/NodeUserAuthorization.ts
18860
+ init_authority_sign_in();
18790
18861
 
18791
18862
  // src/authorization/caveatRefusal.ts
18792
18863
  import {
@@ -19300,6 +19371,23 @@ var NodeUserAuthorization = class {
19300
19371
  );
19301
19372
  return this._capabilityRequest;
19302
19373
  }
19374
+ async refreshNamedKeyFeatureForSignIn(address, chainId) {
19375
+ const request = this.getCapabilityRequest();
19376
+ const siweDomain = this.siweConfig?.domain ?? this.domain;
19377
+ const hasNamedKeys = request?.manifests.some((manifest) => manifest.keys?.length && appKeyHostBinding(siweDomain, manifest.keys_app_id ?? manifest.app_id));
19378
+ if (hasNamedKeys) {
19379
+ await this.resolveTinyCloudHostsForSignIn(address, chainId);
19380
+ await this.refreshNodeInfo();
19381
+ }
19382
+ }
19383
+ /** Manifest key paths that this sign-in cannot grant. */
19384
+ get unavailableKeyPaths() {
19385
+ const request = this.getCapabilityRequest();
19386
+ const siweDomain = this.siweConfig?.domain ?? this.domain;
19387
+ return (request?.manifests ?? []).flatMap(
19388
+ (manifest) => this._nodeFeatures.includes("encryption-named-keys-v1") && appKeyHostBinding(siweDomain, manifest.keys_app_id ?? manifest.app_id) ? [] : (manifest.keys ?? []).map((entry) => "path" in entry ? entry.path : entry.prefix)
19389
+ );
19390
+ }
19303
19391
  resolveSpaceName(space, address, chainId) {
19304
19392
  if (space.startsWith("tinycloud:")) {
19305
19393
  return space;
@@ -19491,15 +19579,31 @@ var NodeUserAuthorization = class {
19491
19579
  }
19492
19580
  const rawAbilities = {};
19493
19581
  const currentDid = pkhDid(address, chainId);
19582
+ if (this._nodeFeatures.includes("encryption-named-keys-v1")) {
19583
+ const siweDomain = this.siweConfig?.domain ?? this.domain;
19584
+ for (const manifest of request.manifests) {
19585
+ if (!appKeyHostBinding(siweDomain, manifest.keys_app_id ?? manifest.app_id)) continue;
19586
+ for (const declaration of manifest.keys ?? []) {
19587
+ const path = "path" in declaration ? declaration.path : declaration.prefix;
19588
+ const resource = `urn:tinycloud:encryption:${currentDid}:default/${path}`;
19589
+ for (const ability of declaration.abilities) {
19590
+ addRawAbility(rawAbilities, resource, `tinycloud.encryption/${ability}`);
19591
+ }
19592
+ }
19593
+ }
19594
+ }
19494
19595
  const spaceResources = request.resources.filter((entry) => {
19495
19596
  if (entry.service !== ENCRYPTION_PERMISSION_SERVICE) {
19496
19597
  return true;
19497
19598
  }
19599
+ const parsed = entry.path.includes("/") ? parseEncryptionResource(entry.path) : { ...parseNetworkId(entry.path), kind: "network" };
19600
+ if (parsed.kind !== "network") {
19601
+ throw new ManifestValidationError("named keys go in manifest.keys");
19602
+ }
19498
19603
  for (const action of entry.actions) {
19499
19604
  addRawAbility(rawAbilities, entry.path, action);
19500
19605
  }
19501
- if (entry.actions.includes(DECRYPT_ACTION)) {
19502
- const parsed = parseNetworkId(entry.path);
19606
+ if (entry.actions.includes(DECRYPT_ACTION) && parsed.kind === "network") {
19503
19607
  if (didPrincipalMatches(parsed.ownerDid, currentDid)) {
19504
19608
  addRawAbility(rawAbilities, entry.path, NETWORK_CREATE_ACTION);
19505
19609
  }
@@ -19895,6 +19999,8 @@ var NodeUserAuthorization = class {
19895
19999
  this._chainId = chainId;
19896
20000
  await this.resolveTinyCloudHostsForSignIn(address, chainId);
19897
20001
  this.assertSignInCurrent(generation);
20002
+ await this.refreshNamedKeyFeatureForSignIn(address, chainId);
20003
+ this.assertSignInCurrent(generation);
19898
20004
  const keyId = `session-${Date.now()}`;
19899
20005
  this.sessionManager.renameSessionKeyId(this.activeSessionKeyId, keyId);
19900
20006
  this.activeSessionKeyId = keyId;
@@ -20041,6 +20147,7 @@ var NodeUserAuthorization = class {
20041
20147
  refuseCaveated(this.getCapabilityRequest()?.manifests);
20042
20148
  const address = canonicalizeAddress(await this.signer.getAddress());
20043
20149
  const chainId = await this.signer.getChainId();
20150
+ await this.refreshNamedKeyFeatureForSignIn(address, chainId);
20044
20151
  const keyId = `session-${Date.now()}`;
20045
20152
  this.sessionManager.renameSessionKeyId(this.activeSessionKeyId, keyId);
20046
20153
  this.activeSessionKeyId = keyId;
@@ -21109,6 +21216,7 @@ var ROOT_DELEGATION_ACTIONS = [
21109
21216
  DUCKDB2.ALL
21110
21217
  ];
21111
21218
  var DEFAULT_SESSION_EXPIRATION_MS = EXPIRY3.SESSION_MS;
21219
+ var OWNER_REVOCATION_WINDOW_MS = 10 * 6e4;
21112
21220
  function unifiedRootAttenuation(capabilities) {
21113
21221
  const attenuation = {};
21114
21222
  for (const capability of capabilities) {
@@ -21573,6 +21681,7 @@ function replicaRestoreRefusal(error) {
21573
21681
  case "purge_pending":
21574
21682
  case "logout_pending":
21575
21683
  case "gate_unavailable":
21684
+ case "wallet_provider_required":
21576
21685
  return error.gate;
21577
21686
  }
21578
21687
  }
@@ -21607,6 +21716,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21607
21716
  this.auth = null;
21608
21717
  this.tc = null;
21609
21718
  this._chainId = 1;
21719
+ this.replicaPurgeFailedHandlers = /* @__PURE__ */ new Set();
21610
21720
  /** Mints the replica session stamp on each fresh sign-in (TC-858 §4.1). Undefined when replication is off. */
21611
21721
  this.establishReplicaStamp = async (session) => {
21612
21722
  const replication = this.config.replication;
@@ -21638,6 +21748,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21638
21748
  return void 0;
21639
21749
  }
21640
21750
  };
21751
+ this._keysUnavailable = [];
21641
21752
  this._baseVaults = /* @__PURE__ */ new Map();
21642
21753
  this._baseSecrets = /* @__PURE__ */ new Map();
21643
21754
  this._secrets = /* @__PURE__ */ new Map();
@@ -21813,6 +21924,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21813
21924
  return instance ? instance.control.purge(input) : runtime.then((ready) => ready.control.purge(input));
21814
21925
  },
21815
21926
  clearPending: async () => (await runtime).control.clearPending(),
21927
+ purgeLocalCopy: async () => (await this.eraseReplicaLocalCopy("purge_local_copy"))?.purge ?? { ok: false, retryNow: false },
21816
21928
  close: async () => (await runtime).control.close()
21817
21929
  };
21818
21930
  }
@@ -21867,18 +21979,14 @@ var _TinyCloudNode = class _TinyCloudNode {
21867
21979
  get freshEncryptionNetworkCreated() {
21868
21980
  return this._freshEncryptionNetworkCreated;
21869
21981
  }
21870
- /**
21871
- * Subscribe to `storage.full`. It fires on the first write any service had
21872
- * rejected because the owner's TinyCloud storage is full
21873
- * (`STORAGE_QUOTA_EXCEEDED` or `STORAGE_LIMIT_REACHED`), so an app can show
21874
- * one read-only banner. Reads keep working. For the signed-in account's own
21875
- * storage it fires once per episode: the episode ends only when a write to
21876
- * that storage succeeds, or on sign-out. A `storage.status()` read does not
21877
- * end it. A rejection on another owner's delegated space fires once per
21878
- * owner, until that owner's `storage.status()` reports space again. Returns
21879
- * the unsubscribe function.
21880
- */
21881
21982
  on(event, handler) {
21983
+ if (event === "replica.purge.failed") {
21984
+ const listener = handler;
21985
+ this.replicaPurgeFailedHandlers.add(listener);
21986
+ return () => {
21987
+ this.replicaPurgeFailedHandlers.delete(listener);
21988
+ };
21989
+ }
21882
21990
  if (event !== "storage.full") {
21883
21991
  throw new Error(`Unknown TinyCloud event: ${String(event)}`);
21884
21992
  }
@@ -22098,7 +22206,8 @@ var _TinyCloudNode = class _TinyCloudNode {
22098
22206
  replication: config.replication?.enabled === true ? {
22099
22207
  enabled: true,
22100
22208
  prefixes: config.replication.prefixes,
22101
- allowSecrets: config.replication.allowSecrets === true
22209
+ allowSecrets: config.replication.allowSecrets === true,
22210
+ syncScope: config.replication.syncScope
22102
22211
  } : void 0
22103
22212
  });
22104
22213
  this.tc = new TinyCloud(this.auth, {
@@ -22358,6 +22467,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22358
22467
  const leavingAuth = this.auth;
22359
22468
  const leavingContext = this._serviceContext;
22360
22469
  let denied;
22470
+ let erased;
22361
22471
  try {
22362
22472
  this.teardownSession();
22363
22473
  } finally {
@@ -22368,6 +22478,7 @@ var _TinyCloudNode = class _TinyCloudNode {
22368
22478
  try {
22369
22479
  await this.accountRegistryTail;
22370
22480
  await this.quiesceReplicaRuntime();
22481
+ if (denied) erased = await this.eraseReplicaLocalCopy("sign_out", denied.status);
22371
22482
  } finally {
22372
22483
  if (leavingAddress) {
22373
22484
  await (leavingAuth ? leavingAuth.clearPersistedSession(leavingAddress) : this.config.sessionStorage?.clear(leavingAddress));
@@ -22375,8 +22486,37 @@ var _TinyCloudNode = class _TinyCloudNode {
22375
22486
  }
22376
22487
  }
22377
22488
  }
22378
- if (denied?.status === "unguarded") {
22379
- throw new Error(`Replica gate was not denied (${denied.code ?? "unknown"}); the replica may still be restorable.`);
22489
+ if (denied?.status === "unguarded" && erased?.outcome.status !== "erased") {
22490
+ throw Object.assign(
22491
+ new Error(`Replica gate was not denied (${denied.code ?? "unknown"}); the replica may still be restorable.`),
22492
+ {
22493
+ code: "REPLICA_PURGE_FAILED",
22494
+ reason: "gate_unavailable",
22495
+ retryNow: erased?.outcome.status === "failed"
22496
+ }
22497
+ );
22498
+ }
22499
+ }
22500
+ /**
22501
+ * Erases the browser local copy after a deny (retry, event and next-load marker live in the lazy
22502
+ * replication authority). Never rejects; `undefined` when replication is off or the storage keeps
22503
+ * no browser database.
22504
+ */
22505
+ async eraseReplicaLocalCopy(trigger, denyStatus) {
22506
+ const replication = this.config.replication;
22507
+ if (!replication?.enabled) return void 0;
22508
+ try {
22509
+ const { eraseReplicaLocalCopy: eraseReplicaLocalCopy2 } = await getNodeReplicationLoaders().authority();
22510
+ const erased = await eraseReplicaLocalCopy2(
22511
+ replication.storage.lifecycle,
22512
+ trigger,
22513
+ denyStatus,
22514
+ this.replicaPurgeFailedHandlers
22515
+ );
22516
+ if (erased?.logoutPending) this.replicaRestoreGate = "logout_pending";
22517
+ return erased;
22518
+ } catch {
22519
+ return void 0;
22380
22520
  }
22381
22521
  }
22382
22522
  /**
@@ -22436,6 +22576,8 @@ var _TinyCloudNode = class _TinyCloudNode {
22436
22576
  this._hooks = void 0;
22437
22577
  this._vault = void 0;
22438
22578
  this._encryption = void 0;
22579
+ this._namedKeyClient = void 0;
22580
+ this._keysUnavailable = [];
22439
22581
  this._baseVaults.clear();
22440
22582
  this._baseSecrets.clear();
22441
22583
  this._secrets.clear();
@@ -22540,6 +22682,10 @@ var _TinyCloudNode = class _TinyCloudNode {
22540
22682
  const priorPrincipal = this.replicaSessionPrincipal ?? (this.address ? pkhDid2(this.address, this._chainId) : void 0);
22541
22683
  if (this.config.replication?.enabled && priorPrincipal && priorPrincipal !== nextPrincipal) {
22542
22684
  const denial = await this.denyReplicaGate({ reason: "account_switch", principal: priorPrincipal, next: nextPrincipal });
22685
+ if (denial) {
22686
+ await this.quiesceReplicaRuntime();
22687
+ await this.eraseReplicaLocalCopy("account_switch", denial.status);
22688
+ }
22543
22689
  this.replicaRestoreGate = denial?.status === "unguarded" ? "gate_unavailable" : "stamp_stale";
22544
22690
  }
22545
22691
  if (address !== this._address || chainId !== this._chainId) {
@@ -22554,6 +22700,8 @@ var _TinyCloudNode = class _TinyCloudNode {
22554
22700
  this._hooks = void 0;
22555
22701
  this._vault = void 0;
22556
22702
  this._encryption = void 0;
22703
+ this._namedKeyClient = void 0;
22704
+ this._keysUnavailable = [];
22557
22705
  this._baseVaults.clear();
22558
22706
  this._baseSecrets.clear();
22559
22707
  this._secrets.clear();
@@ -22606,6 +22754,26 @@ var _TinyCloudNode = class _TinyCloudNode {
22606
22754
  this.assertSessionEpoch(epoch, "Sign-in");
22607
22755
  await this.ensureRequestedEncryptionNetworks();
22608
22756
  this.assertSessionEpoch(epoch, "Sign-in");
22757
+ this._keysUnavailable = this.auth?.unavailableKeyPaths ?? [];
22758
+ if (this._keysUnavailable.length > 0) {
22759
+ this.notificationHandler.warning(`Named keys unavailable: ${this._keysUnavailable.join(", ")}`);
22760
+ }
22761
+ if (this.nodeFeatures.includes("encryption-named-keys-v1")) {
22762
+ for (const manifest of this.auth?.capabilityRequest?.manifests ?? []) {
22763
+ for (const declaration of manifest.keys ?? []) {
22764
+ if ("path" in declaration && declaration.abilities.includes("key.create") && !this._keysUnavailable.includes(declaration.path)) {
22765
+ try {
22766
+ await this.keys.ensureKey(declaration.path);
22767
+ } catch (error) {
22768
+ this._keysUnavailable.push(declaration.path);
22769
+ const code = error && typeof error === "object" && "code" in error && typeof error.code === "string" && /^[A-Z_]+$/.test(error.code) ? error.code : "UNKNOWN";
22770
+ this.notificationHandler.warning(`Named key unavailable: ${declaration.path} (${code})`);
22771
+ }
22772
+ this.assertSessionEpoch(epoch, "Sign-in");
22773
+ }
22774
+ }
22775
+ }
22776
+ }
22609
22777
  if (!bootstrapped && this.config.manifest === void 0 && this.config.capabilityRequest === void 0) {
22610
22778
  await this.ensureOwnedSpaceHostedById(this.ownedSpaceId(SECRETS_SPACE2));
22611
22779
  }
@@ -23393,7 +23561,8 @@ var _TinyCloudNode = class _TinyCloudNode {
23393
23561
  const networkIds = /* @__PURE__ */ new Set();
23394
23562
  for (const resource of request.resources) {
23395
23563
  if (resource.service === ENCRYPTION_PERMISSION_SERVICE2 && resource.path.startsWith("urn:tinycloud:encryption:") && resource.actions.includes(DECRYPT_ACTION2)) {
23396
- networkIds.add(resource.path);
23564
+ const parsed = resource.path.includes("/") ? parseEncryptionResource2(resource.path) : { ...parseNetworkId2(resource.path), kind: "network" };
23565
+ if (parsed.kind === "network") networkIds.add(resource.path);
23397
23566
  }
23398
23567
  }
23399
23568
  return [...networkIds];
@@ -23943,6 +24112,8 @@ var _TinyCloudNode = class _TinyCloudNode {
23943
24112
  this._hooks = stagedGraph.hooks;
23944
24113
  this._vault = stagedGraph.vault;
23945
24114
  this._encryption = stagedGraph.encryption;
24115
+ this._namedKeyClient = void 0;
24116
+ this._keysUnavailable = [];
23946
24117
  this._capabilityRegistry = stagedGraph.capabilityRegistry;
23947
24118
  this._keyProvider = stagedGraph.keyProvider;
23948
24119
  this._sharingService = stagedGraph.sharingService;
@@ -24520,7 +24691,8 @@ var _TinyCloudNode = class _TinyCloudNode {
24520
24691
  replication: this.config.replication?.enabled === true ? {
24521
24692
  enabled: true,
24522
24693
  prefixes: this.config.replication.prefixes,
24523
- allowSecrets: this.config.replication.allowSecrets === true
24694
+ allowSecrets: this.config.replication.allowSecrets === true,
24695
+ syncScope: this.config.replication.syncScope
24524
24696
  } : void 0
24525
24697
  });
24526
24698
  this.tc = new TinyCloud(this.auth, {
@@ -24582,7 +24754,8 @@ var _TinyCloudNode = class _TinyCloudNode {
24582
24754
  replication: this.config.replication?.enabled === true ? {
24583
24755
  enabled: true,
24584
24756
  prefixes: this.config.replication.prefixes,
24585
- allowSecrets: this.config.replication.allowSecrets === true
24757
+ allowSecrets: this.config.replication.allowSecrets === true,
24758
+ syncScope: this.config.replication.syncScope
24586
24759
  } : void 0
24587
24760
  });
24588
24761
  this.tc = new TinyCloud(this.auth, {
@@ -25294,7 +25467,7 @@ var _TinyCloudNode = class _TinyCloudNode {
25294
25467
  * Sign a wallet (CACAO) revocation of the delegation `cid` for the node's
25295
25468
  * `POST /revoke`, and return its Authorization header value. The node
25296
25469
  * accepts it when the owner delegated `cid` or owns a space its abilities
25297
- * target, whichever key issued it. Valid for 60 seconds. Requires the
25470
+ * target, whichever key issued it. Valid for 10 minutes. Requires the
25298
25471
  * owner wallet signer.
25299
25472
  */
25300
25473
  async signOwnerRevocation(cid) {
@@ -25310,7 +25483,7 @@ var _TinyCloudNode = class _TinyCloudNode {
25310
25483
  chainId: session.chainId,
25311
25484
  nonce: generateNonce(),
25312
25485
  issuedAt: issuedAt.toISOString(),
25313
- expirationTime: new Date(issuedAt.getTime() + 6e4).toISOString()
25486
+ expirationTime: new Date(issuedAt.getTime() + OWNER_REVOCATION_WINDOW_MS).toISOString()
25314
25487
  }).prepareMessage();
25315
25488
  const signature2 = await this.signer.signMessage(siwe);
25316
25489
  return this.wasmBindings.siweToDelegationHeaders({ siwe, signature: signature2 }).Authorization;
@@ -25537,6 +25710,40 @@ var _TinyCloudNode = class _TinyCloudNode {
25537
25710
  get encryption() {
25538
25711
  return this.getEncryptionService();
25539
25712
  }
25713
+ /** Named keys bound to the current session. */
25714
+ get keys() {
25715
+ return new Proxy({}, {
25716
+ get: (_target, property) => {
25717
+ if (property === "refreshNodeInfo") {
25718
+ return () => {
25719
+ void this._namedKeyClient?.then((client) => client.refreshNodeInfo());
25720
+ };
25721
+ }
25722
+ if (typeof property !== "string" || ![
25723
+ "getPublicKey",
25724
+ "describeKey",
25725
+ "createKey",
25726
+ "blockKey",
25727
+ "unblockKey",
25728
+ "ensureKey",
25729
+ "encrypt",
25730
+ "decrypt",
25731
+ "decryptMany"
25732
+ ].includes(property)) return void 0;
25733
+ return (...args) => {
25734
+ this._namedKeyClient ?? (this._namedKeyClient = import("./encryption-keys.js").then(({ createNamedKeyClient }) => createNamedKeyClient(this)));
25735
+ return this._namedKeyClient.then((client) => {
25736
+ const method = client[property];
25737
+ return method.apply(client, args);
25738
+ });
25739
+ };
25740
+ }
25741
+ });
25742
+ }
25743
+ /** Manifest key paths unavailable during the latest `signIn()` attempt. */
25744
+ get keysUnavailable() {
25745
+ return this._keysUnavailable;
25746
+ }
25540
25747
  async getEncryptionNetwork(nameOrNetworkId = this.getDefaultEncryptionNetworkId()) {
25541
25748
  const networkId = nameOrNetworkId.startsWith("urn:tinycloud:encryption:") ? nameOrNetworkId : this.getDefaultEncryptionNetworkId(nameOrNetworkId);
25542
25749
  return this.fetchEncryptionNetworkAt(
@@ -28029,7 +28236,7 @@ import {
28029
28236
  CaveatedDelegationUnsupportedError as CaveatedDelegationUnsupportedError3,
28030
28237
  PermissionNotInManifestError as PermissionNotInManifestError2,
28031
28238
  SessionExpiredError as SessionExpiredError2,
28032
- ManifestValidationError,
28239
+ ManifestValidationError as ManifestValidationError2,
28033
28240
  composeManifestRequest as composeManifestRequest2,
28034
28241
  resolveManifest as resolveManifest2,
28035
28242
  validateManifest,
@@ -29174,7 +29381,8 @@ var SqliteReplicaHandle = class {
29174
29381
  options.signal.addEventListener("abort", onAbort, { once: true });
29175
29382
  const engine = new (__privateGet(this, _replica)).Replica({
29176
29383
  store: __privateGet(this, _store),
29177
- transportFor
29384
+ transportFor,
29385
+ ...this.spec.contentFetch === void 0 ? {} : { contentFetch: this.spec.contentFetch }
29178
29386
  });
29179
29387
  const running = engine.sync({ signal: abort.signal });
29180
29388
  const registration = { promise: running, abort: () => abort.abort() };
@@ -30693,7 +30901,7 @@ export {
30693
30901
  InvalidRestoredSessionError,
30694
30902
  KVService4 as KVService,
30695
30903
  MAX_SECRET_SCOPE_LENGTH,
30696
- ManifestValidationError,
30904
+ ManifestValidationError2 as ManifestValidationError,
30697
30905
  MemorySessionStorage,
30698
30906
  NETWORK_NAME_PATTERN,
30699
30907
  NetworkIdError,