@tinycloud/node-sdk 3.8.0-beta.1 → 3.8.0-beta.11

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-Ckqu_fqH.d.ts → TinyCloudNode-BVDUdEcf.d.cts} +53 -5
  2. package/dist/{TinyCloudNode-DDfx8Fx5.d.cts → TinyCloudNode-jMK_2Uj8.d.ts} +53 -5
  3. package/dist/{authority-BwM_s3Ya.d.cts → authority-DJ-PE4Xo.d.cts} +20 -4
  4. package/dist/{authority-DcyJpajL.d.ts → authority-i22vHbbp.d.ts} +20 -4
  5. package/dist/core.cjs +300 -32
  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 +292 -27
  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 +304 -44
  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 +291 -31
  24. package/dist/index.js.map +1 -1
  25. package/dist/replication/authority.cjs +39 -0
  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 +38 -0
  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/core.d.cts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { ReplicationOptions, Manifest, PermissionEntry } from '@tinycloud/sdk-core';
2
2
  export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CanonicalAddress, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DidCacheKeyOptions, DidEqualsOptions, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, ReceiveOptions, 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, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, 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, VersionCheckError, ViewInfo, WasmVaultFunctions, addressStorageKey, buildSpaceUri, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, canonicalizeSecretScope, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, defaultSpaceCreationHandler, didCacheKey, didEquals, disableTinyCloudDebug, enableTinyCloudDebug, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, loadManifest, makePkhSpaceId, makePublicSpaceId, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
3
3
  import { _ as __gated_network } from './gated-network-BEF2XSTC.cjs';
4
- import { _ as __authority } from './authority-BwM_s3Ya.cjs';
5
- import { _ as __runtime } from './runtime-D1o9Eybt.cjs';
4
+ import { _ as __authority } from './authority-DJ-PE4Xo.cjs';
5
+ import { _ as __runtime } from './runtime-mRhSu-vJ.cjs';
6
6
  import { ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
7
7
  export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider } from './WasmKeyProvider-5Ee7fcAw.cjs';
