@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.
- package/dist/{addressed-publish-BP6nsgRq.d.cts → addressed-publish-BcvisG4a.d.cts} +7 -0
- package/dist/{addressed-publish-CpkwV-Au.d.ts → addressed-publish-CwTTn9Jn.d.ts} +7 -0
- package/dist/artifact.cjs +27 -4
- package/dist/artifact.cjs.map +1 -1
- package/dist/artifact.js +27 -4
- package/dist/artifact.js.map +1 -1
- package/dist/index.cjs +302 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +302 -49
- package/dist/index.js.map +1 -1
- package/dist/share-index.cjs +27 -4
- package/dist/share-index.cjs.map +1 -1
- package/dist/share-index.js +27 -4
- package/dist/share-index.js.map +1 -1
- package/dist/share-root.cjs +27 -4
- package/dist/share-root.cjs.map +1 -1
- package/dist/share-root.d.cts +1 -1
- package/dist/share-root.d.ts +1 -1
- package/dist/share-root.js +27 -4
- package/dist/share-root.js.map +1 -1
- package/dist/{web-recipient-entry-CiUzdSQs.d.cts → web-recipient-entry-Bn3yRB7g.d.cts} +47 -6
- package/dist/{web-recipient-entry-DVyTQBl0.d.ts → web-recipient-entry-CTFoIH8l.d.ts} +47 -6
- package/dist/web-recipient.cjs +277 -47
- package/dist/web-recipient.cjs.map +1 -1
- package/dist/web-recipient.d.cts +1 -1
- package/dist/web-recipient.d.ts +1 -1
- package/dist/web-recipient.js +277 -47
- package/dist/web-recipient.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
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
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
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
|
|
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 };
|