@tinycloud/share-sdk 1.4.1-beta.0 → 1.4.1-beta.2

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 { ShareEnvelopeV3, ShareEnvelopeV2 } from '@tinycloud/share-envelope';
2
- import { a as ShareAuthorizationMethod, f as ShareAuthorizedContent, c as ShareAuthorizationAdapter } from './authorization-CmP1skO8.cjs';
1
+ import { ShareEnvelopeV2, ShareEnvelopeV3 } from '@tinycloud/share-envelope';
2
+ import { c as ShareAuthorizationAdapter, f as ShareAuthorizedContent, a as ShareAuthorizationMethod } from './authorization-CmP1skO8.cjs';
3
3
 
4
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
5
  declare const SHARE_RESULT_VERSION: 1;
@@ -42,7 +42,19 @@ interface ShareFetchOptions {
42
42
  readonly now?: () => number;
43
43
  readonly maxSealedBlobBytes?: number;
44
44
  readonly maxContentBlobBytes?: number;
45
- readonly onResolvedAddressedEnvelope?: (envelope: ShareEnvelopeV3, cid: string) => void;
45
+ readonly onResolvedAddressedEnvelope?: (envelope: ShareEnvelopeV2 | ShareEnvelopeV3, cid: string) => void;
46
+ /** Legacy V2 registry transport; used only for existing compact V2 links. */
47
+ readonly registryBaseUrl?: string;
48
+ readonly fetchBlob?: (input: {
49
+ readonly origin: string;
50
+ readonly cid: string;
51
+ readonly signal?: AbortSignal;
52
+ }) => Promise<Uint8Array>;
53
+ readonly trustedSignerDid?: string;
54
+ readonly trustedPolicyAuthority?: SharePolicyAuthority;
55
+ readonly authorization?: ShareAuthorizationAdapter<ShareAuthorizedContent>;
56
+ readonly authorizationResumeToken?: string;
57
+ readonly authorizationProof?: unknown;
46
58
  }
47
59
  interface ShareMetadata {
48
60
  readonly protocol: "tinycloud-share";
@@ -77,8 +89,37 @@ interface ShareInspection {
77
89
  readonly link: {
78
90
  readonly origin: string;
79
91
  readonly cid: string;
80
- readonly kind: "policy";
92
+ readonly kind: "policy" | "compact";
93
+ };
94
+ }
95
+ interface SharePolicyEvidence {
96
+ readonly policyCid: string;
97
+ readonly signerDid: string;
98
+ readonly registrationCid: string;
99
+ readonly shareId: string;
100
+ readonly recipientMatcher: unknown;
101
+ readonly target: {
102
+ readonly origin: string;
103
+ readonly nodeAudience: string;
104
+ readonly spaceId: string;
81
105
  };
106
+ readonly resource: {
107
+ readonly kind: "exact" | "prefix";
108
+ readonly path: string;
109
+ };
110
+ readonly actions: readonly string[];
111
+ readonly contentSource: unknown;
112
+ readonly contentSourceDigest: string;
113
+ readonly delegationCid: string;
114
+ readonly authorityMaterialHandle: string;
115
+ readonly authorityMaterialDigest: string;
116
+ readonly expiresAt: string;
117
+ }
118
+ interface SharePolicyAuthority {
119
+ resolve(input: {
120
+ readonly policyCid: string;
121
+ readonly envelope: ShareEnvelopeV2;
122
+ }): Promise<SharePolicyEvidence | undefined>;
82
123
  }
83
124
  interface ShareReceiveAuthorizationRequired {
84
125
  readonly state: "authorization-required";
@@ -185,7 +226,7 @@ declare class ShareRecipientClient {
185
226
  authorize(envelope: ShareEnvelopeV2): Promise<ShareAuthorizedContent>;
186
227
  establishPolicySession(): Promise<SharePolicySession>;
187
228
  private establishV3;
188
- /** Decrypt a v3 KV value through a fresh recipient-signed decrypt invocation. */
229
+ /** Decrypt unscoped v1 or path-bound v2 content, independently checking canonical and registered raw-key digests. */
189
230
  decryptV3Content(bytes: Uint8Array): Promise<{
190
231
  readonly bytes: Uint8Array;
191
232
  readonly mediaType: string;
@@ -211,4 +252,4 @@ declare function createAddressedAuthorization(input: Omit<ShareRecipientClientOp
211
252
  }) => Promise<SharePresentationMaterial>;
212
253
  }): ShareAuthorizationAdapter<ShareAuthorizedContent>;
213
254
 
214
- 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 };
255
+ 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 SharePolicyAuthority as h, type SharePolicyChallenge as i, type SharePolicyDelegationLink as j, type SharePolicyEvidence as k, type SharePolicySession as l, type SharePresentationMaterial as m, type ShareReceiveAuthorizationRequired as n, ShareReceiveError as o, type ShareReceiveOutcome as p, type ShareReceiveResult as q, ShareRecipientClient as r, type ShareRecipientClientOptions as s, createAddressedAuthorization as t, inspectShare as u, receiveShare as v, toShareErrorInfo as w };
@@ -1,5 +1,5 @@
1
- import { ShareEnvelopeV3, ShareEnvelopeV2 } from '@tinycloud/share-envelope';
2
- import { a as ShareAuthorizationMethod, f as ShareAuthorizedContent, c as ShareAuthorizationAdapter } from './authorization-CmP1skO8.js';
1
+ import { ShareEnvelopeV2, ShareEnvelopeV3 } from '@tinycloud/share-envelope';
2
+ import { c as ShareAuthorizationAdapter, f as ShareAuthorizedContent, a as ShareAuthorizationMethod } from './authorization-CmP1skO8.js';
3
3
 
