@tinycloud/node-sdk 2.11.0-beta.10 → 2.11.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ISigner, Bytes, CapabilityPresentationEnvelopeV1, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
2
2
  export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, 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, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, OwnerSharePolicyRegistrationReceipt, ParsedNetworkId, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterOwnerSharePolicyParams, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, 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, StoredDelegationChain, SubscribeOptions, 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, 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, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
3
- export { A as AuthDelegationArtifact, a as AuthRequestArtifact, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, b as DelegateToResult, c as DelegatedAccess, d as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, e as NodeUserAuthorization, f as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, g as RuntimeDelegationActivator, h as RuntimePermissionGrantOptions, S as SecretPermissionHint, i as SecretReadInput, j as SecretReadResult, k as SignStrategy, T as TinyCloudNode, l as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, m as WasmKeyProviderConfig, n as activateValidatedRuntimeDelegation, o as createWasmKeyProvider, p as defaultSignStrategy, q as deserializeDelegation, r as grantAuthRequest, s as serializeDelegation } from './core-BypriIWK.cjs';
3
+ export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, f as DelegateToResult, g as DelegatedAccess, h as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, i as NodeUserAuthorization, j as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, k as RuntimeDelegationActivator, l as RuntimePermissionGrantOptions, S as SecretPermissionHint, m as SecretReadInput, n as SecretReadResult, o as SignStrategy, T as TinyCloudNode, p as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, q as WasmKeyProviderConfig, r as activateValidatedRuntimeDelegation, s as createWasmKeyProvider, t as defaultSignStrategy, u as deserializeDelegation, v as grantAuthRequest, w as serializeDelegation } from './core-9mWw3N8i.cjs';
4
4
  import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
5
5
  import 'events';
6
6
  import '@tinycloud/sdk-services';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ISigner, Bytes, CapabilityPresentationEnvelopeV1, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
2
2
  export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, 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, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, OwnerSharePolicyRegistrationReceipt, ParsedNetworkId, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterOwnerSharePolicyParams, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, 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, StoredDelegationChain, SubscribeOptions, 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, 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, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
3
- export { A as AuthDelegationArtifact, a as AuthRequestArtifact, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, b as DelegateToResult, c as DelegatedAccess, d as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, e as NodeUserAuthorization, f as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, g as RuntimeDelegationActivator, h as RuntimePermissionGrantOptions, S as SecretPermissionHint, i as SecretReadInput, j as SecretReadResult, k as SignStrategy, T as TinyCloudNode, l as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, m as WasmKeyProviderConfig, n as activateValidatedRuntimeDelegation, o as createWasmKeyProvider, p as defaultSignStrategy, q as deserializeDelegation, r as grantAuthRequest, s as serializeDelegation } from './core-BypriIWK.js';
3
+ export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, f as DelegateToResult, g as DelegatedAccess, h as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, i as NodeUserAuthorization, j as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, k as RuntimeDelegationActivator, l as RuntimePermissionGrantOptions, S as SecretPermissionHint, m as SecretReadInput, n as SecretReadResult, o as SignStrategy, T as TinyCloudNode, p as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, q as WasmKeyProviderConfig, r as activateValidatedRuntimeDelegation, s as createWasmKeyProvider, t as defaultSignStrategy, u as deserializeDelegation, v as grantAuthRequest, w as serializeDelegation } from './core-9mWw3N8i.js';
4
4
  import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
5
5
  import 'events';
6
6
  import '@tinycloud/sdk-services';
