@tinycloud/share-sdk 1.2.1 → 1.3.0-beta.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.
package/dist/index.d.ts CHANGED
@@ -1,105 +1,18 @@
1
- import { ShareEnvelopeV3, ShareEnvelopeV2, ArtifactPin, UnsignedShareEnvelopeV3 } from '@tinycloud/share-envelope';
1
+ export { D as DEFAULT_MAX_CONTENT_BLOB_BYTES, a as DEFAULT_MAX_SEALED_BLOB_BYTES, S as SHARE_RESULT_VERSION, b as ShareErrorCode, c as ShareErrorInfo, d as ShareFetchOptions, e as ShareInspection, f as ShareMetadata, g as ShareNodeTrust, h as SharePolicyChallenge, i as SharePolicyDelegationLink, j as SharePolicySession, k as SharePresentationMaterial, l as ShareReceiveAuthorizationRequired, m as ShareReceiveError, n as ShareReceiveOutcome, o as ShareReceiveResult, p as ShareRecipientClient, q as ShareRecipientClientOptions, r as createAddressedAuthorization, s as inspectShare, t as receiveShare, u as toShareErrorInfo } from './web-recipient-entry-CKA_vCi5.js';
2
+ export { C as CreateOwnerDelegationParams, g as DEFAULT_SHARE_LIFETIME_MS, D as DelegatedShareKey, M as MAX_CONTENT_BYTES, h as OWNER_SHARE_REGISTRATION_DOMAIN, i as OwnerDelegationPermission, f as OwnerDelegationReceipt, O as OwnerShareAction, j as OwnerShareDecryption, a as OwnerShareMatcher, k as OwnerSharePolicyRegistration, b as OwnerSharePolicyRegistrationReceipt, l as OwnerSharePolicyV2, c as PublishedShare, P as PublishedShareDeliveryMaterial, m as PublishedShareMetadata, R as RegisterOwnerSharePolicyParams, n as SHARE_CONTENT_LIMIT, o as SHARE_PUBLISH_RESULT_VERSION, p as SharePublishError, q as SharePublishErrorCode, e as SharePublishOptions, d as SharePublishTarget, S as SignedDelegation, r as canonicalOwnerSharePolicy, s as computeOwnerShareRegistrationCid, t as createDelegatedShareKey, u as createPolicyEnforcementDelegation, v as redactPublishedShare, w as restoreDelegatedShareKey, x as validateOwnerSharePolicyRegistration, y as validateOwnerSharePolicyRegistrationBytes } from './owner-policy-CRFeEC98.js';
3
+ import { ShareEnvelopeV2, ArtifactPin, UnsignedShareEnvelopeV3, ShareEnvelopeV3 } from '@tinycloud/share-envelope';
2
4
  export { CheckBearerDelegationOptions, DelegationCheckResult, canonicalize, checkBearerDelegation, fromBase64Url, requiredResourceUri, resourceUriCovers, toBase64Url } from '@tinycloud/share-envelope';
3
- import { S as ShareAuthorizationMethod, a as ShareAuthorizedContent, b as ShareAuthorizationAdapter, T as TargetPublishOutcome, c as TargetPublishInput, d as ShareAuthorizationResult, e as ShareTarget } from './addressed-publish-BnSBJ-MX.js';
4
- export { A as AddressedOwnerRootInput, f as AddressedOwnerRootReceipt, g as AddressedPolicyRegistrationInput, h as AddressedPolicyRegistrationReceipt, i as AddressedPublishAuthority, j as AddressedSharePublishOptions, k as AddressedShareRequest, P as PreparedAddressedShare, l as ShareAuthorizationDenied, m as ShareAuthorizationReady, n as ShareAuthorizationRequired, o as TargetPublishAdapter, p as addressedCredentialRequirement, q as authorizationMethodForTarget, r as authorizeShare, s as normalizeShareTarget, t as prepareAddressedShare, u as publishAddressedShare, v as publishTargetShare, w as targetAuthorizationMethod } from './addressed-publish-BnSBJ-MX.js';
5
- export { C as CreateOwnerDelegationParams, D as DEFAULT_SHARE_LIFETIME_MS, a as DelegatedShareKey, M as MAX_CONTENT_BYTES, O as OWNER_SHARE_REGISTRATION_DOMAIN, b as OwnerDelegationPermission, c as OwnerDelegationReceipt, d as OwnerShareAction, e as OwnerShareDecryption, f as OwnerShareMatcher, g as OwnerSharePolicyRegistration, h as OwnerSharePolicyRegistrationReceipt, i as OwnerSharePolicyV2, P as PublishedShare, j as PublishedShareDeliveryMaterial, k as PublishedShareMetadata, R as RegisterOwnerSharePolicyParams, S as SHARE_CONTENT_LIMIT, l as SHARE_PUBLISH_RESULT_VERSION, m as SharePublishError, n as SharePublishErrorCode, o as SharePublishOptions, p as SharePublishTarget, q as SignedDelegation, r as canonicalOwnerSharePolicy, s as computeOwnerShareRegistrationCid, t as createDelegatedShareKey, u as createPolicyEnforcementDelegation, v as redactPublishedShare, w as restoreDelegatedShareKey, x as validateOwnerSharePolicyRegistration, y as validateOwnerSharePolicyRegistrationBytes } from './owner-policy-BqzRlkb6.js';
6
- import { S as SenderShareRecord, a as SenderShareRecordStorage } from './history-CyT6x8h4.js';
7
- export { E as EncryptedSenderShareHistory, b as EncryptedShareHistoryStorage, M as MemoryEncryptedShareHistoryStorage, c as MemorySenderShareKeyStorage, d as MemorySenderShareRecordStorage, e as SenderShareKeyStorage, f as SenderShareRecordProofs, g as SenderShareRevocationScope, h as SenderShareStore, i as historyRecordForPublishedShare } from './history-CyT6x8h4.js';
5
+ import { T as TargetPublishOutcome, c as TargetPublishInput, S as ShareTarget } from './addressed-publish-CAdGCqiX.js';
6
+ export { A as AddressedOwnerRootInput, a as AddressedOwnerRootReceipt, d as AddressedPolicyRegistrationInput, e as AddressedPolicyRegistrationReceipt, b as AddressedPublishAuthority, f as AddressedSharePublishOptions, g as AddressedShareRequest, P as PreparedAddressedShare, h as TargetPublishAdapter, i as addressedCredentialRequirement, n as normalizeShareTarget, p as prepareAddressedShare, j as publishAddressedShare, k as publishTargetShare, t as targetAuthorizationMethod } from './addressed-publish-CAdGCqiX.js';
7
+ import { S as SenderShareRecord, a as SenderShareRecordStorage } from './history-q0ALXTv7.js';
8
+ export { E as EncryptedSenderShareHistory, b as EncryptedShareHistoryStorage, M as MemoryEncryptedShareHistoryStorage, c as MemorySenderShareKeyStorage, d as MemorySenderShareRecordStorage, e as SenderShareKeyStorage, f as SenderShareRecordProofs, g as SenderShareRevocationScope, h as SenderShareStore, i as historyRecordForPublishedShare } from './history-q0ALXTv7.js';
9
+ import { b as ShareAuthorizationResult, c as ShareAuthorizationAdapter } from './authorization-CmP1skO8.js';
10
+ export { d as ShareAuthorizationDenied, a as ShareAuthorizationMethod, e as ShareAuthorizationReady, S as ShareAuthorizationRequired, f as ShareAuthorizedContent, g as authorizationMethodForTarget, h as authorizeShare } from './authorization-CmP1skO8.js';
8
11
 
