@tinycloud/share-sdk 0.2.0 → 0.3.0-beta.1

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.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { ShareEnvelopeV2, ShareEnvelope, ShareAction, ContentSource, ShareEnvelopeV3 } from '@tinycloud/share-envelope';
1
+ import { ShareEnvelopeV2, ShareEnvelope, ShareEnvelopeV3, ShareAction, ContentSource } 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. */
@@ -112,8 +112,10 @@ interface ShareFetchOptions {
112
112
  readonly fetchBlob?: (input: {
113
113
  readonly origin: string;
114
114
  readonly cid: string;
115
+ readonly signal?: AbortSignal;
115
116
  }) => Promise<Uint8Array>;
116
117
  readonly fetchFn?: typeof globalThis.fetch;
118
+ readonly signal?: AbortSignal;
117
119
  readonly expectedOrigin?: string;
118
120
  /** Out-of-band signer trust root for addressed envelopes. */
119
121
  readonly trustedSignerDid?: string;
@@ -132,7 +134,7 @@ interface ShareFetchOptions {
132
134
  readonly authorizationResumeToken?: string;
133
135
  readonly authorizationProof?: unknown;
134
136
  /** Addressed-only presentation hook. Bearer envelopes and their keys never cross this boundary. */
135
- readonly onResolvedAddressedEnvelope?: (envelope: ShareEnvelope | ShareEnvelopeV2, cid: string) => void;
137
+ readonly onResolvedAddressedEnvelope?: (envelope: ShareEnvelope | ShareEnvelopeV2 | ShareEnvelopeV3, cid: string) => void;
136
138
  }
137
139
  interface SharePolicyEvidence {
138
140
  readonly policyCid: string;
@@ -1037,6 +1039,10 @@ interface SharePresentationMaterial {
1037
1039
  readonly claim?: Record<string, unknown>;
1038
1040
  /** Exact v3 presentation returned by the verified holder ceremony. */
1039
1041
  readonly presentation?: Record<string, unknown>;
1042
+ /** Exact verified issuer envelope used by accountless v4 admission. */
1043
+ readonly credentialEnvelope?: Record<string, unknown>;
1044
+ /** Exact credential requirement committed by the signed policy. */
1045
+ readonly requirement?: Record<string, unknown>;
1040
1046
  }
1041
1047
  interface SharePolicyChallenge {
1042
1048
  readonly challengeId: string;
@@ -1059,6 +1065,13 @@ interface ShareRecipientClientOptions {
1059
1065
  readonly policy: Record<string, unknown>;
1060
1066
  }) => Promise<SharePresentationMaterial>;
1061
1067
  readonly sign?: (bytes: Uint8Array) => Promise<Uint8Array>;
1068
+ readonly signal?: AbortSignal;
1069
+ readonly onStage?: (stage: "policy-admission" | "delegation-import" | "invocation" | "decryption") => void;
1070
+ /** Previously admitted and imported ordinary policy delegation (account v3 fast path). */
1071
+ readonly policyAuthorization?: {
1072
+ readonly authorization: string;
1073
+ readonly cid: string;
1074
+ };
1062
1075
  }
1063
1076
  interface SharePolicySession {
1064
1077
  readonly sessionId: string;
@@ -1077,6 +1090,7 @@ declare class ShareRecipientClient {
1077
1090
  private nativeSigner;
1078
1091
  private holderProof;
1079
1092
  private v3Authorization;
1093
+ private v3NodeAudience;
1080
1094
  private v3ContentKey;
1081
1095
  private v3ContentEnvelope;
1082
1096
  constructor(options: ShareRecipientClientOptions);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ShareEnvelopeV2, ShareEnvelope, ShareAction, ContentSource, ShareEnvelopeV3 } from '@tinycloud/share-envelope';
1
+ import { ShareEnvelopeV2, ShareEnvelope, ShareEnvelopeV3, ShareAction, ContentSource } 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. */
@@ -112,8 +112,10 @@ interface ShareFetchOptions {
112
112
  readonly fetchBlob?: (input: {
113
113
  readonly origin: string;
114
114
  readonly cid: string;
115
+ readonly signal?: AbortSignal;
115
116
  }) => Promise<Uint8Array>;
116
117
  readonly fetchFn?: typeof globalThis.fetch;
118
+ readonly signal?: AbortSignal;
117
119
  readonly expectedOrigin?: string;
118
120
  /** Out-of-band signer trust root for addressed envelopes. */
119
121
  readonly trustedSignerDid?: string;
@@ -132,7 +134,7 @@ interface ShareFetchOptions {
132
134
  readonly authorizationResumeToken?: string;
133
135
  readonly authorizationProof?: unknown;
134
136
  /** Addressed-only presentation hook. Bearer envelopes and their keys never cross this boundary. */
135
- readonly onResolvedAddressedEnvelope?: (envelope: ShareEnvelope | ShareEnvelopeV2, cid: string) => void;
137
+ readonly onResolvedAddressedEnvelope?: (envelope: ShareEnvelope | ShareEnvelopeV2 | ShareEnvelopeV3, cid: string) => void;
136
138
  }
137
139
  interface SharePolicyEvidence {
138
140
  readonly policyCid: string;
@@ -1037,6 +1039,10 @@ interface SharePresentationMaterial {
1037
1039
  readonly claim?: Record<string, unknown>;
1038
1040
  /** Exact v3 presentation returned by the verified holder ceremony. */
1039
1041
  readonly presentation?: Record<string, unknown>;
1042
+ /** Exact verified issuer envelope used by accountless v4 admission. */
1043
+ readonly credentialEnvelope?: Record<string, unknown>;
1044
+ /** Exact credential requirement committed by the signed policy. */
1045
+ readonly requirement?: Record<string, unknown>;
1040
1046
  }
1041
1047
  interface SharePolicyChallenge {
1042
1048
  readonly challengeId: string;
@@ -1059,6 +1065,13 @@ interface ShareRecipientClientOptions {
1059
1065
  readonly policy: Record<string, unknown>;
1060
1066
  }) => Promise<SharePresentationMaterial>;
1061
1067
  readonly sign?: (bytes: Uint8Array) => Promise<Uint8Array>;
1068
+ readonly signal?: AbortSignal;
1069
+ readonly onStage?: (stage: "policy-admission" | "delegation-import" | "invocation" | "decryption") => void;
1070
+ /** Previously admitted and imported ordinary policy delegation (account v3 fast path). */
1071
+ readonly policyAuthorization?: {
1072
+ readonly authorization: string;
1073
+ readonly cid: string;
1074
+ };
1062
1075
  }
1063
1076
  interface SharePolicySession {
1064
1077
  readonly sessionId: string;
@@ -1077,6 +1090,7 @@ declare class ShareRecipientClient {
1077
1090
  private nativeSigner;
1078
1091
  private holderProof;
1079
1092
  private v3Authorization;
1093
+ private v3NodeAudience;
1080
1094
  private v3ContentKey;
1081
1095
  private v3ContentEnvelope;
1082
1096
  constructor(options: ShareRecipientClientOptions);