@tinycloud/sdk-core 3.0.0-beta.9 → 3.0.0

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.
@@ -1,5 +1,5 @@
1
- import { I as ICapabilityKeyRegistry, D as DelegationManager, R as Result, a as DelegationError } from '../recipient-types.schema-C0igQ1kA.cjs';
2
- export { A as AccountDelegationPage, b as AccountDelegationQueryOptions, c as AccountDelegationRecord, d as AccountDelegationResource, C as CREDENTIAL_INVITATION_REQUEST_DOMAIN, e as CapabilityEntry, f as CreateDelegationParams, g as CreateDelegationWasmParams, h as CreateDelegationWasmResult, i as CreateOwnerDelegationParams, j as CredentialInvitationRequest, k as DELIVERY_ADMISSION_DOMAIN, l as DelegateReceivedShareParams, m as DelegatedResource, n as DelegatedShareAccess, o as DelegatedShareKey, p as Delegation, q as DelegationApiResponse, r as DelegationChain, s as DelegationChainV2, t as DelegationDirection, u as DelegationErrorCode, v as DelegationErrorCodes, w as DelegationFilters, x as DelegationManagerConfig, y as DelegationRecord, z as DelegationRevocationReceipt, B as DelegationStatus, E as DeliveryAdmission, F as EncodedShareData, G as GenerateShareParams, H as ISharingService, 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, ae as ShareActionSchema, 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 ShareDeliveryAuthorizationV3Receipt, ay as ShareDeliveryAuthorizationV3Request, az as ShareDetachedProof, aA as ShareEnvelopeError, aB as ShareEnvelopeV2, aC as ShareExpiryBounds, aD as ShareKvContentSource, aE as ShareLink, aF as ShareLinkData, aG as ShareLinkLocation, aH as ShareListEntry, aI as ShareListResult, aJ as ShareNativeAction, aK as ShareNativeInvokeEnvelopeV1, aL as ShareNativeInvokeErrorResult, aM as ShareNativeInvokeInput, aN as ShareNativeInvokeResult, aO as ShareNativeInvokeSuccessResult, aP as ShareNativeResponse, aQ as ShareNativeResponseSchema, aR as SharePolicy, aS as SharePolicyBinding, aT as SharePolicySession, aU as SharePolicySessionV1, aV as SharePolicySessionWireV1, aW as SharePortableDelegation, aX as ShareReadInvocationV1, aY as ShareReadResult, aZ as ShareRecipientClient, a_ as ShareRecipientClientOptions, a$ as ShareRecipientClientOptionsSchema, b0 as ShareRecipientPolicy, b1 as ShareRecipientPolicySchema, b2 as ShareRecipientResult, b3 as ShareRecipientTarget, b4 as ShareRecipientTargetSchema, b5 as ShareResource, b6 as ShareResourceSchema, b7 as ShareSaveOptions, b8 as ShareSchema, b9 as ShareSqlContentSource, ba as ShareWireAction, bb as SharingService, bc as SharingServiceConfig, bd as SignedDelegation, be as SpaceInfo, bf as SpaceOwnership, bg as VerifyShareEnvelopeOptions, bh as canonicalOwnerSharePolicy, bi as computeOwnerShareRegistrationCid, bj as computeShareCid, bk as createDelegatedShareKey, bl as createPolicyEnforcementDelegation, bm as createShareArtifact, bn as createShareArtifactAsync, bo as createSharePolicy, bp as createSharingService, bq as decryptShareBytesAsync, br as delegatePortablePolicySession, bs as encodeInlineShareUrl, bt as encodeShareArtifact, bu as encodeShareUrl, bv as encryptShareBytes, bw as encryptShareBytesAsync, bx as importPortableDelegation, by as intersectShareCapabilities, bz as isV2ShareLink, bA as normalizeShareActions, bB as normalizeShareRecipientTarget, bC as normalizeShareResource, bD as parsePortableDelegation, bE as parseShareArtifact, bF as parseShareUrl, bG as restoreDelegatedShareKey, bH as serializePortableDelegation, bI as shareCapabilityAllows, bJ as signShareEnvelope, bK as validateOwnerSharePolicyRegistration, bL as validateOwnerSharePolicyRegistrationBytes, bM as validateShareDeliveryAuthorizationV3Bytes, bN as verifyShareCid, bO as verifyShareEnvelope } from '../recipient-types.schema-C0igQ1kA.cjs';
1
+ import { I as ICapabilityKeyRegistry, D as DelegationManager, R as Result, a as DelegationError } from '../recipient-types.schema-D9AI8tjN.cjs';
2
+ export { A as AccountDelegationPage, b as AccountDelegationQueryOptions, c as AccountDelegationRecord, d as AccountDelegationResource, C as CREDENTIAL_INVITATION_REQUEST_DOMAIN, e as CapabilityEntry, f as CreateDelegationParams, g as CreateDelegationWasmParams, h as CreateDelegationWasmResult, i as CreateOwnerDelegationParams, j as CredentialInvitationRequest, k as DELIVERY_ADMISSION_DOMAIN, l as DelegateReceivedShareParams, m as DelegatedResource, n as DelegatedShareAccess, o as DelegatedShareKey, p as Delegation, q as DelegationApiResponse, r as DelegationChain, s as DelegationChainV2, t as DelegationDirection, u as DelegationErrorCode, v as DelegationErrorCodes, w as DelegationFilters, x as DelegationManagerConfig, y as DelegationRecord, z as DelegationRevocationReceipt, B as DelegationStatus, E as DeliveryAdmission, F as EncodedShareData, G as GenerateShareParams, H as ISharingService, 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, ae as ShareActionSchema, 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, aF as ShareLink, 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, b0 as ShareRecipientClientOptionsSchema, b1 as ShareRecipientPolicy, b2 as ShareRecipientPolicySchema, b3 as ShareRecipientResult, b4 as ShareRecipientTarget, b5 as ShareRecipientTargetSchema, b6 as ShareResource, b7 as ShareResourceSchema, b8 as ShareSaveOptions, b9 as ShareSchema, ba as ShareSqlContentSource, bb as ShareWireAction, bc as SharingService, bd as SharingServiceConfig, be as SignedDelegation, bf as SpaceInfo, bg as SpaceOwnership, bh as VerifyShareEnvelopeOptions, bi as canonicalOwnerSharePolicy, bj as computeOwnerShareRegistrationCid, bk as computeShareCid, 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-D9AI8tjN.cjs';
3
3
  export { EncryptedSenderShareHistory, EncryptedShareHistoryStorage, MemoryEncryptedShareHistoryStorage, ShareAuthorizationAdapter, ShareAuthorizationDenied, ShareAuthorizationMethod, ShareAuthorizationReady, ShareAuthorizationRequired, ShareAuthorizationResult, ShareDeliveryAdapter, ShareErrorCode, ShareErrorInfo, ShareFetchOptions, ShareHistoryView, ShareInspection, ShareMetadata, ShareNotifyResult, ShareNotifyState, SharePolicyPublishAdapter, ShareReceiveError, ShareReceiveResult, ShareRevocationAdapter, ShareRevocationResult, ShareTarget, TargetPublishAdapter, TargetPublishInput, TargetPublishOutcome, authorizationMethodForTarget, authorizeShare, claimShare, inspectShare, listShares, notifyShare, publishPolicyShare, publishTargetShare, receiveShare, resumeShareAuthorization, revokeShare, showShare, toShareErrorInfo } from '@tinycloud/share-sdk';
4
4
  import { z } from 'zod';
5
5
  import { ServiceSession, InvokeFunction, FetchFunction, IKVService } from '@tinycloud/sdk-services';
@@ -1,5 +1,5 @@
1
- import { I as ICapabilityKeyRegistry, D as DelegationManager, R as Result, a as DelegationError } from '../recipient-types.schema-C0igQ1kA.js';
2
- export { A as AccountDelegationPage, b as AccountDelegationQueryOptions, c as AccountDelegationRecord, d as AccountDelegationResource, C as CREDENTIAL_INVITATION_REQUEST_DOMAIN, e as CapabilityEntry, f as CreateDelegationParams, g as CreateDelegationWasmParams, h as CreateDelegationWasmResult, i as CreateOwnerDelegationParams, j as CredentialInvitationRequest, k as DELIVERY_ADMISSION_DOMAIN, l as DelegateReceivedShareParams, m as DelegatedResource, n as DelegatedShareAccess, o as DelegatedShareKey, p as Delegation, q as DelegationApiResponse, r as DelegationChain, s as DelegationChainV2, t as DelegationDirection, u as DelegationErrorCode, v as DelegationErrorCodes, w as DelegationFilters, x as DelegationManagerConfig, y as DelegationRecord, z as DelegationRevocationReceipt, B as DelegationStatus, E as DeliveryAdmission, F as EncodedShareData, G as GenerateShareParams, H as ISharingService, 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, ae as ShareActionSchema, 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 ShareDeliveryAuthorizationV3Receipt, ay as ShareDeliveryAuthorizationV3Request, az as ShareDetachedProof, aA as ShareEnvelopeError, aB as ShareEnvelopeV2, aC as ShareExpiryBounds, aD as ShareKvContentSource, aE as ShareLink, aF as ShareLinkData, aG as ShareLinkLocation, aH as ShareListEntry, aI as ShareListResult, aJ as ShareNativeAction, aK as ShareNativeInvokeEnvelopeV1, aL as ShareNativeInvokeErrorResult, aM as ShareNativeInvokeInput, aN as ShareNativeInvokeResult, aO as ShareNativeInvokeSuccessResult, aP as ShareNativeResponse, aQ as ShareNativeResponseSchema, aR as SharePolicy, aS as SharePolicyBinding, aT as SharePolicySession, aU as SharePolicySessionV1, aV as SharePolicySessionWireV1, aW as SharePortableDelegation, aX as ShareReadInvocationV1, aY as ShareReadResult, aZ as ShareRecipientClient, a_ as ShareRecipientClientOptions, a$ as ShareRecipientClientOptionsSchema, b0 as ShareRecipientPolicy, b1 as ShareRecipientPolicySchema, b2 as ShareRecipientResult, b3 as ShareRecipientTarget, b4 as ShareRecipientTargetSchema, b5 as ShareResource, b6 as ShareResourceSchema, b7 as ShareSaveOptions, b8 as ShareSchema, b9 as ShareSqlContentSource, ba as ShareWireAction, bb as SharingService, bc as SharingServiceConfig, bd as SignedDelegation, be as SpaceInfo, bf as SpaceOwnership, bg as VerifyShareEnvelopeOptions, bh as canonicalOwnerSharePolicy, bi as computeOwnerShareRegistrationCid, bj as computeShareCid, bk as createDelegatedShareKey, bl as createPolicyEnforcementDelegation, bm as createShareArtifact, bn as createShareArtifactAsync, bo as createSharePolicy, bp as createSharingService, bq as decryptShareBytesAsync, br as delegatePortablePolicySession, bs as encodeInlineShareUrl, bt as encodeShareArtifact, bu as encodeShareUrl, bv as encryptShareBytes, bw as encryptShareBytesAsync, bx as importPortableDelegation, by as intersectShareCapabilities, bz as isV2ShareLink, bA as normalizeShareActions, bB as normalizeShareRecipientTarget, bC as normalizeShareResource, bD as parsePortableDelegation, bE as parseShareArtifact, bF as parseShareUrl, bG as restoreDelegatedShareKey, bH as serializePortableDelegation, bI as shareCapabilityAllows, bJ as signShareEnvelope, bK as validateOwnerSharePolicyRegistration, bL as validateOwnerSharePolicyRegistrationBytes, bM as validateShareDeliveryAuthorizationV3Bytes, bN as verifyShareCid, bO as verifyShareEnvelope } from '../recipient-types.schema-C0igQ1kA.js';
1
+ import { I as ICapabilityKeyRegistry, D as DelegationManager, R as Result, a as DelegationError } from '../recipient-types.schema-D9AI8tjN.js';
2
+ export { A as AccountDelegationPage, b as AccountDelegationQueryOptions, c as AccountDelegationRecord, d as AccountDelegationResource, C as CREDENTIAL_INVITATION_REQUEST_DOMAIN, e as CapabilityEntry, f as CreateDelegationParams, g as CreateDelegationWasmParams, h as CreateDelegationWasmResult, i as CreateOwnerDelegationParams, j as CredentialInvitationRequest, k as DELIVERY_ADMISSION_DOMAIN, l as DelegateReceivedShareParams, m as DelegatedResource, n as DelegatedShareAccess, o as DelegatedShareKey, p as Delegation, q as DelegationApiResponse, r as DelegationChain, s as DelegationChainV2, t as DelegationDirection, u as DelegationErrorCode, v as DelegationErrorCodes, w as DelegationFilters, x as DelegationManagerConfig, y as DelegationRecord, z as DelegationRevocationReceipt, B as DelegationStatus, E as DeliveryAdmission, F as EncodedShareData, G as GenerateShareParams, H as ISharingService, 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, ae as ShareActionSchema, 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, aF as ShareLink, 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, b0 as ShareRecipientClientOptionsSchema, b1 as ShareRecipientPolicy, b2 as ShareRecipientPolicySchema, b3 as ShareRecipientResult, b4 as ShareRecipientTarget, b5 as ShareRecipientTargetSchema, b6 as ShareResource, b7 as ShareResourceSchema, b8 as ShareSaveOptions, b9 as ShareSchema, ba as ShareSqlContentSource, bb as ShareWireAction, bc as SharingService, bd as SharingServiceConfig, be as SignedDelegation, bf as SpaceInfo, bg as SpaceOwnership, bh as VerifyShareEnvelopeOptions, bi as canonicalOwnerSharePolicy, bj as computeOwnerShareRegistrationCid, bk as computeShareCid, 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-D9AI8tjN.js';
3
3
  export { EncryptedSenderShareHistory, EncryptedShareHistoryStorage, MemoryEncryptedShareHistoryStorage, ShareAuthorizationAdapter, ShareAuthorizationDenied, ShareAuthorizationMethod, ShareAuthorizationReady, ShareAuthorizationRequired, ShareAuthorizationResult, ShareDeliveryAdapter, ShareErrorCode, ShareErrorInfo, ShareFetchOptions, ShareHistoryView, ShareInspection, ShareMetadata, ShareNotifyResult, ShareNotifyState, SharePolicyPublishAdapter, ShareReceiveError, ShareReceiveResult, ShareRevocationAdapter, ShareRevocationResult, ShareTarget, TargetPublishAdapter, TargetPublishInput, TargetPublishOutcome, authorizationMethodForTarget, authorizeShare, claimShare, inspectShare, listShares, notifyShare, publishPolicyShare, publishTargetShare, receiveShare, resumeShareAuthorization, revokeShare, showShare, toShareErrorInfo } from '@tinycloud/share-sdk';
4
4
  import { z } from 'zod';
5
5
  import { ServiceSession, InvokeFunction, FetchFunction, IKVService } from '@tinycloud/sdk-services';
@@ -59,6 +59,7 @@ var DelegationErrorSchema = z.object({
59
59
  });
60
60
  var DelegationErrorCodes = {
61
61
  AUTH_REQUIRED: "AUTH_REQUIRED",
62
+ AUTH_UNAUTHORIZED: "AUTH_UNAUTHORIZED",
62
63
  AUTH_EXPIRED: "AUTH_EXPIRED",
63
64
  NOT_INITIALIZED: "NOT_INITIALIZED",
64
65
  NOT_FOUND: "NOT_FOUND",
@@ -423,7 +424,7 @@ var CreateDelegationWasmResultSchema = z.object({
423
424
  // src/expiry.ts
424
425
  var EPHEMERAL_MS = 60 * 60 * 1e3;
425
426
  var SIGNED_READ_URL_MS = 5 * 60 * 1e3;
426
- var SESSION_MS = 7 * 24 * 60 * 60 * 1e3;
427
+ var SESSION_MS = 30 * 24 * 60 * 60 * 1e3;
427
428
  var SHARE_MS = 7 * 24 * 60 * 60 * 1e3;
428
429
  var APP_MS = 30 * 24 * 60 * 60 * 1e3;
429
430
  var MAX_MS = 10 * 365 * 24 * 60 * 60 * 1e3;
@@ -2582,7 +2583,6 @@ import { ed25519 } from "@noble/curves/ed25519";
2582
2583
  import { blake3 } from "@noble/hashes/blake3";
2583
2584
  import { sha256 as sha2562 } from "@noble/hashes/sha256";
2584
2585
  var ENVELOPE_SCHEMA = "xyz.tinycloud.share/envelope";
2585
- var INLINE_PREFIX = "tc2:";
2586
2586
  var RAW_CID_CODEC = 85;
2587
2587
  var BLAKE3_256_CODE = 30;
2588
2588
  var DEFAULT_MAX_INLINE_BYTES = 256 * 1024;
@@ -3288,31 +3288,6 @@ function parsePublishedShareLink(link, options = {}) {
3288
3288
  const origin = normalizeOrigin(url.origin);
3289
3289
  if (options.trustedOrigins !== void 0 && !options.trustedOrigins.map(normalizeOrigin).includes(origin)) throw new ShareEnvelopeError("origin-mismatch", "share link origin is not trusted");
3290
3290
  if (url.username !== "" || url.password !== "") throw new ShareEnvelopeError("invalid-link", "share link is not canonical");
3291
- if (url.pathname === "/viewer") {
3292
- const secretPayload = url.search === "" && url.hash.startsWith("#tc2=") ? url.hash.slice("#tc2=".length) : void 0;
3293
- const publicPayload = url.hash === "" && url.searchParams.size === 1 ? url.searchParams.get("tc2") ?? void 0 : void 0;
3294
- if (secretPayload === void 0 && publicPayload === void 0) throw new ShareEnvelopeError("invalid-link", "published share link is invalid");
3295
- if (publicPayload !== void 0 && url.search !== `?tc2=${publicPayload}`) throw new ShareEnvelopeError("invalid-link", "published share link is not canonical");
3296
- let payload;
3297
- try {
3298
- const bytes2 = base64UrlToBytes(secretPayload ?? publicPayload);
3299
- if (bytes2.length > (options.maxInlineBytes ?? DEFAULT_MAX_INLINE_BYTES) * 2) throw new Error("inline payload too large");
3300
- const text = new TextDecoder("utf-8", { fatal: true }).decode(bytes2);
3301
- const value = JSON.parse(text);
3302
- if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("inline payload shape");
3303
- if (canonicalJson(value) !== text) throw new Error("inline payload is not canonical JSON");
3304
- payload = value;
3305
- } catch (error) {
3306
- throw new ShareEnvelopeError("invalid-link", error instanceof Error ? error.message : "invalid inline payload");
3307
- }
3308
- const payloadKeys = Object.keys(payload);
3309
- if (payload.v !== 2 || typeof payload.c !== "string" || typeof payload.cid !== "string" || payload.k !== void 0 && typeof payload.k !== "string" || payloadKeys.some((key3) => !["v", "c", "cid", "k"].includes(key3)) || publicPayload !== void 0 && (payloadKeys.length !== 3 || payload.k !== void 0)) throw new ShareEnvelopeError("invalid-link", "inline payload fields are invalid");
3310
- const sealed = base64UrlToBytes(payload.c);
3311
- if (!verifyPublishedShareCid(payload.cid, sealed)) throw new ShareEnvelopeError("cid-mismatch", "inline payload CID does not match");
3312
- const key2 = payload.k === void 0 ? void 0 : base64UrlToBytes(payload.k);
3313
- if (key2 !== void 0 && key2.length !== 32) throw new ShareEnvelopeError("invalid-link", "inline payload key is invalid");
3314
- return { origin, cid: payload.cid, ...key2 === void 0 ? {} : { key: key2 }, sealed };
3315
- }
3316
3291
  if (url.search !== "") throw new ShareEnvelopeError("invalid-link", "share link is not canonical");
3317
3292
  const match = /^\/s\/([a-z2-7]+)$/.exec(url.pathname);
3318
3293
  if (match === null || !url.hash.startsWith("#k=")) throw new ShareEnvelopeError("invalid-link", "published share link is invalid");
@@ -3335,10 +3310,7 @@ function parseShareUrl(link, options = {}) {
3335
3310
  }
3336
3311
  const origin = normalizeOrigin(url.origin);
3337
3312
  if (options.trustedOrigins !== void 0 && !options.trustedOrigins.map(normalizeOrigin).includes(origin)) throw new ShareEnvelopeError("origin-mismatch", "share link origin is not trusted");
3338
- if (url.pathname === "/viewer" && (url.hash.startsWith("#tc2=") || url.searchParams.has("tc2"))) {
3339
- const published = parsePublishedShareLink(link, options);
3340
- return { kind: "inline", origin, cid: published.cid, key: published.key, url: `${url.origin}${url.pathname}`, protocol: "share-envelope-v2" };
3341
- }
3313
+ if (url.pathname === "/viewer") throw new ShareEnvelopeError("invalid-link", "retired viewer links are not accepted");
3342
3314
  if (url.search !== "") throw new ShareEnvelopeError("invalid-link", "share links must not contain query parameters");
3343
3315
  const match = url.pathname.match(/^\/s\/(i\/)?([^/]+)$/);
3344
3316
  if (!match) throw new ShareEnvelopeError("invalid-link", "share link path is invalid");
@@ -3363,9 +3335,9 @@ function parseShareUrl(link, options = {}) {
3363
3335
  function isV2ShareLink(link) {
3364
3336
  try {
3365
3337
  const url = new URL(link);
3366
- return url.pathname.startsWith("/s/") || url.pathname === "/viewer";
3338
+ return url.search === "" && url.pathname.startsWith("/s/");
3367
3339
  } catch {
3368
- return link.startsWith(INLINE_PREFIX);
3340
+ return false;
3369
3341
  }
3370
3342
  }
3371
3343
  async function encryptShareBytes(bytes2, key) {
@@ -3926,6 +3898,7 @@ var CompactPayloadSchema = z4.object({
3926
3898
  nnc: z4.string().min(1),
3927
3899
  prf: z4.array(z4.string().min(1))
3928
3900
  }).strict();
3901
+ var MAX_POLICY_ROOT_SECONDS = 31 * 24 * 60 * 60;
3929
3902
  function createCompactPolicyInvocation(input) {
3930
3903
  const session = parsePolicySessionUcan(input.sessionAuthorization);
3931
3904
  if (session.cid !== input.sessionCid || session.aud !== input.recipientDid)
@@ -3957,7 +3930,7 @@ function createCompactPolicyInvocation(input) {
3957
3930
  const signature = ed255192.sign(signingInput, input.privateKey);
3958
3931
  return parseCompactUcanAuthorization(`${protectedSegment}.${payloadSegment}.${encodeBase64Url(signature)}`);
3959
3932
  }
3960
- function createCompactPolicyDescendant(input) {
3933
+ function compactPolicyDescendantClaims(input) {
3961
3934
  const parent = parseCompactUcanAuthorization(input.parentAuthorization, input.parentCid);
3962
3935
  if (parent.payload.aud !== input.issuerDid) throw new Error("policy descendant issuer is not the parent audience");
3963
3936
  const parentFact = parent.payload.fct[0];
@@ -3965,23 +3938,33 @@ function createCompactPolicyDescendant(input) {
3965
3938
  if (!Number.isInteger(depth) || depth <= 0) throw new Error("policy descendant depth is exhausted");
3966
3939
  if (!compactAttenuationContains(parent.payload.att, input.attenuation))
3967
3940
  throw new Error("policy descendant exceeds the parent attenuation");
3941
+ const now = Math.max(input.now ?? parent.payload.nbf + 1, parent.payload.nbf + 1);
3942
+ const exp = Math.min(input.expiresAt ?? parent.payload.exp - 1, parent.payload.exp - 1);
3943
+ if (exp <= now) throw new Error("policy parent has no strictly narrower validity window");
3944
+ return {
3945
+ parentCid: parent.cid,
3946
+ fact: { ...parentFact, remainingRedelegationDepth: depth - 1 },
3947
+ notBefore: now,
3948
+ expiresAt: exp,
3949
+ nonce: input.nonce ?? encodeBase64Url(crypto.getRandomValues(new Uint8Array(16)))
3950
+ };
3951
+ }
3952
+ function createCompactPolicyDescendant(input) {
3953
+ const claims = compactPolicyDescendantClaims(input);
3968
3954
  const principal = input.issuerDid.split("#", 1)[0];
3969
3955
  const didMaterial = base58btc.decode(principal.slice("did:key:".length));
3970
3956
  const publicKey = ed255192.getPublicKey(input.privateKey);
3971
3957
  if (didMaterial.length !== 34 || !equalBytes2(publicKey, didMaterial.slice(2))) throw new Error("policy descendant signer does not bind issuer DID");
3972
- const now = Math.max(input.now ?? Math.floor(Date.now() / 1e3), parent.payload.nbf + 1);
3973
- const exp = Math.min(input.expiresAt ?? now + 60, now + 60, parent.payload.exp - 1);
3974
- if (exp <= now) throw new Error("policy parent has no strictly narrower validity window");
3975
3958
  const header = { alg: "EdDSA", jwk: { alg: "EdDSA", crv: "Ed25519", kty: "OKP", x: encodeBase64Url(publicKey) }, typ: "JWT", ucv: "0.10.0" };
3976
3959
  const payload = {
3977
3960
  att: input.attenuation,
3978
3961
  aud: input.audienceDid,
3979
- exp,
3980
- fct: [{ ...parentFact, remainingRedelegationDepth: depth - 1 }],
3962
+ exp: claims.expiresAt,
3963
+ fct: [claims.fact],
3981
3964
  iss: input.issuerDid.includes("#") ? input.issuerDid : `${principal}#${principal.slice("did:key:".length)}`,
3982
- nbf: now,
3983
- nnc: input.nonce ?? encodeBase64Url(crypto.getRandomValues(new Uint8Array(16))),
3984
- prf: [parent.cid]
3965
+ nbf: claims.notBefore,
3966
+ nnc: claims.nonce,
3967
+ prf: [claims.parentCid]
3985
3968
  };
3986
3969
  const protectedSegment = encodeBase64Url(new TextEncoder().encode(jcsCanonicalize(header)));
3987
3970
  const payloadSegment = encodeBase64Url(new TextEncoder().encode(jcsCanonicalize(payload)));
@@ -4057,7 +4040,7 @@ function parsePolicySessionUcan(authorization, expectedProofs) {
4057
4040
  throw new Error("policy session UCAN fact is incomplete");
4058
4041
  if (hasV4AuditFactShape && (!LOWER_SHA256_HEX.test(fact.credentialIdAuditDigestHex) || !LOWER_SHA256_HEX.test(fact.presentationJtiAuditDigestHex)))
4059
4042
  throw new Error("policy session UCAN v4 audit facts are invalid");
4060
- if (fact.profile !== POLICY_SESSION_UCAN_V1_PROFILE || typeof fact.remainingRedelegationDepth !== "number" || !Number.isInteger(fact.remainingRedelegationDepth) || fact.remainingRedelegationDepth < 0 || fact.remainingRedelegationDepth > 8 || parsed.payload.exp - parsed.payload.nbf > 60 || parsed.payload.iss.split("#", 1)[0] !== fact.nodeAudience || parsed.payload.aud !== fact.recipientDid)
4043
+ if (fact.profile !== POLICY_SESSION_UCAN_V1_PROFILE || typeof fact.remainingRedelegationDepth !== "number" || !Number.isInteger(fact.remainingRedelegationDepth) || fact.remainingRedelegationDepth < 0 || fact.remainingRedelegationDepth > 8 || parsed.payload.exp - parsed.payload.nbf > MAX_POLICY_ROOT_SECONDS || parsed.payload.iss.split("#", 1)[0] !== fact.nodeAudience || parsed.payload.aud !== fact.recipientDid)
4061
4044
  throw new Error("policy session UCAN fact is invalid");
4062
4045
  return {
4063
4046
  authorization,
@@ -5278,6 +5261,13 @@ var ShareRecipientClient = class {
5278
5261
  };
5279
5262
 
5280
5263
  // src/delegations/SharingService.ts
5264
+ function spaceIdsEqual(left, right) {
5265
+ const normalizeOwnerAddress = (space) => {
5266
+ const match = /^(tinycloud:pkh:eip155:\d+:)(0x[0-9a-fA-F]{40})(:.+)$/.exec(space);
5267
+ return match === null ? space : `${match[1]}${match[2].toLowerCase()}${match[3]}`;
5268
+ };
5269
+ return normalizeOwnerAddress(left) === normalizeOwnerAddress(right);
5270
+ }
5281
5271
  function inferShortServiceFromActionUrns(actions) {
5282
5272
  let short;
5283
5273
  for (const action of actions) {
@@ -5513,11 +5503,11 @@ var SharingService = class {
5513
5503
  }
5514
5504
  return result;
5515
5505
  };
5516
- const canSatisfyFromRegistry = this.findSuitableKeyForDelegation(
5506
+ const canSatisfyFromRegistry = this.classifyDelegationAuthority(
5517
5507
  fullPath,
5518
5508
  actions,
5519
5509
  requestedExpiry
5520
- );
5510
+ ) === "ok";
5521
5511
  if (canSatisfyFromRegistry) {
5522
5512
  const delegationResult = await this.createSessionDelegation(plainDID, fullPath, actions, expiry);
5523
5513
  const childDelegationActiveError = this.retiredGraphError();
@@ -5587,49 +5577,58 @@ var SharingService = class {
5587
5577
  return { ok: true, data: shareLink };
5588
5578
  }
5589
5579
  /**
5590
- * Check if any key in the registry can satisfy the delegation request.
5591
- * A key can satisfy if it has a delegation that:
5592
- * 1. Covers the required path (exact match or parent path)
5593
- * 2. Has all required actions
5594
- * 3. Has sufficient expiry (delegation.expiry >= requestedExpiry)
5595
- * 4. Allows sub-delegation
5580
+ * Report, without side effects, whether this session's registry authority
5581
+ * can issue the child delegation {@link generate} would create for the same
5582
+ * `path`, `actions` and `expiry` (defaults and `pathPrefix` applied the
5583
+ * same way):
5584
+ *
5585
+ * - `"ok"`: an uncaveated entry covers it.
5586
+ * - `"caveated"`: only caveated entries cover it. SharingService cannot
5587
+ * carry signed ReCap caveats into a child delegation.
5588
+ * - `"not-covered"`: no entry covers it, or there is no session.
5589
+ *
5590
+ * It does not consult `onRootDelegationNeeded`, so a signer-backed session
5591
+ * may still generate when this is not `"ok"`.
5592
+ */
5593
+ preflightGenerate(params) {
5594
+ if (!this.session || !params.path) return "not-covered";
5595
+ const fullPath = this.pathPrefix ? `${this.pathPrefix}/${params.path}`.replace(/\/+/g, "/") : params.path;
5596
+ return this.classifyDelegationAuthority(
5597
+ fullPath,
5598
+ params.actions ?? DEFAULT_READ_ACTIONS,
5599
+ params.expiry ?? new Date(Date.now() + DEFAULT_EXPIRY_MS)
5600
+ );
5601
+ }
5602
+ /**
5603
+ * Classify the registry's authority for a child delegation. An entry
5604
+ * satisfies it when it is in the session space, valid, lasts at least until
5605
+ * `requestedExpiry`, allows sub-delegation, covers `path` (exact or parent)
5606
+ * and grants every action. Satisfying entries with caveats are unusable.
5596
5607
  * @internal
5597
5608
  */
5598
- findSuitableKeyForDelegation(path, actions, requestedExpiry) {
5599
- const allKeys = this.registry.getAllKeys();
5600
- for (const key of allKeys) {
5601
- const delegations = this.registry.getDelegationsForKey(key.id);
5602
- for (const delegation of delegations) {
5603
- if (delegation.spaceId !== this.session?.spaceId) {
5604
- continue;
5605
- }
5606
- if ((delegation.caveats?.length ?? 0) > 0) {
5607
- continue;
5608
- }
5609
- if (!this.registry.isDelegationValid(delegation)) {
5609
+ classifyDelegationAuthority(path, actions, requestedExpiry) {
5610
+ let coveredOnlyByCaveated = false;
5611
+ for (const key of this.registry.getAllKeys()) {
5612
+ for (const delegation of this.registry.getDelegationsForKey(key.id)) {
5613
+ if (delegation.spaceId === void 0 || !spaceIdsEqual(delegation.spaceId, this.session?.spaceId ?? "")) {
5610
5614
  continue;
5611
5615
  }
5612
- if (delegation.expiry < requestedExpiry) {
5613
- continue;
5614
- }
5615
- if (delegation.allowSubDelegation === false) {
5616
- continue;
5617
- }
5618
- const delegationPath = delegation.path || "";
5619
- if (!this.pathMatches(delegationPath, path)) {
5616
+ if (!this.registry.isDelegationValid(delegation)) continue;
5617
+ if (delegation.expiry < requestedExpiry) continue;
5618
+ if (delegation.allowSubDelegation === false) continue;
5619
+ if (!this.pathMatches(delegation.path || "", path)) continue;
5620
+ const delegationActions = delegation.actions || [];
5621
+ if (!actions.every((action) => delegationActions.includes(action) || delegationActions.includes("*"))) {
5620
5622
  continue;
5621
5623
  }
5622
- const delegationActions = delegation.actions || [];
5623
- const hasAllActions = actions.every(
5624
- (action) => delegationActions.includes(action) || delegationActions.includes("*")
5625
- );
5626
- if (!hasAllActions) {
5624
+ if ((delegation.caveats?.length ?? 0) > 0) {
5625
+ coveredOnlyByCaveated = true;
5627
5626
  continue;
5628
5627
  }
5629
- return true;
5628
+ return "ok";
5630
5629
  }
5631
5630
  }
5632
- return false;
5631
+ return coveredOnlyByCaveated ? "caveated" : "not-covered";
5633
5632
  }
5634
5633
  retiredGraphError() {
5635
5634
  try {
@@ -5728,11 +5727,23 @@ var SharingService = class {
5728
5727
  const errorText = await registerRes.text();
5729
5728
  const registrationTextActiveError = this.retiredGraphError();
5730
5729
  if (registrationTextActiveError) return { ok: false, error: registrationTextActiveError };
5730
+ const message = `Failed to register delegation with server: ${registerRes.status} ${errorText}`;
5731
+ if (registerRes.status === 401 || registerRes.status === 403) {
5732
+ return {
5733
+ ok: false,
5734
+ error: createError2(
5735
+ DelegationErrorCodes.AUTH_UNAUTHORIZED,
5736
+ message,
5737
+ void 0,
5738
+ { status: registerRes.status }
5739
+ )
5740
+ };
5741
+ }
5731
5742
  return {
5732
5743
  ok: false,
5733
5744
  error: createError2(
5734
5745
  DelegationErrorCodes.CREATION_FAILED,
5735
- `Failed to register delegation with server: ${registerRes.status} ${errorText}`
5746
+ message
5736
5747
  )
5737
5748
  };
5738
5749
  }