@tinycloud/sdk-core 3.8.0-beta.3 → 3.8.0-beta.5

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
@@ -5,8 +5,8 @@ export { canonicalEmailDomain, canonicalMailbox, isCanonicalEmailDomain, mailbox
5
5
  import { InvokeFunction, InvokeAnyFunction, ParsedNetworkId, ServiceError, Result, FetchFunction, ServiceConstructor, RetryPolicy, TelemetryConfig, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService, IEncryptionService, ISecretsService, ServiceSession, IDatabaseHandle, SqlValue, QueryResponse } from '@tinycloud/sdk-services';
6
6
  export { AuthorityRefusal, AuthorizationVerdict, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CanonicalDecryptRequest, CanonicalJson, ColumnInfo, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, 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, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IEncryptionService, IHooksService, IKVService, IPrefixedKVService, ISQLService, ISecretsService, IService, IServiceContext, IStorageService, InlineEncryptedEnvelope, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVBatchReadResponse, KVChange, KVChangesAuthority, KVChangesOptions, KVChangesResponse, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListPage, KVListResponse, KVPutOptions, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, MAX_SECRET_SCOPE_LENGTH, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PinnedKey, PrefixedKVService, PurgeTarget, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaLocalEraseOutcome, ReplicaPurgeError, ReplicaPurgeFailedEvent, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedReplicationOptions, ResolvedSecretPath, Result, RetryPolicy, SECRET_NAME_RE, SECRET_SCOPE_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_NEARLY_FULL_RATIO, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretPutOptions, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SignedReceiverKeyInput, SqlStatement, SqlValue, StorageAccountUsage, StorageFullEvent, StorageFullHandler, StorageFullMonitor, StorageRejectionDetails, StorageStatus, StorageStatusOptions, StorageUsage, StorageUsageState, SubscribeOptions, TC832_RESERVED_SCOPES, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, appSecretScope, authorizationVerdictOf, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalizeEncryptionJson, canonicalizeSecretScope, checkDecryptInvocationInput, clearTinyCloudDebugLogs, createVaultCrypto, decryptEnvelopeWithKey, defaultRetryPolicy, deriveSignedReceiverKey, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, base64Decode as encryptionBase64Decode, base64Encode as encryptionBase64Encode, encryptionError, utf8Decode as encryptionUtf8Decode, utf8Encode as encryptionUtf8Encode, ensureNetworkUsableForDecrypt, err, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isNetworkId, isStorageFullError, networkDiscoveryKey, ok, openWrappedKey, parseCapabilityResource, parseNetworkId, parseSecretCatalogKey, parseStorageRejection, parseStorageStatus, resolveSecretListPrefix, resolveSecretPath, serviceError, storageUsageState, tinyCloudDebugLogger, validateEnvelope, validatedCapabilityOf, verifyDecryptResponse } from '@tinycloud/sdk-services';
7
7
  export { HOLDER_KEY_BINDING_PRESENTATION_SCHEMA, HolderKeyBindingPresentation, LISTEN_SQL_STATEMENT_CATALOG, ListenSqlStatementName, POLICY_ENGINE_CHALLENGE_REQUEST_SCHEMA, POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA, POLICY_ENGINE_DENIAL_SCHEMA, POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES, POLICY_ENGINE_RESOLVE_REQUEST_SCHEMA, PORTABLE_DELEGATION_SCHEMA, PolicyEngineGrantPresentationDenialCode, PortableDelegation, REQUESTER_ENGINE_RETRY_ATTEMPTS, REQUESTER_ENGINE_RETRY_MAX_DELAY_MS, REQUESTER_NEAR_EXPIRY_SECONDS, RequesterEndpointResolution, RequesterHttpRequest, RequesterHttpResponse, RequesterInvocationCapability, RequesterSigningCapability, RequesterTransport, TranscriptRequester, TranscriptRequesterError, TranscriptRequesterErrorCode, TranscriptRequesterErrorState, TranscriptRequesterOptions, TranscriptRequesterReadKvResult, TranscriptRequesterReadSqlResult, createTranscriptRequester, deriveDelegationCid, parseNodeNativePortableDelegation } from './requester/index.cjs';
8
- import { o as Delegation, e as CreateDelegationParams, G as GenerateShareParams, aG as ShareLink, bg as SpaceInfo, I as ICapabilityKeyRegistry, H as ISharingService, w as DelegationManager, a as AccountDelegationQueryOptions, A as AccountDelegationPage, z as DelegationRevocationReceipt } from './recipient-types.schema-BApcOn1t.cjs';
9
- export { b as AccountDelegationRecord, c as AccountDelegationResource, C as CREDENTIAL_INVITATION_REQUEST_DOMAIN, d as CapabilityEntry, bT as CapabilityKeyRegistry, bU as CapabilityKeyRegistryErrorCode, bV as CapabilityKeyRegistryErrorCodes, f as CreateDelegationWasmParams, g as CreateDelegationWasmResult, h as CreateOwnerDelegationParams, i as CredentialInvitationRequest, j as DELIVERY_ADMISSION_DOMAIN, k as DelegateReceivedShareParams, l as DelegatedResource, m as DelegatedShareAccess, n as DelegatedShareKey, p as DelegationApiResponse, q as DelegationChain, r as DelegationChainV2, s as DelegationDirection, D as DelegationError, t as DelegationErrorCode, u as DelegationErrorCodes, v as DelegationFilters, x as DelegationManagerConfig, y as DelegationRecord, R as DelegationResult, B as DelegationStatus, E as DeliveryAdmission, F as EncodedShareData, J as IngestOptions, K as JWK, L as KeyInfo, M as KeyProvider, N as KeyType, O as MAX_CONTENT_BYTES, P as MAX_SEALED_SHARE_CONTENT_BYTES, Q as MAX_SHARE_ARTIFACT_BYTES, S as MAX_SHARE_CONTENT_BYTES, T as MemorySenderShareKeyStorage, U as MemorySenderShareRecordStorage, V as MemoryShareCache, W as OwnerDelegationPermission, X as OwnerDelegationReceipt, Y as OwnerShareAction, Z as OwnerShareDecryption, _ as OwnerShareMatcher, $ as OwnerSharePolicyRegistration, a0 as OwnerSharePolicyRegistrationReceipt, a1 as OwnerSharePolicyV2, a2 as PortableDelegationImportReceipt, a3 as ReceiveOptions, a4 as RegisterOwnerSharePolicyParams, a5 as SenderShareKeyStorage, a6 as SenderShareRecord, a7 as SenderShareRecordStorage, a8 as SenderShareRevocationScope, a9 as SenderShareStore, aa as ShareAccess, ab as ShareAccessError, ac as ShareAccessV2, ad as ShareAction, af as ShareAddressedDelegationEnvelopeV2, ag as ShareAddressedDelegationEnvelopeV2Schema, ah as ShareAddressedDelegationRequestV2, ai as ShareAddressedDelegationRequestV2Schema, aj as ShareAddressedDelegationResponseV2, ak as ShareAddressedDelegationResponseV2Schema, al as ShareAddressedRecipientMatcher, am as ShareArtifactInput, an as ShareArtifactResult, ao as ShareArtifactV2, ap as ShareCache, aq as ShareCacheEntry, ar as ShareCacheKey, as as ShareCacheMetadata, at as ShareCapabilityLike, au as ShareConflict, av as ShareContentMetadata, aw as ShareContentSource, ax as ShareDelegationPreflight, ay as ShareDeliveryAuthorizationV3Receipt, az as ShareDeliveryAuthorizationV3Request, aA as ShareDeliveryRefusedError, aB as ShareDetachedProof, aC as ShareEnvelopeError, aD as ShareEnvelopeV2, aE as ShareExpiryBounds, aF as ShareKvContentSource, aH as ShareLinkData, aI as ShareLinkLocation, aJ as ShareListEntry, aK as ShareListResult, aL as ShareNativeAction, aM as ShareNativeInvokeEnvelopeV1, aN as ShareNativeInvokeErrorResult, aO as ShareNativeInvokeInput, aP as ShareNativeInvokeResult, aQ as ShareNativeInvokeSuccessResult, aR as ShareNativeResponse, aS as ShareNativeResponseSchema, aT as SharePolicy, aU as SharePolicyBinding, aV as SharePolicySession, aW as SharePolicySessionV1, aX as SharePolicySessionWireV1, aY as SharePortableDelegation, aZ as ShareReadInvocationV1, a_ as ShareReadResult, a$ as ShareRecipientClient, b0 as ShareRecipientClientOptions, b2 as ShareRecipientPolicy, b4 as ShareRecipientResult, b5 as ShareRecipientTarget, b7 as ShareResource, b9 as ShareSaveOptions, ba as ShareSchema, bb as ShareSqlContentSource, bc as ShareWireAction, bd as SharingService, be as SharingServiceConfig, bf as SignedDelegation, bh as SpaceOwnership, bW as StoredDelegationChain, bi as VerifyShareEnvelopeOptions, bj as canonicalOwnerSharePolicy, bk as computeOwnerShareRegistrationCid, bl as computeShareCid, bX as createCapabilityKeyRegistry, bm as createDelegatedShareKey, bn as createPolicyEnforcementDelegation, bo as createShareArtifact, bp as createShareArtifactAsync, bq as createSharePolicy, br as createSharingService, bs as decryptShareBytesAsync, bt as delegatePortablePolicySession, bu as encodeInlineShareUrl, bv as encodeShareArtifact, bw as encodeShareUrl, bx as encryptShareBytes, by as encryptShareBytesAsync, bz as importPortableDelegation, bA as intersectShareCapabilities, bB as isV2ShareLink, bC as normalizeShareActions, bD as normalizeShareRecipientTarget, bE as normalizeShareResource, bF as parsePortableDelegation, bG as parseShareArtifact, bH as parseShareUrl, bI as restoreDelegatedShareKey, bJ as serializePortableDelegation, bK as shareCapabilityAllows, bL as shortDeliveryLinkBodyCid, bM as signShareEnvelope, bN as validateOwnerSharePolicyRegistration, bO as validateOwnerSharePolicyRegistrationBytes, bP as verifyShareCid, bQ as verifyShareDeliveryAuthorizationV3Bytes, bR as verifyShareEnvelope, bS as withoutShareLink } from './recipient-types.schema-BApcOn1t.cjs';
8
+ import { o as Delegation, e as CreateDelegationParams, G as GenerateShareParams, aG as ShareLink, bg as SpaceInfo, I as ICapabilityKeyRegistry, H as ISharingService, w as DelegationManager, a as AccountDelegationQueryOptions, A as AccountDelegationPage, z as DelegationRevocationReceipt } from './recipient-types.schema-D7lM-5Jo.cjs';
9
+ export { b as AccountDelegationRecord, c as AccountDelegationResource, C as CREDENTIAL_INVITATION_REQUEST_DOMAIN, d as CapabilityEntry, bT as CapabilityKeyRegistry, bU as CapabilityKeyRegistryErrorCode, bV as CapabilityKeyRegistryErrorCodes, f as CreateDelegationWasmParams, g as CreateDelegationWasmResult, h as CreateOwnerDelegationParams, i as CredentialInvitationRequest, j as DELIVERY_ADMISSION_DOMAIN, k as DelegateReceivedShareParams, l as DelegatedResource, m as DelegatedShareAccess, n as DelegatedShareKey, p as DelegationApiResponse, q as DelegationChain, r as DelegationChainV2, s as DelegationDirection, D as DelegationError, t as DelegationErrorCode, u as DelegationErrorCodes, v as DelegationFilters, x as DelegationManagerConfig, y as DelegationRecord, R as DelegationResult, B as DelegationStatus, E as DeliveryAdmission, F as EncodedShareData, J as IngestOptions, K as JWK, L as KeyInfo, M as KeyProvider, N as KeyType, O as MAX_CONTENT_BYTES, P as MAX_SEALED_SHARE_CONTENT_BYTES, Q as MAX_SHARE_ARTIFACT_BYTES, S as MAX_SHARE_CONTENT_BYTES, T as MemorySenderShareKeyStorage, U as MemorySenderShareRecordStorage, V as MemoryShareCache, W as OwnerDelegationPermission, X as OwnerDelegationReceipt, Y as OwnerShareAction, Z as OwnerShareDecryption, _ as OwnerShareMatcher, $ as OwnerSharePolicyRegistration, a0 as OwnerSharePolicyRegistrationReceipt, a1 as OwnerSharePolicyV2, a2 as PortableDelegationImportReceipt, a3 as ReceiveOptions, a4 as RegisterOwnerSharePolicyParams, a5 as SenderShareKeyStorage, a6 as SenderShareRecord, a7 as SenderShareRecordStorage, a8 as SenderShareRevocationScope, a9 as SenderShareStore, aa as ShareAccess, ab as ShareAccessError, ac as ShareAccessV2, ad as ShareAction, af as ShareAddressedDelegationEnvelopeV2, ag as ShareAddressedDelegationEnvelopeV2Schema, ah as ShareAddressedDelegationRequestV2, ai as ShareAddressedDelegationRequestV2Schema, aj as ShareAddressedDelegationResponseV2, ak as ShareAddressedDelegationResponseV2Schema, al as ShareAddressedRecipientMatcher, am as ShareArtifactInput, an as ShareArtifactResult, ao as ShareArtifactV2, ap as ShareCache, aq as ShareCacheEntry, ar as ShareCacheKey, as as ShareCacheMetadata, at as ShareCapabilityLike, au as ShareConflict, av as ShareContentMetadata, aw as ShareContentSource, ax as ShareDelegationPreflight, ay as ShareDeliveryAuthorizationV3Receipt, az as ShareDeliveryAuthorizationV3Request, aA as ShareDeliveryRefusedError, aB as ShareDetachedProof, aC as ShareEnvelopeError, aD as ShareEnvelopeV2, aE as ShareExpiryBounds, aF as ShareKvContentSource, aH as ShareLinkData, aI as ShareLinkLocation, aJ as ShareListEntry, aK as ShareListResult, aL as ShareNativeAction, aM as ShareNativeInvokeEnvelopeV1, aN as ShareNativeInvokeErrorResult, aO as ShareNativeInvokeInput, aP as ShareNativeInvokeResult, aQ as ShareNativeInvokeSuccessResult, aR as ShareNativeResponse, aS as ShareNativeResponseSchema, aT as SharePolicy, aU as SharePolicyBinding, aV as SharePolicySession, aW as SharePolicySessionV1, aX as SharePolicySessionWireV1, aY as SharePortableDelegation, aZ as ShareReadInvocationV1, a_ as ShareReadResult, a$ as ShareRecipientClient, b0 as ShareRecipientClientOptions, b2 as ShareRecipientPolicy, b4 as ShareRecipientResult, b5 as ShareRecipientTarget, b7 as ShareResource, b9 as ShareSaveOptions, ba as ShareSchema, bb as ShareSqlContentSource, bc as ShareWireAction, bd as SharingService, be as SharingServiceConfig, bf as SignedDelegation, bh as SpaceOwnership, bW as StoredDelegationChain, bi as VerifyShareEnvelopeOptions, bj as canonicalOwnerSharePolicy, bk as computeOwnerShareRegistrationCid, bl as computeShareCid, bX as createCapabilityKeyRegistry, bm as createDelegatedShareKey, bn as createPolicyEnforcementDelegation, bo as createShareArtifact, bp as createShareArtifactAsync, bq as createSharePolicy, br as createSharingService, bs as decryptShareBytesAsync, bt as delegatePortablePolicySession, bu as encodeInlineShareUrl, bv as encodeShareArtifact, bw as encodeShareUrl, bx as encryptShareBytes, by as encryptShareBytesAsync, bz as importPortableDelegation, bA as intersectShareCapabilities, bB as isV2ShareLink, bC as normalizeShareActions, bD as normalizeShareRecipientTarget, bE as normalizeShareResource, bF as parsePortableDelegation, bG as parseShareArtifact, bH as parseShareUrl, bI as restoreDelegatedShareKey, bJ as serializePortableDelegation, bK as shareCapabilityAllows, bL as shortDeliveryLinkBodyCid, bM as signShareEnvelope, bN as validateOwnerSharePolicyRegistration, bO as validateOwnerSharePolicyRegistrationBytes, bP as verifyShareCid, bQ as verifyShareDeliveryAuthorizationV3Bytes, bR as verifyShareEnvelope, bS as withoutShareLink } from './recipient-types.schema-D7lM-5Jo.cjs';
10
10
  export { ACCOUNT_INDEX_SCHEMA, ACCOUNT_MANIFEST_PERMISSIONS, AGENTS_SPACE, BOOTSTRAP_ALLOWLIST, BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST, BOOTSTRAP_DEFAULT_SPACE, BOOTSTRAP_ENCRYPTION_NETWORK_NAME, BOOTSTRAP_ENCRYPTION_NETWORK_RESOURCE_TEMPLATE, BOOTSTRAP_MANIFEST, BOOTSTRAP_PERSISTED_APPLICATION_MANIFESTS, BOOTSTRAP_PUBLIC_SPACE, BOOTSTRAP_SESSION_REQUESTS, BOOTSTRAP_SPACE_MANIFESTS, BOOTSTRAP_SPACE_NAMES, BootstrapAllowlistEntry, BootstrapAllowlistKind, BootstrapEncryptionNetworkStep, BootstrapManifest, BootstrapRawAbilityAllowlistEntry, BootstrapSchemaStep, BootstrapSeedApplicationsStep, BootstrapSeedSpacesStep, BootstrapSpaceDescriptor, BootstrapSpaceName, BootstrapSpaceStep, BootstrapStep, BootstrapStepKind, CAPABILITIES, CAPABILITY_REGISTRY, CapabilityRegistryEntry, CapabilityStatus, DUCKDB, ENCRYPTION, HOOKS, KV, SECRET_RECORDS_SCHEMA, SPACE, SQL, TINYCLOUD_ACCOUNT_SPACE_MANIFEST, TINYCLOUD_AGENTS_SPACE_MANIFEST, TINYCLOUD_APPLICATIONS_SPACE_MANIFEST, TINYCLOUD_DEFAULT_SPACE_MANIFEST, TINYCLOUD_PUBLIC_SPACE_MANIFEST, TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST, bootstrapEncryptionNetworkId, bootstrapSpaceId, bootstrapSteps, composeBootstrapSpaceManifest } from '@tinycloud/bootstrap';
11
11
  export { a as JsonValue, j as jcsCanonicalize, n as normalizeJson, s as serializeJcsJson } from './capability-BjzXwtNw.cjs';
12
12
  export { SiweMessage } from 'siwe';
@@ -333,6 +333,14 @@ type ManifestSecretActions = true | string | string[] | {
333
333
  expiry?: string;
334
334
  description?: string;
335
335
  };
336
+ type ManifestKeyAbility = "key.create" | "decrypt" | "key.block" | "key.unblock";
337
+ type ManifestKeyDeclaration = {
338
+ path: string;
339
+ abilities: ManifestKeyAbility[];
340
+ } | {
341
+ prefix: string;
342
+ abilities: ManifestKeyAbility[];
343
+ };
336
344
  /**
337
345
  * The valid values for `Manifest.defaults`.
338
346
  *
@@ -362,6 +370,8 @@ interface Manifest {
362
370
  manifest_version?: 1;
363
371
  /** Application identifier / namespace prefix. Required. */
364
372
  app_id: string;
373
+ /** App key namespace when it differs from app_id. */
374
+ keys_app_id?: string;
365
375
  /** Display name. Required. */
366
376
  name: string;
367
377
  /** Description of what the app or delegate does. Optional. */
@@ -401,6 +411,8 @@ interface Manifest {
401
411
  * the `secrets` space.
402
412
  */
403
413
  secrets?: Record<string, ManifestSecretActions>;
414
+ /** Named keys on the app's default encryption network. */
415
+ keys?: ManifestKeyDeclaration[];
404
416
  }
405
417
  /**
406
418
  * A resolved permission entry with fully-expanded paths and action URNs.
package/dist/index.d.ts CHANGED
@@ -5,8 +5,8 @@ export { canonicalEmailDomain, canonicalMailbox, isCanonicalEmailDomain, mailbox
5
5
  import { InvokeFunction, InvokeAnyFunction, ParsedNetworkId, ServiceError, Result, FetchFunction, ServiceConstructor, RetryPolicy, TelemetryConfig, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService, IEncryptionService, ISecretsService, ServiceSession, IDatabaseHandle, SqlValue, QueryResponse } from '@tinycloud/sdk-services';
6
6
  export { AuthorityRefusal, AuthorizationVerdict, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CanonicalDecryptRequest, CanonicalJson, ColumnInfo, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, 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, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IEncryptionService, IHooksService, IKVService, IPrefixedKVService, ISQLService, ISecretsService, IService, IServiceContext, IStorageService, InlineEncryptedEnvelope, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVBatchReadResponse, KVChange, KVChangesAuthority, KVChangesOptions, KVChangesResponse, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListPage, KVListResponse, KVPutOptions, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, MAX_SECRET_SCOPE_LENGTH, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PinnedKey, PrefixedKVService, PurgeTarget, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaLocalEraseOutcome, ReplicaPurgeError, ReplicaPurgeFailedEvent, ReplicaPurgeLocalCopyResult, ReplicaPurgeTrigger, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedReplicationOptions, ResolvedSecretPath, Result, RetryPolicy, SECRET_NAME_RE, SECRET_SCOPE_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_NEARLY_FULL_RATIO, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretPutOptions, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SignedReceiverKeyInput, SqlStatement, SqlValue, StorageAccountUsage, StorageFullEvent, StorageFullHandler, StorageFullMonitor, StorageRejectionDetails, StorageStatus, StorageStatusOptions, StorageUsage, StorageUsageState, SubscribeOptions, TC832_RESERVED_SCOPES, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, appSecretScope, authorizationVerdictOf, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalizeEncryptionJson, canonicalizeSecretScope, checkDecryptInvocationInput, clearTinyCloudDebugLogs, createVaultCrypto, decryptEnvelopeWithKey, defaultRetryPolicy, deriveSignedReceiverKey, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, base64Decode as encryptionBase64Decode, base64Encode as encryptionBase64Encode, encryptionError, utf8Decode as encryptionUtf8Decode, utf8Encode as encryptionUtf8Encode, ensureNetworkUsableForDecrypt, err, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isNetworkId, isStorageFullError, networkDiscoveryKey, ok, openWrappedKey, parseCapabilityResource, parseNetworkId, parseSecretCatalogKey, parseStorageRejection, parseStorageStatus, resolveSecretListPrefix, resolveSecretPath, serviceError, storageUsageState, tinyCloudDebugLogger, validateEnvelope, validatedCapabilityOf, verifyDecryptResponse } from '@tinycloud/sdk-services';
7
7
  export { HOLDER_KEY_BINDING_PRESENTATION_SCHEMA, HolderKeyBindingPresentation, LISTEN_SQL_STATEMENT_CATALOG, ListenSqlStatementName, POLICY_ENGINE_CHALLENGE_REQUEST_SCHEMA, POLICY_ENGINE_CHALLENGE_RESPONSE_SCHEMA, POLICY_ENGINE_DENIAL_SCHEMA, POLICY_ENGINE_GRANT_PRESENTATION_DENIAL_CODES, POLICY_ENGINE_RESOLVE_REQUEST_SCHEMA, PORTABLE_DELEGATION_SCHEMA, PolicyEngineGrantPresentationDenialCode, PortableDelegation, REQUESTER_ENGINE_RETRY_ATTEMPTS, REQUESTER_ENGINE_RETRY_MAX_DELAY_MS, REQUESTER_NEAR_EXPIRY_SECONDS, RequesterEndpointResolution, RequesterHttpRequest, RequesterHttpResponse, RequesterInvocationCapability, RequesterSigningCapability, RequesterTransport, TranscriptRequester, TranscriptRequesterError, TranscriptRequesterErrorCode, TranscriptRequesterErrorState, TranscriptRequesterOptions, TranscriptRequesterReadKvResult, TranscriptRequesterReadSqlResult, createTranscriptRequester, deriveDelegationCid, parseNodeNativePortableDelegation } from './requester/index.js';
8
- import { o as Delegation, e as CreateDelegationParams, G as GenerateShareParams, aG as ShareLink, bg as SpaceInfo, I as ICapabilityKeyRegistry, H as ISharingService, w as DelegationManager, a as AccountDelegationQueryOptions, A as AccountDelegationPage, z as DelegationRevocationReceipt } from './recipient-types.schema-BApcOn1t.js';
9
- export { b as AccountDelegationRecord, c as AccountDelegationResource, C as CREDENTIAL_INVITATION_REQUEST_DOMAIN, d as CapabilityEntry, bT as CapabilityKeyRegistry, bU as CapabilityKeyRegistryErrorCode, bV as CapabilityKeyRegistryErrorCodes, f as CreateDelegationWasmParams, g as CreateDelegationWasmResult, h as CreateOwnerDelegationParams, i as CredentialInvitationRequest, j as DELIVERY_ADMISSION_DOMAIN, k as DelegateReceivedShareParams, l as DelegatedResource, m as DelegatedShareAccess, n as DelegatedShareKey, p as DelegationApiResponse, q as DelegationChain, r as DelegationChainV2, s as DelegationDirection, D as DelegationError, t as DelegationErrorCode, u as DelegationErrorCodes, v as DelegationFilters, x as DelegationManagerConfig, y as DelegationRecord, R as DelegationResult, B as DelegationStatus, E as DeliveryAdmission, F as EncodedShareData, J as IngestOptions, K as JWK, L as KeyInfo, M as KeyProvider, N as KeyType, O as MAX_CONTENT_BYTES, P as MAX_SEALED_SHARE_CONTENT_BYTES, Q as MAX_SHARE_ARTIFACT_BYTES, S as MAX_SHARE_CONTENT_BYTES, T as MemorySenderShareKeyStorage, U as MemorySenderShareRecordStorage, V as MemoryShareCache, W as OwnerDelegationPermission, X as OwnerDelegationReceipt, Y as OwnerShareAction, Z as OwnerShareDecryption, _ as OwnerShareMatcher, $ as OwnerSharePolicyRegistration, a0 as OwnerSharePolicyRegistrationReceipt, a1 as OwnerSharePolicyV2, a2 as PortableDelegationImportReceipt, a3 as ReceiveOptions, a4 as RegisterOwnerSharePolicyParams, a5 as SenderShareKeyStorage, a6 as SenderShareRecord, a7 as SenderShareRecordStorage, a8 as SenderShareRevocationScope, a9 as SenderShareStore, aa as ShareAccess, ab as ShareAccessError, ac as ShareAccessV2, ad as ShareAction, af as ShareAddressedDelegationEnvelopeV2, ag as ShareAddressedDelegationEnvelopeV2Schema, ah as ShareAddressedDelegationRequestV2, ai as ShareAddressedDelegationRequestV2Schema, aj as ShareAddressedDelegationResponseV2, ak as ShareAddressedDelegationResponseV2Schema, al as ShareAddressedRecipientMatcher, am as ShareArtifactInput, an as ShareArtifactResult, ao as ShareArtifactV2, ap as ShareCache, aq as ShareCacheEntry, ar as ShareCacheKey, as as ShareCacheMetadata, at as ShareCapabilityLike, au as ShareConflict, av as ShareContentMetadata, aw as ShareContentSource, ax as ShareDelegationPreflight, ay as ShareDeliveryAuthorizationV3Receipt, az as ShareDeliveryAuthorizationV3Request, aA as ShareDeliveryRefusedError, aB as ShareDetachedProof, aC as ShareEnvelopeError, aD as ShareEnvelopeV2, aE as ShareExpiryBounds, aF as ShareKvContentSource, aH as ShareLinkData, aI as ShareLinkLocation, aJ as ShareListEntry, aK as ShareListResult, aL as ShareNativeAction, aM as ShareNativeInvokeEnvelopeV1, aN as ShareNativeInvokeErrorResult, aO as ShareNativeInvokeInput, aP as ShareNativeInvokeResult, aQ as ShareNativeInvokeSuccessResult, aR as ShareNativeResponse, aS as ShareNativeResponseSchema, aT as SharePolicy, aU as SharePolicyBinding, aV as SharePolicySession, aW as SharePolicySessionV1, aX as SharePolicySessionWireV1, aY as SharePortableDelegation, aZ as ShareReadInvocationV1, a_ as ShareReadResult, a$ as ShareRecipientClient, b0 as ShareRecipientClientOptions, b2 as ShareRecipientPolicy, b4 as ShareRecipientResult, b5 as ShareRecipientTarget, b7 as ShareResource, b9 as ShareSaveOptions, ba as ShareSchema, bb as ShareSqlContentSource, bc as ShareWireAction, bd as SharingService, be as SharingServiceConfig, bf as SignedDelegation, bh as SpaceOwnership, bW as StoredDelegationChain, bi as VerifyShareEnvelopeOptions, bj as canonicalOwnerSharePolicy, bk as computeOwnerShareRegistrationCid, bl as computeShareCid, bX as createCapabilityKeyRegistry, bm as createDelegatedShareKey, bn as createPolicyEnforcementDelegation, bo as createShareArtifact, bp as createShareArtifactAsync, bq as createSharePolicy, br as createSharingService, bs as decryptShareBytesAsync, bt as delegatePortablePolicySession, bu as encodeInlineShareUrl, bv as encodeShareArtifact, bw as encodeShareUrl, bx as encryptShareBytes, by as encryptShareBytesAsync, bz as importPortableDelegation, bA as intersectShareCapabilities, bB as isV2ShareLink, bC as normalizeShareActions, bD as normalizeShareRecipientTarget, bE as normalizeShareResource, bF as parsePortableDelegation, bG as parseShareArtifact, bH as parseShareUrl, bI as restoreDelegatedShareKey, bJ as serializePortableDelegation, bK as shareCapabilityAllows, bL as shortDeliveryLinkBodyCid, bM as signShareEnvelope, bN as validateOwnerSharePolicyRegistration, bO as validateOwnerSharePolicyRegistrationBytes, bP as verifyShareCid, bQ as verifyShareDeliveryAuthorizationV3Bytes, bR as verifyShareEnvelope, bS as withoutShareLink } from './recipient-types.schema-BApcOn1t.js';
8
+ import { o as Delegation, e as CreateDelegationParams, G as GenerateShareParams, aG as ShareLink, bg as SpaceInfo, I as ICapabilityKeyRegistry, H as ISharingService, w as DelegationManager, a as AccountDelegationQueryOptions, A as AccountDelegationPage, z as DelegationRevocationReceipt } from './recipient-types.schema-D7lM-5Jo.js';
9
+ export { b as AccountDelegationRecord, c as AccountDelegationResource, C as CREDENTIAL_INVITATION_REQUEST_DOMAIN, d as CapabilityEntry, bT as CapabilityKeyRegistry, bU as CapabilityKeyRegistryErrorCode, bV as CapabilityKeyRegistryErrorCodes, f as CreateDelegationWasmParams, g as CreateDelegationWasmResult, h as CreateOwnerDelegationParams, i as CredentialInvitationRequest, j as DELIVERY_ADMISSION_DOMAIN, k as DelegateReceivedShareParams, l as DelegatedResource, m as DelegatedShareAccess, n as DelegatedShareKey, p as DelegationApiResponse, q as DelegationChain, r as DelegationChainV2, s as DelegationDirection, D as DelegationError, t as DelegationErrorCode, u as DelegationErrorCodes, v as DelegationFilters, x as DelegationManagerConfig, y as DelegationRecord, R as DelegationResult, B as DelegationStatus, E as DeliveryAdmission, F as EncodedShareData, J as IngestOptions, K as JWK, L as KeyInfo, M as KeyProvider, N as KeyType, O as MAX_CONTENT_BYTES, P as MAX_SEALED_SHARE_CONTENT_BYTES, Q as MAX_SHARE_ARTIFACT_BYTES, S as MAX_SHARE_CONTENT_BYTES, T as MemorySenderShareKeyStorage, U as MemorySenderShareRecordStorage, V as MemoryShareCache, W as OwnerDelegationPermission, X as OwnerDelegationReceipt, Y as OwnerShareAction, Z as OwnerShareDecryption, _ as OwnerShareMatcher, $ as OwnerSharePolicyRegistration, a0 as OwnerSharePolicyRegistrationReceipt, a1 as OwnerSharePolicyV2, a2 as PortableDelegationImportReceipt, a3 as ReceiveOptions, a4 as RegisterOwnerSharePolicyParams, a5 as SenderShareKeyStorage, a6 as SenderShareRecord, a7 as SenderShareRecordStorage, a8 as SenderShareRevocationScope, a9 as SenderShareStore, aa as ShareAccess, ab as ShareAccessError, ac as ShareAccessV2, ad as ShareAction, af as ShareAddressedDelegationEnvelopeV2, ag as ShareAddressedDelegationEnvelopeV2Schema, ah as ShareAddressedDelegationRequestV2, ai as ShareAddressedDelegationRequestV2Schema, aj as ShareAddressedDelegationResponseV2, ak as ShareAddressedDelegationResponseV2Schema, al as ShareAddressedRecipientMatcher, am as ShareArtifactInput, an as ShareArtifactResult, ao as ShareArtifactV2, ap as ShareCache, aq as ShareCacheEntry, ar as ShareCacheKey, as as ShareCacheMetadata, at as ShareCapabilityLike, au as ShareConflict, av as ShareContentMetadata, aw as ShareContentSource, ax as ShareDelegationPreflight, ay as ShareDeliveryAuthorizationV3Receipt, az as ShareDeliveryAuthorizationV3Request, aA as ShareDeliveryRefusedError, aB as ShareDetachedProof, aC as ShareEnvelopeError, aD as ShareEnvelopeV2, aE as ShareExpiryBounds, aF as ShareKvContentSource, aH as ShareLinkData, aI as ShareLinkLocation, aJ as ShareListEntry, aK as ShareListResult, aL as ShareNativeAction, aM as ShareNativeInvokeEnvelopeV1, aN as ShareNativeInvokeErrorResult, aO as ShareNativeInvokeInput, aP as ShareNativeInvokeResult, aQ as ShareNativeInvokeSuccessResult, aR as ShareNativeResponse, aS as ShareNativeResponseSchema, aT as SharePolicy, aU as SharePolicyBinding, aV as SharePolicySession, aW as SharePolicySessionV1, aX as SharePolicySessionWireV1, aY as SharePortableDelegation, aZ as ShareReadInvocationV1, a_ as ShareReadResult, a$ as ShareRecipientClient, b0 as ShareRecipientClientOptions, b2 as ShareRecipientPolicy, b4 as ShareRecipientResult, b5 as ShareRecipientTarget, b7 as ShareResource, b9 as ShareSaveOptions, ba as ShareSchema, bb as ShareSqlContentSource, bc as ShareWireAction, bd as SharingService, be as SharingServiceConfig, bf as SignedDelegation, bh as SpaceOwnership, bW as StoredDelegationChain, bi as VerifyShareEnvelopeOptions, bj as canonicalOwnerSharePolicy, bk as computeOwnerShareRegistrationCid, bl as computeShareCid, bX as createCapabilityKeyRegistry, bm as createDelegatedShareKey, bn as createPolicyEnforcementDelegation, bo as createShareArtifact, bp as createShareArtifactAsync, bq as createSharePolicy, br as createSharingService, bs as decryptShareBytesAsync, bt as delegatePortablePolicySession, bu as encodeInlineShareUrl, bv as encodeShareArtifact, bw as encodeShareUrl, bx as encryptShareBytes, by as encryptShareBytesAsync, bz as importPortableDelegation, bA as intersectShareCapabilities, bB as isV2ShareLink, bC as normalizeShareActions, bD as normalizeShareRecipientTarget, bE as normalizeShareResource, bF as parsePortableDelegation, bG as parseShareArtifact, bH as parseShareUrl, bI as restoreDelegatedShareKey, bJ as serializePortableDelegation, bK as shareCapabilityAllows, bL as shortDeliveryLinkBodyCid, bM as signShareEnvelope, bN as validateOwnerSharePolicyRegistration, bO as validateOwnerSharePolicyRegistrationBytes, bP as verifyShareCid, bQ as verifyShareDeliveryAuthorizationV3Bytes, bR as verifyShareEnvelope, bS as withoutShareLink } from './recipient-types.schema-D7lM-5Jo.js';
10
10
  export { ACCOUNT_INDEX_SCHEMA, ACCOUNT_MANIFEST_PERMISSIONS, AGENTS_SPACE, BOOTSTRAP_ALLOWLIST, BOOTSTRAP_DEFAULT_ONLY_SESSION_REQUEST, BOOTSTRAP_DEFAULT_SPACE, BOOTSTRAP_ENCRYPTION_NETWORK_NAME, BOOTSTRAP_ENCRYPTION_NETWORK_RESOURCE_TEMPLATE, BOOTSTRAP_MANIFEST, BOOTSTRAP_PERSISTED_APPLICATION_MANIFESTS, BOOTSTRAP_PUBLIC_SPACE, BOOTSTRAP_SESSION_REQUESTS, BOOTSTRAP_SPACE_MANIFESTS, BOOTSTRAP_SPACE_NAMES, BootstrapAllowlistEntry, BootstrapAllowlistKind, BootstrapEncryptionNetworkStep, BootstrapManifest, BootstrapRawAbilityAllowlistEntry, BootstrapSchemaStep, BootstrapSeedApplicationsStep, BootstrapSeedSpacesStep, BootstrapSpaceDescriptor, BootstrapSpaceName, BootstrapSpaceStep, BootstrapStep, BootstrapStepKind, CAPABILITIES, CAPABILITY_REGISTRY, CapabilityRegistryEntry, CapabilityStatus, DUCKDB, ENCRYPTION, HOOKS, KV, SECRET_RECORDS_SCHEMA, SPACE, SQL, TINYCLOUD_ACCOUNT_SPACE_MANIFEST, TINYCLOUD_AGENTS_SPACE_MANIFEST, TINYCLOUD_APPLICATIONS_SPACE_MANIFEST, TINYCLOUD_DEFAULT_SPACE_MANIFEST, TINYCLOUD_PUBLIC_SPACE_MANIFEST, TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST, bootstrapEncryptionNetworkId, bootstrapSpaceId, bootstrapSteps, composeBootstrapSpaceManifest } from '@tinycloud/bootstrap';
11
11
  export { a as JsonValue, j as jcsCanonicalize, n as normalizeJson, s as serializeJcsJson } from './capability-BjzXwtNw.js';
12
12
  export { SiweMessage } from 'siwe';
@@ -333,6 +333,14 @@ type ManifestSecretActions = true | string | string[] | {
333
333
  expiry?: string;
334
334
  description?: string;
335
335
  };
336
+ type ManifestKeyAbility = "key.create" | "decrypt" | "key.block" | "key.unblock";
337
+ type ManifestKeyDeclaration = {
338
+ path: string;
339
+ abilities: ManifestKeyAbility[];
340
+ } | {
341
+ prefix: string;
342
+ abilities: ManifestKeyAbility[];
343
+ };
336
344
  /**
337
345
  * The valid values for `Manifest.defaults`.
338
346
  *
@@ -362,6 +370,8 @@ interface Manifest {
362
370
  manifest_version?: 1;
363
371
  /** Application identifier / namespace prefix. Required. */
364
372
  app_id: string;
373
+ /** App key namespace when it differs from app_id. */
374
+ keys_app_id?: string;
365
375
  /** Display name. Required. */
366
376
  name: string;
367
377
  /** Description of what the app or delegate does. Optional. */
@@ -401,6 +411,8 @@ interface Manifest {
401
411
  * the `secrets` space.
402
412
  */
403
413
  secrets?: Record<string, ManifestSecretActions>;
414
+ /** Named keys on the app's default encryption network. */
415
+ keys?: ManifestKeyDeclaration[];
404
416
  }
405
417
  /**
406
418
  * A resolved permission entry with fully-expanded paths and action URNs.
package/dist/index.js CHANGED
@@ -6801,8 +6801,14 @@ var DelegationManager = class {
6801
6801
  };
6802
6802
  }
6803
6803
  }
6804
- /** Query lifecycle-complete delegation history for the authenticated account. */
6805
- async query(options2 = {}) {
6804
+ /**
6805
+ * Query lifecycle-complete delegation history for the authenticated account.
6806
+ *
6807
+ * `scope.spaces` lists the spaces to sign `tinycloud.delegation/list` for, in order. Omitted, the
6808
+ * account space is tried, then the session's own space. A caller that knows which of them the session
6809
+ * holds passes only those; an empty list sends nothing and answers PERMISSION_DENIED.
6810
+ */
6811
+ async query(options2 = {}, scope = {}) {
6806
6812
  const validated = AccountDelegationQueryOptionsSchema.safeParse(options2);
6807
6813
  if (!validated.success) {
6808
6814
  return {
@@ -6836,7 +6842,7 @@ var DelegationManager = class {
6836
6842
  }
6837
6843
  try {
6838
6844
  let response;
6839
- for (const spaceId of /* @__PURE__ */ new Set([accountSpaceId, this.session.spaceId])) {
6845
+ for (const spaceId of new Set(scope.spaces ?? [accountSpaceId, this.session.spaceId])) {
6840
6846
  const headers = Object.fromEntries(new Headers(this.invokeAny(this.session, [{
6841
6847
  spaceId,
6842
6848
  service: "delegation",
@@ -7202,7 +7208,7 @@ function validateEncodedShareData(data) {
7202
7208
  // src/manifest.ts
7203
7209
  import ms from "ms";
7204
7210
  import { ACCOUNT_MANIFEST_PERMISSIONS } from "@tinycloud/bootstrap";
7205
- import { resolveSecretPath, SECRET_NAME_RE } from "@tinycloud/sdk-services";
7211
+ import { resolveSecretPath, SECRET_NAME_RE, parseNetworkId } from "@tinycloud/sdk-services";
7206
7212
  var DEFAULT_KNOWLEDGE_ROOT = "knowledge/index.md";
7207
7213
  var ManifestValidationError = class extends Error {
7208
7214
  constructor(message) {
@@ -7325,6 +7331,14 @@ function expandEncryptionPermissionEntry(entry) {
7325
7331
  `tinycloud.encryption entries require path to be a networkId URN (got ${JSON.stringify(entry.path)})`
7326
7332
  );
7327
7333
  }
7334
+ if (entry.path.includes("/")) {
7335
+ throw new ManifestValidationError("named keys go in manifest.keys");
7336
+ }
7337
+ try {
7338
+ parseNetworkId(entry.path);
7339
+ } catch {
7340
+ throw new ManifestValidationError("tinycloud.encryption entries require a valid networkId URN");
7341
+ }
7328
7342
  const normalizedActions = [];
7329
7343
  for (const action of entry.actions) {
7330
7344
  if (action === "decrypt" || action === "tinycloud.encryption/decrypt") {
@@ -7449,8 +7463,56 @@ function validateManifest(input) {
7449
7463
  if (m.secrets !== void 0) {
7450
7464
  validateManifestSecrets(m.secrets);
7451
7465
  }
7466
+ if (Object.prototype.hasOwnProperty.call(m, "keys_app_id") && (typeof m.keys_app_id !== "string" || !KEY_APP_ID.test(m.keys_app_id))) {
7467
+ throw new ManifestValidationError("manifest.keys_app_id is invalid");
7468
+ }
7469
+ validateManifestKeys(m.keys_app_id ?? m.app_id, m.keys);
7452
7470
  return m;
7453
7471
  }
7472
+ var KEY_SEGMENT = "[a-z0-9][a-z0-9._-]{0,63}";
7473
+ var KEY_APP_ID = new RegExp(`^${KEY_SEGMENT}$`);
7474
+ var KEY_PATH = new RegExp(`^${KEY_SEGMENT}(?:/${KEY_SEGMENT}){2,7}$`);
7475
+ var KEY_ABILITIES = ["key.create", "decrypt", "key.block", "key.unblock"];
7476
+ function validateManifestKeys(appId, keys) {
7477
+ if (keys === void 0) return;
7478
+ if (!Array.isArray(keys) || keys.length > 32) {
7479
+ throw new ManifestValidationError("manifest.keys must contain at most 32 entries");
7480
+ }
7481
+ if (keys.length === 0) return;
7482
+ if (!KEY_APP_ID.test(appId)) {
7483
+ throw new ManifestValidationError("manifest.keys requires a valid app_id");
7484
+ }
7485
+ const paths = /* @__PURE__ */ new Set();
7486
+ let prefixSeen = false;
7487
+ for (const [index, value] of keys.entries()) {
7488
+ const label = `manifest.keys[${index}]`;
7489
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
7490
+ throw new ManifestValidationError(`${label} must be an object`);
7491
+ }
7492
+ const entry = value;
7493
+ const fields = Object.keys(entry);
7494
+ const hasPath = Object.prototype.hasOwnProperty.call(entry, "path");
7495
+ const hasPrefix = Object.prototype.hasOwnProperty.call(entry, "prefix");
7496
+ if (hasPath === hasPrefix || fields.some((field) => !["path", "prefix", "abilities"].includes(field))) {
7497
+ throw new ManifestValidationError(`${label} must have one path or prefix and abilities`);
7498
+ }
7499
+ if (!Array.isArray(entry.abilities) || entry.abilities.length === 0 || new Set(entry.abilities).size !== entry.abilities.length || entry.abilities.some((ability) => typeof ability !== "string" || !KEY_ABILITIES.includes(ability))) {
7500
+ throw new ManifestValidationError(`${label}.abilities is invalid`);
7501
+ }
7502
+ if (hasPath) {
7503
+ const path = entry.path;
7504
+ if (typeof path !== "string" || path.length > 255 || !KEY_PATH.test(path) || !path.startsWith(`apps/${appId}/`) || paths.has(path)) {
7505
+ throw new ManifestValidationError(`${label}.path is invalid`);
7506
+ }
7507
+ paths.add(path);
7508
+ } else {
7509
+ if (entry.prefix !== `apps/${appId}/` || prefixSeen) {
7510
+ throw new ManifestValidationError(`${label}.prefix is invalid`);
7511
+ }
7512
+ prefixSeen = true;
7513
+ }
7514
+ }
7515
+ }
7454
7516
  function resolveManifestKnowledgeRoot(knowledge) {
7455
7517
  if (knowledge === void 0) {
7456
7518
  return void 0;
@@ -12242,15 +12304,15 @@ function markDelegationTerminal(token, key) {
12242
12304
  // src/networkId.ts
12243
12305
  import {
12244
12306
  buildNetworkId,
12245
- parseNetworkId
12307
+ parseNetworkId as parseNetworkId2
12246
12308
  } from "@tinycloud/sdk-services";
12247
12309
  function canonicalizeNetworkId(networkId) {
12248
- const parsed = parseNetworkId(networkId);
12310
+ const parsed = parseNetworkId2(networkId);
12249
12311
  return buildNetworkId(canonicalizeDid(parsed.ownerDid), parsed.name);
12250
12312
  }
12251
12313
  function parseCanonicalNetworkId(networkId) {
12252
12314
  const canonical = canonicalizeNetworkId(networkId);
12253
- return parseNetworkId(canonical);
12315
+ return parseNetworkId2(canonical);
12254
12316
  }
12255
12317
 
12256
12318
  // src/storage.schema.ts
@@ -15063,7 +15125,7 @@ import {
15063
15125
  resolveSecretPath as resolveSecretPath2,
15064
15126
  EncryptionService,
15065
15127
  DecryptTransportResponseError,
15066
- parseNetworkId as parseNetworkId2,
15128
+ parseNetworkId as parseNetworkId3,
15067
15129
  buildNetworkId as buildNetworkId2,
15068
15130
  isNetworkId,
15069
15131
  networkDiscoveryKey,
@@ -19888,7 +19950,7 @@ export {
19888
19950
  parseCapabilityResource,
19889
19951
  parseCompactUcanAuthorization,
19890
19952
  parseExpiry,
19891
- parseNetworkId2 as parseNetworkId,
19953
+ parseNetworkId3 as parseNetworkId,
19892
19954
  parseNodeNativePortableDelegation,
19893
19955
  parsePkhDid,
19894
19956
  parsePolicySessionUcan,