@tinycloud/share-sdk 1.2.1-beta.0 → 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/README.md +5 -0
- package/dist/{addressed-publish-BnSBJ-MX.d.ts → addressed-publish-CAdGCqiX.d.ts} +4 -79
- package/dist/{addressed-publish-DtcLNG2m.d.cts → addressed-publish-Db-6rqkA.d.cts} +4 -79
- package/dist/authorization-CmP1skO8.d.cts +79 -0
- package/dist/authorization-CmP1skO8.d.ts +79 -0
- package/dist/{history-CUWDK0lE.d.cts → history-ZJFHV-IU.d.cts} +1 -1
- package/dist/{history-CyT6x8h4.d.ts → history-q0ALXTv7.d.ts} +1 -1
- package/dist/index.d.cts +10 -209
- package/dist/index.d.ts +10 -209
- package/dist/{owner-policy-BqzRlkb6.d.cts → owner-policy-CRFeEC98.d.cts} +1 -1
- package/dist/{owner-policy-BqzRlkb6.d.ts → owner-policy-CRFeEC98.d.ts} +1 -1
- package/dist/share-index.d.cts +3 -3
- package/dist/share-index.d.ts +3 -3
- package/dist/share-root.d.cts +3 -2
- package/dist/share-root.d.ts +3 -2
- package/dist/web-recipient-entry-CKA_vCi5.d.ts +206 -0
- package/dist/web-recipient-entry-D9IJEyRA.d.cts +206 -0
- package/dist/web-recipient.cjs +6307 -0
- package/dist/web-recipient.cjs.map +1 -0
- package/dist/web-recipient.d.cts +3 -0
- package/dist/web-recipient.d.ts +3 -0
- package/dist/web-recipient.js +6285 -0
- package/dist/web-recipient.js.map +1 -0
- package/package.json +8 -2
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @tinycloud/share-sdk
|
|
2
|
+
|
|
3
|
+
## Subpath exports
|
|
4
|
+
|
|
5
|
+
- `@tinycloud/share-sdk/web-recipient`: `inspectShare`, `ShareRecipientClient`, and the `ShareMetadata` type. The browser recipient surface, imported without the package root barrel. Its contents are fixed to these three names.
|
|
@@ -1,81 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/** The only interactive boundary exposed by the headless SDK. */
|
|
5
|
-
type ShareAuthorizationMethod = "openkey-device" | "email-claim" | "email-otp";
|
|
6
|
-
interface ShareAuthorizationRequired {
|
|
7
|
-
readonly state: "authorization-required";
|
|
8
|
-
readonly method: ShareAuthorizationMethod;
|
|
9
|
-
/** A browser-safe continuation location. It must never contain a claim secret. */
|
|
10
|
-
readonly continueUrl?: string;
|
|
11
|
-
/** An opaque, short-lived, nonce-bound handle. It is not a bearer credential. */
|
|
12
|
-
readonly resumeToken?: string;
|
|
13
|
-
}
|
|
14
|
-
interface ShareAuthorizationDenied {
|
|
15
|
-
readonly state: "denied";
|
|
16
|
-
readonly reason: "rejected" | "expired" | "revoked" | "unsupported";
|
|
17
|
-
}
|
|
18
|
-
interface ShareAuthorizationReady<T> {
|
|
19
|
-
readonly state: "ready";
|
|
20
|
-
readonly value: T;
|
|
21
|
-
}
|
|
22
|
-
type ShareAuthorizationResult<T> = ShareAuthorizationReady<T> | ShareAuthorizationRequired | ShareAuthorizationDenied;
|
|
23
|
-
interface ShareAuthorizationAdapter<T> {
|
|
24
|
-
begin(input: {
|
|
25
|
-
readonly envelope: ShareEnvelopeV2;
|
|
26
|
-
readonly method: ShareAuthorizationMethod;
|
|
27
|
-
}): Promise<ShareAuthorizationResult<T>>;
|
|
28
|
-
resume(input: {
|
|
29
|
-
readonly envelope: ShareEnvelopeV2;
|
|
30
|
-
readonly method: ShareAuthorizationMethod;
|
|
31
|
-
readonly resumeToken: string;
|
|
32
|
-
readonly proof?: unknown;
|
|
33
|
-
}): Promise<ShareAuthorizationResult<T>>;
|
|
34
|
-
/** Verify the detached node proof against a pinned authority trust bundle. */
|
|
35
|
-
readonly verifyResult?: (input: {
|
|
36
|
-
readonly envelope: ShareEnvelopeV2;
|
|
37
|
-
readonly value: T;
|
|
38
|
-
readonly proof: unknown;
|
|
39
|
-
}) => Promise<boolean>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A node-authorized addressed read. Returning plaintext alone is not an
|
|
43
|
-
* authorization result: the caller must also return the signed response
|
|
44
|
-
* binding and digest that the node produced for that exact share.
|
|
45
|
-
*/
|
|
46
|
-
interface ShareAuthorizedContent {
|
|
47
|
-
readonly bytes: Uint8Array;
|
|
48
|
-
readonly bodyDigest: string;
|
|
49
|
-
readonly contentSourceDigest: string;
|
|
50
|
-
readonly binding: {
|
|
51
|
-
readonly shareId: string;
|
|
52
|
-
readonly delegationCid: string;
|
|
53
|
-
readonly authorityMaterialHandle: string;
|
|
54
|
-
readonly authorityMaterialDigest: string;
|
|
55
|
-
readonly resource: {
|
|
56
|
-
readonly kind: "exact" | "prefix";
|
|
57
|
-
readonly path: string;
|
|
58
|
-
};
|
|
59
|
-
readonly action?: string;
|
|
60
|
-
};
|
|
61
|
-
/** A detached node proof; self-reported bytes and digests are not authorization. */
|
|
62
|
-
readonly proof: unknown;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Start or continue a target authorization without ever guessing a device,
|
|
66
|
-
* claim, or delegation secret. Adapters own their protocol and are expected
|
|
67
|
-
* to bind their resume token to a server challenge and expiry.
|
|
68
|
-
*/
|
|
69
|
-
declare function authorizeShare<T>(input: {
|
|
70
|
-
readonly envelope: ShareEnvelopeV2;
|
|
71
|
-
readonly method: ShareAuthorizationMethod;
|
|
72
|
-
readonly adapter: ShareAuthorizationAdapter<T>;
|
|
73
|
-
readonly resumeToken?: string;
|
|
74
|
-
readonly proof?: unknown;
|
|
75
|
-
}): Promise<ShareAuthorizationResult<T>>;
|
|
76
|
-
declare function authorizationMethodForTarget(target: {
|
|
77
|
-
readonly kind: string;
|
|
78
|
-
}): ShareAuthorizationMethod | undefined;
|
|
1
|
+
import { UnifiedPolicyCapability, ShareAction, UnifiedContentSource, PolicyCredentialRequirementV1, ArtifactPin } from '@tinycloud/share-envelope';
|
|
2
|
+
import { d as SharePublishTarget, c as PublishedShare, e as SharePublishOptions, O as OwnerShareAction, P as PublishedShareDeliveryMaterial } from './owner-policy-CRFeEC98.js';
|
|
3
|
+
import { S as ShareAuthorizationRequired, a as ShareAuthorizationMethod } from './authorization-CmP1skO8.js';
|
|
79
4
|
|
|
80
5
|
type ShareTarget = SharePublishTarget;
|
|
81
6
|
interface TargetPublishInput {
|
|
@@ -239,4 +164,4 @@ declare function prepareAddressedShare(request: AddressedShareRequest): Prepared
|
|
|
239
164
|
/** Canonical application-neutral Policy/v3 addressed publisher shared by browser and CLI. */
|
|
240
165
|
declare function publishAddressedShare(input: AddressedSharePublishOptions): Promise<PublishedShare>;
|
|
241
166
|
|
|
242
|
-
export { type AddressedOwnerRootInput as A, type PreparedAddressedShare as P, type
|
|
167
|
+
export { type AddressedOwnerRootInput as A, type PreparedAddressedShare as P, type ShareTarget as S, type TargetPublishOutcome as T, type AddressedOwnerRootReceipt as a, type AddressedPublishAuthority as b, type TargetPublishInput as c, type AddressedPolicyRegistrationInput as d, type AddressedPolicyRegistrationReceipt as e, type AddressedSharePublishOptions as f, type AddressedShareRequest as g, type TargetPublishAdapter as h, addressedCredentialRequirement as i, publishAddressedShare as j, publishTargetShare as k, normalizeShareTarget as n, prepareAddressedShare as p, targetAuthorizationMethod as t };
|
|
@@ -1,81 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/** The only interactive boundary exposed by the headless SDK. */
|
|
5
|
-
type ShareAuthorizationMethod = "openkey-device" | "email-claim" | "email-otp";
|
|
6
|
-
interface ShareAuthorizationRequired {
|
|
7
|
-
readonly state: "authorization-required";
|
|
8
|
-
readonly method: ShareAuthorizationMethod;
|
|
9
|
-
/** A browser-safe continuation location. It must never contain a claim secret. */
|
|
10
|
-
readonly continueUrl?: string;
|
|
11
|
-
/** An opaque, short-lived, nonce-bound handle. It is not a bearer credential. */
|
|
12
|
-
readonly resumeToken?: string;
|
|
13
|
-
}
|
|
14
|
-
interface ShareAuthorizationDenied {
|
|
15
|
-
readonly state: "denied";
|
|
16
|
-
readonly reason: "rejected" | "expired" | "revoked" | "unsupported";
|
|
17
|
-
}
|
|
18
|
-
interface ShareAuthorizationReady<T> {
|
|
19
|
-
readonly state: "ready";
|
|
20
|
-
readonly value: T;
|
|
21
|
-
}
|
|
22
|
-
type ShareAuthorizationResult<T> = ShareAuthorizationReady<T> | ShareAuthorizationRequired | ShareAuthorizationDenied;
|
|
23
|
-
interface ShareAuthorizationAdapter<T> {
|
|
24
|
-
begin(input: {
|
|
25
|
-
readonly envelope: ShareEnvelopeV2;
|
|
26
|
-
readonly method: ShareAuthorizationMethod;
|
|
27
|
-
}): Promise<ShareAuthorizationResult<T>>;
|
|
28
|
-
resume(input: {
|
|
29
|
-
readonly envelope: ShareEnvelopeV2;
|
|
30
|
-
readonly method: ShareAuthorizationMethod;
|
|
31
|
-
readonly resumeToken: string;
|
|
32
|
-
readonly proof?: unknown;
|
|
33
|
-
}): Promise<ShareAuthorizationResult<T>>;
|
|
34
|
-
/** Verify the detached node proof against a pinned authority trust bundle. */
|
|
35
|
-
readonly verifyResult?: (input: {
|
|
36
|
-
readonly envelope: ShareEnvelopeV2;
|
|
37
|
-
readonly value: T;
|
|
38
|
-
readonly proof: unknown;
|
|
39
|
-
}) => Promise<boolean>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A node-authorized addressed read. Returning plaintext alone is not an
|
|
43
|
-
* authorization result: the caller must also return the signed response
|
|
44
|
-
* binding and digest that the node produced for that exact share.
|
|
45
|
-
*/
|
|
46
|
-
interface ShareAuthorizedContent {
|
|
47
|
-
readonly bytes: Uint8Array;
|
|
48
|
-
readonly bodyDigest: string;
|
|
49
|
-
readonly contentSourceDigest: string;
|
|
50
|
-
readonly binding: {
|
|
51
|
-
readonly shareId: string;
|
|
52
|
-
readonly delegationCid: string;
|
|
53
|
-
readonly authorityMaterialHandle: string;
|
|
54
|
-
readonly authorityMaterialDigest: string;
|
|
55
|
-
readonly resource: {
|
|
56
|
-
readonly kind: "exact" | "prefix";
|
|
57
|
-
readonly path: string;
|
|
58
|
-
};
|
|
59
|
-
readonly action?: string;
|
|
60
|
-
};
|
|
61
|
-
/** A detached node proof; self-reported bytes and digests are not authorization. */
|
|
62
|
-
readonly proof: unknown;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Start or continue a target authorization without ever guessing a device,
|
|
66
|
-
* claim, or delegation secret. Adapters own their protocol and are expected
|
|
67
|
-
* to bind their resume token to a server challenge and expiry.
|
|
68
|
-
*/
|
|
69
|
-
declare function authorizeShare<T>(input: {
|
|
70
|
-
readonly envelope: ShareEnvelopeV2;
|
|
71
|
-
readonly method: ShareAuthorizationMethod;
|
|
72
|
-
readonly adapter: ShareAuthorizationAdapter<T>;
|
|
73
|
-
readonly resumeToken?: string;
|
|
74
|
-
readonly proof?: unknown;
|
|
75
|
-
}): Promise<ShareAuthorizationResult<T>>;
|
|
76
|
-
declare function authorizationMethodForTarget(target: {
|
|
77
|
-
readonly kind: string;
|
|
78
|
-
}): ShareAuthorizationMethod | undefined;
|
|
1
|
+
import { UnifiedPolicyCapability, ShareAction, UnifiedContentSource, PolicyCredentialRequirementV1, ArtifactPin } from '@tinycloud/share-envelope';
|
|
2
|
+
import { d as SharePublishTarget, c as PublishedShare, e as SharePublishOptions, O as OwnerShareAction, P as PublishedShareDeliveryMaterial } from './owner-policy-CRFeEC98.cjs';
|
|
3
|
+
import { S as ShareAuthorizationRequired, a as ShareAuthorizationMethod } from './authorization-CmP1skO8.cjs';
|
|
79
4
|
|
|
80
5
|
type ShareTarget = SharePublishTarget;
|
|
81
6
|
interface TargetPublishInput {
|
|
@@ -239,4 +164,4 @@ declare function prepareAddressedShare(request: AddressedShareRequest): Prepared
|
|
|
239
164
|
/** Canonical application-neutral Policy/v3 addressed publisher shared by browser and CLI. */
|
|
240
165
|
declare function publishAddressedShare(input: AddressedSharePublishOptions): Promise<PublishedShare>;
|
|
241
166
|
|
|
242
|
-
export { type AddressedOwnerRootInput as A, type PreparedAddressedShare as P, type
|
|
167
|
+
export { type AddressedOwnerRootInput as A, type PreparedAddressedShare as P, type ShareTarget as S, type TargetPublishOutcome as T, type AddressedOwnerRootReceipt as a, type AddressedPublishAuthority as b, type TargetPublishInput as c, type AddressedPolicyRegistrationInput as d, type AddressedPolicyRegistrationReceipt as e, type AddressedSharePublishOptions as f, type AddressedShareRequest as g, type TargetPublishAdapter as h, addressedCredentialRequirement as i, publishAddressedShare as j, publishTargetShare as k, normalizeShareTarget as n, prepareAddressedShare as p, targetAuthorizationMethod as t };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ShareEnvelopeV2 } from '@tinycloud/share-envelope';
|
|
2
|
+
|
|
3
|
+
/** The only interactive boundary exposed by the headless SDK. */
|
|
4
|
+
type ShareAuthorizationMethod = "openkey-device" | "email-claim" | "email-otp";
|
|
5
|
+
interface ShareAuthorizationRequired {
|
|
6
|
+
readonly state: "authorization-required";
|
|
7
|
+
readonly method: ShareAuthorizationMethod;
|
|
8
|
+
/** A browser-safe continuation location. It must never contain a claim secret. */
|
|
9
|
+
readonly continueUrl?: string;
|
|
10
|
+
/** An opaque, short-lived, nonce-bound handle. It is not a bearer credential. */
|
|
11
|
+
readonly resumeToken?: string;
|
|
12
|
+
}
|
|
13
|
+
interface ShareAuthorizationDenied {
|
|
14
|
+
readonly state: "denied";
|
|
15
|
+
readonly reason: "rejected" | "expired" | "revoked" | "unsupported";
|
|
16
|
+
}
|
|
17
|
+
interface ShareAuthorizationReady<T> {
|
|
18
|
+
readonly state: "ready";
|
|
19
|
+
readonly value: T;
|
|
20
|
+
}
|
|
21
|
+
type ShareAuthorizationResult<T> = ShareAuthorizationReady<T> | ShareAuthorizationRequired | ShareAuthorizationDenied;
|
|
22
|
+
interface ShareAuthorizationAdapter<T> {
|
|
23
|
+
begin(input: {
|
|
24
|
+
readonly envelope: ShareEnvelopeV2;
|
|
25
|
+
readonly method: ShareAuthorizationMethod;
|
|
26
|
+
}): Promise<ShareAuthorizationResult<T>>;
|
|
27
|
+
resume(input: {
|
|
28
|
+
readonly envelope: ShareEnvelopeV2;
|
|
29
|
+
readonly method: ShareAuthorizationMethod;
|
|
30
|
+
readonly resumeToken: string;
|
|
31
|
+
readonly proof?: unknown;
|
|
32
|
+
}): Promise<ShareAuthorizationResult<T>>;
|
|
33
|
+
/** Verify the detached node proof against a pinned authority trust bundle. */
|
|
34
|
+
readonly verifyResult?: (input: {
|
|
35
|
+
readonly envelope: ShareEnvelopeV2;
|
|
36
|
+
readonly value: T;
|
|
37
|
+
readonly proof: unknown;
|
|
38
|
+
}) => Promise<boolean>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A node-authorized addressed read. Returning plaintext alone is not an
|
|
42
|
+
* authorization result: the caller must also return the signed response
|
|
43
|
+
* binding and digest that the node produced for that exact share.
|
|
44
|
+
*/
|
|
45
|
+
interface ShareAuthorizedContent {
|
|
46
|
+
readonly bytes: Uint8Array;
|
|
47
|
+
readonly bodyDigest: string;
|
|
48
|
+
readonly contentSourceDigest: string;
|
|
49
|
+
readonly binding: {
|
|
50
|
+
readonly shareId: string;
|
|
51
|
+
readonly delegationCid: string;
|
|
52
|
+
readonly authorityMaterialHandle: string;
|
|
53
|
+
readonly authorityMaterialDigest: string;
|
|
54
|
+
readonly resource: {
|
|
55
|
+
readonly kind: "exact" | "prefix";
|
|
56
|
+
readonly path: string;
|
|
57
|
+
};
|
|
58
|
+
readonly action?: string;
|
|
59
|
+
};
|
|
60
|
+
/** A detached node proof; self-reported bytes and digests are not authorization. */
|
|
61
|
+
readonly proof: unknown;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Start or continue a target authorization without ever guessing a device,
|
|
65
|
+
* claim, or delegation secret. Adapters own their protocol and are expected
|
|
66
|
+
* to bind their resume token to a server challenge and expiry.
|
|
67
|
+
*/
|
|
68
|
+
declare function authorizeShare<T>(input: {
|
|
69
|
+
readonly envelope: ShareEnvelopeV2;
|
|
70
|
+
readonly method: ShareAuthorizationMethod;
|
|
71
|
+
readonly adapter: ShareAuthorizationAdapter<T>;
|
|
72
|
+
readonly resumeToken?: string;
|
|
73
|
+
readonly proof?: unknown;
|
|
74
|
+
}): Promise<ShareAuthorizationResult<T>>;
|
|
75
|
+
declare function authorizationMethodForTarget(target: {
|
|
76
|
+
readonly kind: string;
|
|
77
|
+
}): ShareAuthorizationMethod | undefined;
|
|
78
|
+
|
|
79
|
+
export { type ShareAuthorizationRequired as S, type ShareAuthorizationMethod as a, type ShareAuthorizationResult as b, type ShareAuthorizationAdapter as c, type ShareAuthorizationDenied as d, type ShareAuthorizationReady as e, type ShareAuthorizedContent as f, authorizationMethodForTarget as g, authorizeShare as h };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ShareEnvelopeV2 } from '@tinycloud/share-envelope';
|
|
2
|
+
|
|
3
|
+
/** The only interactive boundary exposed by the headless SDK. */
|
|
4
|
+
type ShareAuthorizationMethod = "openkey-device" | "email-claim" | "email-otp";
|
|
5
|
+
interface ShareAuthorizationRequired {
|
|
6
|
+
readonly state: "authorization-required";
|
|
7
|
+
readonly method: ShareAuthorizationMethod;
|
|
8
|
+
/** A browser-safe continuation location. It must never contain a claim secret. */
|
|
9
|
+
readonly continueUrl?: string;
|
|
10
|
+
/** An opaque, short-lived, nonce-bound handle. It is not a bearer credential. */
|
|
11
|
+
readonly resumeToken?: string;
|
|
12
|
+
}
|
|
13
|
+
interface ShareAuthorizationDenied {
|
|
14
|
+
readonly state: "denied";
|
|
15
|
+
readonly reason: "rejected" | "expired" | "revoked" | "unsupported";
|
|
16
|
+
}
|
|
17
|
+
interface ShareAuthorizationReady<T> {
|
|
18
|
+
readonly state: "ready";
|
|
19
|
+
readonly value: T;
|
|
20
|
+
}
|
|
21
|
+
type ShareAuthorizationResult<T> = ShareAuthorizationReady<T> | ShareAuthorizationRequired | ShareAuthorizationDenied;
|
|
22
|
+
interface ShareAuthorizationAdapter<T> {
|
|
23
|
+
begin(input: {
|
|
24
|
+
readonly envelope: ShareEnvelopeV2;
|
|
25
|
+
readonly method: ShareAuthorizationMethod;
|
|
26
|
+
}): Promise<ShareAuthorizationResult<T>>;
|
|
27
|
+
resume(input: {
|
|
28
|
+
readonly envelope: ShareEnvelopeV2;
|
|
29
|
+
readonly method: ShareAuthorizationMethod;
|
|
30
|
+
readonly resumeToken: string;
|
|
31
|
+
readonly proof?: unknown;
|
|
32
|
+
}): Promise<ShareAuthorizationResult<T>>;
|
|
33
|
+
/** Verify the detached node proof against a pinned authority trust bundle. */
|
|
34
|
+
readonly verifyResult?: (input: {
|
|
35
|
+
readonly envelope: ShareEnvelopeV2;
|
|
36
|
+
readonly value: T;
|
|
37
|
+
readonly proof: unknown;
|
|
38
|
+
}) => Promise<boolean>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A node-authorized addressed read. Returning plaintext alone is not an
|
|
42
|
+
* authorization result: the caller must also return the signed response
|
|
43
|
+
* binding and digest that the node produced for that exact share.
|
|
44
|
+
*/
|
|
45
|
+
interface ShareAuthorizedContent {
|
|
46
|
+
readonly bytes: Uint8Array;
|
|
47
|
+
readonly bodyDigest: string;
|
|
48
|
+
readonly contentSourceDigest: string;
|
|
49
|
+
readonly binding: {
|
|
50
|
+
readonly shareId: string;
|
|
51
|
+
readonly delegationCid: string;
|
|
52
|
+
readonly authorityMaterialHandle: string;
|
|
53
|
+
readonly authorityMaterialDigest: string;
|
|
54
|
+
readonly resource: {
|
|
55
|
+
readonly kind: "exact" | "prefix";
|
|
56
|
+
readonly path: string;
|
|
57
|
+
};
|
|
58
|
+
readonly action?: string;
|
|
59
|
+
};
|
|
60
|
+
/** A detached node proof; self-reported bytes and digests are not authorization. */
|
|
61
|
+
readonly proof: unknown;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Start or continue a target authorization without ever guessing a device,
|
|
65
|
+
* claim, or delegation secret. Adapters own their protocol and are expected
|
|
66
|
+
* to bind their resume token to a server challenge and expiry.
|
|
67
|
+
*/
|
|
68
|
+
declare function authorizeShare<T>(input: {
|
|
69
|
+
readonly envelope: ShareEnvelopeV2;
|
|
70
|
+
readonly method: ShareAuthorizationMethod;
|
|
71
|
+
readonly adapter: ShareAuthorizationAdapter<T>;
|
|
72
|
+
readonly resumeToken?: string;
|
|
73
|
+
readonly proof?: unknown;
|
|
74
|
+
}): Promise<ShareAuthorizationResult<T>>;
|
|
75
|
+
declare function authorizationMethodForTarget(target: {
|
|
76
|
+
readonly kind: string;
|
|
77
|
+
}): ShareAuthorizationMethod | undefined;
|
|
78
|
+
|
|
79
|
+
export { type ShareAuthorizationRequired as S, type ShareAuthorizationMethod as a, type ShareAuthorizationResult as b, type ShareAuthorizationAdapter as c, type ShareAuthorizationDenied as d, type ShareAuthorizationReady as e, type ShareAuthorizedContent as f, authorizationMethodForTarget as g, authorizeShare as h };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as OwnerShareAction, a as OwnerShareMatcher, P as PublishedShareDeliveryMaterial, S as SignedDelegation, b as OwnerSharePolicyRegistrationReceipt, D as DelegatedShareKey, c as PublishedShare } from './owner-policy-CRFeEC98.cjs';
|
|
2
2
|
|
|
3
3
|
interface EncryptedShareHistoryStorage {
|
|
4
4
|
put(value: Uint8Array): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as OwnerShareAction, a as OwnerShareMatcher, P as PublishedShareDeliveryMaterial, S as SignedDelegation, b as OwnerSharePolicyRegistrationReceipt, D as DelegatedShareKey, c as PublishedShare } from './owner-policy-CRFeEC98.js';
|
|
2
2
|
|
|
3
3
|
interface EncryptedShareHistoryStorage {
|
|
4
4
|
put(value: Uint8Array): Promise<void>;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,105 +1,18 @@
|
|
|
1
|
-
|
|
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-D9IJEyRA.cjs';
|
|
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.cjs';
|
|
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 {
|
|
4
|
-
export { A as AddressedOwnerRootInput,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { T as TargetPublishOutcome, c as TargetPublishInput, S as ShareTarget } from './addressed-publish-Db-6rqkA.cjs';
|
|
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-Db-6rqkA.cjs';
|
|
7
|
+
import { S as SenderShareRecord, a as SenderShareRecordStorage } from './history-ZJFHV-IU.cjs';
|
|
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-ZJFHV-IU.cjs';
|
|
9
|
+
import { b as ShareAuthorizationResult, c as ShareAuthorizationAdapter } from './authorization-CmP1skO8.cjs';
|
|
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.cjs';
|
|
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,
|
|
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 };
|