9
12
  declare function hasUnsafeFilenameCodePoint(value: string): boolean;
10
13
  /** A single display/download filename, never a path. Returns the NFC form. */
11
14
  declare function canonicalShareFilename(value: string): string;
12
15
 
13
- type ShareErrorCode = "invalid-link" | "fetch-failed" | "max-bytes-exceeded" | "cid-mismatch" | "decrypt-failed" | "envelope-invalid" | "origin-mismatch" | "signature-invalid" | "capability-invalid" | "expired" | "unsupported-target" | "authorization-denied" | "content-integrity-failed";
14
- declare const SHARE_RESULT_VERSION: 1;
15
- declare const DEFAULT_MAX_SEALED_BLOB_BYTES: number;
16
- declare const DEFAULT_MAX_CONTENT_BLOB_BYTES: number;
17
- declare class ShareReceiveError extends Error {
18
- readonly code: ShareErrorCode;
19
- readonly details: {
20
- readonly expiresAt?: string;
21
- readonly stage?: "envelope" | "content";
22
- readonly reason?: "policy-target" | "recipient-did-target" | "prefix-resource";
23
- } | undefined;
24
- constructor(code: ShareErrorCode, message: string, details?: {
25
- readonly expiresAt?: string;
26
- readonly stage?: "envelope" | "content";
27
- readonly reason?: "policy-target" | "recipient-did-target" | "prefix-resource";
28
- });
29
- toJSON(): ShareErrorInfo;
30
- }
31
- interface ShareErrorInfo {
32
- readonly protocol: "tinycloud-share";
33
- readonly version: typeof SHARE_RESULT_VERSION;
34
- readonly error: {
35
- readonly code: ShareErrorCode;
36
- };
37
- }
38
- declare function toShareErrorInfo(error: unknown): ShareErrorInfo;
39
- /** Policy/v3 links seal their authorization metadata in a fragment; no blob fetch adapter exists. */
40
- interface ShareFetchOptions {
41
- readonly expectedOrigin?: string;
42
- readonly signal?: AbortSignal;
43
- readonly now?: () => number;
44
- readonly maxSealedBlobBytes?: number;
45
- readonly maxContentBlobBytes?: number;
46
- readonly onResolvedAddressedEnvelope?: (envelope: ShareEnvelopeV3, cid: string) => void;
47
- }
48
- interface ShareMetadata {
49
- readonly protocol: "tinycloud-share";
50
- readonly version: 1;
51
- readonly shareId: string;
52
- readonly origin: string;
53
- readonly target: {
54
- readonly kind: "bearer" | "recipientDid" | "email" | "emailDomain";
55
- readonly origin: string;
56
- readonly nodeAudience: string;
57
- readonly spaceId: string;
58
- };
59
- readonly resource: {
60
- readonly kind: "exact" | "prefix";
61
- readonly path: string;
62
- };
63
- readonly actions: readonly string[];
64
- readonly expiresAt: string;
65
- readonly display: {
66
- readonly senderName?: string;
67
- readonly filename?: string;
68
- readonly mode?: string;
69
- };
70
- /** Set when the share is pinned to one artifact version; the owner's signature covers it (TC-1428). */
71
- readonly artifact?: {
72
- readonly id: string;
73
- readonly version: number;
74
- };
75
- }
76
- interface ShareInspection {
77
- readonly metadata: ShareMetadata;
78
- readonly link: {
79
- readonly origin: string;
80
- readonly cid: string;
81
- readonly kind: "policy";
82
- };
83
- }
84
- interface ShareReceiveAuthorizationRequired {
85
- readonly state: "authorization-required";
86
- readonly method: ShareAuthorizationMethod;
87
- readonly continueUrl?: string;
88
- readonly resumeToken?: string;
89
- }
90
- /** Retained as the result consumed after the node authorization ceremony. */
91
- interface ShareReceiveResult extends ShareInspection {
92
- readonly bytes: Uint8Array;
93
- readonly text?: string;
94
- }
95
- type ShareReceiveOutcome = ShareReceiveResult | ShareReceiveAuthorizationRequired;
96
- declare function inspectShare(link: string, options?: ShareFetchOptions): Promise<ShareInspection>;
97
- /**
98
- * Resolve and verify invitation metadata only. Actual content access is an
99
- * invocation against the owner node and is performed by the receiver SDK.
100
- */
101
- declare function receiveShare(link: string, options?: ShareFetchOptions): Promise<ShareReceiveOutcome>;
102
-
103
16
  interface ParsedAddressedEnvelope {
104
17
  readonly envelope: ShareEnvelopeV2;
105
18
  readonly policy: Record<string, unknown>;
@@ -288,118 +201,6 @@ declare function showShare(input: {
288
201
  readonly link?: string;
289
202
  }): Promise<ShareHistoryView>;
290
203
 
291
- interface ShareNodeTrust {
292
- readonly invitationKid: string;
293
- readonly invitationPublicKey: Uint8Array;
294
- }
295
- interface SharePresentationMaterial {
296
- readonly holderDid: string;
297
- readonly credential: string;
298
- readonly credentialDigest?: string;
299
- readonly holderBinding: Record<string, unknown>;
300
- readonly proof: Record<string, unknown>;
301
- readonly sign?: (bytes: Uint8Array) => Promise<Uint8Array>;
302
- readonly email?: string;
303
- /** Exact v3 credential claim returned by the verified holder ceremony. */
304
- readonly claim?: Record<string, unknown>;
305
- /** Exact v3 presentation returned by the verified holder ceremony. */
306
- readonly presentation?: Record<string, unknown>;
307
- /** Exact verified issuer envelope used by accountless v4 admission. */
308
- readonly credentialEnvelope?: Record<string, unknown>;
309
- /** Exact credential requirement committed by the signed policy. */
310
- readonly requirement?: Record<string, unknown>;
311
- }
312
- interface SharePolicyChallenge {
313
- readonly challengeId: string;
314
- readonly nonce: string;
315
- readonly expiresAt: string;
316
- readonly enforcerDid?: string;
317
- readonly action: string;
318
- readonly requestBodyDigest: string;
319
- readonly [key: string]: unknown;
320
- }
321
- interface ShareRecipientClientOptions {
322
- readonly nodeOrigin: string;
323
- /** Required only by the retired v2 response-proof adapter. Policy/v3 trusts its signed attested binding. */
324
- readonly trustedNode?: ShareNodeTrust;
325
- readonly holderDid: string;
326
- readonly envelope: ShareEnvelopeV2 | ShareEnvelopeV3;
327
- readonly fetchFn?: typeof fetch;
328
- readonly buildPresentation?: (input: {
329
- readonly challenge: SharePolicyChallenge;
330
- readonly envelope: ShareEnvelopeV2 | ShareEnvelopeV3;
331
- readonly policy: Record<string, unknown>;
332
- }) => Promise<SharePresentationMaterial>;
333
- readonly sign?: (bytes: Uint8Array) => Promise<Uint8Array>;
334
- readonly signal?: AbortSignal;
335
- readonly onStage?: (stage: "policy-admission" | "delegation-import" | "invocation" | "decryption") => void;
336
- /**
337
- * A previously admitted and imported policy session (S0), optionally with
338
- * the descendants that re-delegate it, in order, down to this holder.
339
- */
340
- readonly policyAuthorization?: {
341
- readonly authorization: string;
342
- readonly cid: string;
343
- readonly descendants?: readonly SharePolicyDelegationLink[];
344
- };
345
- }
346
- /** One signed link of a policy delegation chain, as imported into the Node. */
347
- interface SharePolicyDelegationLink {
348
- readonly authorization: string;
349
- readonly cid: string;
350
- }
351
- interface SharePolicySession {
352
- readonly sessionId: string;
353
- readonly expiresAt: string;
354
- readonly actions: readonly ("read" | "list" | "edit")[];
355
- readonly resource: {
356
- readonly kind: "exact" | "prefix";
357
- readonly path: string;
358
- };
359
- }
360
- declare class ShareRecipientClient {
361
- private readonly options;
362
- private readonly fetchFn;
363
- private session;
364
- private signer;
365
- private nativeSigner;
366
- private holderProof;
367
- private v3Authorization;
368
- private v3NodeAudience;
369
- private v3ContentKey;
370
- private v3ContentEnvelope;
371
- constructor(options: ShareRecipientClientOptions);
372
- beginChallenge(envelope: ShareEnvelopeV2): Promise<SharePolicyChallenge>;
373
- private establish;
374
- authorize(envelope: ShareEnvelopeV2): Promise<ShareAuthorizedContent>;
375
- establishPolicySession(): Promise<SharePolicySession>;
376
- private establishV3;
377
- /** Decrypt a v3 KV value through a fresh recipient-signed decrypt invocation. */
378
- decryptV3Content(bytes: Uint8Array): Promise<{
379
- readonly bytes: Uint8Array;
380
- readonly mediaType: string;
381
- }>;
382
- /** Re-encrypt edited v3 content with the admitted content key. */
383
- encryptV3Content(bytes: Uint8Array, mediaType: string): Promise<Uint8Array>;
384
- resumeWithProof(envelope: ShareEnvelopeV2, resumeToken: string, proof: unknown): Promise<ShareAuthorizedContent>;
385
- nativeInvoke(request: {
386
- readonly action: string;
387
- readonly resource?: Record<string, unknown>;
388
- readonly body?: number[];
389
- readonly bodyDigest?: number[];
390
- readonly ifMatch?: string;
391
- readonly contentType?: string;
392
- }): Promise<Response>;
393
- private nativeInvokeV3;
394
- }
395
- declare function createAddressedAuthorization(input: Omit<ShareRecipientClientOptions, "envelope" | "buildPresentation"> & {
396
- readonly buildPresentation?: (input: {
397
- readonly challenge: SharePolicyChallenge;
398
- readonly envelope: ShareEnvelopeV2;
399
- readonly policy: Record<string, unknown>;
400
- }) => Promise<SharePresentationMaterial>;
401
- }): ShareAuthorizationAdapter<ShareAuthorizedContent>;
402
-
403
204
  declare const SHARE_V2_PROTOCOL: Readonly<{
404
205
  readonly challengeDomain: "xyz.tinycloud.share/policy-challenge/v2\0";
405
206
  readonly sessionDomain: "xyz.tinycloud.share/policy-session/v2\0";
@@ -571,4 +372,4 @@ declare function assertArtifactBinding(view: ArtifactBindingView, expected?: Exp
571
372
  */
572
373
  declare function verifyArtifactShare(envelope: ShareEnvelopeV3, options: VerifyArtifactShareOptions): ArtifactPin | undefined;
573
374
 
574
- export { type ArtifactBindingView, ArtifactPinError, type ArtifactPinErrorCode, CredentialInvitationError, type CredentialInvitationErrorCode, type CredentialInvitationReceipt, type CredentialInvitationResult, DEFAULT_MAX_CONTENT_BLOB_BYTES, DEFAULT_MAX_SEALED_BLOB_BYTES, type ExpectedArtifact, MemoryShareCache, NATIVE_SHARE_FRAGMENT_PARAMETER, type NativeShareResult, type NativeSharingService, type ParsedAddressedEnvelope, SHARE_RESULT_VERSION, SHARE_V2_PROTOCOL, SenderShareRecord, SenderShareRecordStorage, ShareAuthorizationAdapter, ShareAuthorizationMethod, ShareAuthorizationResult, ShareAuthorizedContent, type ShareCache, type ShareCacheEntry, type ShareCacheKey, type ShareCacheMetadata, type ShareDeliveryAdapter, type ShareErrorCode, type ShareErrorInfo, type ShareFetchOptions, type ShareHistoryView, type ShareInspection, type ShareMetadata, type ShareNodeTrust, ShareNotifyError, type ShareNotifyInput, type ShareNotifyResult, type ShareNotifyState, type SharePolicyChallenge, type SharePolicyDelegationLink, type SharePolicyPublishAdapter, type SharePolicyRootRevocation, type SharePolicySession, type SharePresentationMaterial, type ShareReceiveAuthorizationRequired, ShareReceiveError, type ShareReceiveOutcome, type ShareReceiveResult, ShareRecipientClient, type ShareRecipientClientOptions, type ShareRevocationAdapter, type ShareRevocationResult, ShareTarget, TargetPublishInput, TargetPublishOutcome, type VerifyArtifactShareOptions, artifactBindingView, assertArtifactBinding, canonicalShareFilename, claimShare, createAddressedAuthorization, createNativeShare, createShareV2HolderBindingArtifact, deliverCredentialInvitation, hasUnsafeFilenameCodePoint, inspectShare, listShares, notifyShare, openNativeShare, parseAddressedEnvelope, parseNativeShareUrl, publishPolicyShare, receiveShare, recipientMatchesShareRecord, resumeShareAuthorization, revokeShare, shareDeliveryWindowExpiresAt, showShare, toShareErrorInfo, verifyArtifactShare };
375
+ export { type ArtifactBindingView, ArtifactPinError, type ArtifactPinErrorCode, CredentialInvitationError, type CredentialInvitationErrorCode, type CredentialInvitationReceipt, type CredentialInvitationResult, type ExpectedArtifact, MemoryShareCache, NATIVE_SHARE_FRAGMENT_PARAMETER, type NativeShareResult, type NativeSharingService, type ParsedAddressedEnvelope, SHARE_V2_PROTOCOL, SenderShareRecord, SenderShareRecordStorage, ShareAuthorizationAdapter, ShareAuthorizationResult, type ShareCache, type ShareCacheEntry, type ShareCacheKey, type ShareCacheMetadata, type ShareDeliveryAdapter, type ShareHistoryView, ShareNotifyError, type ShareNotifyInput, type ShareNotifyResult, type ShareNotifyState, type SharePolicyPublishAdapter, type SharePolicyRootRevocation, type ShareRevocationAdapter, type ShareRevocationResult, ShareTarget, TargetPublishInput, TargetPublishOutcome, type VerifyArtifactShareOptions, artifactBindingView, assertArtifactBinding, canonicalShareFilename, claimShare, createNativeShare, createShareV2HolderBindingArtifact, deliverCredentialInvitation, hasUnsafeFilenameCodePoint, listShares, notifyShare, openNativeShare, parseAddressedEnvelope, parseNativeShareUrl, publishPolicyShare, recipientMatchesShareRecord, resumeShareAuthorization, revokeShare, shareDeliveryWindowExpiresAt, showShare, verifyArtifactShare };
@@ -294,4 +294,4 @@ declare function validateOwnerSharePolicyRegistration(value: unknown, expected:
294
294
  /** Validate the exact UTF-8 response bytes emitted by the registration route. */
295
295
  declare function validateOwnerSharePolicyRegistrationBytes(bytesValue: Uint8Array, expected: RegisterOwnerSharePolicyParams): OwnerSharePolicyRegistrationReceipt;
296
296
 
297
- export { type CreateOwnerDelegationParams as C, DEFAULT_SHARE_LIFETIME_MS as D, MAX_CONTENT_BYTES as M, OWNER_SHARE_REGISTRATION_DOMAIN as O, type PublishedShare as P, type RegisterOwnerSharePolicyParams as R, SHARE_CONTENT_LIMIT as S, type DelegatedShareKey as a, type OwnerDelegationPermission as b, type OwnerDelegationReceipt as c, type OwnerShareAction as d, type OwnerShareDecryption as e, type OwnerShareMatcher as f, type OwnerSharePolicyRegistration as g, type OwnerSharePolicyRegistrationReceipt as h, type OwnerSharePolicyV2 as i, type PublishedShareDeliveryMaterial as j, type PublishedShareMetadata as k, SHARE_PUBLISH_RESULT_VERSION as l, SharePublishError as m, type SharePublishErrorCode as n, type SharePublishOptions as o, type SharePublishTarget as p, type SignedDelegation as q, canonicalOwnerSharePolicy as r, computeOwnerShareRegistrationCid as s, createDelegatedShareKey as t, createPolicyEnforcementDelegation as u, redactPublishedShare as v, restoreDelegatedShareKey as w, validateOwnerSharePolicyRegistration as x, validateOwnerSharePolicyRegistrationBytes as y };
297
+ export { type CreateOwnerDelegationParams as C, type DelegatedShareKey as D, MAX_CONTENT_BYTES as M, type OwnerShareAction as O, type PublishedShareDeliveryMaterial as P, type RegisterOwnerSharePolicyParams as R, type SignedDelegation as S, type OwnerShareMatcher as a, type OwnerSharePolicyRegistrationReceipt as b, type PublishedShare as c, type SharePublishTarget as d, type SharePublishOptions as e, type OwnerDelegationReceipt as f, DEFAULT_SHARE_LIFETIME_MS as g, OWNER_SHARE_REGISTRATION_DOMAIN as h, type OwnerDelegationPermission as i, type OwnerShareDecryption as j, type OwnerSharePolicyRegistration as k, type OwnerSharePolicyV2 as l, type PublishedShareMetadata as m, SHARE_CONTENT_LIMIT as n, SHARE_PUBLISH_RESULT_VERSION as o, SharePublishError as p, type SharePublishErrorCode as q, canonicalOwnerSharePolicy as r, computeOwnerShareRegistrationCid as s, createDelegatedShareKey as t, createPolicyEnforcementDelegation as u, redactPublishedShare as v, restoreDelegatedShareKey as w, validateOwnerSharePolicyRegistration as x, validateOwnerSharePolicyRegistrationBytes as y };
@@ -294,4 +294,4 @@ declare function validateOwnerSharePolicyRegistration(value: unknown, expected:
294
294
  /** Validate the exact UTF-8 response bytes emitted by the registration route. */
295
295
  declare function validateOwnerSharePolicyRegistrationBytes(bytesValue: Uint8Array, expected: RegisterOwnerSharePolicyParams): OwnerSharePolicyRegistrationReceipt;
296
296
 
297
- export { type CreateOwnerDelegationParams as C, DEFAULT_SHARE_LIFETIME_MS as D, MAX_CONTENT_BYTES as M, OWNER_SHARE_REGISTRATION_DOMAIN as O, type PublishedShare as P, type RegisterOwnerSharePolicyParams as R, SHARE_CONTENT_LIMIT as S, type DelegatedShareKey as a, type OwnerDelegationPermission as b, type OwnerDelegationReceipt as c, type OwnerShareAction as d, type OwnerShareDecryption as e, type OwnerShareMatcher as f, type OwnerSharePolicyRegistration as g, type OwnerSharePolicyRegistrationReceipt as h, type OwnerSharePolicyV2 as i, type PublishedShareDeliveryMaterial as j, type PublishedShareMetadata as k, SHARE_PUBLISH_RESULT_VERSION as l, SharePublishError as m, type SharePublishErrorCode as n, type SharePublishOptions as o, type SharePublishTarget as p, type SignedDelegation as q, canonicalOwnerSharePolicy as r, computeOwnerShareRegistrationCid as s, createDelegatedShareKey as t, createPolicyEnforcementDelegation as u, redactPublishedShare as v, restoreDelegatedShareKey as w, validateOwnerSharePolicyRegistration as x, validateOwnerSharePolicyRegistrationBytes as y };
297
+ export { type CreateOwnerDelegationParams as C, type DelegatedShareKey as D, MAX_CONTENT_BYTES as M, type OwnerShareAction as O, type PublishedShareDeliveryMaterial as P, type RegisterOwnerSharePolicyParams as R, type SignedDelegation as S, type OwnerShareMatcher as a, type OwnerSharePolicyRegistrationReceipt as b, type PublishedShare as c, type SharePublishTarget as d, type SharePublishOptions as e, type OwnerDelegationReceipt as f, DEFAULT_SHARE_LIFETIME_MS as g, OWNER_SHARE_REGISTRATION_DOMAIN as h, type OwnerDelegationPermission as i, type OwnerShareDecryption as j, type OwnerSharePolicyRegistration as k, type OwnerSharePolicyV2 as l, type PublishedShareMetadata as m, SHARE_CONTENT_LIMIT as n, SHARE_PUBLISH_RESULT_VERSION as o, SharePublishError as p, type SharePublishErrorCode as q, canonicalOwnerSharePolicy as r, computeOwnerShareRegistrationCid as s, createDelegatedShareKey as t, createPolicyEnforcementDelegation as u, redactPublishedShare as v, restoreDelegatedShareKey as w, validateOwnerSharePolicyRegistration as x, validateOwnerSharePolicyRegistrationBytes as y };
@@ -1,6 +1,6 @@
1
- import { a as SenderShareRecordStorage, S as SenderShareRecord } from './history-CUWDK0lE.cjs';
2
- export { f as SenderShareRecordProofs } from './history-CUWDK0lE.cjs';
3
- import { j as PublishedShareDeliveryMaterial, q as SignedDelegation, g as OwnerSharePolicyRegistration } from './owner-policy-BqzRlkb6.cjs';
1
+ import { a as SenderShareRecordStorage, S as SenderShareRecord } from './history-ZJFHV-IU.cjs';
2
+ export { f as SenderShareRecordProofs } from './history-ZJFHV-IU.cjs';
3
+ import { P as PublishedShareDeliveryMaterial, S as SignedDelegation, k as OwnerSharePolicyRegistration } from './owner-policy-CRFeEC98.cjs';
4
4
  import { ShareEnvelopeV3 } from '@tinycloud/share-envelope';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { a as SenderShareRecordStorage, S as SenderShareRecord } from './history-CyT6x8h4.js';
2
- export { f as SenderShareRecordProofs } from './history-CyT6x8h4.js';
3
- import { j as PublishedShareDeliveryMaterial, q as SignedDelegation, g as OwnerSharePolicyRegistration } from './owner-policy-BqzRlkb6.js';
1
+ import { a as SenderShareRecordStorage, S as SenderShareRecord } from './history-q0ALXTv7.js';
2
+ export { f as SenderShareRecordProofs } from './history-q0ALXTv7.js';
3
+ import { P as PublishedShareDeliveryMaterial, S as SignedDelegation, k as OwnerSharePolicyRegistration } from './owner-policy-CRFeEC98.js';
4
4
  import { ShareEnvelopeV3 } from '@tinycloud/share-envelope';
5
5
 
6
6
  /**
@@ -1,6 +1,7 @@
1
1
  import { CompactUcanAuthorization, UnifiedContentSource } from '@tinycloud/share-envelope';
2
- import { A as AddressedOwnerRootInput, f as AddressedOwnerRootReceipt, i as AddressedPublishAuthority } from './addressed-publish-DtcLNG2m.cjs';
3
- import { C as CreateOwnerDelegationParams, c as OwnerDelegationReceipt, a as DelegatedShareKey } from './owner-policy-BqzRlkb6.cjs';
2
+ import { A as AddressedOwnerRootInput, a as AddressedOwnerRootReceipt, b as AddressedPublishAuthority } from './addressed-publish-Db-6rqkA.cjs';
3
+ import { C as CreateOwnerDelegationParams, f as OwnerDelegationReceipt, D as DelegatedShareKey } from './owner-policy-CRFeEC98.cjs';
4
+ import './authorization-CmP1skO8.cjs';
4
5
 
5
6
  /**
6
7
  * The fields of an owner-signed SIWE CACAO that bound its authority. Read
@@ -1,6 +1,7 @@
1
1
  import { CompactUcanAuthorization, UnifiedContentSource } from '@tinycloud/share-envelope';
2
- import { A as AddressedOwnerRootInput, f as AddressedOwnerRootReceipt, i as AddressedPublishAuthority } from './addressed-publish-BnSBJ-MX.js';
3
- import { C as CreateOwnerDelegationParams, c as OwnerDelegationReceipt, a as DelegatedShareKey } from './owner-policy-BqzRlkb6.js';
2
+ import { A as AddressedOwnerRootInput, a as AddressedOwnerRootReceipt, b as AddressedPublishAuthority } from './addressed-publish-CAdGCqiX.js';
3
+ import { C as CreateOwnerDelegationParams, f as OwnerDelegationReceipt, D as DelegatedShareKey } from './owner-policy-CRFeEC98.js';
4
+ import './authorization-CmP1skO8.js';
4
5
 
5
6
  /**
6
7
  * The fields of an owner-signed SIWE CACAO that bound its authority. Read
@@ -0,0 +1,206 @@
1
+ import { ShareEnvelopeV3, ShareEnvelopeV2 } from '@tinycloud/share-envelope';
2
+ import { a as ShareAuthorizationMethod, f as ShareAuthorizedContent, c as ShareAuthorizationAdapter } from './authorization-CmP1skO8.js';
3
+
4
+ type ShareErrorCode = "invalid-link" | "fetch-failed" | "max-bytes-exceeded" | "cid-mismatch" | "decrypt-failed" | "envelope-invalid" | "origin-mismatch" | "signature-invalid" | "capability-invalid" | "expired" | "unsupported-target" | "authorization-denied" | "content-integrity-failed";
5
+ declare const SHARE_RESULT_VERSION: 1;
6
+ declare const DEFAULT_MAX_SEALED_BLOB_BYTES: number;
7
+ declare const DEFAULT_MAX_CONTENT_BLOB_BYTES: number;
8
+ declare class ShareReceiveError extends Error {
9
+ readonly code: ShareErrorCode;
10
+ readonly details: {
11
+ readonly expiresAt?: string;
12
+ readonly stage?: "envelope" | "content";
13
+ readonly reason?: "policy-target" | "recipient-did-target" | "prefix-resource";
14
+ } | undefined;
15
+ constructor(code: ShareErrorCode, message: string, details?: {
16
+ readonly expiresAt?: string;
17
+ readonly stage?: "envelope" | "content";
18
+ readonly reason?: "policy-target" | "recipient-did-target" | "prefix-resource";
19
+ });
20
+ toJSON(): ShareErrorInfo;
21
+ }
22
+ interface ShareErrorInfo {
23
+ readonly protocol: "tinycloud-share";
24
+ readonly version: typeof SHARE_RESULT_VERSION;
25
+ readonly error: {
26
+ readonly code: ShareErrorCode;
27
+ };
28
+ }
29
+ declare function toShareErrorInfo(error: unknown): ShareErrorInfo;
30
+ /** Policy/v3 links seal their authorization metadata in a fragment; no blob fetch adapter exists. */
31
+ interface ShareFetchOptions {
32
+ readonly expectedOrigin?: string;
33
+ readonly signal?: AbortSignal;
34
+ readonly now?: () => number;
35
+ readonly maxSealedBlobBytes?: number;
36
+ readonly maxContentBlobBytes?: number;
37
+ readonly onResolvedAddressedEnvelope?: (envelope: ShareEnvelopeV3, cid: string) => void;
38
+ }
39
+ interface ShareMetadata {
40
+ readonly protocol: "tinycloud-share";
41
+ readonly version: 1;
42
+ readonly shareId: string;
43
+ readonly origin: string;
44
+ readonly target: {
45
+ readonly kind: "bearer" | "recipientDid" | "email" | "emailDomain";
46
+ readonly origin: string;
47
+ readonly nodeAudience: string;
48
+ readonly spaceId: string;
49
+ };
50
+ readonly resource: {
51
+ readonly kind: "exact" | "prefix";
52
+ readonly path: string;
53
+ };
54
+ readonly actions: readonly string[];
55
+ readonly expiresAt: string;
56
+ readonly display: {
57
+ readonly senderName?: string;
58
+ readonly filename?: string;
59
+ readonly mode?: string;
60
+ };
61
+ /** Set when the share is pinned to one artifact version; the owner's signature covers it (TC-1428). */
62
+ readonly artifact?: {
63
+ readonly id: string;
64
+ readonly version: number;
65
+ };
66
+ }
67
+ interface ShareInspection {
68
+ readonly metadata: ShareMetadata;
69
+ readonly link: {
70
+ readonly origin: string;
71
+ readonly cid: string;
72
+ readonly kind: "policy";
73
+ };
74
+ }
75
+ interface ShareReceiveAuthorizationRequired {
76
+ readonly state: "authorization-required";
77
+ readonly method: ShareAuthorizationMethod;
78
+ readonly continueUrl?: string;
79
+ readonly resumeToken?: string;
80
+ }
81
+ /** Retained as the result consumed after the node authorization ceremony. */
82
+ interface ShareReceiveResult extends ShareInspection {
83
+ readonly bytes: Uint8Array;
84
+ readonly text?: string;
85
+ }
86
+ type ShareReceiveOutcome = ShareReceiveResult | ShareReceiveAuthorizationRequired;
87
+ declare function inspectShare(link: string, options?: ShareFetchOptions): Promise<ShareInspection>;
88
+ /**
89
+ * Resolve and verify invitation metadata only. Actual content access is an
90
+ * invocation against the owner node and is performed by the receiver SDK.
91
+ */
92
+ declare function receiveShare(link: string, options?: ShareFetchOptions): Promise<ShareReceiveOutcome>;
93
+
94
+ interface ShareNodeTrust {
95
+ readonly invitationKid: string;
96
+ readonly invitationPublicKey: Uint8Array;
97
+ }
98
+ interface SharePresentationMaterial {
99
+ readonly holderDid: string;
100
+ readonly credential: string;
101
+ readonly credentialDigest?: string;
102
+ readonly holderBinding: Record<string, unknown>;
103
+ readonly proof: Record<string, unknown>;
104
+ readonly sign?: (bytes: Uint8Array) => Promise<Uint8Array>;
105
+ readonly email?: string;
106
+ /** Exact v3 credential claim returned by the verified holder ceremony. */
107
+ readonly claim?: Record<string, unknown>;
108
+ /** Exact v3 presentation returned by the verified holder ceremony. */
109
+ readonly presentation?: Record<string, unknown>;
110
+ /** Exact verified issuer envelope used by accountless v4 admission. */
111
+ readonly credentialEnvelope?: Record<string, unknown>;
112
+ /** Exact credential requirement committed by the signed policy. */
113
+ readonly requirement?: Record<string, unknown>;
114
+ }
115
+ interface SharePolicyChallenge {
116
+ readonly challengeId: string;
117
+ readonly nonce: string;
118
+ readonly expiresAt: string;
119
+ readonly enforcerDid?: string;
120
+ readonly action: string;
121
+ readonly requestBodyDigest: string;
122
+ readonly [key: string]: unknown;
123
+ }
124
+ interface ShareRecipientClientOptions {
125
+ readonly nodeOrigin: string;
126
+ /** Required only by the retired v2 response-proof adapter. Policy/v3 trusts its signed attested binding. */
127
+ readonly trustedNode?: ShareNodeTrust;
128
+ readonly holderDid: string;
129
+ readonly envelope: ShareEnvelopeV2 | ShareEnvelopeV3;
130
+ readonly fetchFn?: typeof fetch;
131
+ readonly buildPresentation?: (input: {
132
+ readonly challenge: SharePolicyChallenge;
133
+ readonly envelope: ShareEnvelopeV2 | ShareEnvelopeV3;
134
+ readonly policy: Record<string, unknown>;
135
+ }) => Promise<SharePresentationMaterial>;
136
+ readonly sign?: (bytes: Uint8Array) => Promise<Uint8Array>;
137
+ readonly signal?: AbortSignal;
138
+ readonly onStage?: (stage: "policy-admission" | "delegation-import" | "invocation" | "decryption") => void;
139
+ /**
140
+ * A previously admitted and imported policy session (S0), optionally with
141
+ * the descendants that re-delegate it, in order, down to this holder.
142
+ */
143
+ readonly policyAuthorization?: {
144
+ readonly authorization: string;
145
+ readonly cid: string;
146
+ readonly descendants?: readonly SharePolicyDelegationLink[];
147
+ };
148
+ }
149
+ /** One signed link of a policy delegation chain, as imported into the Node. */
150
+ interface SharePolicyDelegationLink {
151
+ readonly authorization: string;
152
+ readonly cid: string;
153
+ }
154
+ interface SharePolicySession {
155
+ readonly sessionId: string;
156
+ readonly expiresAt: string;
157
+ readonly actions: readonly ("read" | "list" | "edit")[];
158
+ readonly resource: {
159
+ readonly kind: "exact" | "prefix";
160
+ readonly path: string;
161
+ };
162
+ }
163
+ declare class ShareRecipientClient {
164
+ private readonly options;
165
+ private readonly fetchFn;
166
+ private session;
167
+ private signer;
168
+ private nativeSigner;
169
+ private holderProof;
170
+ private v3Authorization;
171
+ private v3NodeAudience;
172
+ private v3ContentKey;
173
+ private v3ContentEnvelope;
174
+ constructor(options: ShareRecipientClientOptions);
175
+ beginChallenge(envelope: ShareEnvelopeV2): Promise<SharePolicyChallenge>;
176
+ private establish;
177
+ authorize(envelope: ShareEnvelopeV2): Promise<ShareAuthorizedContent>;
178
+ establishPolicySession(): Promise<SharePolicySession>;
179
+ private establishV3;
180
+ /** Decrypt a v3 KV value through a fresh recipient-signed decrypt invocation. */
181
+ decryptV3Content(bytes: Uint8Array): Promise<{
182
+ readonly bytes: Uint8Array;
183
+ readonly mediaType: string;
184
+ }>;
185
+ /** Re-encrypt edited v3 content with the admitted content key. */
186
+ encryptV3Content(bytes: Uint8Array, mediaType: string): Promise<Uint8Array>;
187
+ resumeWithProof(envelope: ShareEnvelopeV2, resumeToken: string, proof: unknown): Promise<ShareAuthorizedContent>;
188
+ nativeInvoke(request: {
189
+ readonly action: string;
190
+ readonly resource?: Record<string, unknown>;
191
+ readonly body?: number[];
192
+ readonly bodyDigest?: number[];
193
+ readonly ifMatch?: string;
194
+ readonly contentType?: string;
195
+ }): Promise<Response>;
196
+ private nativeInvokeV3;
197
+ }
198
+ declare function createAddressedAuthorization(input: Omit<ShareRecipientClientOptions, "envelope" | "buildPresentation"> & {
199
+ readonly buildPresentation?: (input: {
200
+ readonly challenge: SharePolicyChallenge;
201
+ readonly envelope: ShareEnvelopeV2;
202
+ readonly policy: Record<string, unknown>;
203
+ }) => Promise<SharePresentationMaterial>;
204
+ }): ShareAuthorizationAdapter<ShareAuthorizedContent>;
205
+
206
+ export { DEFAULT_MAX_CONTENT_BLOB_BYTES as D, SHARE_RESULT_VERSION as S, DEFAULT_MAX_SEALED_BLOB_BYTES as a, type ShareErrorCode as b, type ShareErrorInfo as c, type ShareFetchOptions as d, type ShareInspection as e, type ShareMetadata as f, type ShareNodeTrust as g, type SharePolicyChallenge as h, type SharePolicyDelegationLink as i, type SharePolicySession as j, type SharePresentationMaterial as k, type ShareReceiveAuthorizationRequired as l, ShareReceiveError as m, type ShareReceiveOutcome as n, type ShareReceiveResult as o, ShareRecipientClient as p, type ShareRecipientClientOptions as q, createAddressedAuthorization as r, inspectShare as s, receiveShare as t, toShareErrorInfo as u };