package/dist/index.js CHANGED
@@ -17179,12 +17179,14 @@ import {
17179
17179
  SharingService,
17180
17180
  UnsupportedFeatureError,
17181
17181
  makePublicSpaceId,
17182
- ACCOUNT_REGISTRY_SPACE,
17182
+ ACCOUNT_REGISTRY_SPACE as ACCOUNT_REGISTRY_SPACE2,
17183
+ BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST,
17183
17184
  BOOTSTRAP_SESSION_REQUESTS,
17184
17185
  SECRET_RECORDS_SCHEMA,
17185
17186
  SECRETS_SPACE as SECRETS_SPACE2,
17186
17187
  TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST,
17187
17188
  bootstrapSteps,
17189
+ ErrorCodes as ErrorCodes2,
17188
17190
  ENCRYPTION_PERMISSION_SERVICE as ENCRYPTION_PERMISSION_SERVICE2,
17189
17191
  CaveatedDelegationUnsupportedError,
17190
17192
  PermissionNotInManifestError,
@@ -17243,6 +17245,8 @@ import {
17243
17245
  extractRecapAttenuations,
17244
17246
  unauthorizedRecapCapabilities,
17245
17247
  parseCanonicalRecapResource,
17248
+ ACCOUNT_REGISTRY_SPACE,
17249
+ ACCOUNT_MANIFEST_PERMISSIONS,
17246
17250
  KV,
17247
17251
  SQL,
17248
17252
  DUCKDB,
@@ -17367,6 +17371,16 @@ function addRawAbility(rawAbilities, resource, action) {
17367
17371
  actions.push(action);
17368
17372
  }
17369
17373
  }
17374
+ function cloneAbilitiesMap(actions) {
17375
+ return Object.fromEntries(
17376
+ Object.entries(actions).map(([service, paths]) => [
17377
+ service,
17378
+ Object.fromEntries(
17379
+ Object.entries(paths).map(([path, pathActions]) => [path, [...pathActions]])
17380
+ )
17381
+ ])
17382
+ );
17383
+ }
17370
17384
  var NodeUserAuthorization = class {
17371
17385
  constructor(config) {
17372
17386
  this.activeSessionKeyId = "default";
@@ -17638,23 +17652,41 @@ var NodeUserAuthorization = class {
17638
17652
  const defaultNetworkId = this.defaultEncryptionNetworkId(address, chainId);
17639
17653
  const primarySpaceId2 = makePkhSpaceId(address, chainId, this.spacePrefix);
17640
17654
  const secretsSpaceId = makePkhSpaceId(address, chainId, "secrets");
17641
- return {
17642
- abilities: this.defaultActions,
17643
- spaceId: primarySpaceId2,
17644
- spaceAbilities: {
17645
- [primarySpaceId2]: this.defaultActions,
17646
- [secretsSpaceId]: {
17647
- kv: {
17648
- "vault/secrets/": [
17649
- KV.GET,
17650
- KV.PUT,
17651
- KV.DEL,
17652
- KV.LIST,
17653
- KV.METADATA
17654
- ]
17655
+ const primaryActions = this.includeAccountRegistryPermissions && this.spacePrefix === ACCOUNT_REGISTRY_SPACE ? cloneAbilitiesMap(this.defaultActions) : this.defaultActions;
17656
+ const spaceAbilities2 = {
17657
+ [primarySpaceId2]: primaryActions,
17658
+ [secretsSpaceId]: {
17659
+ kv: {
17660
+ "vault/secrets/": [
17661
+ KV.GET,
17662
+ KV.PUT,
17663
+ KV.DEL,
17664
+ KV.LIST,
17665
+ KV.METADATA
17666
+ ]
17667
+ }
17668
+ }
17669
+ };
17670
+ if (this.includeAccountRegistryPermissions && this.spacePrefix !== ACCOUNT_REGISTRY_SPACE) {
17671
+ spaceAbilities2[makePkhSpaceId(address, chainId, ACCOUNT_REGISTRY_SPACE)] = resourceCapabilitiesToAbilitiesMap(ACCOUNT_MANIFEST_PERMISSIONS);
17672
+ } else if (this.includeAccountRegistryPermissions) {
17673
+ const accountAbilities = resourceCapabilitiesToAbilitiesMap(
17674
+ ACCOUNT_MANIFEST_PERMISSIONS
17675
+ );
17676
+ for (const [service, paths] of Object.entries(accountAbilities)) {
17677
+ const existingPaths = primaryActions[service] ?? (primaryActions[service] = {});
17678
+ for (const [path, actions] of Object.entries(paths)) {
17679
+ const existingActions = existingPaths[path] ?? (existingPaths[path] = []);
17680
+ for (const action of actions) {
17681
+ if (!existingActions.includes(action)) existingActions.push(action);
17655
17682
  }
17656
17683
  }
17657
- },
17684
+ }
17685
+ }
17686
+ return {
17687
+ abilities: primaryActions,
17688
+ spaceId: primarySpaceId2,
17689
+ spaceAbilities: spaceAbilities2,
17658
17690
  rawAbilities: {
17659
17691
  [defaultNetworkId]: [DECRYPT_ACTION, NETWORK_CREATE_ACTION]
17660
17692
  }
@@ -19133,6 +19165,9 @@ var DEFAULT_HOST = "https://node.tinycloud.xyz";
19133
19165
  var DEFAULT_ENCRYPTION_NETWORK_NAME = "default";
19134
19166
  var NETWORK_CREATE_ACTION2 = ENCRYPTION2.NETWORK_CREATE;
19135
19167
  var DECRYPT_ACTION2 = ENCRYPTION2.DECRYPT;
19168
+ var BOOTSTRAP_COMPLETION_MARKER_KEY = "system/bootstrap/complete";
19169
+ var BOOTSTRAP_COMPLETION_MARKER_VERSION = 1;
19170
+ var ACCEPTED_MARKER_VERSIONS = [BOOTSTRAP_COMPLETION_MARKER_VERSION];
19136
19171
  var NETWORK_ADMIN_TYPE = "tinycloud.encryption.network-admin/v1";
19137
19172
  function isSecretPayload(value) {
19138
19173
  return typeof value === "object" && value !== null && "value" in value && typeof value.value === "string" && "createdAt" in value && typeof value.createdAt === "string" && "updatedAt" in value && typeof value.updatedAt === "string";
@@ -19540,9 +19575,12 @@ var _TinyCloudNode = class _TinyCloudNode {
19540
19575
  this._bootstrapSkipped = false;
19541
19576
  /**
19542
19577
  * Outcome of the last signIn()'s account-bootstrap attempt. `skipped` is
19543
- * true when bootstrap did not complete (interactive signer, auto-sign
19544
- * denied, or a bootstrap step failed); `reason` carries the cause so apps
19545
- * can surface a "finish account setup" call-to-action. `warnings` is
19578
+ * true when bootstrap did not complete in this invocation (interactive signer,
19579
+ * auto-bootstrap disabled, already provisioned, or a decision/provisioning
19580
+ * step failed). `already-provisioned` means the bootstrap was not run here;
19581
+ * it does not mean a prior provisioning attempt failed to complete.
19582
+ * `reason` carries the cause so apps can surface a "finish account setup"
19583
+ * call-to-action. `warnings` is
19546
19584
  * present when bootstrap completed, but one or more steps recovered from
19547
19585
  * an ambiguous failure (e.g. a KV batch write reconciled via per-space
19548
19586
  * fallback) — clean vs. recovered runs are otherwise byte-identical.
@@ -19725,7 +19763,7 @@ var _TinyCloudNode = class _TinyCloudNode {
19725
19763
  nonce: config.nonce,
19726
19764
  siweConfig: config.siweConfig,
19727
19765
  manifest: useBootstrapSignInRequest ? void 0 : config.manifest,
19728
- capabilityRequest: useBootstrapSignInRequest ? BOOTSTRAP_SESSION_REQUESTS.default : config.capabilityRequest,
19766
+ capabilityRequest: useBootstrapSignInRequest ? config.includeAccountRegistryPermissions === false ? BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST : BOOTSTRAP_SESSION_REQUESTS.default : config.capabilityRequest,
19729
19767
  includeAccountRegistryPermissions: useBootstrapSignInRequest ? false : config.includeAccountRegistryPermissions
19730
19768
  });
19731
19769
  this.tc = new TinyCloud(this.auth, {
@@ -19865,7 +19903,7 @@ var _TinyCloudNode = class _TinyCloudNode {
19865
19903
  if (!this._address) {
19866
19904
  return void 0;
19867
19905
  }
19868
- return this.wasmBindings.makeSpaceId(this._address, this._chainId, ACCOUNT_REGISTRY_SPACE);
19906
+ return this.wasmBindings.makeSpaceId(this._address, this._chainId, ACCOUNT_REGISTRY_SPACE2);
19869
19907
  }
19870
19908
  /**
19871
19909
  * Account-level application and delegation helpers.
@@ -19968,6 +20006,7 @@ var _TinyCloudNode = class _TinyCloudNode {
19968
20006
  this._bootstrapSkipped = false;
19969
20007
  this._bootstrapStatus = { skipped: false };
19970
20008
  if (this.config.autoBootstrapAccount === false) {
20009
+ this._bootstrapStatus = { skipped: true, reason: "auto-bootstrap-disabled" };
19971
20010
  return false;
19972
20011
  }
19973
20012
  if (!this.auth || !this._address) {
@@ -19982,11 +20021,14 @@ var _TinyCloudNode = class _TinyCloudNode {
19982
20021
  return false;
19983
20022
  }
19984
20023
  const steps = bootstrapSteps(this._address, this._chainId);
19985
- if (!await this.isFreshBootstrapAccount(steps)) {
19986
- return false;
19987
- }
19988
20024
  try {
19989
- const warnings = await this.runAccountBootstrap(steps);
20025
+ const decision = await this.resolveBootstrapDecision(steps);
20026
+ if (decision.action === "skip") {
20027
+ this._bootstrapStatus = { skipped: true, reason: "already-provisioned" };
20028
+ return false;
20029
+ }
20030
+ const warnings = await this.runAccountBootstrap(steps, { mode: decision.mode });
20031
+ await this.writeBootstrapCompletionMarker(steps);
19990
20032
  if (warnings.length > 0) {
19991
20033
  this._bootstrapStatus = { skipped: false, warnings };
19992
20034
  this.notificationHandler.warning(
@@ -20005,32 +20047,92 @@ var _TinyCloudNode = class _TinyCloudNode {
20005
20047
  }
20006
20048
  return true;
20007
20049
  }
20008
- async isFreshBootstrapAccount(steps) {
20050
+ async resolveBootstrapDecision(steps) {
20009
20051
  const enshrinedSpaceIds = /* @__PURE__ */ new Set();
20010
20052
  for (const step of steps) {
20011
20053
  if (step.kind === "session") {
20012
20054
  enshrinedSpaceIds.add(step.spaceId);
20013
20055
  }
20014
20056
  }
20015
- const skipped = this.auth.lastActivationSkippedSpaceIds;
20057
+ const auth = this.auth;
20058
+ if (!auth) {
20059
+ throw new Error("Account bootstrap requires an active wallet session");
20060
+ }
20061
+ const skipped = auth.lastActivationSkippedSpaceIds;
20016
20062
  if (skipped.some((spaceId) => enshrinedSpaceIds.has(spaceId))) {
20017
- return true;
20063
+ return { action: "run", mode: "fresh" };
20018
20064
  }
20019
20065
  try {
20020
- const indexed = await this.account.index.spaces.list();
20021
- if (indexed.ok && indexed.data.length === 0) {
20022
- return true;
20066
+ const accountSpaceId = this.ownedSpaceId(ACCOUNT_REGISTRY_SPACE2);
20067
+ const markerPermission = {
20068
+ service: "tinycloud.kv",
20069
+ space: accountSpaceId,
20070
+ path: BOOTSTRAP_COMPLETION_MARKER_KEY,
20071
+ actions: ["get"]
20072
+ };
20073
+ if (!this.hasRuntimePermissions([markerPermission])) {
20074
+ return { action: "run", mode: "repair" };
20023
20075
  }
20024
- } catch {
20076
+ const marker = await this.readBootstrapCompletionMarker();
20077
+ if (marker.ok) {
20078
+ if (this.isAcceptedBootstrapCompletionMarker(marker.data.data)) {
20079
+ return { action: "skip" };
20080
+ }
20081
+ return { action: "run", mode: "repair" };
20082
+ }
20083
+ if (marker.error.code === ErrorCodes2.KV_NOT_FOUND && this.markerReadIsUnhostedSpace(marker.error.meta)) {
20084
+ return { action: "run", mode: "fresh" };
20085
+ }
20086
+ } catch (err) {
20087
+ const reason = err instanceof Error ? err.message : String(err);
20088
+ this.notificationHandler.warning(
20089
+ `Account bootstrap decision failed; attempting one bounded repair: ${reason}`
20090
+ );
20091
+ console.warn(`[TinyCloudNode] account bootstrap decision failed: ${reason}`);
20092
+ return { action: "run", mode: "repair" };
20025
20093
  }
20026
- try {
20027
- const spaces = await this.account.spaces.list();
20028
- return spaces.ok && spaces.data.length === 0;
20029
- } catch {
20030
- return false;
20094
+ return { action: "run", mode: "repair" };
20095
+ }
20096
+ async readBootstrapCompletionMarker() {
20097
+ return this.kvForSpace(this.ownedSpaceId(ACCOUNT_REGISTRY_SPACE2)).get(
20098
+ BOOTSTRAP_COMPLETION_MARKER_KEY
20099
+ );
20100
+ }
20101
+ async writeBootstrapCompletionMarker(steps) {
20102
+ if (!this._address) {
20103
+ throw new Error("Bootstrap completion marker requires an active wallet session");
20031
20104
  }
20105
+ const canonicalStepIds = new Set(
20106
+ bootstrapSteps(this._address, this._chainId).map((step) => step.id)
20107
+ );
20108
+ const providedStepIds = new Set(steps.map((step) => step.id));
20109
+ if (canonicalStepIds.size !== providedStepIds.size || [...canonicalStepIds].some((stepId) => !providedStepIds.has(stepId))) {
20110
+ throw new Error("Bootstrap completion marker requires the canonical bootstrap step set");
20111
+ }
20112
+ const marker = {
20113
+ v: BOOTSTRAP_COMPLETION_MARKER_VERSION,
20114
+ stepIds: [...canonicalStepIds],
20115
+ completedAt: (/* @__PURE__ */ new Date()).toISOString()
20116
+ };
20117
+ const written = await this.kvForSpace(this.ownedSpaceId(ACCOUNT_REGISTRY_SPACE2)).put(
20118
+ BOOTSTRAP_COMPLETION_MARKER_KEY,
20119
+ marker
20120
+ );
20121
+ if (!written.ok) {
20122
+ throw new Error(`Failed to write bootstrap completion marker: ${written.error.message}`);
20123
+ }
20124
+ }
20125
+ isAcceptedBootstrapCompletionMarker(value) {
20126
+ if (typeof value !== "object" || value === null) return false;
20127
+ const entries = Object.entries(value);
20128
+ const markerValue = (name) => entries.find(([key2]) => key2 === name)?.[1];
20129
+ const version23 = markerValue("v");
20130
+ return typeof version23 === "number" && Number.isInteger(version23) && ACCEPTED_MARKER_VERSIONS.some((acceptedVersion) => acceptedVersion === version23);
20131
+ }
20132
+ markerReadIsUnhostedSpace(meta) {
20133
+ return meta?.status === 404;
20032
20134
  }
20033
- async runAccountBootstrap(steps) {
20135
+ async runAccountBootstrap(steps, { mode } = { mode: "fresh" }) {
20034
20136
  if (!this.auth || !this._address) {
20035
20137
  throw new Error("Account bootstrap requires an active wallet session");
20036
20138
  }
@@ -20131,9 +20233,8 @@ var _TinyCloudNode = class _TinyCloudNode {
20131
20233
  if (step.kind === "seed-applications") {
20132
20234
  const registered = await this.account.applications.register(
20133
20235
  step.manifests.length > 0 ? [...step.manifests] : TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST,
20134
- // Bootstrap only runs on an account with no registry records, so the
20135
- // manifest-hash pre-read is definitionally a miss. Skip it; the write
20136
- // it guards is an INSERT OR REPLACE and is safe to repeat.
20236
+ // The write is an INSERT OR REPLACE and is safe to repeat during a
20237
+ // repair, so skip the manifest-hash pre-read.
20137
20238
  { assumeUnregistered: true }
20138
20239
  );
20139
20240
  if (!registered.ok) {
@@ -20141,7 +20242,7 @@ var _TinyCloudNode = class _TinyCloudNode {
20141
20242
  }
20142
20243
  }
20143
20244
  if (step.kind === "encryption-network-create") {
20144
- await this.ensureEncryptionNetwork(step.networkId, { assumeMissing: true });
20245
+ await this.ensureEncryptionNetwork(step.networkId, { assumeMissing: mode === "fresh" });
20145
20246
  }
20146
20247
  if (step.kind === "secret-records-schema") {
20147
20248
  const db = this.sqlForSpace(step.spaceId).db(step.database);
@@ -20324,7 +20425,7 @@ var _TinyCloudNode = class _TinyCloudNode {
20324
20425
  if (!this.auth || !this.signer) {
20325
20426
  throw new Error("Manifest registry write requires wallet mode");
20326
20427
  }
20327
- const accountSpaceId = this.ownedSpaceId(ACCOUNT_REGISTRY_SPACE);
20428
+ const accountSpaceId = this.ownedSpaceId(ACCOUNT_REGISTRY_SPACE2);
20328
20429
  await this.ensureOwnedSpaceHostedById(accountSpaceId);
20329
20430
  const result = await this.account.applications.register(request.manifests);
20330
20431
  if (!result.ok) {
@@ -21190,7 +21291,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21190
21291
  nonce: this.config.nonce,
21191
21292
  siweConfig: this.config.siweConfig,
21192
21293
  manifest: useBootstrapSignInRequest ? void 0 : this.config.manifest,
21193
- capabilityRequest: useBootstrapSignInRequest ? BOOTSTRAP_SESSION_REQUESTS.default : this.config.capabilityRequest,
21294
+ capabilityRequest: useBootstrapSignInRequest ? this.config.includeAccountRegistryPermissions === false ? BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST : BOOTSTRAP_SESSION_REQUESTS.default : this.config.capabilityRequest,
21194
21295
  includeAccountRegistryPermissions: useBootstrapSignInRequest ? false : this.config.includeAccountRegistryPermissions
21195
21296
  });
21196
21297
  this.tc = new TinyCloud(this.auth, {
@@ -21243,7 +21344,7 @@ var _TinyCloudNode = class _TinyCloudNode {
21243
21344
  nonce: this.config.nonce,
21244
21345
  siweConfig: this.config.siweConfig,
21245
21346
  manifest: useBootstrapSignInRequest ? void 0 : this.config.manifest,
21246
- capabilityRequest: useBootstrapSignInRequest ? BOOTSTRAP_SESSION_REQUESTS.default : this.config.capabilityRequest,
21347
+ capabilityRequest: useBootstrapSignInRequest ? this.config.includeAccountRegistryPermissions === false ? BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST : BOOTSTRAP_SESSION_REQUESTS.default : this.config.capabilityRequest,
21247
21348
  includeAccountRegistryPermissions: useBootstrapSignInRequest ? false : this.config.includeAccountRegistryPermissions
21248
21349
  });
21249
21350
  this.tc = new TinyCloud(this.auth, {
@@ -23992,35 +24093,44 @@ var _TinyCloudNode = class _TinyCloudNode {
23992
24093
  if (parentDelegation.disableSubDelegation) {
23993
24094
  throw new Error("Parent delegation does not allow sub-delegation");
23994
24095
  }
23995
- if (!params.path.startsWith(parentDelegation.path)) {
24096
+ const parentResources = parentDelegation.resources ?? [{
24097
+ service: parentDelegation.actions[0]?.split("/", 1)[0]?.replace(/^tinycloud\./, "") ?? "kv",
24098
+ space: parentDelegation.spaceId,
24099
+ path: parentDelegation.path,
24100
+ actions: parentDelegation.actions
24101
+ }];
24102
+ const requestedResources = params.resources ?? [{
24103
+ service: params.actions[0]?.split("/", 1)[0]?.replace(/^tinycloud\./, "") ?? "kv",
24104
+ space: parentDelegation.spaceId,
24105
+ path: params.path,
24106
+ actions: params.actions
24107
+ }];
24108
+ const resourceIsContained = (parent, child) => {
24109
+ const parentEncryption = parent.service === "encryption" || parent.service === "tinycloud.encryption";
24110
+ const childEncryption = child.service === "encryption" || child.service === "tinycloud.encryption";
24111
+ if (parentEncryption || childEncryption) return parentEncryption && childEncryption && parent.path === child.path && child.actions.every((action) => parent.actions.includes(action));
24112
+ const pathContained = parent.path === child.path || parent.path.endsWith("/") && child.path.startsWith(parent.path) || child.path.startsWith(`${parent.path}/`);
24113
+ return pathContained && child.actions.every((action) => parent.actions.includes(action));
24114
+ };
24115
+ if (requestedResources.length === 0 || requestedResources.some((child) => !parentResources.some((parent) => resourceIsContained(parent, child)))) {
23996
24116
  throw new Error(
23997
- `Sub-delegation path "${params.path}" must be within parent path "${parentDelegation.path}"`
24117
+ "Sub-delegation resources exceed the received delegation"
23998
24118
  );
23999
24119
  }
24000
- const parentActions = new Set(parentDelegation.actions);
24001
- for (const action of params.actions) {
24002
- if (!parentActions.has(action)) {
24003
- throw new Error(
24004
- `Sub-delegation action "${action}" is not in parent's actions: ${parentDelegation.actions.join(", ")}`
24005
- );
24006
- }
24007
- }
24008
24120
  const now = /* @__PURE__ */ new Date();
24009
24121
  const expiryMs = params.expiryMs ?? 60 * 60 * 1e3;
24010
24122
  const requestedExpiry = new Date(now.getTime() + expiryMs);
24011
24123
  const actualExpiry = requestedExpiry > parentDelegation.expiry ? parentDelegation.expiry : requestedExpiry;
24012
24124
  const abilities = {};
24013
- const kvActions = params.actions.filter((a) => a.startsWith("tinycloud.kv/"));
24014
- const sqlActions = params.actions.filter((a) => a.startsWith("tinycloud.sql/"));
24015
- const duckdbActions = params.actions.filter((a) => a.startsWith("tinycloud.duckdb/"));
24016
- if (kvActions.length > 0) {
24017
- abilities.kv = { [params.path]: kvActions };
24018
- }
24019
- if (sqlActions.length > 0) {
24020
- abilities.sql = { [params.path]: sqlActions };
24021
- }
24022
- if (duckdbActions.length > 0) {
24023
- abilities.duckdb = { [params.path]: duckdbActions };
24125
+ const rawAbilities = {};
24126
+ for (const resource of requestedResources) {
24127
+ const service = resource.service.replace(/^tinycloud\./, "");
24128
+ if (service === "encryption") {
24129
+ rawAbilities[resource.path] = [...resource.actions];
24130
+ continue;
24131
+ }
24132
+ abilities[service] ?? (abilities[service] = {});
24133
+ abilities[service][resource.path] = [...resource.actions];
24024
24134
  }
24025
24135
  const targetHost = parentDelegation.host ?? this.config.host;
24026
24136
  const prepared = this.wasmBindings.prepareSession({
@@ -24032,7 +24142,8 @@ var _TinyCloudNode = class _TinyCloudNode {
24032
24142
  expirationTime: actualExpiry.toISOString(),
24033
24143
  spaceId: parentDelegation.spaceId,
24034
24144
  delegateUri: params.delegateDID,
24035
- parents: [parentDelegation.cid]
24145
+ parents: [parentDelegation.cid],
24146
+ ...Object.keys(rawAbilities).length > 0 ? { rawAbilities } : {}
24036
24147
  });
24037
24148
  const signature2 = await this.signer.signMessage(prepared.siwe);
24038
24149
  const subDelegationSession = this.wasmBindings.completeSessionSetup({
@@ -24050,14 +24161,20 @@ var _TinyCloudNode = class _TinyCloudNode {
24050
24161
  cid: subDelegationSession.delegationCid,
24051
24162
  delegationHeader: subDelegationSession.delegationHeader,
24052
24163
  spaceId: parentDelegation.spaceId,
24053
- path: params.path,
24054
- actions: params.actions,
24164
+ path: requestedResources[0].path,
24165
+ actions: requestedResources[0].actions,
24055
24166
  disableSubDelegation: params.disableSubDelegation ?? false,
24056
24167
  expiry: actualExpiry,
24057
24168
  delegateDID: params.delegateDID,
24058
24169
  ownerAddress: parentDelegation.ownerAddress,
24059
24170
  chainId: parentDelegation.chainId,
24060
- host: targetHost
24171
+ host: targetHost,
24172
+ resources: requestedResources.map((resource) => ({
24173
+ service: resource.service.replace(/^tinycloud\./, ""),
24174
+ space: resource.service.replace(/^tinycloud\./, "") === "encryption" ? "encryption" : resource.space ?? parentDelegation.spaceId,
24175
+ path: resource.path,
24176
+ actions: [...resource.actions]
24177
+ }))
24061
24178
  };
24062
24179
  }
24063
24180
  };
@@ -24277,7 +24394,7 @@ function wireOpenKeyAuthorize(openkey) {
24277
24394
  // src/index.ts
24278
24395
  import {
24279
24396
  ACCOUNT_REGISTRY_PATH,
24280
- ACCOUNT_REGISTRY_SPACE as ACCOUNT_REGISTRY_SPACE2,
24397
+ ACCOUNT_REGISTRY_SPACE as ACCOUNT_REGISTRY_SPACE3,
24281
24398
  DEFAULT_MANIFEST_SPACE as DEFAULT_MANIFEST_SPACE2,
24282
24399
  DEFAULT_MANIFEST_VERSION,
24283
24400
  VAULT_PERMISSION_SERVICE,
@@ -24385,6 +24502,14 @@ function signedAuthorityFromCompactUcan(authorization) {
24385
24502
  if (typeof payload.aud !== "string" || payload.aud.length === 0) {
24386
24503
  throw new Error("Validated runtime delegation is missing a signed audience.");
24387
24504
  }
24505
+ if (typeof payload.iss !== "string" || payload.iss.length === 0) {
24506
+ throw new Error("Validated runtime delegation is missing a signed issuer.");
24507
+ }
24508
+ if (!Array.isArray(payload.prf) || payload.prf.some(
24509
+ (proof) => typeof proof !== "string" || proof.length === 0
24510
+ )) {
24511
+ throw new Error("Validated runtime delegation has malformed signed proofs.");
24512
+ }
24388
24513
  if (typeof payload.exp !== "number" || !Number.isFinite(payload.exp)) {
24389
24514
  throw new Error("Validated runtime delegation is missing a signed expiry.");
24390
24515
  }
@@ -24395,6 +24520,11 @@ function signedAuthorityFromCompactUcan(authorization) {
24395
24520
  if (payload.att === null || typeof payload.att !== "object" || Array.isArray(payload.att)) {
24396
24521
  throw new Error("Validated runtime delegation is missing a signed attenuation.");
24397
24522
  }
24523
+ const fact = Array.isArray(payload.fct) && payload.fct.length > 0 && payload.fct[0] !== null && typeof payload.fct[0] === "object" && !Array.isArray(payload.fct[0]) ? payload.fct[0] : void 0;
24524
+ const remainingRedelegationDepth = fact?.remainingRedelegationDepth;
24525
+ if (remainingRedelegationDepth !== void 0 && (!Number.isInteger(remainingRedelegationDepth) || remainingRedelegationDepth < 0 || remainingRedelegationDepth > 8)) {
24526
+ throw new Error("Validated runtime delegation has invalid signed redelegation depth.");
24527
+ }
24398
24528
  const permissions = [];
24399
24529
  for (const [resource, abilities] of Object.entries(payload.att)) {
24400
24530
  if (abilities === null || typeof abilities !== "object" || Array.isArray(abilities)) {
@@ -24445,8 +24575,11 @@ function signedAuthorityFromCompactUcan(authorization) {
24445
24575
  ...permission.caveats === void 0 ? {} : { caveats: permission.caveats }
24446
24576
  }));
24447
24577
  return {
24578
+ issuer: payload.iss,
24448
24579
  audience: payload.aud,
24449
24580
  expiry,
24581
+ proofs: [...payload.prf],
24582
+ ...remainingRedelegationDepth === void 0 ? {} : { remainingRedelegationDepth },
24450
24583
  permissions: canonicalPermissions,
24451
24584
  resources: canonicalResources
24452
24585
  };
@@ -24537,6 +24670,13 @@ async function activateValidatedRuntimeDelegation(node, delegation, options) {
24537
24670
  delegationHeader: { Authorization: authorization },
24538
24671
  ownerAddress: delegation.ownerAddress,
24539
24672
  chainId: delegation.chainId,
24673
+ delegatorDID: signed2.issuer,
24674
+ ...signed2.proofs.length === 1 ? { parentCid: signed2.proofs[0] } : {},
24675
+ ...signed2.remainingRedelegationDepth === void 0 ? {} : {
24676
+ allowSubDelegation: signed2.remainingRedelegationDepth > 0,
24677
+ disableSubDelegation: signed2.remainingRedelegationDepth === 0
24678
+ },
24679
+ authHeader: authorization,
24540
24680
  spaceId: signedSpace ?? delegation.spaceId,
24541
24681
  path: primary.path,
24542
24682
  actions: [...primary.actions],
@@ -24711,10 +24851,13 @@ import {
24711
24851
  } from "@tinycloud/sdk-core";
24712
24852
  import { ServiceContext as ServiceContext3 } from "@tinycloud/sdk-core";
24713
24853
  export {
24854
+ ACCEPTED_MARKER_VERSIONS,
24714
24855
  ACCOUNT_REGISTRY_PATH,
24715
- ACCOUNT_REGISTRY_SPACE2 as ACCOUNT_REGISTRY_SPACE,
24856
+ ACCOUNT_REGISTRY_SPACE3 as ACCOUNT_REGISTRY_SPACE,
24716
24857
  AccountService,
24717
24858
  AutoApproveSpaceCreationHandler2 as AutoApproveSpaceCreationHandler,
24859
+ BOOTSTRAP_COMPLETION_MARKER_KEY,
24860
+ BOOTSTRAP_COMPLETION_MARKER_VERSION,
24718
24861
  CapabilityKeyRegistry2 as CapabilityKeyRegistry,
24719
24862
  CapabilityKeyRegistryErrorCodes,
24720
24863
  CaveatedDelegationUnsupportedError2 as CaveatedDelegationUnsupportedError,