@tinycloud/sdk-core 3.3.0-beta.22 → 3.3.0-beta.23
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/delegations/index.cjs +71 -228
- package/dist/delegations/index.cjs.map +1 -1
- package/dist/delegations/index.d.cts +3 -10
- package/dist/delegations/index.d.ts +3 -10
- package/dist/delegations/index.js +71 -228
- package/dist/delegations/index.js.map +1 -1
- package/dist/index.cjs +71 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +71 -228
- package/dist/index.js.map +1 -1
- package/dist/{recipient-types.schema-CPDoAVh4.d.cts → recipient-types.schema-DWLT3lo3.d.cts} +10 -61
- package/dist/{recipient-types.schema-CPDoAVh4.d.ts → recipient-types.schema-DWLT3lo3.d.ts} +10 -61
- package/package.json +1 -1
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, 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 {
|
|
9
|
-
export {
|
|
8
|
+
import { o as Delegation, e as CreateDelegationParams, G as GenerateShareParams, aF as ShareLink, bf as SpaceInfo, I as ICapabilityKeyRegistry, H as ISharingService, w as DelegationManager, a as AccountDelegationQueryOptions, A as AccountDelegationPage, z as DelegationRevocationReceipt } from './recipient-types.schema-DWLT3lo3.cjs';
|
|
9
|
+
export { b as AccountDelegationRecord, c as AccountDelegationResource, C as CREDENTIAL_INVITATION_REQUEST_DOMAIN, d as CapabilityEntry, bQ as CapabilityKeyRegistry, bR as CapabilityKeyRegistryErrorCode, bS 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 ShareDetachedProof, aB as ShareEnvelopeError, aC as ShareEnvelopeV2, aD as ShareExpiryBounds, aE as ShareKvContentSource, aG as ShareLinkData, aH as ShareLinkLocation, aI as ShareListEntry, aJ as ShareListResult, aK as ShareNativeAction, aL as ShareNativeInvokeEnvelopeV1, aM as ShareNativeInvokeErrorResult, aN as ShareNativeInvokeInput, aO as ShareNativeInvokeResult, aP as ShareNativeInvokeSuccessResult, aQ as ShareNativeResponse, aR as ShareNativeResponseSchema, aS as SharePolicy, aT as SharePolicyBinding, aU as SharePolicySession, aV as SharePolicySessionV1, aW as SharePolicySessionWireV1, aX as SharePortableDelegation, aY as ShareReadInvocationV1, aZ as ShareReadResult, a_ as ShareRecipientClient, a$ as ShareRecipientClientOptions, b1 as ShareRecipientPolicy, b3 as ShareRecipientResult, b4 as ShareRecipientTarget, b6 as ShareResource, b8 as ShareSaveOptions, b9 as ShareSchema, ba as ShareSqlContentSource, bb as ShareWireAction, bc as SharingService, bd as SharingServiceConfig, be as SignedDelegation, bg as SpaceOwnership, bT as StoredDelegationChain, bh as VerifyShareEnvelopeOptions, bi as canonicalOwnerSharePolicy, bj as computeOwnerShareRegistrationCid, bk as computeShareCid, bU as createCapabilityKeyRegistry, bl as createDelegatedShareKey, bm as createPolicyEnforcementDelegation, bn as createShareArtifact, bo as createShareArtifactAsync, bp as createSharePolicy, bq as createSharingService, br as decryptShareBytesAsync, bs as delegatePortablePolicySession, bt as encodeInlineShareUrl, bu as encodeShareArtifact, bv as encodeShareUrl, bw as encryptShareBytes, bx as encryptShareBytesAsync, by as importPortableDelegation, bz as intersectShareCapabilities, bA as isV2ShareLink, bB as normalizeShareActions, bC as normalizeShareRecipientTarget, bD as normalizeShareResource, bE as parsePortableDelegation, bF as parseShareArtifact, bG as parseShareUrl, bH as restoreDelegatedShareKey, bI as serializePortableDelegation, bJ as shareCapabilityAllows, bK as signShareEnvelope, bL as validateOwnerSharePolicyRegistration, bM as validateOwnerSharePolicyRegistrationBytes, bN as validateShareDeliveryAuthorizationV3Bytes, bO as verifyShareCid, bP as verifyShareEnvelope } from './recipient-types.schema-DWLT3lo3.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';
|
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, 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 {
|
|
9
|
-
export {
|
|
8
|
+
import { o as Delegation, e as CreateDelegationParams, G as GenerateShareParams, aF as ShareLink, bf as SpaceInfo, I as ICapabilityKeyRegistry, H as ISharingService, w as DelegationManager, a as AccountDelegationQueryOptions, A as AccountDelegationPage, z as DelegationRevocationReceipt } from './recipient-types.schema-DWLT3lo3.js';
|
|
9
|
+
export { b as AccountDelegationRecord, c as AccountDelegationResource, C as CREDENTIAL_INVITATION_REQUEST_DOMAIN, d as CapabilityEntry, bQ as CapabilityKeyRegistry, bR as CapabilityKeyRegistryErrorCode, bS 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 ShareDetachedProof, aB as ShareEnvelopeError, aC as ShareEnvelopeV2, aD as ShareExpiryBounds, aE as ShareKvContentSource, aG as ShareLinkData, aH as ShareLinkLocation, aI as ShareListEntry, aJ as ShareListResult, aK as ShareNativeAction, aL as ShareNativeInvokeEnvelopeV1, aM as ShareNativeInvokeErrorResult, aN as ShareNativeInvokeInput, aO as ShareNativeInvokeResult, aP as ShareNativeInvokeSuccessResult, aQ as ShareNativeResponse, aR as ShareNativeResponseSchema, aS as SharePolicy, aT as SharePolicyBinding, aU as SharePolicySession, aV as SharePolicySessionV1, aW as SharePolicySessionWireV1, aX as SharePortableDelegation, aY as ShareReadInvocationV1, aZ as ShareReadResult, a_ as ShareRecipientClient, a$ as ShareRecipientClientOptions, b1 as ShareRecipientPolicy, b3 as ShareRecipientResult, b4 as ShareRecipientTarget, b6 as ShareResource, b8 as ShareSaveOptions, b9 as ShareSchema, ba as ShareSqlContentSource, bb as ShareWireAction, bc as SharingService, bd as SharingServiceConfig, be as SignedDelegation, bg as SpaceOwnership, bT as StoredDelegationChain, bh as VerifyShareEnvelopeOptions, bi as canonicalOwnerSharePolicy, bj as computeOwnerShareRegistrationCid, bk as computeShareCid, bU as createCapabilityKeyRegistry, bl as createDelegatedShareKey, bm as createPolicyEnforcementDelegation, bn as createShareArtifact, bo as createShareArtifactAsync, bp as createSharePolicy, bq as createSharingService, br as decryptShareBytesAsync, bs as delegatePortablePolicySession, bt as encodeInlineShareUrl, bu as encodeShareArtifact, bv as encodeShareUrl, bw as encryptShareBytes, bx as encryptShareBytesAsync, by as importPortableDelegation, bz as intersectShareCapabilities, bA as isV2ShareLink, bB as normalizeShareActions, bC as normalizeShareRecipientTarget, bD as normalizeShareResource, bE as parsePortableDelegation, bF as parseShareArtifact, bG as parseShareUrl, bH as restoreDelegatedShareKey, bI as serializePortableDelegation, bJ as shareCapabilityAllows, bK as signShareEnvelope, bL as validateOwnerSharePolicyRegistration, bM as validateOwnerSharePolicyRegistrationBytes, bN as validateShareDeliveryAuthorizationV3Bytes, bO as verifyShareCid, bP as verifyShareEnvelope } from './recipient-types.schema-DWLT3lo3.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';
|
package/dist/index.js
CHANGED
|
@@ -6176,7 +6176,8 @@ var DelegationErrorCodes = {
|
|
|
6176
6176
|
INVALID_TOKEN: "INVALID_TOKEN",
|
|
6177
6177
|
KV_SERVICE_UNAVAILABLE: "KV_SERVICE_UNAVAILABLE",
|
|
6178
6178
|
DATA_FETCH_FAILED: "DATA_FETCH_FAILED",
|
|
6179
|
-
VALIDATION_ERROR: "VALIDATION_ERROR"
|
|
6179
|
+
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
6180
|
+
UNSUPPORTED_OPERATION: "UNSUPPORTED_OPERATION"
|
|
6180
6181
|
};
|
|
6181
6182
|
var DelegationSchema = z4.object({
|
|
6182
6183
|
/** Content identifier (CID) of the delegation */
|
|
@@ -6525,26 +6526,8 @@ var CreateDelegationWasmResultSchema = z4.object({
|
|
|
6525
6526
|
resources: z4.array(DelegatedResourceSchema)
|
|
6526
6527
|
});
|
|
6527
6528
|
|
|
6528
|
-
// src/expiry.ts
|
|
6529
|
-
var EPHEMERAL_MS = 60 * 60 * 1e3;
|
|
6530
|
-
var SIGNED_READ_URL_MS = 5 * 60 * 1e3;
|
|
6531
|
-
var SESSION_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
6532
|
-
var SHARE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
6533
|
-
var APP_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
6534
|
-
var MAX_MS = 10 * 365 * 24 * 60 * 60 * 1e3;
|
|
6535
|
-
var EXPIRY = {
|
|
6536
|
-
EPHEMERAL_MS,
|
|
6537
|
-
SIGNED_READ_URL_MS,
|
|
6538
|
-
SESSION_MS,
|
|
6539
|
-
SHARE_MS,
|
|
6540
|
-
APP_MS,
|
|
6541
|
-
MAX_MS
|
|
6542
|
-
};
|
|
6543
|
-
var DEFAULT_SIGNED_READ_URL_EXPIRY_MS = EXPIRY.SIGNED_READ_URL_MS;
|
|
6544
|
-
|
|
6545
6529
|
// src/delegations/DelegationManager.ts
|
|
6546
6530
|
var DelegationAction = {
|
|
6547
|
-
CREATE: "tinycloud.delegation/create",
|
|
6548
6531
|
REVOKE: "tinycloud.delegation/revoke",
|
|
6549
6532
|
STATUS: "tinycloud.delegation/status",
|
|
6550
6533
|
LIST: "tinycloud.delegation/list",
|
|
@@ -6560,6 +6543,21 @@ function createError(code3, message, cause, meta) {
|
|
|
6560
6543
|
meta
|
|
6561
6544
|
};
|
|
6562
6545
|
}
|
|
6546
|
+
async function readInvokedJson(response, action) {
|
|
6547
|
+
const text3 = await response.text();
|
|
6548
|
+
if (text3.trim() === "") {
|
|
6549
|
+
return {
|
|
6550
|
+
ok: false,
|
|
6551
|
+
error: createError(
|
|
6552
|
+
DelegationErrorCodes.UNSUPPORTED_OPERATION,
|
|
6553
|
+
`The node answered ${action} with an empty ${response.status} response; it does not support this operation`,
|
|
6554
|
+
void 0,
|
|
6555
|
+
{ status: response.status, action }
|
|
6556
|
+
)
|
|
6557
|
+
};
|
|
6558
|
+
}
|
|
6559
|
+
return { ok: true, data: JSON.parse(text3) };
|
|
6560
|
+
}
|
|
6563
6561
|
var DelegationManager = class {
|
|
6564
6562
|
/**
|
|
6565
6563
|
* Creates a new DelegationManager instance.
|
|
@@ -6600,114 +6598,6 @@ var DelegationManager = class {
|
|
|
6600
6598
|
body
|
|
6601
6599
|
});
|
|
6602
6600
|
}
|
|
6603
|
-
/**
|
|
6604
|
-
* Creates a new delegation.
|
|
6605
|
-
*
|
|
6606
|
-
* Delegates specific permissions to another DID for a given path.
|
|
6607
|
-
* The delegatee can then use these permissions to access resources
|
|
6608
|
-
* within the specified scope.
|
|
6609
|
-
*
|
|
6610
|
-
* @param params - Parameters for the delegation
|
|
6611
|
-
* @returns Result containing the created Delegation or an error
|
|
6612
|
-
*
|
|
6613
|
-
* @example
|
|
6614
|
-
* ```typescript
|
|
6615
|
-
* const result = await manager.create({
|
|
6616
|
-
* delegateDID: bob.did,
|
|
6617
|
-
* path: "documents/shared/",
|
|
6618
|
-
* actions: ["tinycloud.kv/get", "tinycloud.kv/put"],
|
|
6619
|
-
* expiry: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000), // 7 days
|
|
6620
|
-
* });
|
|
6621
|
-
* ```
|
|
6622
|
-
*/
|
|
6623
|
-
async create(params) {
|
|
6624
|
-
if (!params.delegateDID) {
|
|
6625
|
-
return {
|
|
6626
|
-
ok: false,
|
|
6627
|
-
error: createError(
|
|
6628
|
-
DelegationErrorCodes.INVALID_INPUT,
|
|
6629
|
-
"delegateDID is required"
|
|
6630
|
-
)
|
|
6631
|
-
};
|
|
6632
|
-
}
|
|
6633
|
-
if (!params.path) {
|
|
6634
|
-
return {
|
|
6635
|
-
ok: false,
|
|
6636
|
-
error: createError(
|
|
6637
|
-
DelegationErrorCodes.INVALID_INPUT,
|
|
6638
|
-
"path is required"
|
|
6639
|
-
)
|
|
6640
|
-
};
|
|
6641
|
-
}
|
|
6642
|
-
if (!params.actions || params.actions.length === 0) {
|
|
6643
|
-
return {
|
|
6644
|
-
ok: false,
|
|
6645
|
-
error: createError(
|
|
6646
|
-
DelegationErrorCodes.INVALID_INPUT,
|
|
6647
|
-
"at least one action is required"
|
|
6648
|
-
)
|
|
6649
|
-
};
|
|
6650
|
-
}
|
|
6651
|
-
try {
|
|
6652
|
-
const body = JSON.stringify({
|
|
6653
|
-
delegateDID: params.delegateDID,
|
|
6654
|
-
path: params.path,
|
|
6655
|
-
actions: params.actions,
|
|
6656
|
-
expiry: params.expiry?.toISOString(),
|
|
6657
|
-
disableSubDelegation: params.disableSubDelegation ?? false,
|
|
6658
|
-
statement: params.statement
|
|
6659
|
-
});
|
|
6660
|
-
const response = await this.invokeOperation(
|
|
6661
|
-
params.path,
|
|
6662
|
-
DelegationAction.CREATE,
|
|
6663
|
-
body
|
|
6664
|
-
);
|
|
6665
|
-
if (!response.ok) {
|
|
6666
|
-
const errorText = await response.text();
|
|
6667
|
-
return {
|
|
6668
|
-
ok: false,
|
|
6669
|
-
error: createError(
|
|
6670
|
-
DelegationErrorCodes.CREATION_FAILED,
|
|
6671
|
-
`Failed to create delegation: ${response.status} - ${errorText}`,
|
|
6672
|
-
void 0,
|
|
6673
|
-
{ status: response.status, path: params.path }
|
|
6674
|
-
)
|
|
6675
|
-
};
|
|
6676
|
-
}
|
|
6677
|
-
const apiResponse = await response.json();
|
|
6678
|
-
const delegation = {
|
|
6679
|
-
cid: apiResponse.cid ?? "",
|
|
6680
|
-
delegateDID: params.delegateDID,
|
|
6681
|
-
spaceId: this.session.spaceId,
|
|
6682
|
-
path: params.path,
|
|
6683
|
-
actions: params.actions,
|
|
6684
|
-
expiry: params.expiry ?? new Date(Date.now() + EXPIRY.SHARE_MS),
|
|
6685
|
-
isRevoked: false,
|
|
6686
|
-
allowSubDelegation: !(params.disableSubDelegation ?? false),
|
|
6687
|
-
createdAt: /* @__PURE__ */ new Date()
|
|
6688
|
-
};
|
|
6689
|
-
return { ok: true, data: delegation };
|
|
6690
|
-
} catch (error) {
|
|
6691
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
6692
|
-
return {
|
|
6693
|
-
ok: false,
|
|
6694
|
-
error: createError(
|
|
6695
|
-
DelegationErrorCodes.ABORTED,
|
|
6696
|
-
"Request aborted",
|
|
6697
|
-
error
|
|
6698
|
-
)
|
|
6699
|
-
};
|
|
6700
|
-
}
|
|
6701
|
-
return {
|
|
6702
|
-
ok: false,
|
|
6703
|
-
error: createError(
|
|
6704
|
-
DelegationErrorCodes.NETWORK_ERROR,
|
|
6705
|
-
`Network error during delegation creation: ${String(error)}`,
|
|
6706
|
-
error instanceof Error ? error : void 0
|
|
6707
|
-
)
|
|
6708
|
-
};
|
|
6709
|
-
}
|
|
6710
|
-
}
|
|
6711
6601
|
/**
|
|
6712
6602
|
* Revokes an existing delegation.
|
|
6713
6603
|
*
|
|
@@ -6936,19 +6826,33 @@ var DelegationManager = class {
|
|
|
6936
6826
|
};
|
|
6937
6827
|
}
|
|
6938
6828
|
try {
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6829
|
+
let response;
|
|
6830
|
+
for (const spaceId of /* @__PURE__ */ new Set([accountSpaceId, this.session.spaceId])) {
|
|
6831
|
+
const headers = Object.fromEntries(new Headers(this.invokeAny(this.session, [{
|
|
6832
|
+
spaceId,
|
|
6833
|
+
service: "delegation",
|
|
6834
|
+
path: "",
|
|
6835
|
+
action: DelegationAction.LIST
|
|
6836
|
+
}])).entries());
|
|
6837
|
+
headers["content-type"] = "application/json";
|
|
6838
|
+
response = await this.fetchFn(`${this.host}/delegation/query`, {
|
|
6839
|
+
method: "POST",
|
|
6840
|
+
headers,
|
|
6841
|
+
body: JSON.stringify(validated.data)
|
|
6842
|
+
});
|
|
6843
|
+
if (response.status !== 403) break;
|
|
6844
|
+
}
|
|
6845
|
+
if (!response || response.status === 403) {
|
|
6846
|
+
return {
|
|
6847
|
+
ok: false,
|
|
6848
|
+
error: createError(
|
|
6849
|
+
DelegationErrorCodes.PERMISSION_DENIED,
|
|
6850
|
+
"This session does not hold tinycloud.delegation/list on the account space or its own space",
|
|
6851
|
+
void 0,
|
|
6852
|
+
{ status: 403 }
|
|
6853
|
+
)
|
|
6854
|
+
};
|
|
6855
|
+
}
|
|
6952
6856
|
if (!response.ok) {
|
|
6953
6857
|
const errorText = await response.text();
|
|
6954
6858
|
return {
|
|
@@ -6983,75 +6887,6 @@ var DelegationManager = class {
|
|
|
6983
6887
|
};
|
|
6984
6888
|
}
|
|
6985
6889
|
}
|
|
6986
|
-
/**
|
|
6987
|
-
* Lists all delegations for the current session's space.
|
|
6988
|
-
*
|
|
6989
|
-
* Returns both delegations created by the current user (as delegator)
|
|
6990
|
-
* and delegations granted to the current user (as delegatee).
|
|
6991
|
-
*
|
|
6992
|
-
* @returns Result containing an array of Delegations or an error
|
|
6993
|
-
*
|
|
6994
|
-
* @example
|
|
6995
|
-
* ```typescript
|
|
6996
|
-
* const result = await manager.list();
|
|
6997
|
-
* if (result.ok) {
|
|
6998
|
-
* for (const delegation of result.data) {
|
|
6999
|
-
* console.log(`${delegation.cid}: ${delegation.path} -> ${delegation.delegateDID}`);
|
|
7000
|
-
* }
|
|
7001
|
-
* }
|
|
7002
|
-
* ```
|
|
7003
|
-
*/
|
|
7004
|
-
async list() {
|
|
7005
|
-
try {
|
|
7006
|
-
const response = await this.invokeOperation("", DelegationAction.LIST);
|
|
7007
|
-
if (!response.ok) {
|
|
7008
|
-
const errorText = await response.text();
|
|
7009
|
-
return {
|
|
7010
|
-
ok: false,
|
|
7011
|
-
error: createError(
|
|
7012
|
-
DelegationErrorCodes.NETWORK_ERROR,
|
|
7013
|
-
`Failed to list delegations: ${response.status} - ${errorText}`,
|
|
7014
|
-
void 0,
|
|
7015
|
-
{ status: response.status }
|
|
7016
|
-
)
|
|
7017
|
-
};
|
|
7018
|
-
}
|
|
7019
|
-
const data = await response.json();
|
|
7020
|
-
const delegations = data.map((item) => ({
|
|
7021
|
-
cid: item.cid,
|
|
7022
|
-
delegateDID: item.delegateDID,
|
|
7023
|
-
delegatorDID: item.delegatorDID,
|
|
7024
|
-
spaceId: item.spaceId,
|
|
7025
|
-
path: item.path,
|
|
7026
|
-
actions: item.actions,
|
|
7027
|
-
expiry: new Date(item.expiry),
|
|
7028
|
-
isRevoked: item.isRevoked,
|
|
7029
|
-
createdAt: item.createdAt ? new Date(item.createdAt) : void 0,
|
|
7030
|
-
parentCid: item.parentCid,
|
|
7031
|
-
allowSubDelegation: item.allowSubDelegation
|
|
7032
|
-
}));
|
|
7033
|
-
return { ok: true, data: delegations };
|
|
7034
|
-
} catch (error) {
|
|
7035
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
7036
|
-
return {
|
|
7037
|
-
ok: false,
|
|
7038
|
-
error: createError(
|
|
7039
|
-
DelegationErrorCodes.ABORTED,
|
|
7040
|
-
"Request aborted",
|
|
7041
|
-
error
|
|
7042
|
-
)
|
|
7043
|
-
};
|
|
7044
|
-
}
|
|
7045
|
-
return {
|
|
7046
|
-
ok: false,
|
|
7047
|
-
error: createError(
|
|
7048
|
-
DelegationErrorCodes.NETWORK_ERROR,
|
|
7049
|
-
`Network error during delegation list: ${String(error)}`,
|
|
7050
|
-
error instanceof Error ? error : void 0
|
|
7051
|
-
)
|
|
7052
|
-
};
|
|
7053
|
-
}
|
|
7054
|
-
}
|
|
7055
6890
|
/**
|
|
7056
6891
|
* Gets the full delegation chain for a given delegation.
|
|
7057
6892
|
*
|
|
@@ -7110,7 +6945,9 @@ var DelegationManager = class {
|
|
|
7110
6945
|
)
|
|
7111
6946
|
};
|
|
7112
6947
|
}
|
|
7113
|
-
const
|
|
6948
|
+
const parsed = await readInvokedJson(response, DelegationAction.GET);
|
|
6949
|
+
if (!parsed.ok) return parsed;
|
|
6950
|
+
const data = parsed.data;
|
|
7114
6951
|
const chain = data.chain.map((item) => ({
|
|
7115
6952
|
cid: item.cid,
|
|
7116
6953
|
delegateDID: item.delegateDID,
|
|
@@ -7207,8 +7044,9 @@ var DelegationManager = class {
|
|
|
7207
7044
|
)
|
|
7208
7045
|
};
|
|
7209
7046
|
}
|
|
7210
|
-
const
|
|
7211
|
-
|
|
7047
|
+
const body2 = await readInvokedJson(response, DelegationAction.CHECK);
|
|
7048
|
+
if (!body2.ok) return body2;
|
|
7049
|
+
return { ok: true, data: body2.data.allowed };
|
|
7212
7050
|
} catch (error) {
|
|
7213
7051
|
if (error instanceof Error && error.name === "AbortError") {
|
|
7214
7052
|
return {
|
|
@@ -7296,14 +7134,6 @@ var SharingServiceConfigSchema = z5.object({
|
|
|
7296
7134
|
(val) => val !== null && typeof val === "object",
|
|
7297
7135
|
{ message: "Expected an ICapabilityKeyRegistry object" }
|
|
7298
7136
|
),
|
|
7299
|
-
/**
|
|
7300
|
-
* Delegation manager for creating delegations.
|
|
7301
|
-
* Required for generate(), optional for receive().
|
|
7302
|
-
*/
|
|
7303
|
-
delegationManager: z5.unknown().refine(
|
|
7304
|
-
(val) => val === void 0 || val !== null && typeof val === "object",
|
|
7305
|
-
{ message: "Expected a DelegationManager object or undefined" }
|
|
7306
|
-
).optional(),
|
|
7307
7137
|
/** Factory for creating KV service instances */
|
|
7308
7138
|
createKVService: z5.unknown().refine(
|
|
7309
7139
|
(val) => typeof val === "function",
|
|
@@ -10578,6 +10408,23 @@ var ShareRecipientClient = class {
|
|
|
10578
10408
|
}
|
|
10579
10409
|
};
|
|
10580
10410
|
|
|
10411
|
+
// src/expiry.ts
|
|
10412
|
+
var EPHEMERAL_MS = 60 * 60 * 1e3;
|
|
10413
|
+
var SIGNED_READ_URL_MS = 5 * 60 * 1e3;
|
|
10414
|
+
var SESSION_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
10415
|
+
var SHARE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
10416
|
+
var APP_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
10417
|
+
var MAX_MS = 10 * 365 * 24 * 60 * 60 * 1e3;
|
|
10418
|
+
var EXPIRY = {
|
|
10419
|
+
EPHEMERAL_MS,
|
|
10420
|
+
SIGNED_READ_URL_MS,
|
|
10421
|
+
SESSION_MS,
|
|
10422
|
+
SHARE_MS,
|
|
10423
|
+
APP_MS,
|
|
10424
|
+
MAX_MS
|
|
10425
|
+
};
|
|
10426
|
+
var DEFAULT_SIGNED_READ_URL_EXPIRY_MS = EXPIRY.SIGNED_READ_URL_MS;
|
|
10427
|
+
|
|
10581
10428
|
// src/delegations/SharingService.ts
|
|
10582
10429
|
function spaceIdsEqual(left, right) {
|
|
10583
10430
|
const normalizeOwnerAddress = (space) => {
|
|
@@ -10676,7 +10523,6 @@ var SharingService = class {
|
|
|
10676
10523
|
this.fetchFn = config.fetch ?? globalThis.fetch.bind(globalThis);
|
|
10677
10524
|
this.keyProvider = config.keyProvider;
|
|
10678
10525
|
this.registry = config.registry;
|
|
10679
|
-
this.delegationManager = config.delegationManager;
|
|
10680
10526
|
this.createKVService = config.createKVService;
|
|
10681
10527
|
this.baseUrl = (config.baseUrl ?? "").replace(/\/$/, "");
|
|
10682
10528
|
this.createDelegationFn = config.createDelegation;
|
|
@@ -10702,16 +10548,13 @@ var SharingService = class {
|
|
|
10702
10548
|
}
|
|
10703
10549
|
/**
|
|
10704
10550
|
* Updates the service configuration.
|
|
10705
|
-
* Used to add full capabilities (session,
|
|
10551
|
+
* Used to add full capabilities (session, createDelegation, createDelegationWasm) after signIn.
|
|
10706
10552
|
*/
|
|
10707
10553
|
updateConfig(config) {
|
|
10708
10554
|
this.assertActiveFn?.();
|
|
10709
10555
|
if (config.session !== void 0) {
|
|
10710
10556
|
this.session = config.session;
|
|
10711
10557
|
}
|
|
10712
|
-
if (config.delegationManager !== void 0) {
|
|
10713
|
-
this.delegationManager = config.delegationManager;
|
|
10714
|
-
}
|
|
10715
10558
|
if (config.createDelegation !== void 0) {
|
|
10716
10559
|
this.createDelegationFn = config.createDelegation;
|
|
10717
10560
|
}
|
|
@@ -10750,12 +10593,12 @@ var SharingService = class {
|
|
|
10750
10593
|
)
|
|
10751
10594
|
};
|
|
10752
10595
|
}
|
|
10753
|
-
if (!this.createDelegationWasmFn && !this.createDelegationFn
|
|
10596
|
+
if (!this.createDelegationWasmFn && !this.createDelegationFn) {
|
|
10754
10597
|
return {
|
|
10755
10598
|
ok: false,
|
|
10756
10599
|
error: createError2(
|
|
10757
10600
|
DelegationErrorCodes.NOT_INITIALIZED,
|
|
10758
|
-
"
|
|
10601
|
+
"createDelegation or createDelegationWasm function required for generating sharing links."
|
|
10759
10602
|
)
|
|
10760
10603
|
};
|
|
10761
10604
|
}
|
|
@@ -11107,7 +10950,7 @@ var SharingService = class {
|
|
|
11107
10950
|
expiry,
|
|
11108
10951
|
disableSubDelegation: false
|
|
11109
10952
|
};
|
|
11110
|
-
const delegationResult =
|
|
10953
|
+
const delegationResult = await this.createDelegationFn(delegationParams);
|
|
11111
10954
|
const delegationCreationActiveError = this.retiredGraphError();
|
|
11112
10955
|
if (delegationCreationActiveError) return { ok: false, error: delegationCreationActiveError };
|
|
11113
10956
|
if (!delegationResult.ok) {
|