4
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
5
  declare const SHARE_RESULT_VERSION: 1;
@@ -42,7 +42,19 @@ interface ShareFetchOptions {
42
42
  readonly now?: () => number;
43
43
  readonly maxSealedBlobBytes?: number;
44
44
  readonly maxContentBlobBytes?: number;
45
- readonly onResolvedAddressedEnvelope?: (envelope: ShareEnvelopeV3, cid: string) => void;
45
+ readonly onResolvedAddressedEnvelope?: (envelope: ShareEnvelopeV2 | ShareEnvelopeV3, cid: string) => void;
46
+ /** Legacy V2 registry transport; used only for existing compact V2 links. */
47
+ readonly registryBaseUrl?: string;
48
+ readonly fetchBlob?: (input: {
49
+ readonly origin: string;
50
+ readonly cid: string;
51
+ readonly signal?: AbortSignal;
52
+ }) => Promise<Uint8Array>;
53
+ readonly trustedSignerDid?: string;
54
+ readonly trustedPolicyAuthority?: SharePolicyAuthority;
55
+ readonly authorization?: ShareAuthorizationAdapter<ShareAuthorizedContent>;
56
+ readonly authorizationResumeToken?: string;
57
+ readonly authorizationProof?: unknown;
46
58
  }
47
59
  interface ShareMetadata {
48
60
  readonly protocol: "tinycloud-share";
@@ -77,8 +89,37 @@ interface ShareInspection {
77
89
  readonly link: {
78
90
  readonly origin: string;
79
91
  readonly cid: string;
80
- readonly kind: "policy";
92
+ readonly kind: "policy" | "compact";
93
+ };
94
+ }
95
+ interface SharePolicyEvidence {
96
+ readonly policyCid: string;
97
+ readonly signerDid: string;
98
+ readonly registrationCid: string;
99
+ readonly shareId: string;
100
+ readonly recipientMatcher: unknown;
101
+ readonly target: {
102
+ readonly origin: string;
103
+ readonly nodeAudience: string;
104
+ readonly spaceId: string;
81
105
  };
106
+ readonly resource: {
107
+ readonly kind: "exact" | "prefix";
108
+ readonly path: string;
109
+ };
110
+ readonly actions: readonly string[];
111
+ readonly contentSource: unknown;
112
+ readonly contentSourceDigest: string;
113
+ readonly delegationCid: string;
114
+ readonly authorityMaterialHandle: string;
115
+ readonly authorityMaterialDigest: string;
116
+ readonly expiresAt: string;
117
+ }
118
+ interface SharePolicyAuthority {
119
+ resolve(input: {
120
+ readonly policyCid: string;
121
+ readonly envelope: ShareEnvelopeV2;
122
+ }): Promise<SharePolicyEvidence | undefined>;
82
123
  }
83
124
  interface ShareReceiveAuthorizationRequired {
84
125
  readonly state: "authorization-required";
@@ -185,7 +226,7 @@ declare class ShareRecipientClient {
185
226
  authorize(envelope: ShareEnvelopeV2): Promise<ShareAuthorizedContent>;
186
227
  establishPolicySession(): Promise<SharePolicySession>;
187
228
  private establishV3;
188
- /** Decrypt a v3 KV value through a fresh recipient-signed decrypt invocation. */
229
+ /** Decrypt unscoped v1 or path-bound v2 content, independently checking canonical and registered raw-key digests. */
189
230
  decryptV3Content(bytes: Uint8Array): Promise<{
190
231
  readonly bytes: Uint8Array;
191
232
  readonly mediaType: string;
@@ -211,4 +252,4 @@ declare function createAddressedAuthorization(input: Omit<ShareRecipientClientOp
211
252
  }) => Promise<SharePresentationMaterial>;
212
253
  }): ShareAuthorizationAdapter<ShareAuthorizedContent>;
213
254
 
214
- 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 };
255
+ 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 SharePolicyAuthority as h, type SharePolicyChallenge as i, type SharePolicyDelegationLink as j, type SharePolicyEvidence as k, type SharePolicySession as l, type SharePresentationMaterial as m, type ShareReceiveAuthorizationRequired as n, ShareReceiveError as o, type ShareReceiveOutcome as p, type ShareReceiveResult as q, ShareRecipientClient as r, type ShareRecipientClientOptions as s, createAddressedAuthorization as t, inspectShare as u, receiveShare as v, toShareErrorInfo as w };