@tinycloud/node-sdk 3.10.0 → 3.11.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ISigner, Bytes, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
2
2
  export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IStorageService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, MAX_SECRET_SCOPE_LENGTH, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, ParsedNetworkId, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaLocalEraseOutcome, ReplicaPurgeError, ReplicaPurgeFailedEvent, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SECRET_SCOPE_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretPutOptions, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StorageAccountUsage, StorageFullEvent, StorageStatus, StorageStatusOptions, StorageUsage, StorageUsageState, StoredDelegationChain, SubscribeOptions, TC832_RESERVED_SCOPES, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, appSecretScope, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, isStorageFullError, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, storageUsageState, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
3
3
  export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider, i as isAppKeyHostBound } from './WasmKeyProvider-BKCPRC-c.cjs';
4
- export { A as ACCEPTED_MARKER_VERSIONS, m as BOOTSTRAP_COMPLETION_MARKER_KEY, n as BOOTSTRAP_COMPLETION_MARKER_VERSION, o as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, c as NodeUserAuthorization, p as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, q as OpenKeyAuthorizationResultV1, r as OpenKeyAuthorizeInput, O as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, e as OwnerDelegationReceipt, P as PreparedOpenKeyAuthorization, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, f as SecretReadInput, g as SecretReadResult, h as SignStrategy, T as TinyCloudNode, i as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, j as UnifiedOwnerRootReceipt, k as UnsupportedSessionRestoreError, l as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-BhWBbCay.cjs';
4
+ export { A as ACCEPTED_MARKER_VERSIONS, m as BOOTSTRAP_COMPLETION_MARKER_KEY, n as BOOTSTRAP_COMPLETION_MARKER_VERSION, o as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, c as NodeUserAuthorization, p as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, q as OpenKeyAuthorizationResultV1, r as OpenKeyAuthorizeInput, O as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, e as OwnerDelegationReceipt, P as PreparedOpenKeyAuthorization, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, f as SecretReadInput, g as SecretReadResult, h as SignStrategy, T as TinyCloudNode, i as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, j as UnifiedOwnerRootReceipt, k as UnsupportedSessionRestoreError, l as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-CnVaWnAX.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
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';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ISigner, Bytes, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
2
2
  export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IStorageService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, MAX_SECRET_SCOPE_LENGTH, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, ParsedNetworkId, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaLocalEraseOutcome, ReplicaPurgeError, ReplicaPurgeFailedEvent, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SECRET_SCOPE_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretPutOptions, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StorageAccountUsage, StorageFullEvent, StorageStatus, StorageStatusOptions, StorageUsage, StorageUsageState, StoredDelegationChain, SubscribeOptions, TC832_RESERVED_SCOPES, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, appSecretScope, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, isStorageFullError, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, storageUsageState, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
3
3
  export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider, i as isAppKeyHostBound } from './WasmKeyProvider-BKCPRC-c.js';
4
- export { A as ACCEPTED_MARKER_VERSIONS, m as BOOTSTRAP_COMPLETION_MARKER_KEY, n as BOOTSTRAP_COMPLETION_MARKER_VERSION, o as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, c as NodeUserAuthorization, p as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, q as OpenKeyAuthorizationResultV1, r as OpenKeyAuthorizeInput, O as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, e as OwnerDelegationReceipt, P as PreparedOpenKeyAuthorization, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, f as SecretReadInput, g as SecretReadResult, h as SignStrategy, T as TinyCloudNode, i as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, j as UnifiedOwnerRootReceipt, k as UnsupportedSessionRestoreError, l as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-BjJJIifr.js';
4
+ export { A as ACCEPTED_MARKER_VERSIONS, m as BOOTSTRAP_COMPLETION_MARKER_KEY, n as BOOTSTRAP_COMPLETION_MARKER_VERSION, o as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, c as NodeUserAuthorization, p as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, q as OpenKeyAuthorizationResultV1, r as OpenKeyAuthorizeInput, O as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, e as OwnerDelegationReceipt, P as PreparedOpenKeyAuthorization, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, f as SecretReadInput, g as SecretReadResult, h as SignStrategy, T as TinyCloudNode, i as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, j as UnifiedOwnerRootReceipt, k as UnsupportedSessionRestoreError, l as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-BlNcvo1c.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
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';
package/dist/index.js CHANGED
@@ -18756,6 +18756,7 @@ import {
18756
18756
  DUCKDB as DUCKDB2,
18757
18757
  ENCRYPTION as ENCRYPTION2,
18758
18758
  EXPIRY as EXPIRY3,
18759
+ assertExpiryWithinTechnicalLimit as assertExpiryWithinTechnicalLimit2,
18759
18760
  canonicalHashHex,
18760
18761
  canonicalizeEncryptionJson,
18761
18762
  verifyDidKeyEd25519Signature,
@@ -18817,11 +18818,13 @@ import {
18817
18818
  createInMemoryRegistrySequenceStore,
18818
18819
  registryOwnerSubjectV1,
18819
18820
  EXPIRY,
18821
+ assertExpiryWithinTechnicalLimit,
18820
18822
  canonicalizeAddress,
18821
18823
  makePkhSpaceId,
18822
18824
  pkhDid,
18823
18825
  extractImmutableSiweFields,
18824
18826
  diffImmutableSiweFields,
18827
+ checkChangedExpiration,
18825
18828
  extractRecapAttenuations,
18826
18829
  unauthorizedRecapCapabilities,
18827
18830
  parseCanonicalRecapResource,
@@ -18968,6 +18971,16 @@ var MemorySessionStorage = class {
18968
18971
  };
18969
18972
 
18970
18973
  // src/authorization/NodeUserAuthorization.ts
18974
+ function assertMaxExpiresAt(value) {
18975
+ if (value === void 0 || typeof value === "function") return;
18976
+ const ms = value instanceof Date ? value.getTime() : value;
18977
+ if (typeof ms !== "number" || !Number.isFinite(new Date(ms).getTime())) {
18978
+ throw new Error("maxExpiresAt must be a finite number of epoch milliseconds, a valid Date, or a function returning one");
18979
+ }
18980
+ }
18981
+ function lastAnchoredLine(siwe, pattern) {
18982
+ return [...siwe.matchAll(pattern)].at(-1)?.[1];
18983
+ }
18971
18984
  function pkhSpaceIdentity(spaceId) {
18972
18985
  const match = /^(tinycloud:pkh:eip155:\d+:)(0x[0-9a-fA-F]{40})(:.+)$/.exec(spaceId);
18973
18986
  return match === null ? spaceId : `${match[1]}${match[2].toLowerCase()}${match[3]}`;
@@ -19941,7 +19954,7 @@ var NodeUserAuthorization = class {
19941
19954
  }
19942
19955
  const jwk = JSON.parse(jwkString);
19943
19956
  const now = /* @__PURE__ */ new Date();
19944
- const expirationTime = new Date(now.getTime() + this.sessionExpirationMs);
19957
+ const expirationTime = this.sessionExpiryFrom(now);
19945
19958
  const primaryIdentity = pkhSpaceIdentity(options.spaceId);
19946
19959
  const resourcesBySpace = /* @__PURE__ */ new Map();
19947
19960
  for (const resource of options.capabilityRequest.resources) {
@@ -19996,6 +20009,17 @@ var NodeUserAuthorization = class {
19996
20009
  signature: signature2
19997
20010
  };
19998
20011
  }
20012
+ /**
20013
+ * When a session that starts at `now` ends. Refused with a dated message when
20014
+ * the configured lifetime reaches past what a sign-in message can carry,
20015
+ * instead of the bare `RangeError` or WASM parse error `toISOString()` and
20016
+ * `prepareSession` would otherwise give.
20017
+ */
20018
+ sessionExpiryFrom(now) {
20019
+ const expirationTime = new Date(now.getTime() + this.sessionExpirationMs);
20020
+ assertExpiryWithinTechnicalLimit(expirationTime, "siwe");
20021
+ return expirationTime;
20022
+ }
19999
20023
  persistedData(session, expiresAt, createdAt, replicaStamp) {
20000
20024
  return {
20001
20025
  address: session.address,
@@ -20051,7 +20075,7 @@ var NodeUserAuthorization = class {
20051
20075
  const capabilityPlan = this.resolveSignInCapabilities(address, chainId);
20052
20076
  const spaceId = capabilityPlan.spaceId;
20053
20077
  const now = /* @__PURE__ */ new Date();
20054
- const expirationTime = new Date(now.getTime() + this.sessionExpirationMs);
20078
+ const expirationTime = this.sessionExpiryFrom(now);
20055
20079
  const prepared = this.prepareSessionWithResources({
20056
20080
  abilities: capabilityPlan.abilities,
20057
20081
  ...capabilityPlan.spaceAbilities !== void 0 ? { spaceAbilities: capabilityPlan.spaceAbilities } : {},
@@ -20197,7 +20221,7 @@ var NodeUserAuthorization = class {
20197
20221
  const capabilityPlan = this.resolveSignInCapabilities(address, chainId);
20198
20222
  const spaceId = capabilityPlan.spaceId;
20199
20223
  const now = /* @__PURE__ */ new Date();
20200
- const expirationTime = new Date(now.getTime() + this.sessionExpirationMs);
20224
+ const expirationTime = this.sessionExpiryFrom(now);
20201
20225
  const prepared = this.prepareSessionWithResources({
20202
20226
  abilities: capabilityPlan.abilities,
20203
20227
  ...capabilityPlan.spaceAbilities !== void 0 ? { spaceAbilities: capabilityPlan.spaceAbilities } : {},
@@ -20260,10 +20284,8 @@ var NodeUserAuthorization = class {
20260
20284
  siwe: prepared.siwe,
20261
20285
  signature: signature2
20262
20286
  };
20263
- const expirationMatch = prepared.siwe?.match(/Expiration Time: (.+)/);
20264
- const issuedAtMatch = prepared.siwe?.match(/Issued At: (.+)/);
20265
- const expiresAt = expirationMatch?.[1] ?? new Date(Date.now() + this.sessionExpirationMs).toISOString();
20266
- const createdAt = issuedAtMatch?.[1] ?? (/* @__PURE__ */ new Date()).toISOString();
20287
+ const expiresAt = lastAnchoredLine(prepared.siwe ?? "", /^Expiration Time: (.+)$/gm) ?? this.sessionExpiryFrom(/* @__PURE__ */ new Date()).toISOString();
20288
+ const createdAt = lastAnchoredLine(prepared.siwe ?? "", /^Issued At: (.+)$/gm) ?? (/* @__PURE__ */ new Date()).toISOString();
20267
20289
  const replicaStamp = await this.establishReplicaStamp?.(tinyCloudSession);
20268
20290
  const persistedData = this.persistedData(tinyCloudSession, expiresAt, createdAt, replicaStamp);
20269
20291
  await this.sessionStorage.save(address, persistedData);
@@ -20322,6 +20344,7 @@ var NodeUserAuthorization = class {
20322
20344
  /** Finish address, host and SIWE preparation before an approval click. */
20323
20345
  async prepareOpenKeySignIn(options) {
20324
20346
  refuseCaveated(this.getCapabilityRequest()?.manifests);
20347
+ assertMaxExpiresAt(options?.maxExpiresAt);
20325
20348
  if (options?.host !== void 0) {
20326
20349
  const overrideHost = options.host.trim();
20327
20350
  if (!overrideHost) {
@@ -20342,7 +20365,9 @@ var NodeUserAuthorization = class {
20342
20365
  verificationMethod: prepared.verificationMethod,
20343
20366
  host: hostHint,
20344
20367
  keyId: options?.openkeyKeyId,
20345
- presentation
20368
+ presentation,
20369
+ // Present only when set, so the default request shape is unchanged.
20370
+ ...options?.expiryChangeable === true ? { expiryChangeable: true } : {}
20346
20371
  };
20347
20372
  return {
20348
20373
  request: originalRequest,
@@ -20352,7 +20377,10 @@ var NodeUserAuthorization = class {
20352
20377
  address,
20353
20378
  chainId,
20354
20379
  generation: this.sessionGeneration,
20355
- createdAt: Date.now()
20380
+ createdAt: Date.now(),
20381
+ // Kept in memory with the pending request. It is not part of `request`, so it is never sent to OpenKey, and
20382
+ // nothing here is persisted.
20383
+ ...options?.maxExpiresAt === void 0 ? {} : { maxExpiresAt: options.maxExpiresAt }
20356
20384
  };
20357
20385
  }
20358
20386
  /** Complete a prepared approval. The caller starts authorization before awaiting this method. */
@@ -20370,7 +20398,11 @@ var NodeUserAuthorization = class {
20370
20398
  for (let attempt = 0; ; ) {
20371
20399
  try {
20372
20400
  result ?? (result = await authorization);
20373
- signed2 = await this.verifyOpenKeyResult(result, prepared);
20401
+ signed2 = await this.verifyOpenKeyResult(result, prepared, {
20402
+ // Relax only for a request that actually carried the opt-in.
20403
+ allowExpirationChange: originalRequest.expiryChangeable === true,
20404
+ maxExpiresAt: pending.maxExpiresAt
20405
+ });
20374
20406
  signature2 = result.signature;
20375
20407
  break;
20376
20408
  } catch (error) {
@@ -20462,13 +20494,23 @@ var NodeUserAuthorization = class {
20462
20494
  * in the original prepared SIWE — narrowing OK, broadening rejected.
20463
20495
  * 5. Every `result.selectedActionKeys` entry corresponds to a
20464
20496
  * (resource, action) pair in the returned SIWE.
20497
+ *
20498
+ * `options.expiryChangeable` is true only when the request sent to OpenKey
20499
+ * carried `expiryChangeable: true`. Then (and only then) the signed
20500
+ * `Expiration Time` may differ from the prepared one and is the expiry the
20501
+ * session is built with; the changed expiry must pass
20502
+ * `checkChangedExpiration` and every other field in (3) must still match.
20503
+ * Without it, any expiry difference is refused as in (3).
20465
20504
  */
20466
- async signInWithOpenKeyResult(result, prepared, keyId, jwk) {
20467
- const signed2 = await this.verifyOpenKeyResult(result, prepared);
20505
+ async signInWithOpenKeyResult(result, prepared, keyId, jwk, options) {
20506
+ const signed2 = await this.verifyOpenKeyResult(result, prepared, {
20507
+ allowExpirationChange: options?.expiryChangeable === true,
20508
+ maxExpiresAt: options?.maxExpiresAt
20509
+ });
20468
20510
  return this.signInWithPreparedSession(signed2, result.signature, keyId, jwk);
20469
20511
  }
20470
20512
  /** Validate a candidate without activating a network session, so paste retries reuse one preparation. */
20471
- async verifyOpenKeyResult(result, prepared) {
20513
+ async verifyOpenKeyResult(result, prepared, options) {
20472
20514
  if (result.protocolVersion !== 1) {
20473
20515
  throw new Error(`Unsupported OpenKey protocol version ${result.protocolVersion}`);
20474
20516
  }
@@ -20511,16 +20553,39 @@ var NodeUserAuthorization = class {
20511
20553
  `OpenKey signedMessage.address (${parsedSignedSiwe.address}) does not match local signer address (${expectedAddress})`
20512
20554
  );
20513
20555
  }
20556
+ const parsedExpiry = parsedSignedSiwe.expirationTime;
20557
+ const lineExpiry = lastAnchoredLine(result.signedMessage, /^Expiration Time: (.+)$/gm);
20558
+ if (parsedExpiry === void 0 || parsedExpiry === null || lineExpiry === void 0) {
20559
+ throw new Error("OpenKey signedMessage has no Expiration Time line of its own");
20560
+ }
20561
+ const parsedExpiryMs = Date.parse(parsedExpiry);
20562
+ if (!Number.isFinite(parsedExpiryMs) || parsedExpiryMs !== Date.parse(lineExpiry)) {
20563
+ throw new Error("OpenKey signedMessage Expiration Time line does not match the message's own expiry");
20564
+ }
20514
20565
  const originalHasRecap = /(?:^|\n)-\s+urn:recap:/i.test(prepared.siwe);
20515
20566
  const originalFields = extractImmutableSiweFields(prepared.siwe);
20516
20567
  const signedFields = extractImmutableSiweFields(result.signedMessage);
20517
- const changedFields = diffImmutableSiweFields(originalFields, signedFields, {
20518
- originalHasRecap
20519
- });
20520
- if (changedFields.length > 0) {
20521
- throw new Error(
20522
- `OpenKey signedMessage altered immutable SIWE fields: ${changedFields.join(", ")}`
20523
- );
20568
+ if (options?.allowExpirationChange === true) {
20569
+ const maxExpiresAt = typeof options.maxExpiresAt === "function" ? options.maxExpiresAt() : options.maxExpiresAt;
20570
+ const refusal = checkChangedExpiration({
20571
+ preparedSiwe: prepared.siwe,
20572
+ signedSiwe: result.signedMessage,
20573
+ now: Date.now(),
20574
+ originalHasRecap,
20575
+ ...maxExpiresAt === void 0 ? {} : { maxExpiresAt }
20576
+ });
20577
+ if (refusal !== null) {
20578
+ throw new Error(`OpenKey signedMessage ${refusal}`);
20579
+ }
20580
+ } else {
20581
+ const changedFields = diffImmutableSiweFields(originalFields, signedFields, {
20582
+ originalHasRecap
20583
+ });
20584
+ if (changedFields.length > 0) {
20585
+ throw new Error(
20586
+ `OpenKey signedMessage altered immutable SIWE fields: ${changedFields.join(", ")}`
20587
+ );
20588
+ }
20524
20589
  }
20525
20590
  let originalCaps;
20526
20591
  let signedCaps;
@@ -22720,14 +22785,14 @@ var _TinyCloudNode = class _TinyCloudNode {
22720
22785
  await this.signInWith(() => this.auth.signInWithOpenKey(authorizeFn, options));
22721
22786
  }
22722
22787
  /** Prepare the OpenKey request before the approval click. */
22723
- async prepareOpenKeySignIn() {
22788
+ async prepareOpenKeySignIn(options) {
22724
22789
  if (!this.signer || !this.tc || !this.auth) {
22725
22790
  throw new Error("Cannot prepare OpenKey sign-in in session-only mode. Provide a signer in config.");
22726
22791
  }
22727
22792
  await this.signOutInFlight;
22728
22793
  await this.accountRegistryTail;
22729
22794
  await this.wasmBindings.ensureInitialized?.();
22730
- return this.auth.prepareOpenKeySignIn();
22795
+ return this.auth.prepareOpenKeySignIn(options);
22731
22796
  }
22732
22797
  /** Start OpenKey authorization synchronously, then complete normal session setup. */
22733
22798
  signInWithPreparedOpenKey(pending, authorizeFn) {
@@ -25311,7 +25376,7 @@ var _TinyCloudNode = class _TinyCloudNode {
25311
25376
  path: "",
25312
25377
  // Root access
25313
25378
  actions: [...ROOT_DELEGATION_ACTIONS],
25314
- expiry: this.getSessionExpiry(),
25379
+ expiry: this.getSignedSessionExpiry(),
25315
25380
  isRevoked: false,
25316
25381
  allowSubDelegation: true
25317
25382
  };
@@ -25324,7 +25389,7 @@ var _TinyCloudNode = class _TinyCloudNode {
25324
25389
  spaceId,
25325
25390
  path: "",
25326
25391
  actions: [...ROOT_DELEGATION_ACTIONS],
25327
- expiry: this.getSessionExpiry(),
25392
+ expiry: this.getSignedSessionExpiry(),
25328
25393
  isRevoked: false,
25329
25394
  allowSubDelegation: true
25330
25395
  });
@@ -25416,7 +25481,7 @@ var _TinyCloudNode = class _TinyCloudNode {
25416
25481
  assertActive: () => graph.assertActive(),
25417
25482
  keyProvider: this._keyProvider,
25418
25483
  registry: this._capabilityRegistry,
25419
- sessionExpiry: this.getSessionExpiry(),
25484
+ sessionExpiry: this.getSignedSessionExpiry(),
25420
25485
  createDelegationWasm: (params) => {
25421
25486
  graph.assertActive();
25422
25487
  return this.createDelegationWrapper(params);
@@ -25463,6 +25528,29 @@ var _TinyCloudNode = class _TinyCloudNode {
25463
25528
  const expirationMs = this.config.sessionExpirationMs ?? DEFAULT_SESSION_EXPIRATION_MS;
25464
25529
  return new Date(Date.now() + expirationMs);
25465
25530
  }
25531
+ /**
25532
+ * The expiry of the session that was actually signed, so the registry root
25533
+ * and the sharing service never outlive or undercut what the SIWE grants
25534
+ * (a user may change the expiry in the OpenKey approval).
25535
+ *
25536
+ * Any expiry the SIWE parses to is used exactly as signed, however near or
25537
+ * far. The configured lifetime is used only when the SIWE cannot be parsed
25538
+ * (the session is already established, so failing sign-in here would be
25539
+ * worse; real sign-ins verify the SIWE first) or when a valid SIWE carries
25540
+ * no `Expiration Time` line, as the other `extractSiweExpiration` callers do.
25541
+ * @internal
25542
+ */
25543
+ getSignedSessionExpiry() {
25544
+ const siwe = this.auth?.tinyCloudSession?.siwe;
25545
+ if (!siwe) return this.getSessionExpiry();
25546
+ let signed2;
25547
+ try {
25548
+ signed2 = extractSiweExpiration(siwe);
25549
+ } catch {
25550
+ return this.getSessionExpiry();
25551
+ }
25552
+ return signed2 ?? this.getSessionExpiry();
25553
+ }
25466
25554
  /**
25467
25555
  * Wrapper for the WASM createDelegation function.
25468
25556
  *
@@ -25492,6 +25580,7 @@ var _TinyCloudNode = class _TinyCloudNode {
25492
25580
  // DID here and rejects the fragment as an invalid audience DID.
25493
25581
  verificationMethod: params.session.verificationMethod.split("#", 1)[0]
25494
25582
  };
25583
+ assertExpiryWithinTechnicalLimit2(params.expirationSecs * 1e3, "ucan");
25495
25584
  const result = this.wasmBindings.createDelegation(
25496
25585
  wasmSession,
25497
25586
  params.delegateDID,
@@ -25524,9 +25613,10 @@ var _TinyCloudNode = class _TinyCloudNode {
25524
25613
  }
25525
25614
  const permissions = ownerDelegationPermissions(params);
25526
25615
  const now = /* @__PURE__ */ new Date();
25527
- if (!(params.expiresAt instanceof Date) || params.expiresAt.getTime() <= now.getTime() || params.expiresAt.getTime() - now.getTime() > EXPIRY3.MAX_MS) {
25528
- throw new Error("Owner delegation expiry must be explicit, future, and within EXPIRY.MAX_MS");
25616
+ if (!(params.expiresAt instanceof Date) || params.expiresAt.getTime() <= now.getTime()) {
25617
+ throw new Error("Owner delegation expiry must be explicit, future, and a valid date");
25529
25618
  }
25619
+ assertExpiryWithinTechnicalLimit2(params.expiresAt, "siwe");
25530
25620
  if (!this.signer) throw new Error("Owner wallet signer is required");
25531
25621
  const session = this.currentTinyCloudSession();
25532
25622
  if (!session) throw new Error("Owner session is required");
@@ -25627,6 +25717,7 @@ var _TinyCloudNode = class _TinyCloudNode {
25627
25717
  * not sent.
25628
25718
  */
25629
25719
  async authorizeShareDeliveryV3(input) {
25720
+ assertExpiryWithinTechnicalLimit2(new Date(input.expiresAt), "siwe");
25630
25721
  const envelopeRef = await shortDeliveryLinkBodyCid(input.shareUrl, input.trustedOrigins);
25631
25722
  const session = this.currentTinyCloudSession();
25632
25723
  const serviceSession = this._serviceContext?.session;
@@ -25679,6 +25770,7 @@ var _TinyCloudNode = class _TinyCloudNode {
25679
25770
  };
25680
25771
  }
25681
25772
  async createRootDelegationForSharing(params, assertActive) {
25773
+ assertExpiryWithinTechnicalLimit2(params.requestedExpiry, "siwe");
25682
25774
  try {
25683
25775
  return (await this.createOwnerDelegation({
25684
25776
  delegateDid: params.shareKeyDID,
@@ -26375,6 +26467,7 @@ var _TinyCloudNode = class _TinyCloudNode {
26375
26467
  if (sessionExpiry !== void 0 && sessionExpiry < expiresAt) {
26376
26468
  expiresAt = sessionExpiry;
26377
26469
  }
26470
+ assertExpiryWithinTechnicalLimit2(expiresAt, "siwe");
26378
26471
  const delegations = [];
26379
26472
  let rawEntriesAttached = false;
26380
26473
  for (const [spaceId, entries] of bySpace) {
@@ -27847,6 +27940,7 @@ var _TinyCloudNode = class _TinyCloudNode {
27847
27940
  const now = /* @__PURE__ */ new Date();
27848
27941
  const expiryMs = params.expiryMs ?? 60 * 60 * 1e3;
27849
27942
  const expirationTime = new Date(now.getTime() + expiryMs);
27943
+ assertExpiryWithinTechnicalLimit2(expirationTime, "siwe");
27850
27944
  const prepared = this.wasmBindings.prepareSession({
27851
27945
  abilities,
27852
27946
  address: this.wasmBindings.ensureEip55(session.address),
@@ -28001,6 +28095,7 @@ var _TinyCloudNode = class _TinyCloudNode {
28001
28095
  const { abilities, rawAbilities } = this.buildActivationAbilities(delegation);
28002
28096
  const now = /* @__PURE__ */ new Date();
28003
28097
  const expirationTime = delegation.expiry;
28098
+ assertExpiryWithinTechnicalLimit2(expirationTime, "siwe");
28004
28099
  const prepared = this.wasmBindings.prepareSession({
28005
28100
  abilities,
28006
28101
  address: this.wasmBindings.ensureEip55(mySession.address),
@@ -28120,6 +28215,7 @@ var _TinyCloudNode = class _TinyCloudNode {
28120
28215
  const now = /* @__PURE__ */ new Date();
28121
28216
  const requestedExpiry = params.expiryMs === void 0 ? parentDelegation.expiry : new Date(now.getTime() + params.expiryMs);
28122
28217
  const actualExpiry = requestedExpiry > parentDelegation.expiry ? parentDelegation.expiry : requestedExpiry;
28218
+ assertExpiryWithinTechnicalLimit2(actualExpiry, "siwe");
28123
28219
  const abilities = {};
28124
28220
  const rawAbilities = {};
28125
28221
  for (const resource of requestedResources) {
@@ -28380,7 +28476,9 @@ function wireOpenKeyAuthorize(openkey, opts) {
28380
28476
  host: input.host,
28381
28477
  // Forward the presentation envelope verbatim — the OpenKey SDK
28382
28478
  // validates and size-bounds it before use.
28383
- presentation: input.presentation
28479
+ presentation: input.presentation,
28480
+ // Sent only when true, so a request without it keeps its prior shape.
28481
+ ...input.expiryChangeable === true ? { expiryChangeable: true } : {}
28384
28482
  }, opts);
28385
28483
  if (result.protocolVersion !== 1) {
28386
28484
  throw new Error(