@tinycloud/share-sdk 1.0.0-beta.3 → 1.0.0-beta.4

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
@@ -103,7 +103,7 @@ interface ShareErrorInfo {
103
103
  };
104
104
  }
105
105
  declare function toShareErrorInfo(error: unknown): ShareErrorInfo;
106
- /** Policy/v3 links are self-contained authorization metadata; no blob fetch adapter exists. */
106
+ /** Policy/v3 links seal their authorization metadata in a fragment; no blob fetch adapter exists. */
107
107
  interface ShareFetchOptions {
108
108
  readonly expectedOrigin?: string;
109
109
  readonly signal?: AbortSignal;
@@ -226,8 +226,20 @@ interface PublishedShareMetadata {
226
226
  }
227
227
  /** Sender-only Policy/v3 material retained in encrypted history for delivery retries. */
228
228
  interface PublishedShareDeliveryMaterial {
229
+ /**
230
+ * The signed plaintext policy envelope. It is retained only in encrypted
231
+ * sender history so a delivery can be retried; it never travels in a URL.
232
+ */
229
233
  readonly envelope: Readonly<Record<string, unknown>>;
234
+ /** CIDv1/raw/sha2-256 of `sealedEnvelope`, and the CID in the share URL. */
230
235
  readonly shareCid: string;
236
+ /**
237
+ * Canonical `version || nonce || AES-256-GCM ciphertext+tag`, base64url.
238
+ * Node reopens this exact value before authorizing email delivery.
239
+ */
240
+ readonly sealedEnvelope: string;
241
+ /** 32-byte AES-GCM key for `sealedEnvelope`, base64url and fragment-only in the URL. */
242
+ readonly envelopeKey: string;
231
243
  }
232
244
  interface PublishedShare {
233
245
  readonly protocol: "tinycloud-share";
@@ -572,10 +584,7 @@ interface AddressedSharePublishOptions {
572
584
  readonly deliveryEmail?: string;
573
585
  readonly expiresAt: Date;
574
586
  /** Sender-history material required by Node's Policy/v3 delivery authorization. */
575
- readonly onDeliveryMaterial?: (input: {
576
- readonly envelope: Readonly<Record<string, unknown>>;
577
- readonly shareCid: string;
578
- }) => void;
587
+ readonly onDeliveryMaterial?: (input: PublishedShareDeliveryMaterial) => void;
579
588
  readonly authority: AddressedPublishAuthority;
580
589
  }
581
590
  /** Canonical application-neutral Policy/v3 addressed publisher shared by browser and CLI. */
@@ -803,6 +812,36 @@ declare function notifyShare(input: {
803
812
  readonly signal?: AbortSignal;
804
813
  }): Promise<ShareNotifyResult>;
805
814
 
815
+ /** The signed, app-neutral receipt accepted by OpenCredentials' invitation endpoint. */
816
+ interface CredentialInvitationReceipt {
817
+ readonly request: {
818
+ readonly returnLink: string;
819
+ readonly [field: string]: unknown;
820
+ };
821
+ readonly admission: Record<string, unknown>;
822
+ readonly proof: Record<string, unknown>;
823
+ }
824
+ interface CredentialInvitationResult {
825
+ readonly status: "accepted";
826
+ }
827
+ type CredentialInvitationErrorCode = "invalid-origin" | "invalid-receipt" | "rejected" | "invalid-response" | "transport";
828
+ /** A detail-free boundary error; it never embeds signed invitation material. */
829
+ declare class CredentialInvitationError extends Error {
830
+ readonly code: CredentialInvitationErrorCode;
831
+ constructor(code: CredentialInvitationErrorCode, message: string);
832
+ }
833
+ /**
834
+ * Submit a Node-authorized credential invitation without involving the Share
835
+ * application. Other TinyCloud applications can use this same boundary.
836
+ */
837
+ declare function deliverCredentialInvitation(input: {
838
+ readonly credentialsOrigin: string;
839
+ readonly receipt: CredentialInvitationReceipt;
840
+ readonly shareUrl: string;
841
+ readonly fetchFn?: typeof globalThis.fetch;
842
+ readonly signal?: AbortSignal;
843
+ }): Promise<CredentialInvitationResult>;
844
+
806
845
  type ShareRevocationResult = {
807
846
  readonly state: "revoked";
808
847
  readonly target: "bearer" | "recipientDid" | "email" | "emailDomain";
@@ -1051,4 +1090,4 @@ declare function parseNativeShareUrl(value: string): string;
1051
1090
  /** Receive through the public SDK without creating another transport protocol. */
1052
1091
  declare function openNativeShare(sharing: NativeSharingService, link: string): Promise<unknown>;
1053
1092
 
1054
- export { type AddressedOwnerRootInput, type AddressedOwnerRootReceipt, type AddressedPolicyRegistrationInput, type AddressedPolicyRegistrationReceipt, type AddressedPublishAuthority, type AddressedSharePublishOptions, type CreateOwnerDelegationParams, DEFAULT_MAX_CONTENT_BLOB_BYTES, DEFAULT_MAX_SEALED_BLOB_BYTES, DEFAULT_SHARE_LIFETIME_MS, type DelegatedShareKey, EncryptedSenderShareHistory, type EncryptedShareHistoryStorage, MAX_CONTENT_BYTES, MemoryEncryptedShareHistoryStorage, MemorySenderShareKeyStorage, MemorySenderShareRecordStorage, MemoryShareCache, NATIVE_SHARE_FRAGMENT_PARAMETER, type NativeSharingService, OWNER_SHARE_REGISTRATION_DOMAIN, type OwnerDelegationPermission, type OwnerDelegationReceipt, type OwnerShareAction, type OwnerShareDecryption, type OwnerShareMatcher, type OwnerSharePolicyRegistration, type OwnerSharePolicyRegistrationReceipt, type OwnerSharePolicyV2, type ParsedAddressedEnvelope, type PublishedShare, type PublishedShareDeliveryMaterial, type PublishedShareMetadata, type RegisterOwnerSharePolicyParams, SHARE_CONTENT_LIMIT, SHARE_PUBLISH_RESULT_VERSION, SHARE_RESULT_VERSION, SHARE_V2_PROTOCOL, type SenderShareKeyStorage, type SenderShareRecord, type SenderShareRecordStorage, type SenderShareRevocationScope, SenderShareStore, type ShareAuthorizationAdapter, type ShareAuthorizationDenied, type ShareAuthorizationMethod, type ShareAuthorizationReady, type ShareAuthorizationRequired, type ShareAuthorizationResult, type ShareAuthorizedContent, type ShareCache, type ShareCacheEntry, type ShareCacheKey, type ShareCacheMetadata, type ShareDeliveryAdapter, type ShareErrorCode, type ShareErrorInfo, type ShareFetchOptions, type ShareHistoryView, type ShareInspection, type ShareMetadata, type ShareNodeTrust, ShareNotifyError, type ShareNotifyInput, type ShareNotifyResult, type ShareNotifyState, type SharePolicyChallenge, type SharePolicyPublishAdapter, type SharePolicyRootRevocation, type SharePolicySession, type SharePresentationMaterial, SharePublishError, type SharePublishErrorCode, type SharePublishOptions, type SharePublishTarget, type ShareReceiveAuthorizationRequired, ShareReceiveError, type ShareReceiveOutcome, type ShareReceiveResult, ShareRecipientClient, type ShareRecipientClientOptions, type ShareRevocationAdapter, type ShareRevocationResult, type ShareTarget, type SignedDelegation, type TargetPublishAdapter, type TargetPublishInput, type TargetPublishOutcome, authorizationMethodForTarget, authorizeShare, canonicalOwnerSharePolicy, claimShare, computeOwnerShareRegistrationCid, createAddressedAuthorization, createDelegatedShareKey, createNativeShare, createPolicyEnforcementDelegation, createShareV2HolderBindingArtifact, historyRecordForPublishedShare, inspectShare, listShares, normalizeShareTarget, notifyShare, openNativeShare, parseAddressedEnvelope, parseNativeShareUrl, publishAddressedShare, publishPolicyShare, publishTargetShare, receiveShare, recipientMatchesShareRecord, redactPublishedShare, restoreDelegatedShareKey, resumeShareAuthorization, revokeShare, showShare, targetAuthorizationMethod, toShareErrorInfo, validateOwnerSharePolicyRegistration, validateOwnerSharePolicyRegistrationBytes };
1093
+ export { type AddressedOwnerRootInput, type AddressedOwnerRootReceipt, type AddressedPolicyRegistrationInput, type AddressedPolicyRegistrationReceipt, type AddressedPublishAuthority, type AddressedSharePublishOptions, type CreateOwnerDelegationParams, CredentialInvitationError, type CredentialInvitationErrorCode, type CredentialInvitationReceipt, type CredentialInvitationResult, DEFAULT_MAX_CONTENT_BLOB_BYTES, DEFAULT_MAX_SEALED_BLOB_BYTES, DEFAULT_SHARE_LIFETIME_MS, type DelegatedShareKey, EncryptedSenderShareHistory, type EncryptedShareHistoryStorage, MAX_CONTENT_BYTES, MemoryEncryptedShareHistoryStorage, MemorySenderShareKeyStorage, MemorySenderShareRecordStorage, MemoryShareCache, NATIVE_SHARE_FRAGMENT_PARAMETER, type NativeSharingService, OWNER_SHARE_REGISTRATION_DOMAIN, type OwnerDelegationPermission, type OwnerDelegationReceipt, type OwnerShareAction, type OwnerShareDecryption, type OwnerShareMatcher, type OwnerSharePolicyRegistration, type OwnerSharePolicyRegistrationReceipt, type OwnerSharePolicyV2, type ParsedAddressedEnvelope, type PublishedShare, type PublishedShareDeliveryMaterial, type PublishedShareMetadata, type RegisterOwnerSharePolicyParams, SHARE_CONTENT_LIMIT, SHARE_PUBLISH_RESULT_VERSION, SHARE_RESULT_VERSION, SHARE_V2_PROTOCOL, type SenderShareKeyStorage, type SenderShareRecord, type SenderShareRecordStorage, type SenderShareRevocationScope, SenderShareStore, type ShareAuthorizationAdapter, type ShareAuthorizationDenied, type ShareAuthorizationMethod, type ShareAuthorizationReady, type ShareAuthorizationRequired, type ShareAuthorizationResult, type ShareAuthorizedContent, type ShareCache, type ShareCacheEntry, type ShareCacheKey, type ShareCacheMetadata, type ShareDeliveryAdapter, type ShareErrorCode, type ShareErrorInfo, type ShareFetchOptions, type ShareHistoryView, type ShareInspection, type ShareMetadata, type ShareNodeTrust, ShareNotifyError, type ShareNotifyInput, type ShareNotifyResult, type ShareNotifyState, type SharePolicyChallenge, type SharePolicyPublishAdapter, type SharePolicyRootRevocation, type SharePolicySession, type SharePresentationMaterial, SharePublishError, type SharePublishErrorCode, type SharePublishOptions, type SharePublishTarget, type ShareReceiveAuthorizationRequired, ShareReceiveError, type ShareReceiveOutcome, type ShareReceiveResult, ShareRecipientClient, type ShareRecipientClientOptions, type ShareRevocationAdapter, type ShareRevocationResult, type ShareTarget, type SignedDelegation, type TargetPublishAdapter, type TargetPublishInput, type TargetPublishOutcome, authorizationMethodForTarget, authorizeShare, canonicalOwnerSharePolicy, claimShare, computeOwnerShareRegistrationCid, createAddressedAuthorization, createDelegatedShareKey, createNativeShare, createPolicyEnforcementDelegation, createShareV2HolderBindingArtifact, deliverCredentialInvitation, historyRecordForPublishedShare, inspectShare, listShares, normalizeShareTarget, notifyShare, openNativeShare, parseAddressedEnvelope, parseNativeShareUrl, publishAddressedShare, publishPolicyShare, publishTargetShare, receiveShare, recipientMatchesShareRecord, redactPublishedShare, restoreDelegatedShareKey, resumeShareAuthorization, revokeShare, showShare, targetAuthorizationMethod, toShareErrorInfo, validateOwnerSharePolicyRegistration, validateOwnerSharePolicyRegistrationBytes };
package/dist/index.d.ts CHANGED
@@ -103,7 +103,7 @@ interface ShareErrorInfo {
103
103
  };
104
104
  }
105
105
  declare function toShareErrorInfo(error: unknown): ShareErrorInfo;
106
- /** Policy/v3 links are self-contained authorization metadata; no blob fetch adapter exists. */
106
+ /** Policy/v3 links seal their authorization metadata in a fragment; no blob fetch adapter exists. */
107
107
  interface ShareFetchOptions {
108
108
  readonly expectedOrigin?: string;
109
109
  readonly signal?: AbortSignal;
@@ -226,8 +226,20 @@ interface PublishedShareMetadata {
226
226
  }
227
227
  /** Sender-only Policy/v3 material retained in encrypted history for delivery retries. */
228
228
  interface PublishedShareDeliveryMaterial {
229
+ /**
230
+ * The signed plaintext policy envelope. It is retained only in encrypted
231
+ * sender history so a delivery can be retried; it never travels in a URL.
232
+ */
229
233
  readonly envelope: Readonly<Record<string, unknown>>;
234
+ /** CIDv1/raw/sha2-256 of `sealedEnvelope`, and the CID in the share URL. */
230
235
  readonly shareCid: string;
236
+ /**
237
+ * Canonical `version || nonce || AES-256-GCM ciphertext+tag`, base64url.
238
+ * Node reopens this exact value before authorizing email delivery.
239
+ */
240
+ readonly sealedEnvelope: string;
241
+ /** 32-byte AES-GCM key for `sealedEnvelope`, base64url and fragment-only in the URL. */
242
+ readonly envelopeKey: string;
231
243
  }
232
244
  interface PublishedShare {
233
245
  readonly protocol: "tinycloud-share";
@@ -572,10 +584,7 @@ interface AddressedSharePublishOptions {
572
584
  readonly deliveryEmail?: string;
573
585
  readonly expiresAt: Date;
574
586
  /** Sender-history material required by Node's Policy/v3 delivery authorization. */
575
- readonly onDeliveryMaterial?: (input: {
576
- readonly envelope: Readonly<Record<string, unknown>>;
577
- readonly shareCid: string;
578
- }) => void;
587
+ readonly onDeliveryMaterial?: (input: PublishedShareDeliveryMaterial) => void;
579
588
  readonly authority: AddressedPublishAuthority;
580
589
  }
581
590
  /** Canonical application-neutral Policy/v3 addressed publisher shared by browser and CLI. */
@@ -803,6 +812,36 @@ declare function notifyShare(input: {
803
812
  readonly signal?: AbortSignal;
804
813
  }): Promise<ShareNotifyResult>;
805
814
 
815
+ /** The signed, app-neutral receipt accepted by OpenCredentials' invitation endpoint. */
816
+ interface CredentialInvitationReceipt {
817
+ readonly request: {
818
+ readonly returnLink: string;
819
+ readonly [field: string]: unknown;
820
+ };
821
+ readonly admission: Record<string, unknown>;
822
+ readonly proof: Record<string, unknown>;
823
+ }
824
+ interface CredentialInvitationResult {
825
+ readonly status: "accepted";
826
+ }
827
+ type CredentialInvitationErrorCode = "invalid-origin" | "invalid-receipt" | "rejected" | "invalid-response" | "transport";
828
+ /** A detail-free boundary error; it never embeds signed invitation material. */
829
+ declare class CredentialInvitationError extends Error {
830
+ readonly code: CredentialInvitationErrorCode;
831
+ constructor(code: CredentialInvitationErrorCode, message: string);
832
+ }
833
+ /**
834
+ * Submit a Node-authorized credential invitation without involving the Share
835
+ * application. Other TinyCloud applications can use this same boundary.
836
+ */
837
+ declare function deliverCredentialInvitation(input: {
838
+ readonly credentialsOrigin: string;
839
+ readonly receipt: CredentialInvitationReceipt;
840
+ readonly shareUrl: string;
841
+ readonly fetchFn?: typeof globalThis.fetch;
842
+ readonly signal?: AbortSignal;
843
+ }): Promise<CredentialInvitationResult>;
844
+
806
845
  type ShareRevocationResult = {
807
846
  readonly state: "revoked";
808
847
  readonly target: "bearer" | "recipientDid" | "email" | "emailDomain";
@@ -1051,4 +1090,4 @@ declare function parseNativeShareUrl(value: string): string;
1051
1090
  /** Receive through the public SDK without creating another transport protocol. */
1052
1091
  declare function openNativeShare(sharing: NativeSharingService, link: string): Promise<unknown>;
1053
1092
 
1054
- export { type AddressedOwnerRootInput, type AddressedOwnerRootReceipt, type AddressedPolicyRegistrationInput, type AddressedPolicyRegistrationReceipt, type AddressedPublishAuthority, type AddressedSharePublishOptions, type CreateOwnerDelegationParams, DEFAULT_MAX_CONTENT_BLOB_BYTES, DEFAULT_MAX_SEALED_BLOB_BYTES, DEFAULT_SHARE_LIFETIME_MS, type DelegatedShareKey, EncryptedSenderShareHistory, type EncryptedShareHistoryStorage, MAX_CONTENT_BYTES, MemoryEncryptedShareHistoryStorage, MemorySenderShareKeyStorage, MemorySenderShareRecordStorage, MemoryShareCache, NATIVE_SHARE_FRAGMENT_PARAMETER, type NativeSharingService, OWNER_SHARE_REGISTRATION_DOMAIN, type OwnerDelegationPermission, type OwnerDelegationReceipt, type OwnerShareAction, type OwnerShareDecryption, type OwnerShareMatcher, type OwnerSharePolicyRegistration, type OwnerSharePolicyRegistrationReceipt, type OwnerSharePolicyV2, type ParsedAddressedEnvelope, type PublishedShare, type PublishedShareDeliveryMaterial, type PublishedShareMetadata, type RegisterOwnerSharePolicyParams, SHARE_CONTENT_LIMIT, SHARE_PUBLISH_RESULT_VERSION, SHARE_RESULT_VERSION, SHARE_V2_PROTOCOL, type SenderShareKeyStorage, type SenderShareRecord, type SenderShareRecordStorage, type SenderShareRevocationScope, SenderShareStore, type ShareAuthorizationAdapter, type ShareAuthorizationDenied, type ShareAuthorizationMethod, type ShareAuthorizationReady, type ShareAuthorizationRequired, type ShareAuthorizationResult, type ShareAuthorizedContent, type ShareCache, type ShareCacheEntry, type ShareCacheKey, type ShareCacheMetadata, type ShareDeliveryAdapter, type ShareErrorCode, type ShareErrorInfo, type ShareFetchOptions, type ShareHistoryView, type ShareInspection, type ShareMetadata, type ShareNodeTrust, ShareNotifyError, type ShareNotifyInput, type ShareNotifyResult, type ShareNotifyState, type SharePolicyChallenge, type SharePolicyPublishAdapter, type SharePolicyRootRevocation, type SharePolicySession, type SharePresentationMaterial, SharePublishError, type SharePublishErrorCode, type SharePublishOptions, type SharePublishTarget, type ShareReceiveAuthorizationRequired, ShareReceiveError, type ShareReceiveOutcome, type ShareReceiveResult, ShareRecipientClient, type ShareRecipientClientOptions, type ShareRevocationAdapter, type ShareRevocationResult, type ShareTarget, type SignedDelegation, type TargetPublishAdapter, type TargetPublishInput, type TargetPublishOutcome, authorizationMethodForTarget, authorizeShare, canonicalOwnerSharePolicy, claimShare, computeOwnerShareRegistrationCid, createAddressedAuthorization, createDelegatedShareKey, createNativeShare, createPolicyEnforcementDelegation, createShareV2HolderBindingArtifact, historyRecordForPublishedShare, inspectShare, listShares, normalizeShareTarget, notifyShare, openNativeShare, parseAddressedEnvelope, parseNativeShareUrl, publishAddressedShare, publishPolicyShare, publishTargetShare, receiveShare, recipientMatchesShareRecord, redactPublishedShare, restoreDelegatedShareKey, resumeShareAuthorization, revokeShare, showShare, targetAuthorizationMethod, toShareErrorInfo, validateOwnerSharePolicyRegistration, validateOwnerSharePolicyRegistrationBytes };
1093
+ export { type AddressedOwnerRootInput, type AddressedOwnerRootReceipt, type AddressedPolicyRegistrationInput, type AddressedPolicyRegistrationReceipt, type AddressedPublishAuthority, type AddressedSharePublishOptions, type CreateOwnerDelegationParams, CredentialInvitationError, type CredentialInvitationErrorCode, type CredentialInvitationReceipt, type CredentialInvitationResult, DEFAULT_MAX_CONTENT_BLOB_BYTES, DEFAULT_MAX_SEALED_BLOB_BYTES, DEFAULT_SHARE_LIFETIME_MS, type DelegatedShareKey, EncryptedSenderShareHistory, type EncryptedShareHistoryStorage, MAX_CONTENT_BYTES, MemoryEncryptedShareHistoryStorage, MemorySenderShareKeyStorage, MemorySenderShareRecordStorage, MemoryShareCache, NATIVE_SHARE_FRAGMENT_PARAMETER, type NativeSharingService, OWNER_SHARE_REGISTRATION_DOMAIN, type OwnerDelegationPermission, type OwnerDelegationReceipt, type OwnerShareAction, type OwnerShareDecryption, type OwnerShareMatcher, type OwnerSharePolicyRegistration, type OwnerSharePolicyRegistrationReceipt, type OwnerSharePolicyV2, type ParsedAddressedEnvelope, type PublishedShare, type PublishedShareDeliveryMaterial, type PublishedShareMetadata, type RegisterOwnerSharePolicyParams, SHARE_CONTENT_LIMIT, SHARE_PUBLISH_RESULT_VERSION, SHARE_RESULT_VERSION, SHARE_V2_PROTOCOL, type SenderShareKeyStorage, type SenderShareRecord, type SenderShareRecordStorage, type SenderShareRevocationScope, SenderShareStore, type ShareAuthorizationAdapter, type ShareAuthorizationDenied, type ShareAuthorizationMethod, type ShareAuthorizationReady, type ShareAuthorizationRequired, type ShareAuthorizationResult, type ShareAuthorizedContent, type ShareCache, type ShareCacheEntry, type ShareCacheKey, type ShareCacheMetadata, type ShareDeliveryAdapter, type ShareErrorCode, type ShareErrorInfo, type ShareFetchOptions, type ShareHistoryView, type ShareInspection, type ShareMetadata, type ShareNodeTrust, ShareNotifyError, type ShareNotifyInput, type ShareNotifyResult, type ShareNotifyState, type SharePolicyChallenge, type SharePolicyPublishAdapter, type SharePolicyRootRevocation, type SharePolicySession, type SharePresentationMaterial, SharePublishError, type SharePublishErrorCode, type SharePublishOptions, type SharePublishTarget, type ShareReceiveAuthorizationRequired, ShareReceiveError, type ShareReceiveOutcome, type ShareReceiveResult, ShareRecipientClient, type ShareRecipientClientOptions, type ShareRevocationAdapter, type ShareRevocationResult, type ShareTarget, type SignedDelegation, type TargetPublishAdapter, type TargetPublishInput, type TargetPublishOutcome, authorizationMethodForTarget, authorizeShare, canonicalOwnerSharePolicy, claimShare, computeOwnerShareRegistrationCid, createAddressedAuthorization, createDelegatedShareKey, createNativeShare, createPolicyEnforcementDelegation, createShareV2HolderBindingArtifact, deliverCredentialInvitation, historyRecordForPublishedShare, inspectShare, listShares, normalizeShareTarget, notifyShare, openNativeShare, parseAddressedEnvelope, parseNativeShareUrl, publishAddressedShare, publishPolicyShare, publishTargetShare, receiveShare, recipientMatchesShareRecord, redactPublishedShare, restoreDelegatedShareKey, resumeShareAuthorization, revokeShare, showShare, targetAuthorizationMethod, toShareErrorInfo, validateOwnerSharePolicyRegistration, validateOwnerSharePolicyRegistrationBytes };