8
- export { 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, d as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, 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 } from './TinyCloudNode-DDfx8Fx5.cjs';
9
- export { C as CompactRuntimeDelegationInput, P as PortableDelegation, V as ValidatedRuntimeDelegation, a as activateCompactRuntimeDelegation, d as deserializeDelegation, s as serializeDelegation } from './delegation-0LKZkmP2.cjs';
8
+ export { 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, d as NodeUserAuthorizationConfig, O as OpenKeyAuthorizeTinyCloud, e as OwnerDelegationReceipt, P as PreparedOpenKeyAuthorization, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, f as SecretReadInput, g as SecretReadResult, h as SignStrategy, T as TinyCloudNode, i as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, j as UnifiedOwnerRootReceipt, k as UnsupportedSessionRestoreError, l as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-BVDUdEcf.cjs';
9
+ export { C as CompactRuntimeDelegationInput, P as PortableDelegation, R as RuntimeDelegationRejectedError, a as RuntimeDelegationRejection, V as ValidatedRuntimeDelegation, b as activateCompactRuntimeDelegation, c as activateValidatedRuntimeDelegation, d as deserializeDelegation, s as serializeDelegation } from './delegation-Ckc3UETl.cjs';
10
10
  import '@tinycloud/sdk-services';
11
+ import '@tinycloud/sdk-services/encryption/named-keys';
11
12
  import 'events';
12
13
 
13
14
  /**
package/dist/core.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { ReplicationOptions, Manifest, PermissionEntry } from '@tinycloud/sdk-core';
2
2
  export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CanonicalAddress, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DidCacheKeyOptions, DidEqualsOptions, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, ReceiveOptions, 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, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, 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, VersionCheckError, ViewInfo, WasmVaultFunctions, addressStorageKey, buildSpaceUri, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, canonicalizeSecretScope, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, defaultSpaceCreationHandler, didCacheKey, didEquals, disableTinyCloudDebug, enableTinyCloudDebug, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, loadManifest, makePkhSpaceId, makePublicSpaceId, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
3
3
  import { _ as __gated_network } from './gated-network-BEF2XSTC.js';
4
- import { _ as __authority } from './authority-DcyJpajL.js';
5
- import { _ as __runtime } from './runtime-v62FzQHz.js';
4
+ import { _ as __authority } from './authority-i22vHbbp.js';
5
+ import { _ as __runtime } from './runtime-CO4VXnPq.js';
6
6
  import { ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
7
7
  export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider } from './WasmKeyProvider-5Ee7fcAw.js';
8
- export { 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, d as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, 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 } from './TinyCloudNode-Ckqu_fqH.js';
9
- export { C as CompactRuntimeDelegationInput, P as PortableDelegation, V as ValidatedRuntimeDelegation, a as activateCompactRuntimeDelegation, d as deserializeDelegation, s as serializeDelegation } from './delegation-0LKZkmP2.js';
8
+ export { 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, d as NodeUserAuthorizationConfig, O as OpenKeyAuthorizeTinyCloud, e as OwnerDelegationReceipt, P as PreparedOpenKeyAuthorization, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, f as SecretReadInput, g as SecretReadResult, h as SignStrategy, T as TinyCloudNode, i as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, j as UnifiedOwnerRootReceipt, k as UnsupportedSessionRestoreError, l as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-jMK_2Uj8.js';
9
+ export { C as CompactRuntimeDelegationInput, P as PortableDelegation, R as RuntimeDelegationRejectedError, a as RuntimeDelegationRejection, V as ValidatedRuntimeDelegation, b as activateCompactRuntimeDelegation, c as activateValidatedRuntimeDelegation, d as deserializeDelegation, s as serializeDelegation } from './delegation-Ckc3UETl.js';
10
10
  import '@tinycloud/sdk-services';
11
+ import '@tinycloud/sdk-services/encryption/named-keys';
11
12
  import 'events';
12
13
 
13
14
  /**
package/dist/core.js CHANGED
@@ -242,10 +242,10 @@ import {
242
242
  activateSessionWithHost,
243
243
  checkNodeInfo,
244
244
  AutoApproveSpaceCreationHandler,
245
+ ManifestValidationError,
245
246
  DEFAULT_MANIFEST_SPACE,
246
247
  ENCRYPTION_PERMISSION_SERVICE,
247
248
  composeManifestRequest,
248
- parseNetworkId,
249
249
  principalDidEquals,
250
250
  resourceCapabilitiesToAbilitiesMap,
251
251
  resourceCapabilitiesToSpaceAbilitiesMap,
@@ -273,6 +273,32 @@ import {
273
273
  HOOKS,
274
274
  ENCRYPTION
275
275
  } from "@tinycloud/sdk-core";
276
+ import { parseEncryptionResource } from "@tinycloud/sdk-services/encryption/resource";
277
+ import { parseNetworkId } from "@tinycloud/sdk-services";
278
+
279
+ // src/authorization/appKeyHostBinding.ts
280
+ var DOMAIN_LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
281
+ var IPV4 = /^\d+\.\d+\.\d+\.\d+$/;
282
+ var APP_ID = /^[a-z0-9][a-z0-9._-]{0,63}$/;
283
+ function appKeyHostBinding(domain, appId) {
284
+ if (!APP_ID.test(appId)) return false;
285
+ if (domain.endsWith(":")) return false;
286
+ let url;
287
+ try {
288
+ url = new URL(`https://${domain}`);
289
+ } catch {
290
+ return false;
291
+ }
292
+ if (url.protocol !== "https:" || url.port !== "" || url.username !== "" || url.password !== "") return false;
293
+ if (url.pathname !== "/" || url.search !== "" || url.hash !== "") return false;
294
+ const host = url.hostname;
295
+ if (host.startsWith("[") || host.endsWith(".") || IPV4.test(host)) return false;
296
+ const labels = host.split(".");
297
+ if (labels.length < 2 || labels[labels.length - 1] === "localhost") return false;
298
+ if (!labels.every((label) => DOMAIN_LABEL.test(label))) return false;
299
+ const reversed = labels.reverse().join(".");
300
+ return appId === reversed || appId.startsWith(`${reversed}.`);
301
+ }
276
302
 
277
303
  // src/replication/authority-sign-in.ts
278
304
  import {
@@ -410,6 +436,7 @@ function cloneAbilitiesMap(actions) {
410
436
  var NodeUserAuthorization = class {
411
437
  constructor(config) {
412
438
  this.activeSessionKeyId = "default";
439
+ this.preparedSessionCounter = 0;
413
440
  /** Incremented by resetSession; a sign-in started earlier publishes nothing. */
414
441
  this.sessionGeneration = 0;
415
442
  /**
@@ -766,6 +793,23 @@ var NodeUserAuthorization = class {
766
793
  );
767
794
  return this._capabilityRequest;
768
795
  }
796
+ async refreshNamedKeyFeatureForSignIn(address, chainId) {
797
+ const request = this.getCapabilityRequest();
798
+ const siweDomain = this.siweConfig?.domain ?? this.domain;
799
+ const hasNamedKeys = request?.manifests.some((manifest) => manifest.keys?.length && appKeyHostBinding(siweDomain, manifest.keys_app_id ?? manifest.app_id));
800
+ if (hasNamedKeys) {
801
+ await this.resolveTinyCloudHostsForSignIn(address, chainId);
802
+ await this.refreshNodeInfo();
803
+ }
804
+ }
805
+ /** Manifest key paths that this sign-in cannot grant. */
806
+ get unavailableKeyPaths() {
807
+ const request = this.getCapabilityRequest();
808
+ const siweDomain = this.siweConfig?.domain ?? this.domain;
809
+ return (request?.manifests ?? []).flatMap(
810
+ (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)
811
+ );
812
+ }
769
813
  resolveSpaceName(space, address, chainId) {
770
814
  if (space.startsWith("tinycloud:")) {
771
815
  return space;
@@ -957,15 +1001,31 @@ var NodeUserAuthorization = class {
957
1001
  }
958
1002
  const rawAbilities = {};
959
1003
  const currentDid = pkhDid(address, chainId);
1004
+ if (this._nodeFeatures.includes("encryption-named-keys-v1")) {
1005
+ const siweDomain = this.siweConfig?.domain ?? this.domain;
1006
+ for (const manifest of request.manifests) {
1007
+ if (!appKeyHostBinding(siweDomain, manifest.keys_app_id ?? manifest.app_id)) continue;
1008
+ for (const declaration of manifest.keys ?? []) {
1009
+ const path = "path" in declaration ? declaration.path : declaration.prefix;
1010
+ const resource = `urn:tinycloud:encryption:${currentDid}:default/${path}`;
1011
+ for (const ability of declaration.abilities) {
1012
+ addRawAbility(rawAbilities, resource, `tinycloud.encryption/${ability}`);
1013
+ }
1014
+ }
1015
+ }
1016
+ }
960
1017
  const spaceResources = request.resources.filter((entry) => {
961
1018
  if (entry.service !== ENCRYPTION_PERMISSION_SERVICE) {
962
1019
  return true;
963
1020
  }
1021
+ const parsed = entry.path.includes("/") ? parseEncryptionResource(entry.path) : { ...parseNetworkId(entry.path), kind: "network" };
1022
+ if (parsed.kind !== "network") {
1023
+ throw new ManifestValidationError("named keys go in manifest.keys");
1024
+ }
964
1025
  for (const action of entry.actions) {
965
1026
  addRawAbility(rawAbilities, entry.path, action);
966
1027
  }
967
- if (entry.actions.includes(DECRYPT_ACTION)) {
968
- const parsed = parseNetworkId(entry.path);
1028
+ if (entry.actions.includes(DECRYPT_ACTION) && parsed.kind === "network") {
969
1029
  if (didPrincipalMatches(parsed.ownerDid, currentDid)) {
970
1030
  addRawAbility(rawAbilities, entry.path, NETWORK_CREATE_ACTION);
971
1031
  }
@@ -1361,6 +1421,8 @@ var NodeUserAuthorization = class {
1361
1421
  this._chainId = chainId;
1362
1422
  await this.resolveTinyCloudHostsForSignIn(address, chainId);
1363
1423
  this.assertSignInCurrent(generation);
1424
+ await this.refreshNamedKeyFeatureForSignIn(address, chainId);
1425
+ this.assertSignInCurrent(generation);
1364
1426
  const keyId = `session-${Date.now()}`;
1365
1427
  this.sessionManager.renameSessionKeyId(this.activeSessionKeyId, keyId);
1366
1428
  this.activeSessionKeyId = keyId;
@@ -1507,9 +1569,9 @@ var NodeUserAuthorization = class {
1507
1569
  refuseCaveated(this.getCapabilityRequest()?.manifests);
1508
1570
  const address = canonicalizeAddress(await this.signer.getAddress());
1509
1571
  const chainId = await this.signer.getChainId();
1510
- const keyId = `session-${Date.now()}`;
1511
- this.sessionManager.renameSessionKeyId(this.activeSessionKeyId, keyId);
1512
- this.activeSessionKeyId = keyId;
1572
+ await this.refreshNamedKeyFeatureForSignIn(address, chainId);
1573
+ const keyId = `openkey-session-${Date.now()}-${++this.preparedSessionCounter}`;
1574
+ this.sessionManager.createSessionKey(keyId);
1513
1575
  const jwkString = this.sessionManager.jwk(keyId);
1514
1576
  if (!jwkString) {
1515
1577
  throw new Error("Failed to create session key");
@@ -1590,6 +1652,7 @@ var NodeUserAuthorization = class {
1590
1652
  await this.sessionStorage.save(address, persistedData);
1591
1653
  this._session = clientSession;
1592
1654
  this._tinyCloudSession = tinyCloudSession;
1655
+ this.activeSessionKeyId = keyId;
1593
1656
  this._address = address;
1594
1657
  this._chainId = chainId;
1595
1658
  await this.refreshNodeInfo();
@@ -1636,6 +1699,11 @@ var NodeUserAuthorization = class {
1636
1699
  * @param options Optional overrides for the OpenKey request.
1637
1700
  */
1638
1701
  async signInWithOpenKey(authorizeFn, options) {
1702
+ const pending = await this.prepareOpenKeySignIn(options);
1703
+ return this.completeOpenKeySignIn(pending, authorizeFn(pending.request), options);
1704
+ }
1705
+ /** Finish address, host and SIWE preparation before an approval click. */
1706
+ async prepareOpenKeySignIn(options) {
1639
1707
  refuseCaveated(this.getCapabilityRequest()?.manifests);
1640
1708
  if (options?.host !== void 0) {
1641
1709
  const overrideHost = options.host.trim();
@@ -1647,7 +1715,7 @@ var NodeUserAuthorization = class {
1647
1715
  const signingAddress = canonicalizeAddress(await this.signer.getAddress());
1648
1716
  const signingChainId = await this.signer.getChainId();
1649
1717
  await this.resolveTinyCloudHostsForSignIn(signingAddress, signingChainId);
1650
- const { prepared, keyId, jwk } = await this.prepareSessionForSigning();
1718
+ const { prepared, keyId, jwk, address, chainId } = await this.prepareSessionForSigning();
1651
1719
  const presentation = this.buildPresentationEnvelope(options?.reason);
1652
1720
  const hostHint = this.primaryTinyCloudHost;
1653
1721
  const originalRequest = {
@@ -1659,12 +1727,32 @@ var NodeUserAuthorization = class {
1659
1727
  keyId: options?.openkeyKeyId,
1660
1728
  presentation
1661
1729
  };
1730
+ return {
1731
+ request: originalRequest,
1732
+ prepared,
1733
+ keyId,
1734
+ jwk,
1735
+ address,
1736
+ chainId,
1737
+ generation: this.sessionGeneration,
1738
+ createdAt: Date.now()
1739
+ };
1740
+ }
1741
+ /** Complete a prepared approval. The caller starts authorization before awaiting this method. */
1742
+ async completeOpenKeySignIn(pending, authorization, options) {
1743
+ if (Date.now() - pending.createdAt > 5 * 6e4) {
1744
+ throw new Error("Prepared OpenKey sign-in expired; prepare again");
1745
+ }
1746
+ if (pending.generation !== this.sessionGeneration) {
1747
+ throw new Error("Prepared OpenKey sign-in expired after sign-out");
1748
+ }
1749
+ const { request: originalRequest, prepared, keyId, jwk } = pending;
1662
1750
  let result;
1663
1751
  let signed;
1664
1752
  let signature;
1665
1753
  for (let attempt = 0; ; ) {
1666
1754
  try {
1667
- result ?? (result = await authorizeFn(originalRequest));
1755
+ result ?? (result = await authorization);
1668
1756
  signed = await this.verifyOpenKeyResult(result, prepared);
1669
1757
  signature = result.signature;
1670
1758
  break;
@@ -2085,6 +2173,50 @@ var NodeUserAuthorization = class {
2085
2173
  }
2086
2174
  };
2087
2175
 
2176
+ // src/authorization/openKeyBridge.ts
2177
+ function wireOpenKeyAuthorize(openkey, opts) {
2178
+ return async (input) => {
2179
+ const result = await openkey.authorizeTinyCloud({
2180
+ protocolVersion: 1,
2181
+ siwe: input.siwe,
2182
+ keyId: input.keyId,
2183
+ jwk: input.jwk,
2184
+ host: input.host,
2185
+ // Forward the presentation envelope verbatim — the OpenKey SDK
2186
+ // validates and size-bounds it before use.
2187
+ presentation: input.presentation
2188
+ }, opts);
2189
+ if (result.protocolVersion !== 1) {
2190
+ throw new Error(
2191
+ `wireOpenKeyAuthorize: OpenKey returned unsupported protocolVersion ${result.protocolVersion}`
2192
+ );
2193
+ }
2194
+ if (typeof result.signedMessage !== "string" || !result.signedMessage) {
2195
+ throw new Error(
2196
+ "wireOpenKeyAuthorize: OpenKey returned no signedMessage \u2014 cannot complete a TinyCloud session"
2197
+ );
2198
+ }
2199
+ if (!Array.isArray(result.selectedActionKeys)) {
2200
+ throw new Error(
2201
+ "wireOpenKeyAuthorize: OpenKey returned no selectedActionKeys"
2202
+ );
2203
+ }
2204
+ if (!Array.isArray(result.permissions)) {
2205
+ throw new Error(
2206
+ "wireOpenKeyAuthorize: OpenKey returned no permissions"
2207
+ );
2208
+ }
2209
+ return {
2210
+ protocolVersion: 1,
2211
+ address: result.address,
2212
+ signature: result.signature,
2213
+ signedMessage: result.signedMessage,
2214
+ selectedActionKeys: result.selectedActionKeys,
2215
+ permissions: result.permissions
2216
+ };
2217
+ };
2218
+ }
2219
+
2088
2220
  // src/recordingServiceContext.ts
2089
2221
  import {
2090
2222
  ServiceContext
@@ -2819,6 +2951,7 @@ import {
2819
2951
  tinyCloudDebugLogger
2820
2952
  } from "@tinycloud/sdk-services";
2821
2953
  import { RequestLog, observeReplicaReads, readOnlyRequestLog } from "@tinycloud/sdk-services/telemetry/requestLog";
2954
+ import { parseEncryptionResource as parseEncryptionResource2 } from "@tinycloud/sdk-services/encryption/resource";
2822
2955
 
2823
2956
  // src/account/AccountService.ts
2824
2957
  import { AccountService } from "@tinycloud/sdk-core";
@@ -3310,6 +3443,7 @@ var ROOT_DELEGATION_ACTIONS = [
3310
3443
  DUCKDB2.ALL
3311
3444
  ];
3312
3445
  var DEFAULT_SESSION_EXPIRATION_MS = EXPIRY3.SESSION_MS;
3446
+ var OWNER_REVOCATION_WINDOW_MS = 10 * 6e4;
3313
3447
  function unifiedRootAttenuation(capabilities) {
3314
3448
  const attenuation = {};
3315
3449
  for (const capability of capabilities) {
@@ -3774,6 +3908,7 @@ function replicaRestoreRefusal(error) {
3774
3908
  case "purge_pending":
3775
3909
  case "logout_pending":
3776
3910
  case "gate_unavailable":
3911
+ case "wallet_provider_required":
3777
3912
  return error.gate;
3778
3913
  }
3779
3914
  }
@@ -3806,8 +3941,10 @@ var _TinyCloudNode = class _TinyCloudNode {
3806
3941
  constructor(config = {}) {
3807
3942
  this.signer = null;
3808
3943
  this.auth = null;
3944
+ this.consumedOpenKeyPendings = /* @__PURE__ */ new WeakSet();
3809
3945
  this.tc = null;
3810
3946
  this._chainId = 1;
3947
+ this.replicaPurgeFailedHandlers = /* @__PURE__ */ new Set();
3811
3948
  /** Mints the replica session stamp on each fresh sign-in (TC-858 §4.1). Undefined when replication is off. */
3812
3949
  this.establishReplicaStamp = async (session) => {
3813
3950
  const replication = this.config.replication;
@@ -3839,6 +3976,7 @@ var _TinyCloudNode = class _TinyCloudNode {
3839
3976
  return void 0;
3840
3977
  }
3841
3978
  };
3979
+ this._keysUnavailable = [];
3842
3980
  this._baseVaults = /* @__PURE__ */ new Map();
3843
3981
  this._baseSecrets = /* @__PURE__ */ new Map();
3844
3982
  this._secrets = /* @__PURE__ */ new Map();
@@ -4014,6 +4152,7 @@ var _TinyCloudNode = class _TinyCloudNode {
4014
4152
  return instance ? instance.control.purge(input) : runtime.then((ready) => ready.control.purge(input));
4015
4153
  },
4016
4154
  clearPending: async () => (await runtime).control.clearPending(),
4155
+ purgeLocalCopy: async () => (await this.eraseReplicaLocalCopy("purge_local_copy"))?.purge ?? { ok: false, retryNow: false },
4017
4156
  close: async () => (await runtime).control.close()
4018
4157
  };
4019
4158
  }
@@ -4068,18 +4207,14 @@ var _TinyCloudNode = class _TinyCloudNode {
4068
4207
  get freshEncryptionNetworkCreated() {
4069
4208
  return this._freshEncryptionNetworkCreated;
4070
4209
  }
4071
- /**
4072
- * Subscribe to `storage.full`. It fires on the first write any service had
4073
- * rejected because the owner's TinyCloud storage is full
4074
- * (`STORAGE_QUOTA_EXCEEDED` or `STORAGE_LIMIT_REACHED`), so an app can show
4075
- * one read-only banner. Reads keep working. For the signed-in account's own
4076
- * storage it fires once per episode: the episode ends only when a write to
4077
- * that storage succeeds, or on sign-out. A `storage.status()` read does not
4078
- * end it. A rejection on another owner's delegated space fires once per
4079
- * owner, until that owner's `storage.status()` reports space again. Returns
4080
- * the unsubscribe function.
4081
- */
4082
4210
  on(event, handler) {
4211
+ if (event === "replica.purge.failed") {
4212
+ const listener = handler;
4213
+ this.replicaPurgeFailedHandlers.add(listener);
4214
+ return () => {
4215
+ this.replicaPurgeFailedHandlers.delete(listener);
4216
+ };
4217
+ }
4083
4218
  if (event !== "storage.full") {
4084
4219
  throw new Error(`Unknown TinyCloud event: ${String(event)}`);
4085
4220
  }
@@ -4560,6 +4695,7 @@ var _TinyCloudNode = class _TinyCloudNode {
4560
4695
  const leavingAuth = this.auth;
4561
4696
  const leavingContext = this._serviceContext;
4562
4697
  let denied;
4698
+ let erased;
4563
4699
  try {
4564
4700
  this.teardownSession();
4565
4701
  } finally {
@@ -4570,6 +4706,7 @@ var _TinyCloudNode = class _TinyCloudNode {
4570
4706
  try {
4571
4707
  await this.accountRegistryTail;
4572
4708
  await this.quiesceReplicaRuntime();
4709
+ if (denied) erased = await this.eraseReplicaLocalCopy("sign_out", denied.status);
4573
4710
  } finally {
4574
4711
  if (leavingAddress) {
4575
4712
  await (leavingAuth ? leavingAuth.clearPersistedSession(leavingAddress) : this.config.sessionStorage?.clear(leavingAddress));
@@ -4577,8 +4714,37 @@ var _TinyCloudNode = class _TinyCloudNode {
4577
4714
  }
4578
4715
  }
4579
4716
  }
4580
- if (denied?.status === "unguarded") {
4581
- throw new Error(`Replica gate was not denied (${denied.code ?? "unknown"}); the replica may still be restorable.`);
4717
+ if (denied?.status === "unguarded" && erased?.outcome.status !== "erased") {
4718
+ throw Object.assign(
4719
+ new Error(`Replica gate was not denied (${denied.code ?? "unknown"}); the replica may still be restorable.`),
4720
+ {
4721
+ code: "REPLICA_PURGE_FAILED",
4722
+ reason: "gate_unavailable",
4723
+ retryNow: erased?.outcome.status === "failed"
4724
+ }
4725
+ );
4726
+ }
4727
+ }
4728
+ /**
4729
+ * Erases the browser local copy after a deny (retry, event and next-load marker live in the lazy
4730
+ * replication authority). Never rejects; `undefined` when replication is off or the storage keeps
4731
+ * no browser database.
4732
+ */
4733
+ async eraseReplicaLocalCopy(trigger, denyStatus) {
4734
+ const replication = this.config.replication;
4735
+ if (!replication?.enabled) return void 0;
4736
+ try {
4737
+ const { eraseReplicaLocalCopy } = await getNodeReplicationLoaders().authority();
4738
+ const erased = await eraseReplicaLocalCopy(
4739
+ replication.storage.lifecycle,
4740
+ trigger,
4741
+ denyStatus,
4742
+ this.replicaPurgeFailedHandlers
4743
+ );
4744
+ if (erased?.logoutPending) this.replicaRestoreGate = "logout_pending";
4745
+ return erased;
4746
+ } catch {
4747
+ return void 0;
4582
4748
  }
4583
4749
  }
4584
4750
  /**
@@ -4638,6 +4804,8 @@ var _TinyCloudNode = class _TinyCloudNode {
4638
4804
  this._hooks = void 0;
4639
4805
  this._vault = void 0;
4640
4806
  this._encryption = void 0;
4807
+ this._namedKeyClient = void 0;
4808
+ this._keysUnavailable = [];
4641
4809
  this._baseVaults.clear();
4642
4810
  this._baseSecrets.clear();
4643
4811
  this._secrets.clear();
@@ -4714,6 +4882,37 @@ var _TinyCloudNode = class _TinyCloudNode {
4714
4882
  }
4715
4883
  await this.signInWith(() => this.auth.signInWithOpenKey(authorizeFn, options));
4716
4884
  }
4885
+ /** Prepare the OpenKey request before the approval click. */
4886
+ async prepareOpenKeySignIn() {
4887
+ if (!this.signer || !this.tc || !this.auth) {
4888
+ throw new Error("Cannot prepare OpenKey sign-in in session-only mode. Provide a signer in config.");
4889
+ }
4890
+ await this.signOutInFlight;
4891
+ await this.accountRegistryTail;
4892
+ await this.wasmBindings.ensureInitialized?.();
4893
+ return this.auth.prepareOpenKeySignIn();
4894
+ }
4895
+ /** Start OpenKey authorization synchronously, then complete normal session setup. */
4896
+ signInWithPreparedOpenKey(pending, authorizeFn) {
4897
+ if (!this.signer || !this.tc || !this.auth || this.signOutInFlight) {
4898
+ throw new Error("Prepared OpenKey sign-in is unavailable");
4899
+ }
4900
+ if (this.consumedOpenKeyPendings.has(pending)) {
4901
+ throw new Error("Prepared OpenKey sign-in was already used");
4902
+ }
4903
+ if (Date.now() - pending.createdAt > 5 * 6e4) {
4904
+ throw new Error("Prepared OpenKey sign-in expired; prepare again");
4905
+ }
4906
+ this.consumedOpenKeyPendings.add(pending);
4907
+ const authorization = authorizeFn(pending.request);
4908
+ void authorization.catch(() => void 0);
4909
+ return this.signInWith(() => {
4910
+ if (this._address !== pending.address || this._chainId !== pending.chainId) {
4911
+ throw new Error("OpenKey account changed after sign-in preparation");
4912
+ }
4913
+ return this.auth.completeOpenKeySignIn(pending, authorization);
4914
+ });
4915
+ }
4717
4916
  async signInWith(performSignIn) {
4718
4917
  refuseCaveated(this.auth?.capabilityRequest?.manifests);
4719
4918
  const epoch = this.sessionEpoch;
@@ -4742,6 +4941,10 @@ var _TinyCloudNode = class _TinyCloudNode {
4742
4941
  const priorPrincipal = this.replicaSessionPrincipal ?? (this.address ? pkhDid2(this.address, this._chainId) : void 0);
4743
4942
  if (this.config.replication?.enabled && priorPrincipal && priorPrincipal !== nextPrincipal) {
4744
4943
  const denial = await this.denyReplicaGate({ reason: "account_switch", principal: priorPrincipal, next: nextPrincipal });
4944
+ if (denial) {
4945
+ await this.quiesceReplicaRuntime();
4946
+ await this.eraseReplicaLocalCopy("account_switch", denial.status);
4947
+ }
4745
4948
  this.replicaRestoreGate = denial?.status === "unguarded" ? "gate_unavailable" : "stamp_stale";
4746
4949
  }
4747
4950
  if (address !== this._address || chainId !== this._chainId) {
@@ -4756,6 +4959,8 @@ var _TinyCloudNode = class _TinyCloudNode {
4756
4959
  this._hooks = void 0;
4757
4960
  this._vault = void 0;
4758
4961
  this._encryption = void 0;
4962
+ this._namedKeyClient = void 0;
4963
+ this._keysUnavailable = [];
4759
4964
  this._baseVaults.clear();
4760
4965
  this._baseSecrets.clear();
4761
4966
  this._secrets.clear();
@@ -4808,6 +5013,26 @@ var _TinyCloudNode = class _TinyCloudNode {
4808
5013
  this.assertSessionEpoch(epoch, "Sign-in");
4809
5014
  await this.ensureRequestedEncryptionNetworks();
4810
5015
  this.assertSessionEpoch(epoch, "Sign-in");
5016
+ this._keysUnavailable = this.auth?.unavailableKeyPaths ?? [];
5017
+ if (this._keysUnavailable.length > 0) {
5018
+ this.notificationHandler.warning(`Named keys unavailable: ${this._keysUnavailable.join(", ")}`);
5019
+ }
5020
+ if (this.nodeFeatures.includes("encryption-named-keys-v1")) {
5021
+ for (const manifest of this.auth?.capabilityRequest?.manifests ?? []) {
5022
+ for (const declaration of manifest.keys ?? []) {
5023
+ if ("path" in declaration && declaration.abilities.includes("key.create") && !this._keysUnavailable.includes(declaration.path)) {
5024
+ try {
5025
+ await this.keys.ensureKey(declaration.path);
5026
+ } catch (error) {
5027
+ this._keysUnavailable.push(declaration.path);
5028
+ const code = error && typeof error === "object" && "code" in error && typeof error.code === "string" && /^[A-Z_]+$/.test(error.code) ? error.code : "UNKNOWN";
5029
+ this.notificationHandler.warning(`Named key unavailable: ${declaration.path} (${code})`);
5030
+ }
5031
+ this.assertSessionEpoch(epoch, "Sign-in");
5032
+ }
5033
+ }
5034
+ }
5035
+ }
4811
5036
  if (!bootstrapped && this.config.manifest === void 0 && this.config.capabilityRequest === void 0) {
4812
5037
  await this.ensureOwnedSpaceHostedById(this.ownedSpaceId(SECRETS_SPACE2));
4813
5038
  }
@@ -5595,7 +5820,8 @@ var _TinyCloudNode = class _TinyCloudNode {
5595
5820
  const networkIds = /* @__PURE__ */ new Set();
5596
5821
  for (const resource of request.resources) {
5597
5822
  if (resource.service === ENCRYPTION_PERMISSION_SERVICE2 && resource.path.startsWith("urn:tinycloud:encryption:") && resource.actions.includes(DECRYPT_ACTION2)) {
5598
- networkIds.add(resource.path);
5823
+ const parsed = resource.path.includes("/") ? parseEncryptionResource2(resource.path) : { ...parseNetworkId2(resource.path), kind: "network" };
5824
+ if (parsed.kind === "network") networkIds.add(resource.path);
5599
5825
  }
5600
5826
  }
5601
5827
  return [...networkIds];
@@ -6145,6 +6371,8 @@ var _TinyCloudNode = class _TinyCloudNode {
6145
6371
  this._hooks = stagedGraph.hooks;
6146
6372
  this._vault = stagedGraph.vault;
6147
6373
  this._encryption = stagedGraph.encryption;
6374
+ this._namedKeyClient = void 0;
6375
+ this._keysUnavailable = [];
6148
6376
  this._capabilityRegistry = stagedGraph.capabilityRegistry;
6149
6377
  this._keyProvider = stagedGraph.keyProvider;
6150
6378
  this._sharingService = stagedGraph.sharingService;
@@ -7498,7 +7726,7 @@ var _TinyCloudNode = class _TinyCloudNode {
7498
7726
  * Sign a wallet (CACAO) revocation of the delegation `cid` for the node's
7499
7727
  * `POST /revoke`, and return its Authorization header value. The node
7500
7728
  * accepts it when the owner delegated `cid` or owns a space its abilities
7501
- * target, whichever key issued it. Valid for 60 seconds. Requires the
7729
+ * target, whichever key issued it. Valid for 10 minutes. Requires the
7502
7730
  * owner wallet signer.
7503
7731
  */
7504
7732
  async signOwnerRevocation(cid) {
@@ -7514,7 +7742,7 @@ var _TinyCloudNode = class _TinyCloudNode {
7514
7742
  chainId: session.chainId,
7515
7743
  nonce: generateNonce(),
7516
7744
  issuedAt: issuedAt.toISOString(),
7517
- expirationTime: new Date(issuedAt.getTime() + 6e4).toISOString()
7745
+ expirationTime: new Date(issuedAt.getTime() + OWNER_REVOCATION_WINDOW_MS).toISOString()
7518
7746
  }).prepareMessage();
7519
7747
  const signature = await this.signer.signMessage(siwe);
7520
7748
  return this.wasmBindings.siweToDelegationHeaders({ siwe, signature }).Authorization;
@@ -7741,6 +7969,40 @@ var _TinyCloudNode = class _TinyCloudNode {
7741
7969
  get encryption() {
7742
7970
  return this.getEncryptionService();
7743
7971
  }
7972
+ /** Named keys bound to the current session. */
7973
+ get keys() {
7974
+ return new Proxy({}, {
7975
+ get: (_target, property) => {
7976
+ if (property === "refreshNodeInfo") {
7977
+ return () => {
7978
+ void this._namedKeyClient?.then((client) => client.refreshNodeInfo());
7979
+ };
7980
+ }
7981
+ if (typeof property !== "string" || ![
7982
+ "getPublicKey",
7983
+ "describeKey",
7984
+ "createKey",
7985
+ "blockKey",
7986
+ "unblockKey",
7987
+ "ensureKey",
7988
+ "encrypt",
7989
+ "decrypt",
7990
+ "decryptMany"
7991
+ ].includes(property)) return void 0;
7992
+ return (...args) => {
7993
+ this._namedKeyClient ?? (this._namedKeyClient = import("./encryption-keys.js").then(({ createNamedKeyClient }) => createNamedKeyClient(this)));
7994
+ return this._namedKeyClient.then((client) => {
7995
+ const method = client[property];
7996
+ return method.apply(client, args);
7997
+ });
7998
+ };
7999
+ }
8000
+ });
8001
+ }
8002
+ /** Manifest key paths unavailable during the latest `signIn()` attempt. */
8003
+ get keysUnavailable() {
8004
+ return this._keysUnavailable;
8005
+ }
7744
8006
  async getEncryptionNetwork(nameOrNetworkId = this.getDefaultEncryptionNetworkId()) {
7745
8007
  const networkId = nameOrNetworkId.startsWith("urn:tinycloud:encryption:") ? nameOrNetworkId : this.getDefaultEncryptionNetworkId(nameOrNetworkId);
7746
8008
  return this.fetchEncryptionNetworkAt(
@@ -10015,7 +10277,7 @@ import {
10015
10277
  CaveatedDelegationUnsupportedError as CaveatedDelegationUnsupportedError3,
10016
10278
  PermissionNotInManifestError as PermissionNotInManifestError2,
10017
10279
  SessionExpiredError as SessionExpiredError2,
10018
- ManifestValidationError,
10280
+ ManifestValidationError as ManifestValidationError2,
10019
10281
  composeManifestRequest as composeManifestRequest2,
10020
10282
  resolveManifest as resolveManifest2,
10021
10283
  validateManifest,
@@ -10100,12 +10362,13 @@ export {
10100
10362
  IdentityParseError,
10101
10363
  InvalidRestoredSessionError,
10102
10364
  KVService3 as KVService,
10103
- ManifestValidationError,
10365
+ ManifestValidationError2 as ManifestValidationError,
10104
10366
  MemorySessionStorage,
10105
10367
  NodeUserAuthorization,
10106
10368
  PermissionNotInManifestError2 as PermissionNotInManifestError,
10107
10369
  PrefixedKVService,
10108
10370
  ProtocolMismatchError2 as ProtocolMismatchError,
10371
+ RuntimeDelegationRejectedError,
10109
10372
  SECRET_NAME_RE,
10110
10373
  SQLAction,
10111
10374
  SQLService3 as SQLService,
@@ -10128,6 +10391,7 @@ export {
10128
10391
  VersionCheckError,
10129
10392
  WasmKeyProvider,
10130
10393
  activateCompactRuntimeDelegation,
10394
+ activateValidatedRuntimeDelegation,
10131
10395
  addressStorageKey,
10132
10396
  buildSpaceUri,
10133
10397
  canonicalizeAddress3 as canonicalizeAddress,
@@ -10178,6 +10442,7 @@ export {
10178
10442
  resourceCapabilitiesToSpaceAbilitiesMap2 as resourceCapabilitiesToSpaceAbilitiesMap,
10179
10443
  serializeDelegation,
10180
10444
  tinyCloudDebugLogger2 as tinyCloudDebugLogger,
10181
- validateManifest
10445
+ validateManifest,
10446
+ wireOpenKeyAuthorize
10182
10447
  };
10183
10448
  //# sourceMappingURL=core.js.map