@tinycloud/share-sdk 0.2.0-beta.0 → 0.2.0-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/index.cjs +468 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -4
- package/dist/index.d.ts +27 -4
- package/dist/index.js +468 -62
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShareEnvelopeV2, ShareEnvelope, ShareAction, ContentSource } from '@tinycloud/share-envelope';
|
|
1
|
+
import { ShareEnvelopeV2, ShareEnvelope, ShareAction, ContentSource, ShareEnvelopeV3 } from '@tinycloud/share-envelope';
|
|
2
2
|
export { CheckBearerDelegationOptions, DelegationCheckResult, canonicalize, checkBearerDelegation, fromBase64Url, requiredResourceUri, resourceUriCovers, toBase64Url } from '@tinycloud/share-envelope';
|
|
3
3
|
|
|
4
4
|
/** The only interactive boundary exposed by the headless SDK. */
|
|
@@ -1033,6 +1033,10 @@ interface SharePresentationMaterial {
|
|
|
1033
1033
|
readonly proof: Record<string, unknown>;
|
|
1034
1034
|
readonly sign?: (bytes: Uint8Array) => Promise<Uint8Array>;
|
|
1035
1035
|
readonly email?: string;
|
|
1036
|
+
/** Exact v3 credential claim returned by the verified holder ceremony. */
|
|
1037
|
+
readonly claim?: Record<string, unknown>;
|
|
1038
|
+
/** Exact v3 presentation returned by the verified holder ceremony. */
|
|
1039
|
+
readonly presentation?: Record<string, unknown>;
|
|
1036
1040
|
}
|
|
1037
1041
|
interface SharePolicyChallenge {
|
|
1038
1042
|
readonly challengeId: string;
|
|
@@ -1047,11 +1051,11 @@ interface ShareRecipientClientOptions {
|
|
|
1047
1051
|
readonly nodeOrigin: string;
|
|
1048
1052
|
readonly trustedNode: ShareNodeTrust;
|
|
1049
1053
|
readonly holderDid: string;
|
|
1050
|
-
readonly envelope: ShareEnvelopeV2;
|
|
1054
|
+
readonly envelope: ShareEnvelopeV2 | ShareEnvelopeV3;
|
|
1051
1055
|
readonly fetchFn?: typeof fetch;
|
|
1052
1056
|
readonly buildPresentation?: (input: {
|
|
1053
1057
|
readonly challenge: SharePolicyChallenge;
|
|
1054
|
-
readonly envelope: ShareEnvelopeV2;
|
|
1058
|
+
readonly envelope: ShareEnvelopeV2 | ShareEnvelopeV3;
|
|
1055
1059
|
readonly policy: Record<string, unknown>;
|
|
1056
1060
|
}) => Promise<SharePresentationMaterial>;
|
|
1057
1061
|
readonly sign?: (bytes: Uint8Array) => Promise<Uint8Array>;
|
|
@@ -1070,12 +1074,24 @@ declare class ShareRecipientClient {
|
|
|
1070
1074
|
private readonly fetchFn;
|
|
1071
1075
|
private session;
|
|
1072
1076
|
private signer;
|
|
1077
|
+
private nativeSigner;
|
|
1073
1078
|
private holderProof;
|
|
1079
|
+
private v3Authorization;
|
|
1080
|
+
private v3ContentKey;
|
|
1081
|
+
private v3ContentEnvelope;
|
|
1074
1082
|
constructor(options: ShareRecipientClientOptions);
|
|
1075
1083
|
beginChallenge(envelope: ShareEnvelopeV2): Promise<SharePolicyChallenge>;
|
|
1076
1084
|
private establish;
|
|
1077
1085
|
authorize(envelope: ShareEnvelopeV2): Promise<ShareAuthorizedContent>;
|
|
1078
1086
|
establishPolicySession(): Promise<SharePolicySession>;
|
|
1087
|
+
private establishV3;
|
|
1088
|
+
/** Decrypt a v3 KV value through a fresh recipient-signed decrypt invocation. */
|
|
1089
|
+
decryptV3Content(bytes: Uint8Array): Promise<{
|
|
1090
|
+
readonly bytes: Uint8Array;
|
|
1091
|
+
readonly mediaType: string;
|
|
1092
|
+
}>;
|
|
1093
|
+
/** Re-encrypt edited v3 content with the admitted content key. */
|
|
1094
|
+
encryptV3Content(bytes: Uint8Array, mediaType: string): Promise<Uint8Array>;
|
|
1079
1095
|
resumeWithProof(envelope: ShareEnvelopeV2, resumeToken: string, proof: unknown): Promise<ShareAuthorizedContent>;
|
|
1080
1096
|
nativeInvoke(request: {
|
|
1081
1097
|
readonly action: string;
|
|
@@ -1085,8 +1101,15 @@ declare class ShareRecipientClient {
|
|
|
1085
1101
|
readonly ifMatch?: string;
|
|
1086
1102
|
readonly contentType?: string;
|
|
1087
1103
|
}): Promise<Response>;
|
|
1104
|
+
private nativeInvokeV3;
|
|
1088
1105
|
}
|
|
1089
|
-
declare function createAddressedAuthorization(input: Omit<ShareRecipientClientOptions, "envelope">
|
|
1106
|
+
declare function createAddressedAuthorization(input: Omit<ShareRecipientClientOptions, "envelope" | "buildPresentation"> & {
|
|
1107
|
+
readonly buildPresentation?: (input: {
|
|
1108
|
+
readonly challenge: SharePolicyChallenge;
|
|
1109
|
+
readonly envelope: ShareEnvelopeV2;
|
|
1110
|
+
readonly policy: Record<string, unknown>;
|
|
1111
|
+
}) => Promise<SharePresentationMaterial>;
|
|
1112
|
+
}): ShareAuthorizationAdapter<ShareAuthorizedContent>;
|
|
1090
1113
|
|
|
1091
1114
|
declare const SHARE_V2_PROTOCOL: Readonly<{
|
|
1092
1115
|
readonly challengeDomain: "xyz.tinycloud.share/policy-challenge/v2\0";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShareEnvelopeV2, ShareEnvelope, ShareAction, ContentSource } from '@tinycloud/share-envelope';
|
|
1
|
+
import { ShareEnvelopeV2, ShareEnvelope, ShareAction, ContentSource, ShareEnvelopeV3 } from '@tinycloud/share-envelope';
|
|
2
2
|
export { CheckBearerDelegationOptions, DelegationCheckResult, canonicalize, checkBearerDelegation, fromBase64Url, requiredResourceUri, resourceUriCovers, toBase64Url } from '@tinycloud/share-envelope';
|
|
3
3
|
|
|
4
4
|
/** The only interactive boundary exposed by the headless SDK. */
|
|
@@ -1033,6 +1033,10 @@ interface SharePresentationMaterial {
|
|
|
1033
1033
|
readonly proof: Record<string, unknown>;
|
|
1034
1034
|
readonly sign?: (bytes: Uint8Array) => Promise<Uint8Array>;
|
|
1035
1035
|
readonly email?: string;
|
|
1036
|
+
/** Exact v3 credential claim returned by the verified holder ceremony. */
|
|
1037
|
+
readonly claim?: Record<string, unknown>;
|
|
1038
|
+
/** Exact v3 presentation returned by the verified holder ceremony. */
|
|
1039
|
+
readonly presentation?: Record<string, unknown>;
|
|
1036
1040
|
}
|
|
1037
1041
|
interface SharePolicyChallenge {
|
|
1038
1042
|
readonly challengeId: string;
|
|
@@ -1047,11 +1051,11 @@ interface ShareRecipientClientOptions {
|
|
|
1047
1051
|
readonly nodeOrigin: string;
|
|
1048
1052
|
readonly trustedNode: ShareNodeTrust;
|
|
1049
1053
|
readonly holderDid: string;
|
|
1050
|
-
readonly envelope: ShareEnvelopeV2;
|
|
1054
|
+
readonly envelope: ShareEnvelopeV2 | ShareEnvelopeV3;
|
|
1051
1055
|
readonly fetchFn?: typeof fetch;
|
|
1052
1056
|
readonly buildPresentation?: (input: {
|
|
1053
1057
|
readonly challenge: SharePolicyChallenge;
|
|
1054
|
-
readonly envelope: ShareEnvelopeV2;
|
|
1058
|
+
readonly envelope: ShareEnvelopeV2 | ShareEnvelopeV3;
|
|
1055
1059
|
readonly policy: Record<string, unknown>;
|
|
1056
1060
|
}) => Promise<SharePresentationMaterial>;
|
|
1057
1061
|
readonly sign?: (bytes: Uint8Array) => Promise<Uint8Array>;
|
|
@@ -1070,12 +1074,24 @@ declare class ShareRecipientClient {
|
|
|
1070
1074
|
private readonly fetchFn;
|
|
1071
1075
|
private session;
|
|
1072
1076
|
private signer;
|
|
1077
|
+
private nativeSigner;
|
|
1073
1078
|
private holderProof;
|
|
1079
|
+
private v3Authorization;
|
|
1080
|
+
private v3ContentKey;
|
|
1081
|
+
private v3ContentEnvelope;
|
|
1074
1082
|
constructor(options: ShareRecipientClientOptions);
|
|
1075
1083
|
beginChallenge(envelope: ShareEnvelopeV2): Promise<SharePolicyChallenge>;
|
|
1076
1084
|
private establish;
|
|
1077
1085
|
authorize(envelope: ShareEnvelopeV2): Promise<ShareAuthorizedContent>;
|
|
1078
1086
|
establishPolicySession(): Promise<SharePolicySession>;
|
|
1087
|
+
private establishV3;
|
|
1088
|
+
/** Decrypt a v3 KV value through a fresh recipient-signed decrypt invocation. */
|
|
1089
|
+
decryptV3Content(bytes: Uint8Array): Promise<{
|
|
1090
|
+
readonly bytes: Uint8Array;
|
|
1091
|
+
readonly mediaType: string;
|
|
1092
|
+
}>;
|
|
1093
|
+
/** Re-encrypt edited v3 content with the admitted content key. */
|
|
1094
|
+
encryptV3Content(bytes: Uint8Array, mediaType: string): Promise<Uint8Array>;
|
|
1079
1095
|
resumeWithProof(envelope: ShareEnvelopeV2, resumeToken: string, proof: unknown): Promise<ShareAuthorizedContent>;
|
|
1080
1096
|
nativeInvoke(request: {
|
|
1081
1097
|
readonly action: string;
|
|
@@ -1085,8 +1101,15 @@ declare class ShareRecipientClient {
|
|
|
1085
1101
|
readonly ifMatch?: string;
|
|
1086
1102
|
readonly contentType?: string;
|
|
1087
1103
|
}): Promise<Response>;
|
|
1104
|
+
private nativeInvokeV3;
|
|
1088
1105
|
}
|
|
1089
|
-
declare function createAddressedAuthorization(input: Omit<ShareRecipientClientOptions, "envelope">
|
|
1106
|
+
declare function createAddressedAuthorization(input: Omit<ShareRecipientClientOptions, "envelope" | "buildPresentation"> & {
|
|
1107
|
+
readonly buildPresentation?: (input: {
|
|
1108
|
+
readonly challenge: SharePolicyChallenge;
|
|
1109
|
+
readonly envelope: ShareEnvelopeV2;
|
|
1110
|
+
readonly policy: Record<string, unknown>;
|
|
1111
|
+
}) => Promise<SharePresentationMaterial>;
|
|
1112
|
+
}): ShareAuthorizationAdapter<ShareAuthorizedContent>;
|
|
1090
1113
|
|
|
1091
1114
|
declare const SHARE_V2_PROTOCOL: Readonly<{
|
|
1092
1115
|
readonly challengeDomain: "xyz.tinycloud.share/policy-challenge/v2\0";
|