@tinycloud/share-sdk 1.2.0-beta.2 → 1.2.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
@@ -1,7 +1,10 @@
1
1
  import { ShareEnvelopeV3, ShareEnvelopeV2 } from '@tinycloud/share-envelope';
2
2
  export { CheckBearerDelegationOptions, DelegationCheckResult, canonicalize, checkBearerDelegation, fromBase64Url, requiredResourceUri, resourceUriCovers, toBase64Url } from '@tinycloud/share-envelope';
3
- import { S as ShareAuthorizationMethod, O as OwnerShareAction, a as OwnerShareMatcher, P as PublishedShareDeliveryMaterial, b as OwnerSharePolicyRegistrationReceipt, D as DelegatedShareKey, c as PublishedShare, d as ShareAuthorizedContent, e as ShareAuthorizationAdapter, T as TargetPublishOutcome, f as TargetPublishInput, g as ShareAuthorizationResult, h as ShareTarget } from './addressed-publish-CsUS7-SI.cjs';
4
- export { A as AddressedOwnerRootInput, i as AddressedOwnerRootReceipt, j as AddressedPolicyRegistrationInput, k as AddressedPolicyRegistrationReceipt, l as AddressedPublishAuthority, m as AddressedSharePublishOptions, n as AddressedShareRequest, C as CreateOwnerDelegationParams, o as DEFAULT_SHARE_LIFETIME_MS, M as MAX_CONTENT_BYTES, p as OWNER_SHARE_REGISTRATION_DOMAIN, q as OwnerDelegationPermission, r as OwnerDelegationReceipt, s as OwnerShareDecryption, t as OwnerSharePolicyRegistration, u as OwnerSharePolicyV2, v as PreparedAddressedShare, w as PublishedShareMetadata, R as RegisterOwnerSharePolicyParams, x as SHARE_CONTENT_LIMIT, y as SHARE_PUBLISH_RESULT_VERSION, z as ShareAuthorizationDenied, B as ShareAuthorizationReady, E as ShareAuthorizationRequired, F as SharePublishError, G as SharePublishErrorCode, H as SharePublishOptions, I as SharePublishTarget, J as SignedDelegation, K as TargetPublishAdapter, L as addressedCredentialRequirement, N as authorizationMethodForTarget, Q as authorizeShare, U as canonicalOwnerSharePolicy, V as computeOwnerShareRegistrationCid, W as createDelegatedShareKey, X as createPolicyEnforcementDelegation, Y as normalizeShareTarget, Z as prepareAddressedShare, _ as publishAddressedShare, $ as publishTargetShare, a0 as redactPublishedShare, a1 as restoreDelegatedShareKey, a2 as targetAuthorizationMethod, a3 as validateOwnerSharePolicyRegistration, a4 as validateOwnerSharePolicyRegistrationBytes } from './addressed-publish-CsUS7-SI.cjs';
3
+ import { S as ShareAuthorizationMethod, a as ShareAuthorizedContent, b as ShareAuthorizationAdapter, T as TargetPublishOutcome, c as TargetPublishInput, d as ShareAuthorizationResult, e as ShareTarget } from './addressed-publish-DVvTlGog.cjs';
4
+ export { A as AddressedOwnerRootInput, f as AddressedOwnerRootReceipt, g as AddressedPolicyRegistrationInput, h as AddressedPolicyRegistrationReceipt, i as AddressedPublishAuthority, j as AddressedSharePublishOptions, k as AddressedShareRequest, P as PreparedAddressedShare, l as ShareAuthorizationDenied, m as ShareAuthorizationReady, n as ShareAuthorizationRequired, o as TargetPublishAdapter, p as addressedCredentialRequirement, q as authorizationMethodForTarget, r as authorizeShare, s as normalizeShareTarget, t as prepareAddressedShare, u as publishAddressedShare, v as publishTargetShare, w as targetAuthorizationMethod } from './addressed-publish-DVvTlGog.cjs';
5
+ export { C as CreateOwnerDelegationParams, D as DEFAULT_SHARE_LIFETIME_MS, a as DelegatedShareKey, M as MAX_CONTENT_BYTES, O as OWNER_SHARE_REGISTRATION_DOMAIN, b as OwnerDelegationPermission, c as OwnerDelegationReceipt, d as OwnerShareAction, e as OwnerShareDecryption, f as OwnerShareMatcher, g as OwnerSharePolicyRegistration, h as OwnerSharePolicyRegistrationReceipt, i as OwnerSharePolicyV2, P as PublishedShare, j as PublishedShareDeliveryMaterial, k as PublishedShareMetadata, R as RegisterOwnerSharePolicyParams, S as SHARE_CONTENT_LIMIT, l as SHARE_PUBLISH_RESULT_VERSION, m as SharePublishError, n as SharePublishErrorCode, o as SharePublishOptions, p as SharePublishTarget, q 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-BqzRlkb6.cjs';
6
+ import { S as SenderShareRecord, a as SenderShareRecordStorage } from './history-CUWDK0lE.cjs';
7
+ 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-CUWDK0lE.cjs';
5
8
 
6
9
  declare function hasUnsafeFilenameCodePoint(value: string): boolean;
7
10
  /** A single display/download filename, never a path. Returns the NFC form. */
@@ -139,156 +142,6 @@ declare class MemoryShareCache implements ShareCache {
139
142
  clear(): Promise<void>;
140
143
  }
141
144
 
142
- interface EncryptedShareHistoryStorage {
143
- put(value: Uint8Array): Promise<void>;
144
- list(): Promise<readonly Uint8Array[]>;
145
- clear(): Promise<void>;
146
- }
147
- declare class MemoryEncryptedShareHistoryStorage implements EncryptedShareHistoryStorage {
148
- private readonly values;
149
- put(value: Uint8Array): Promise<void>;
150
- list(): Promise<readonly Uint8Array[]>;
151
- clear(): Promise<void>;
152
- }
153
- /**
154
- * The durable record a sender needs, after a reload, to display and manage
155
- * a share it created. Every identity/CID here comes verbatim from the
156
- * Node-verified {@link OwnerSharePolicyRegistrationReceipt}; nothing is
157
- * re-derived or guessed.
158
- */
159
- interface SenderShareRecord {
160
- readonly shareId: string;
161
- readonly registrationCid?: string;
162
- readonly policyCid?: string;
163
- readonly ownerDelegationCid?: string;
164
- readonly enforcementDelegationCid?: string;
165
- readonly shareKeyDid?: string;
166
- readonly ownerDid?: string;
167
- readonly enforcerDid?: string;
168
- readonly target: {
169
- readonly origin: string;
170
- readonly nodeAudience: string;
171
- readonly spaceId: string;
172
- };
173
- readonly resource: {
174
- readonly kind: "exact" | "prefix";
175
- readonly path: string;
176
- };
177
- readonly actions: readonly OwnerShareAction[];
178
- readonly recipientMatcher: OwnerShareMatcher;
179
- /** The signed target discriminator, retained separately from the email matcher. */
180
- readonly targetKind?: "bearer" | "recipientDid" | "email" | "emailDomain";
181
- readonly registeredAt: string;
182
- readonly expiresAt: string;
183
- readonly revokedAt?: string;
184
- readonly envelopeCid?: string;
185
- readonly shareCid?: string;
186
- /** Complete bearer links are encrypted at rest and only revealed explicitly. */
187
- readonly link?: string;
188
- readonly filename?: string;
189
- /** Policy/v3 delivery material. The containing history record must remain encrypted at rest. */
190
- readonly deliveryMaterial?: PublishedShareDeliveryMaterial;
191
- /** Canonical mailboxes whose invitation delivery was confirmed; history is encrypted at rest. */
192
- readonly deliveredRecipients?: readonly string[];
193
- }
194
- /** Create the durable encrypted-history shape from canonical publication receipts. */
195
- declare function historyRecordForPublishedShare(result: PublishedShare, now?: Date): SenderShareRecord;
196
- /**
197
- * "direct" selects the Policy/v3 enforcement root; "ancestor" selects its
198
- * policy-authority sibling. Addressed shares revoke that signed root through
199
- * the Node Policy/v3 endpoint, which cuts off existing sessions as well as
200
- * fresh admission and delivery. Bearer shares retain ordinary delegation
201
- * revocation.
202
- */
203
- type SenderShareRevocationScope = "direct" | "ancestor";
204
- interface SenderShareRecordStorage {
205
- put(record: SenderShareRecord): Promise<void>;
206
- /** Atomically transform the latest record, if present. Implementations that
207
- * provide this must serialize the read and write with every other writer. */
208
- update?(shareId: string, change: (record: SenderShareRecord) => SenderShareRecord | Promise<SenderShareRecord>): Promise<SenderShareRecord | undefined>;
209
- list(): Promise<readonly SenderShareRecord[]>;
210
- get(shareId: string): Promise<SenderShareRecord | undefined>;
211
- delete(shareId: string): Promise<void>;
212
- }
213
- interface StoredSenderShareKey {
214
- readonly cryptoKey: CryptoKey;
215
- readonly publicKey: Uint8Array;
216
- readonly extractable: boolean;
217
- }
218
- interface SenderShareKeyStorage {
219
- put(shareId: string, key: StoredSenderShareKey): Promise<void>;
220
- get(shareId: string): Promise<StoredSenderShareKey | undefined>;
221
- delete(shareId: string): Promise<void>;
222
- }
223
- /** In-memory reference implementation. Real deployments back these with IndexedDB so the non-extractable `CryptoKey` survives a reload via structured clone. */
224
- declare class MemorySenderShareRecordStorage implements SenderShareRecordStorage {
225
- private readonly records;
226
- private operation;
227
- private serialize;
228
- put(record: SenderShareRecord): Promise<void>;
229
- update(shareId: string, change: (record: SenderShareRecord) => SenderShareRecord | Promise<SenderShareRecord>): Promise<SenderShareRecord | undefined>;
230
- list(): Promise<readonly SenderShareRecord[]>;
231
- get(shareId: string): Promise<SenderShareRecord | undefined>;
232
- delete(shareId: string): Promise<void>;
233
- }
234
- declare class MemorySenderShareKeyStorage implements SenderShareKeyStorage {
235
- private readonly keys;
236
- put(shareId: string, key: StoredSenderShareKey): Promise<void>;
237
- get(shareId: string): Promise<StoredSenderShareKey | undefined>;
238
- delete(shareId: string): Promise<void>;
239
- }
240
- interface SenderShareStoreOptions {
241
- readonly records: SenderShareRecordStorage;
242
- readonly keys: SenderShareKeyStorage;
243
- readonly now?: () => Date;
244
- }
245
- /**
246
- * Reload-safe sender-side management for shares created through
247
- * {@link canonicalOwnerSharePolicy} / `registerOwnerSharePolicy`. Persists
248
- * the registration receipt's canonical identity tuple plus the ephemeral
249
- * share key's non-extractable `CryptoKey` handle, so a sender can list,
250
- * inspect, and revoke shares it created in an earlier session -- without
251
- * ever re-exporting private key material.
252
- */
253
- declare class SenderShareStore {
254
- private readonly records;
255
- private readonly keys;
256
- private readonly now;
257
- constructor(options: SenderShareStoreOptions);
258
- /** Persist a Node-verified registration receipt and its share key handle. */
259
- save(receipt: OwnerSharePolicyRegistrationReceipt, key: DelegatedShareKey): Promise<SenderShareRecord>;
260
- /** List shares created in any session, most recent first. */
261
- list(options?: {
262
- readonly includeRevoked?: boolean;
263
- readonly includeExpired?: boolean;
264
- }): Promise<readonly SenderShareRecord[]>;
265
- get(shareId: string): Promise<SenderShareRecord | undefined>;
266
- /** Recover a signer for the persisted share key after a reload. */
267
- loadKey(shareId: string): Promise<DelegatedShareKey | undefined>;
268
- /**
269
- * The delegation CID to pass to the node's existing generic
270
- * `tinycloud.delegation/revoke` invocation to revoke this share at the
271
- * requested scope. Does not itself call the node -- callers invoke
272
- * their own `revokeDelegation`/`DelegationManager.revoke` with the
273
- * returned CID, then call {@link markRevoked} once that succeeds.
274
- */
275
- revocationTarget(shareId: string, scope: SenderShareRevocationScope): Promise<string>;
276
- /** Mark a share revoked locally after the caller's node-side revoke call succeeds. */
277
- markRevoked(shareId: string, revokedAt?: string): Promise<SenderShareRecord>;
278
- /** Forget a share and clear its persisted key handle. */
279
- remove(shareId: string): Promise<void>;
280
- }
281
- /** WebCrypto-backed persistence adapter; links and private material are absent. */
282
- declare class EncryptedSenderShareHistory {
283
- private readonly storage;
284
- private readonly key;
285
- private readonly now;
286
- constructor(storage: EncryptedShareHistoryStorage, key: CryptoKey, now?: () => Date);
287
- put(record: SenderShareRecord): Promise<void>;
288
- list(): Promise<readonly SenderShareRecord[]>;
289
- clear(): Promise<void>;
290
- }
291
-
292
145
  type ShareNotifyState = "delivered" | "already-delivered" | "partial-failure";
293
146
  interface ShareNotifyResult {
294
147
  readonly protocol: "tinycloud-share";
@@ -632,4 +485,4 @@ declare function parseNativeShareUrl(value: string): string;
632
485
  /** Receive through the public SDK without creating another transport protocol. */
633
486
  declare function openNativeShare(sharing: NativeSharingService, link: string): Promise<unknown>;
634
487
 
635
- export { CredentialInvitationError, type CredentialInvitationErrorCode, type CredentialInvitationReceipt, type CredentialInvitationResult, DEFAULT_MAX_CONTENT_BLOB_BYTES, DEFAULT_MAX_SEALED_BLOB_BYTES, DelegatedShareKey, EncryptedSenderShareHistory, type EncryptedShareHistoryStorage, MemoryEncryptedShareHistoryStorage, MemorySenderShareKeyStorage, MemorySenderShareRecordStorage, MemoryShareCache, NATIVE_SHARE_FRAGMENT_PARAMETER, type NativeShareResult, type NativeSharingService, OwnerShareAction, OwnerShareMatcher, OwnerSharePolicyRegistrationReceipt, type ParsedAddressedEnvelope, PublishedShare, PublishedShareDeliveryMaterial, SHARE_RESULT_VERSION, SHARE_V2_PROTOCOL, type SenderShareKeyStorage, type SenderShareRecord, type SenderShareRecordStorage, type SenderShareRevocationScope, SenderShareStore, ShareAuthorizationAdapter, ShareAuthorizationMethod, ShareAuthorizationResult, 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 SharePolicyDelegationLink, type SharePolicyPublishAdapter, type SharePolicyRootRevocation, type SharePolicySession, type SharePresentationMaterial, type ShareReceiveAuthorizationRequired, ShareReceiveError, type ShareReceiveOutcome, type ShareReceiveResult, ShareRecipientClient, type ShareRecipientClientOptions, type ShareRevocationAdapter, type ShareRevocationResult, ShareTarget, TargetPublishInput, TargetPublishOutcome, canonicalShareFilename, claimShare, createAddressedAuthorization, createNativeShare, createShareV2HolderBindingArtifact, deliverCredentialInvitation, hasUnsafeFilenameCodePoint, historyRecordForPublishedShare, inspectShare, listShares, notifyShare, openNativeShare, parseAddressedEnvelope, parseNativeShareUrl, publishPolicyShare, receiveShare, recipientMatchesShareRecord, resumeShareAuthorization, revokeShare, shareDeliveryWindowExpiresAt, showShare, toShareErrorInfo };
488
+ export { CredentialInvitationError, type CredentialInvitationErrorCode, type CredentialInvitationReceipt, type CredentialInvitationResult, DEFAULT_MAX_CONTENT_BLOB_BYTES, DEFAULT_MAX_SEALED_BLOB_BYTES, MemoryShareCache, NATIVE_SHARE_FRAGMENT_PARAMETER, type NativeShareResult, type NativeSharingService, type ParsedAddressedEnvelope, SHARE_RESULT_VERSION, SHARE_V2_PROTOCOL, SenderShareRecord, SenderShareRecordStorage, ShareAuthorizationAdapter, ShareAuthorizationMethod, ShareAuthorizationResult, 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 SharePolicyDelegationLink, type SharePolicyPublishAdapter, type SharePolicyRootRevocation, type SharePolicySession, type SharePresentationMaterial, type ShareReceiveAuthorizationRequired, ShareReceiveError, type ShareReceiveOutcome, type ShareReceiveResult, ShareRecipientClient, type ShareRecipientClientOptions, type ShareRevocationAdapter, type ShareRevocationResult, ShareTarget, TargetPublishInput, TargetPublishOutcome, canonicalShareFilename, claimShare, createAddressedAuthorization, createNativeShare, createShareV2HolderBindingArtifact, deliverCredentialInvitation, hasUnsafeFilenameCodePoint, inspectShare, listShares, notifyShare, openNativeShare, parseAddressedEnvelope, parseNativeShareUrl, publishPolicyShare, receiveShare, recipientMatchesShareRecord, resumeShareAuthorization, revokeShare, shareDeliveryWindowExpiresAt, showShare, toShareErrorInfo };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { ShareEnvelopeV3, ShareEnvelopeV2 } from '@tinycloud/share-envelope';
2
2
  export { CheckBearerDelegationOptions, DelegationCheckResult, canonicalize, checkBearerDelegation, fromBase64Url, requiredResourceUri, resourceUriCovers, toBase64Url } from '@tinycloud/share-envelope';
3
- import { S as ShareAuthorizationMethod, O as OwnerShareAction, a as OwnerShareMatcher, P as PublishedShareDeliveryMaterial, b as OwnerSharePolicyRegistrationReceipt, D as DelegatedShareKey, c as PublishedShare, d as ShareAuthorizedContent, e as ShareAuthorizationAdapter, T as TargetPublishOutcome, f as TargetPublishInput, g as ShareAuthorizationResult, h as ShareTarget } from './addressed-publish-CsUS7-SI.js';
4
- export { A as AddressedOwnerRootInput, i as AddressedOwnerRootReceipt, j as AddressedPolicyRegistrationInput, k as AddressedPolicyRegistrationReceipt, l as AddressedPublishAuthority, m as AddressedSharePublishOptions, n as AddressedShareRequest, C as CreateOwnerDelegationParams, o as DEFAULT_SHARE_LIFETIME_MS, M as MAX_CONTENT_BYTES, p as OWNER_SHARE_REGISTRATION_DOMAIN, q as OwnerDelegationPermission, r as OwnerDelegationReceipt, s as OwnerShareDecryption, t as OwnerSharePolicyRegistration, u as OwnerSharePolicyV2, v as PreparedAddressedShare, w as PublishedShareMetadata, R as RegisterOwnerSharePolicyParams, x as SHARE_CONTENT_LIMIT, y as SHARE_PUBLISH_RESULT_VERSION, z as ShareAuthorizationDenied, B as ShareAuthorizationReady, E as ShareAuthorizationRequired, F as SharePublishError, G as SharePublishErrorCode, H as SharePublishOptions, I as SharePublishTarget, J as SignedDelegation, K as TargetPublishAdapter, L as addressedCredentialRequirement, N as authorizationMethodForTarget, Q as authorizeShare, U as canonicalOwnerSharePolicy, V as computeOwnerShareRegistrationCid, W as createDelegatedShareKey, X as createPolicyEnforcementDelegation, Y as normalizeShareTarget, Z as prepareAddressedShare, _ as publishAddressedShare, $ as publishTargetShare, a0 as redactPublishedShare, a1 as restoreDelegatedShareKey, a2 as targetAuthorizationMethod, a3 as validateOwnerSharePolicyRegistration, a4 as validateOwnerSharePolicyRegistrationBytes } from './addressed-publish-CsUS7-SI.js';
3
+ import { S as ShareAuthorizationMethod, a as ShareAuthorizedContent, b as ShareAuthorizationAdapter, T as TargetPublishOutcome, c as TargetPublishInput, d as ShareAuthorizationResult, e as ShareTarget } from './addressed-publish-BDaGyQA9.js';
4
+ export { A as AddressedOwnerRootInput, f as AddressedOwnerRootReceipt, g as AddressedPolicyRegistrationInput, h as AddressedPolicyRegistrationReceipt, i as AddressedPublishAuthority, j as AddressedSharePublishOptions, k as AddressedShareRequest, P as PreparedAddressedShare, l as ShareAuthorizationDenied, m as ShareAuthorizationReady, n as ShareAuthorizationRequired, o as TargetPublishAdapter, p as addressedCredentialRequirement, q as authorizationMethodForTarget, r as authorizeShare, s as normalizeShareTarget, t as prepareAddressedShare, u as publishAddressedShare, v as publishTargetShare, w as targetAuthorizationMethod } from './addressed-publish-BDaGyQA9.js';
5
+ export { C as CreateOwnerDelegationParams, D as DEFAULT_SHARE_LIFETIME_MS, a as DelegatedShareKey, M as MAX_CONTENT_BYTES, O as OWNER_SHARE_REGISTRATION_DOMAIN, b as OwnerDelegationPermission, c as OwnerDelegationReceipt, d as OwnerShareAction, e as OwnerShareDecryption, f as OwnerShareMatcher, g as OwnerSharePolicyRegistration, h as OwnerSharePolicyRegistrationReceipt, i as OwnerSharePolicyV2, P as PublishedShare, j as PublishedShareDeliveryMaterial, k as PublishedShareMetadata, R as RegisterOwnerSharePolicyParams, S as SHARE_CONTENT_LIMIT, l as SHARE_PUBLISH_RESULT_VERSION, m as SharePublishError, n as SharePublishErrorCode, o as SharePublishOptions, p as SharePublishTarget, q 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-BqzRlkb6.js';
6
+ import { S as SenderShareRecord, a as SenderShareRecordStorage } from './history-CyT6x8h4.js';
7
+ 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-CyT6x8h4.js';
5
8
 
6
9
  declare function hasUnsafeFilenameCodePoint(value: string): boolean;
7
10
  /** A single display/download filename, never a path. Returns the NFC form. */
@@ -139,156 +142,6 @@ declare class MemoryShareCache implements ShareCache {
139
142
  clear(): Promise<void>;
140
143
  }
141
144
 
142
- interface EncryptedShareHistoryStorage {
143
- put(value: Uint8Array): Promise<void>;
144
- list(): Promise<readonly Uint8Array[]>;
145
- clear(): Promise<void>;
146
- }
147
- declare class MemoryEncryptedShareHistoryStorage implements EncryptedShareHistoryStorage {
148
- private readonly values;
149
- put(value: Uint8Array): Promise<void>;
150
- list(): Promise<readonly Uint8Array[]>;
151
- clear(): Promise<void>;
152
- }
153
- /**
154
- * The durable record a sender needs, after a reload, to display and manage
155
- * a share it created. Every identity/CID here comes verbatim from the
156
- * Node-verified {@link OwnerSharePolicyRegistrationReceipt}; nothing is
157
- * re-derived or guessed.
158
- */
159
- interface SenderShareRecord {
160
- readonly shareId: string;
161
- readonly registrationCid?: string;
162
- readonly policyCid?: string;
163
- readonly ownerDelegationCid?: string;
164
- readonly enforcementDelegationCid?: string;
165
- readonly shareKeyDid?: string;
166
- readonly ownerDid?: string;
167
- readonly enforcerDid?: string;
168
- readonly target: {
169
- readonly origin: string;
170
- readonly nodeAudience: string;
171
- readonly spaceId: string;
172
- };
173
- readonly resource: {
174
- readonly kind: "exact" | "prefix";
175
- readonly path: string;
176
- };
177
- readonly actions: readonly OwnerShareAction[];
178
- readonly recipientMatcher: OwnerShareMatcher;
179
- /** The signed target discriminator, retained separately from the email matcher. */
180
- readonly targetKind?: "bearer" | "recipientDid" | "email" | "emailDomain";
181
- readonly registeredAt: string;
182
- readonly expiresAt: string;
183
- readonly revokedAt?: string;
184
- readonly envelopeCid?: string;
185
- readonly shareCid?: string;
186
- /** Complete bearer links are encrypted at rest and only revealed explicitly. */
187
- readonly link?: string;
188
- readonly filename?: string;
189
- /** Policy/v3 delivery material. The containing history record must remain encrypted at rest. */
190
- readonly deliveryMaterial?: PublishedShareDeliveryMaterial;
191
- /** Canonical mailboxes whose invitation delivery was confirmed; history is encrypted at rest. */
192
- readonly deliveredRecipients?: readonly string[];
193
- }
194
- /** Create the durable encrypted-history shape from canonical publication receipts. */
195
- declare function historyRecordForPublishedShare(result: PublishedShare, now?: Date): SenderShareRecord;
196
- /**
197
- * "direct" selects the Policy/v3 enforcement root; "ancestor" selects its
198
- * policy-authority sibling. Addressed shares revoke that signed root through
199
- * the Node Policy/v3 endpoint, which cuts off existing sessions as well as
200
- * fresh admission and delivery. Bearer shares retain ordinary delegation
201
- * revocation.
202
- */
203
- type SenderShareRevocationScope = "direct" | "ancestor";
204
- interface SenderShareRecordStorage {
205
- put(record: SenderShareRecord): Promise<void>;
206
- /** Atomically transform the latest record, if present. Implementations that
207
- * provide this must serialize the read and write with every other writer. */
208
- update?(shareId: string, change: (record: SenderShareRecord) => SenderShareRecord | Promise<SenderShareRecord>): Promise<SenderShareRecord | undefined>;
209
- list(): Promise<readonly SenderShareRecord[]>;
210
- get(shareId: string): Promise<SenderShareRecord | undefined>;
211
- delete(shareId: string): Promise<void>;
212
- }
213
- interface StoredSenderShareKey {
214
- readonly cryptoKey: CryptoKey;
215
- readonly publicKey: Uint8Array;
216
- readonly extractable: boolean;
217
- }
218
- interface SenderShareKeyStorage {
219
- put(shareId: string, key: StoredSenderShareKey): Promise<void>;
220
- get(shareId: string): Promise<StoredSenderShareKey | undefined>;
221
- delete(shareId: string): Promise<void>;
222
- }
223
- /** In-memory reference implementation. Real deployments back these with IndexedDB so the non-extractable `CryptoKey` survives a reload via structured clone. */
224
- declare class MemorySenderShareRecordStorage implements SenderShareRecordStorage {
225
- private readonly records;
226
- private operation;
227
- private serialize;
228
- put(record: SenderShareRecord): Promise<void>;
229
- update(shareId: string, change: (record: SenderShareRecord) => SenderShareRecord | Promise<SenderShareRecord>): Promise<SenderShareRecord | undefined>;
230
- list(): Promise<readonly SenderShareRecord[]>;
231
- get(shareId: string): Promise<SenderShareRecord | undefined>;
232
- delete(shareId: string): Promise<void>;
233
- }
234
- declare class MemorySenderShareKeyStorage implements SenderShareKeyStorage {
235
- private readonly keys;
236
- put(shareId: string, key: StoredSenderShareKey): Promise<void>;
237
- get(shareId: string): Promise<StoredSenderShareKey | undefined>;
238
- delete(shareId: string): Promise<void>;
239
- }
240
- interface SenderShareStoreOptions {
241
- readonly records: SenderShareRecordStorage;
242
- readonly keys: SenderShareKeyStorage;
243
- readonly now?: () => Date;
244
- }
245
- /**
246
- * Reload-safe sender-side management for shares created through
247
- * {@link canonicalOwnerSharePolicy} / `registerOwnerSharePolicy`. Persists
248
- * the registration receipt's canonical identity tuple plus the ephemeral
249
- * share key's non-extractable `CryptoKey` handle, so a sender can list,
250
- * inspect, and revoke shares it created in an earlier session -- without
251
- * ever re-exporting private key material.
252
- */
253
- declare class SenderShareStore {
254
- private readonly records;
255
- private readonly keys;
256
- private readonly now;
257
- constructor(options: SenderShareStoreOptions);
258
- /** Persist a Node-verified registration receipt and its share key handle. */
259
- save(receipt: OwnerSharePolicyRegistrationReceipt, key: DelegatedShareKey): Promise<SenderShareRecord>;
260
- /** List shares created in any session, most recent first. */
261
- list(options?: {
262
- readonly includeRevoked?: boolean;
263
- readonly includeExpired?: boolean;
264
- }): Promise<readonly SenderShareRecord[]>;
265
- get(shareId: string): Promise<SenderShareRecord | undefined>;
266
- /** Recover a signer for the persisted share key after a reload. */
267
- loadKey(shareId: string): Promise<DelegatedShareKey | undefined>;
268
- /**
269
- * The delegation CID to pass to the node's existing generic
270
- * `tinycloud.delegation/revoke` invocation to revoke this share at the
271
- * requested scope. Does not itself call the node -- callers invoke
272
- * their own `revokeDelegation`/`DelegationManager.revoke` with the
273
- * returned CID, then call {@link markRevoked} once that succeeds.
274
- */
275
- revocationTarget(shareId: string, scope: SenderShareRevocationScope): Promise<string>;
276
- /** Mark a share revoked locally after the caller's node-side revoke call succeeds. */
277
- markRevoked(shareId: string, revokedAt?: string): Promise<SenderShareRecord>;
278
- /** Forget a share and clear its persisted key handle. */
279
- remove(shareId: string): Promise<void>;
280
- }
281
- /** WebCrypto-backed persistence adapter; links and private material are absent. */
282
- declare class EncryptedSenderShareHistory {
283
- private readonly storage;
284
- private readonly key;
285
- private readonly now;
286
- constructor(storage: EncryptedShareHistoryStorage, key: CryptoKey, now?: () => Date);
287
- put(record: SenderShareRecord): Promise<void>;
288
- list(): Promise<readonly SenderShareRecord[]>;
289
- clear(): Promise<void>;
290
- }
291
-
292
145
  type ShareNotifyState = "delivered" | "already-delivered" | "partial-failure";
293
146
  interface ShareNotifyResult {
294
147
  readonly protocol: "tinycloud-share";
@@ -632,4 +485,4 @@ declare function parseNativeShareUrl(value: string): string;
632
485
  /** Receive through the public SDK without creating another transport protocol. */
633
486
  declare function openNativeShare(sharing: NativeSharingService, link: string): Promise<unknown>;
634
487
 
635
- export { CredentialInvitationError, type CredentialInvitationErrorCode, type CredentialInvitationReceipt, type CredentialInvitationResult, DEFAULT_MAX_CONTENT_BLOB_BYTES, DEFAULT_MAX_SEALED_BLOB_BYTES, DelegatedShareKey, EncryptedSenderShareHistory, type EncryptedShareHistoryStorage, MemoryEncryptedShareHistoryStorage, MemorySenderShareKeyStorage, MemorySenderShareRecordStorage, MemoryShareCache, NATIVE_SHARE_FRAGMENT_PARAMETER, type NativeShareResult, type NativeSharingService, OwnerShareAction, OwnerShareMatcher, OwnerSharePolicyRegistrationReceipt, type ParsedAddressedEnvelope, PublishedShare, PublishedShareDeliveryMaterial, SHARE_RESULT_VERSION, SHARE_V2_PROTOCOL, type SenderShareKeyStorage, type SenderShareRecord, type SenderShareRecordStorage, type SenderShareRevocationScope, SenderShareStore, ShareAuthorizationAdapter, ShareAuthorizationMethod, ShareAuthorizationResult, 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 SharePolicyDelegationLink, type SharePolicyPublishAdapter, type SharePolicyRootRevocation, type SharePolicySession, type SharePresentationMaterial, type ShareReceiveAuthorizationRequired, ShareReceiveError, type ShareReceiveOutcome, type ShareReceiveResult, ShareRecipientClient, type ShareRecipientClientOptions, type ShareRevocationAdapter, type ShareRevocationResult, ShareTarget, TargetPublishInput, TargetPublishOutcome, canonicalShareFilename, claimShare, createAddressedAuthorization, createNativeShare, createShareV2HolderBindingArtifact, deliverCredentialInvitation, hasUnsafeFilenameCodePoint, historyRecordForPublishedShare, inspectShare, listShares, notifyShare, openNativeShare, parseAddressedEnvelope, parseNativeShareUrl, publishPolicyShare, receiveShare, recipientMatchesShareRecord, resumeShareAuthorization, revokeShare, shareDeliveryWindowExpiresAt, showShare, toShareErrorInfo };
488
+ export { CredentialInvitationError, type CredentialInvitationErrorCode, type CredentialInvitationReceipt, type CredentialInvitationResult, DEFAULT_MAX_CONTENT_BLOB_BYTES, DEFAULT_MAX_SEALED_BLOB_BYTES, MemoryShareCache, NATIVE_SHARE_FRAGMENT_PARAMETER, type NativeShareResult, type NativeSharingService, type ParsedAddressedEnvelope, SHARE_RESULT_VERSION, SHARE_V2_PROTOCOL, SenderShareRecord, SenderShareRecordStorage, ShareAuthorizationAdapter, ShareAuthorizationMethod, ShareAuthorizationResult, 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 SharePolicyDelegationLink, type SharePolicyPublishAdapter, type SharePolicyRootRevocation, type SharePolicySession, type SharePresentationMaterial, type ShareReceiveAuthorizationRequired, ShareReceiveError, type ShareReceiveOutcome, type ShareReceiveResult, ShareRecipientClient, type ShareRecipientClientOptions, type ShareRevocationAdapter, type ShareRevocationResult, ShareTarget, TargetPublishInput, TargetPublishOutcome, canonicalShareFilename, claimShare, createAddressedAuthorization, createNativeShare, createShareV2HolderBindingArtifact, deliverCredentialInvitation, hasUnsafeFilenameCodePoint, inspectShare, listShares, notifyShare, openNativeShare, parseAddressedEnvelope, parseNativeShareUrl, publishPolicyShare, receiveShare, recipientMatchesShareRecord, resumeShareAuthorization, revokeShare, shareDeliveryWindowExpiresAt, showShare, toShareErrorInfo };