@tinycloud/share-sdk 1.2.0-beta.3 → 1.2.0-beta.5

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.
@@ -0,0 +1,297 @@
1
+ declare const SHARE_CONTENT_LIMIT: number;
2
+ declare const SHARE_PUBLISH_RESULT_VERSION: 1;
3
+ declare const DEFAULT_SHARE_LIFETIME_MS: number;
4
+ type SharePublishTarget = {
5
+ readonly kind: "bearer";
6
+ } | {
7
+ readonly kind: "recipientDid";
8
+ readonly did: string;
9
+ } | {
10
+ readonly kind: "email";
11
+ readonly address: string;
12
+ } | {
13
+ readonly kind: "emailDomain";
14
+ readonly domain: string;
15
+ };
16
+ /** Input shared by the native bearer and Policy/v3 addressed publishers. */
17
+ interface SharePublishOptions {
18
+ readonly source: Uint8Array | AsyncIterable<Uint8Array>;
19
+ readonly filename: string;
20
+ readonly mediaType?: string;
21
+ readonly allowBinary?: boolean;
22
+ readonly target?: SharePublishTarget;
23
+ readonly expiresAt?: Date;
24
+ readonly expiryWasExplicit?: boolean;
25
+ readonly origin: string;
26
+ readonly maxBytes?: number;
27
+ readonly now?: () => number;
28
+ }
29
+ interface PublishedShareMetadata {
30
+ readonly protocol: "tinycloud-share";
31
+ readonly version: 1;
32
+ readonly shareId: string;
33
+ readonly origin: string;
34
+ readonly target: {
35
+ readonly kind: "bearer" | "recipientDid" | "email" | "emailDomain";
36
+ readonly origin: string;
37
+ readonly nodeAudience: string;
38
+ readonly spaceId: string;
39
+ };
40
+ readonly resource: {
41
+ readonly kind: "exact" | "prefix";
42
+ readonly path: string;
43
+ };
44
+ readonly actions: readonly string[];
45
+ readonly expiryClamped?: boolean;
46
+ readonly expiresAt: string;
47
+ readonly display: {
48
+ readonly filename?: string;
49
+ readonly senderName?: string;
50
+ };
51
+ readonly recipientMatcher?: {
52
+ readonly kind: "bearer" | "recipientDid" | "exactEmail" | "emailDomain";
53
+ readonly value?: string;
54
+ };
55
+ readonly registrationCid?: string;
56
+ readonly policyCid?: string;
57
+ readonly ownerDelegationCid?: string;
58
+ readonly enforcementDelegationCid?: string;
59
+ readonly ownerDid?: string;
60
+ readonly shareKeyDid?: string;
61
+ readonly enforcerDid?: string;
62
+ readonly envelopeCid?: string;
63
+ readonly shareCid?: string;
64
+ /** Set when the content is a numbered artifact version (TC-1428). Pinned: the share can only ever read this version. */
65
+ readonly artifact?: {
66
+ readonly id: string;
67
+ readonly version: number;
68
+ readonly mode: "pinned";
69
+ };
70
+ }
71
+ /** Sender-only Policy/v3 material retained in encrypted history for delivery retries. */
72
+ interface PublishedShareDeliveryMaterial {
73
+ /**
74
+ * The signed plaintext policy envelope. It is retained only in encrypted
75
+ * sender history so a delivery can be retried; it never travels in a URL.
76
+ */
77
+ readonly envelope: Readonly<Record<string, unknown>>;
78
+ /** CIDv1/raw/sha2-256 of `sealedEnvelope`, and the CID in the share URL. */
79
+ readonly shareCid: string;
80
+ /**
81
+ * Canonical `version || nonce || AES-256-GCM ciphertext+tag`, base64url.
82
+ * Node reopens this exact value before authorizing email delivery.
83
+ */
84
+ readonly sealedEnvelope: string;
85
+ /** 32-byte AES-GCM key for `sealedEnvelope`, base64url and fragment-only in the URL. */
86
+ readonly envelopeKey: string;
87
+ }
88
+ interface PublishedShare {
89
+ readonly protocol: "tinycloud-share";
90
+ readonly version: typeof SHARE_PUBLISH_RESULT_VERSION;
91
+ /** The complete link is deliberately non-enumerable on production results. */
92
+ readonly url: string;
93
+ readonly link: {
94
+ readonly kind: "native" | "policy";
95
+ readonly cid: string;
96
+ };
97
+ readonly metadata: PublishedShareMetadata;
98
+ /** Non-enumerable Policy/v3 delivery material; never included in command output. */
99
+ readonly deliveryMaterial?: PublishedShareDeliveryMaterial;
100
+ }
101
+ /** Machine-readable output omits the complete bearer capability and delivery material. */
102
+ declare function redactPublishedShare(result: PublishedShare): Omit<PublishedShare, "url" | "deliveryMaterial">;
103
+ type SharePublishErrorCode = "invalid-argument" | "authority-required" | "max-bytes-exceeded";
104
+ declare class SharePublishError extends Error {
105
+ readonly code: SharePublishErrorCode;
106
+ constructor(code: SharePublishErrorCode, message: string);
107
+ }
108
+
109
+ interface OwnerDelegationReceipt {
110
+ readonly delegationCid: string;
111
+ readonly signedDagCbor: Uint8Array;
112
+ readonly delegation: {
113
+ readonly delegateDID: string;
114
+ readonly spaceId: string;
115
+ readonly path: string;
116
+ readonly actions: readonly string[];
117
+ readonly expiry: Date;
118
+ };
119
+ /** Exact service-scoped capabilities encoded in the signed owner delegation. */
120
+ readonly permissions?: readonly OwnerDelegationPermission[];
121
+ }
122
+ interface OwnerDelegationPermission {
123
+ readonly service: string;
124
+ readonly path: string;
125
+ readonly actions: readonly string[];
126
+ }
127
+ interface CreateOwnerDelegationBase {
128
+ readonly delegateDid: string;
129
+ readonly spaceId: string;
130
+ readonly expiresAt: Date;
131
+ }
132
+ type CreateOwnerDelegationParams = CreateOwnerDelegationBase & ({
133
+ readonly path: string;
134
+ readonly actions: readonly string[];
135
+ readonly permissions?: never;
136
+ } | {
137
+ readonly permissions: readonly OwnerDelegationPermission[];
138
+ readonly path?: never;
139
+ readonly actions?: never;
140
+ });
141
+ declare const MAX_CONTENT_BYTES: number;
142
+ declare const OWNER_SHARE_REGISTRATION_DOMAIN = "xyz.tinycloud.share/policy-registration/v2\0";
143
+ type OwnerShareAction = "tinycloud.kv/get" | "tinycloud.kv/list" | "tinycloud.kv/metadata" | "tinycloud.kv/put";
144
+ interface OwnerShareDecryption {
145
+ readonly networkId: string;
146
+ readonly action: "tinycloud.encryption/decrypt";
147
+ }
148
+ type OwnerShareMatcher = {
149
+ readonly kind: "exactEmail";
150
+ readonly value: string;
151
+ } | {
152
+ readonly kind: "emailDomain";
153
+ readonly value: string;
154
+ } | {
155
+ readonly kind: "recipientDid";
156
+ readonly value: string;
157
+ } | {
158
+ readonly kind: "bearer";
159
+ };
160
+ interface OwnerSharePolicyV2 {
161
+ readonly type: "TinyCloudSharePolicy";
162
+ readonly version: 2;
163
+ readonly shareId: string;
164
+ readonly ownerDid: string;
165
+ readonly shareKeyDid: string;
166
+ readonly recipientMatcher: OwnerShareMatcher;
167
+ readonly target: {
168
+ readonly origin: string;
169
+ readonly nodeAudience: string;
170
+ readonly enforcerDid: 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 decryption?: OwnerShareDecryption;
179
+ readonly contentSource: {
180
+ readonly kind: "kv";
181
+ readonly space: string;
182
+ readonly path: string;
183
+ readonly action: "tinycloud.kv/get";
184
+ };
185
+ readonly contentSourceDigest: string;
186
+ readonly ownerDelegationCid: string;
187
+ readonly expiresAt: string;
188
+ }
189
+ interface DelegatedShareKey {
190
+ readonly did: string;
191
+ readonly publicKey: Uint8Array;
192
+ readonly extractable: boolean;
193
+ /** The underlying WebCrypto private key handle; private JWK material is never returned. */
194
+ readonly cryptoKey: CryptoKey;
195
+ sign(bytes: Uint8Array): Promise<Uint8Array>;
196
+ clear(): void;
197
+ }
198
+ interface SignedDelegation {
199
+ readonly cid: string;
200
+ readonly dagCbor: string;
201
+ readonly issuerDid: string;
202
+ readonly audienceDid: string;
203
+ readonly facts: Record<string, string | readonly string[]>;
204
+ readonly signature: string;
205
+ }
206
+ interface RegisterOwnerSharePolicyParams {
207
+ readonly policy: {
208
+ readonly bytes: Uint8Array;
209
+ readonly cid: string;
210
+ readonly proof: string;
211
+ };
212
+ readonly ownerDelegation: OwnerDelegationReceipt;
213
+ readonly enforcementDelegation: SignedDelegation;
214
+ readonly contentSourceDigest: string;
215
+ /** The enrolled receipt key from the node trust bundle. */
216
+ readonly nodeProof?: {
217
+ readonly kid: string;
218
+ readonly publicKey: Uint8Array;
219
+ };
220
+ }
221
+ interface OwnerSharePolicyRegistration {
222
+ readonly registrationCid: string;
223
+ readonly policyCid: string;
224
+ readonly ownerDelegationCid: string;
225
+ readonly enforcementDelegationCid: string;
226
+ readonly ownerDid: string;
227
+ readonly shareKeyDid: string;
228
+ readonly enforcerDid: string;
229
+ readonly shareId: string;
230
+ readonly recipientMatcher: OwnerShareMatcher;
231
+ readonly target: {
232
+ readonly origin: string;
233
+ readonly nodeAudience: string;
234
+ readonly spaceId: string;
235
+ };
236
+ readonly resource: {
237
+ readonly kind: "exact" | "prefix";
238
+ readonly path: string;
239
+ };
240
+ readonly actions: readonly OwnerShareAction[];
241
+ readonly contentSource: {
242
+ readonly kind: "kv";
243
+ readonly space: string;
244
+ readonly path: string;
245
+ readonly action: "tinycloud.kv/get";
246
+ };
247
+ readonly contentSourceDigest: string;
248
+ readonly registeredAt: string;
249
+ readonly expiresAt: string;
250
+ }
251
+ interface OwnerSharePolicyRegistrationReceipt {
252
+ readonly registration: OwnerSharePolicyRegistration;
253
+ readonly proof: {
254
+ readonly alg: "EdDSA";
255
+ readonly kid: string;
256
+ readonly signature: string;
257
+ };
258
+ }
259
+ declare function createDelegatedShareKey(options: {
260
+ readonly extractable: boolean;
261
+ }): Promise<DelegatedShareKey>;
262
+ /**
263
+ * Rehydrate a signer wrapper around a `DelegatedShareKey`'s private
264
+ * `CryptoKey` handle that was persisted (e.g. via IndexedDB structured
265
+ * clone) and recovered after a reload. `privateKey` must be the same
266
+ * non-extractable Ed25519 `CryptoKey` originally produced by
267
+ * {@link createDelegatedShareKey}.
268
+ */
269
+ declare function restoreDelegatedShareKey(input: {
270
+ readonly privateKey: CryptoKey;
271
+ readonly publicKey: Uint8Array;
272
+ readonly extractable: boolean;
273
+ }): DelegatedShareKey;
274
+ declare function createPolicyEnforcementDelegation(input: {
275
+ readonly ownerDelegation: OwnerDelegationReceipt;
276
+ readonly shareKey: DelegatedShareKey;
277
+ readonly enforcerDid: string;
278
+ readonly policyCid: string;
279
+ readonly shareId: string;
280
+ readonly spaceId: string;
281
+ readonly nodeAudience: string;
282
+ readonly path: string;
283
+ readonly actions: readonly OwnerShareAction[];
284
+ readonly contentSourceDigest: string;
285
+ readonly expiresAt: string;
286
+ }): Promise<SignedDelegation>;
287
+ declare function canonicalOwnerSharePolicy(policy: OwnerSharePolicyV2): Promise<{
288
+ readonly bytes: Uint8Array;
289
+ readonly cid: string;
290
+ readonly digest: string;
291
+ }>;
292
+ declare function computeOwnerShareRegistrationCid(registration: Omit<OwnerSharePolicyRegistration, "registrationCid">): string;
293
+ declare function validateOwnerSharePolicyRegistration(value: unknown, expected: RegisterOwnerSharePolicyParams): OwnerSharePolicyRegistrationReceipt;
294
+ /** Validate the exact UTF-8 response bytes emitted by the registration route. */
295
+ declare function validateOwnerSharePolicyRegistrationBytes(bytesValue: Uint8Array, expected: RegisterOwnerSharePolicyParams): OwnerSharePolicyRegistrationReceipt;
296
+
297
+ export { type CreateOwnerDelegationParams as C, DEFAULT_SHARE_LIFETIME_MS as D, MAX_CONTENT_BYTES as M, OWNER_SHARE_REGISTRATION_DOMAIN as O, type PublishedShare as P, type RegisterOwnerSharePolicyParams as R, SHARE_CONTENT_LIMIT as S, type DelegatedShareKey as a, type OwnerDelegationPermission as b, type OwnerDelegationReceipt as c, type OwnerShareAction as d, type OwnerShareDecryption as e, type OwnerShareMatcher as f, type OwnerSharePolicyRegistration as g, type OwnerSharePolicyRegistrationReceipt as h, type OwnerSharePolicyV2 as i, type PublishedShareDeliveryMaterial as j, type PublishedShareMetadata as k, SHARE_PUBLISH_RESULT_VERSION as l, SharePublishError as m, type SharePublishErrorCode as n, type SharePublishOptions as o, type SharePublishTarget as p, type SignedDelegation as q, canonicalOwnerSharePolicy as r, computeOwnerShareRegistrationCid as s, createDelegatedShareKey as t, createPolicyEnforcementDelegation as u, redactPublishedShare as v, restoreDelegatedShareKey as w, validateOwnerSharePolicyRegistration as x, validateOwnerSharePolicyRegistrationBytes as y };
@@ -0,0 +1,297 @@
1
+ declare const SHARE_CONTENT_LIMIT: number;
2
+ declare const SHARE_PUBLISH_RESULT_VERSION: 1;
3
+ declare const DEFAULT_SHARE_LIFETIME_MS: number;
4
+ type SharePublishTarget = {
5
+ readonly kind: "bearer";
6
+ } | {
7
+ readonly kind: "recipientDid";
8
+ readonly did: string;
9
+ } | {
10
+ readonly kind: "email";
11
+ readonly address: string;
12
+ } | {
13
+ readonly kind: "emailDomain";
14
+ readonly domain: string;
15
+ };
16
+ /** Input shared by the native bearer and Policy/v3 addressed publishers. */
17
+ interface SharePublishOptions {
18
+ readonly source: Uint8Array | AsyncIterable<Uint8Array>;
19
+ readonly filename: string;
20
+ readonly mediaType?: string;
21
+ readonly allowBinary?: boolean;
22
+ readonly target?: SharePublishTarget;
23
+ readonly expiresAt?: Date;
24
+ readonly expiryWasExplicit?: boolean;
25
+ readonly origin: string;
26
+ readonly maxBytes?: number;
27
+ readonly now?: () => number;
28
+ }
29
+ interface PublishedShareMetadata {
30
+ readonly protocol: "tinycloud-share";
31
+ readonly version: 1;
32
+ readonly shareId: string;
33
+ readonly origin: string;
34
+ readonly target: {
35
+ readonly kind: "bearer" | "recipientDid" | "email" | "emailDomain";
36
+ readonly origin: string;
37
+ readonly nodeAudience: string;
38
+ readonly spaceId: string;
39
+ };
40
+ readonly resource: {
41
+ readonly kind: "exact" | "prefix";
42
+ readonly path: string;
43
+ };
44
+ readonly actions: readonly string[];
45
+ readonly expiryClamped?: boolean;
46
+ readonly expiresAt: string;
47
+ readonly display: {
48
+ readonly filename?: string;
49
+ readonly senderName?: string;
50
+ };
51
+ readonly recipientMatcher?: {
52
+ readonly kind: "bearer" | "recipientDid" | "exactEmail" | "emailDomain";
53
+ readonly value?: string;
54
+ };
55
+ readonly registrationCid?: string;
56
+ readonly policyCid?: string;
57
+ readonly ownerDelegationCid?: string;
58
+ readonly enforcementDelegationCid?: string;
59
+ readonly ownerDid?: string;
60
+ readonly shareKeyDid?: string;
61
+ readonly enforcerDid?: string;
62
+ readonly envelopeCid?: string;
63
+ readonly shareCid?: string;
64
+ /** Set when the content is a numbered artifact version (TC-1428). Pinned: the share can only ever read this version. */
65
+ readonly artifact?: {
66
+ readonly id: string;
67
+ readonly version: number;
68
+ readonly mode: "pinned";
69
+ };
70
+ }
71
+ /** Sender-only Policy/v3 material retained in encrypted history for delivery retries. */
72
+ interface PublishedShareDeliveryMaterial {
73
+ /**
74
+ * The signed plaintext policy envelope. It is retained only in encrypted
75
+ * sender history so a delivery can be retried; it never travels in a URL.
76
+ */
77
+ readonly envelope: Readonly<Record<string, unknown>>;
78
+ /** CIDv1/raw/sha2-256 of `sealedEnvelope`, and the CID in the share URL. */
79
+ readonly shareCid: string;
80
+ /**
81
+ * Canonical `version || nonce || AES-256-GCM ciphertext+tag`, base64url.
82
+ * Node reopens this exact value before authorizing email delivery.
83
+ */
84
+ readonly sealedEnvelope: string;
85
+ /** 32-byte AES-GCM key for `sealedEnvelope`, base64url and fragment-only in the URL. */
86
+ readonly envelopeKey: string;
87
+ }
88
+ interface PublishedShare {
89
+ readonly protocol: "tinycloud-share";
90
+ readonly version: typeof SHARE_PUBLISH_RESULT_VERSION;
91
+ /** The complete link is deliberately non-enumerable on production results. */
92
+ readonly url: string;
93
+ readonly link: {
94
+ readonly kind: "native" | "policy";
95
+ readonly cid: string;
96
+ };
97
+ readonly metadata: PublishedShareMetadata;
98
+ /** Non-enumerable Policy/v3 delivery material; never included in command output. */
99
+ readonly deliveryMaterial?: PublishedShareDeliveryMaterial;
100
+ }
101
+ /** Machine-readable output omits the complete bearer capability and delivery material. */
102
+ declare function redactPublishedShare(result: PublishedShare): Omit<PublishedShare, "url" | "deliveryMaterial">;
103
+ type SharePublishErrorCode = "invalid-argument" | "authority-required" | "max-bytes-exceeded";
104
+ declare class SharePublishError extends Error {
105
+ readonly code: SharePublishErrorCode;
106
+ constructor(code: SharePublishErrorCode, message: string);
107
+ }
108
+
109
+ interface OwnerDelegationReceipt {
110
+ readonly delegationCid: string;
111
+ readonly signedDagCbor: Uint8Array;
112
+ readonly delegation: {
113
+ readonly delegateDID: string;
114
+ readonly spaceId: string;
115
+ readonly path: string;
116
+ readonly actions: readonly string[];
117
+ readonly expiry: Date;
118
+ };
119
+ /** Exact service-scoped capabilities encoded in the signed owner delegation. */
120
+ readonly permissions?: readonly OwnerDelegationPermission[];
121
+ }
122
+ interface OwnerDelegationPermission {
123
+ readonly service: string;
124
+ readonly path: string;
125
+ readonly actions: readonly string[];
126
+ }
127
+ interface CreateOwnerDelegationBase {
128
+ readonly delegateDid: string;
129
+ readonly spaceId: string;
130
+ readonly expiresAt: Date;
131
+ }
132
+ type CreateOwnerDelegationParams = CreateOwnerDelegationBase & ({
133
+ readonly path: string;
134
+ readonly actions: readonly string[];
135
+ readonly permissions?: never;
136
+ } | {
137
+ readonly permissions: readonly OwnerDelegationPermission[];
138
+ readonly path?: never;
139
+ readonly actions?: never;
140
+ });
141
+ declare const MAX_CONTENT_BYTES: number;
142
+ declare const OWNER_SHARE_REGISTRATION_DOMAIN = "xyz.tinycloud.share/policy-registration/v2\0";
143
+ type OwnerShareAction = "tinycloud.kv/get" | "tinycloud.kv/list" | "tinycloud.kv/metadata" | "tinycloud.kv/put";
144
+ interface OwnerShareDecryption {
145
+ readonly networkId: string;
146
+ readonly action: "tinycloud.encryption/decrypt";
147
+ }
148
+ type OwnerShareMatcher = {
149
+ readonly kind: "exactEmail";
150
+ readonly value: string;
151
+ } | {
152
+ readonly kind: "emailDomain";
153
+ readonly value: string;
154
+ } | {
155
+ readonly kind: "recipientDid";
156
+ readonly value: string;
157
+ } | {
158
+ readonly kind: "bearer";
159
+ };
160
+ interface OwnerSharePolicyV2 {
161
+ readonly type: "TinyCloudSharePolicy";
162
+ readonly version: 2;
163
+ readonly shareId: string;
164
+ readonly ownerDid: string;
165
+ readonly shareKeyDid: string;
166
+ readonly recipientMatcher: OwnerShareMatcher;
167
+ readonly target: {
168
+ readonly origin: string;
169
+ readonly nodeAudience: string;
170
+ readonly enforcerDid: 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 decryption?: OwnerShareDecryption;
179
+ readonly contentSource: {
180
+ readonly kind: "kv";
181
+ readonly space: string;
182
+ readonly path: string;
183
+ readonly action: "tinycloud.kv/get";
184
+ };
185
+ readonly contentSourceDigest: string;
186
+ readonly ownerDelegationCid: string;
187
+ readonly expiresAt: string;
188
+ }
189
+ interface DelegatedShareKey {
190
+ readonly did: string;
191
+ readonly publicKey: Uint8Array;
192
+ readonly extractable: boolean;
193
+ /** The underlying WebCrypto private key handle; private JWK material is never returned. */
194
+ readonly cryptoKey: CryptoKey;
195
+ sign(bytes: Uint8Array): Promise<Uint8Array>;
196
+ clear(): void;
197
+ }
198
+ interface SignedDelegation {
199
+ readonly cid: string;
200
+ readonly dagCbor: string;
201
+ readonly issuerDid: string;
202
+ readonly audienceDid: string;
203
+ readonly facts: Record<string, string | readonly string[]>;
204
+ readonly signature: string;
205
+ }
206
+ interface RegisterOwnerSharePolicyParams {
207
+ readonly policy: {
208
+ readonly bytes: Uint8Array;
209
+ readonly cid: string;
210
+ readonly proof: string;
211
+ };
212
+ readonly ownerDelegation: OwnerDelegationReceipt;
213
+ readonly enforcementDelegation: SignedDelegation;
214
+ readonly contentSourceDigest: string;
215
+ /** The enrolled receipt key from the node trust bundle. */
216
+ readonly nodeProof?: {
217
+ readonly kid: string;
218
+ readonly publicKey: Uint8Array;
219
+ };
220
+ }
221
+ interface OwnerSharePolicyRegistration {
222
+ readonly registrationCid: string;
223
+ readonly policyCid: string;
224
+ readonly ownerDelegationCid: string;
225
+ readonly enforcementDelegationCid: string;
226
+ readonly ownerDid: string;
227
+ readonly shareKeyDid: string;
228
+ readonly enforcerDid: string;
229
+ readonly shareId: string;
230
+ readonly recipientMatcher: OwnerShareMatcher;
231
+ readonly target: {
232
+ readonly origin: string;
233
+ readonly nodeAudience: string;
234
+ readonly spaceId: string;
235
+ };
236
+ readonly resource: {
237
+ readonly kind: "exact" | "prefix";
238
+ readonly path: string;
239
+ };
240
+ readonly actions: readonly OwnerShareAction[];
241
+ readonly contentSource: {
242
+ readonly kind: "kv";
243
+ readonly space: string;
244
+ readonly path: string;
245
+ readonly action: "tinycloud.kv/get";
246
+ };
247
+ readonly contentSourceDigest: string;
248
+ readonly registeredAt: string;
249
+ readonly expiresAt: string;
250
+ }
251
+ interface OwnerSharePolicyRegistrationReceipt {
252
+ readonly registration: OwnerSharePolicyRegistration;
253
+ readonly proof: {
254
+ readonly alg: "EdDSA";
255
+ readonly kid: string;
256
+ readonly signature: string;
257
+ };
258
+ }
259
+ declare function createDelegatedShareKey(options: {
260
+ readonly extractable: boolean;
261
+ }): Promise<DelegatedShareKey>;
262
+ /**
263
+ * Rehydrate a signer wrapper around a `DelegatedShareKey`'s private
264
+ * `CryptoKey` handle that was persisted (e.g. via IndexedDB structured
265
+ * clone) and recovered after a reload. `privateKey` must be the same
266
+ * non-extractable Ed25519 `CryptoKey` originally produced by
267
+ * {@link createDelegatedShareKey}.
268
+ */
269
+ declare function restoreDelegatedShareKey(input: {
270
+ readonly privateKey: CryptoKey;
271
+ readonly publicKey: Uint8Array;
272
+ readonly extractable: boolean;
273
+ }): DelegatedShareKey;
274
+ declare function createPolicyEnforcementDelegation(input: {
275
+ readonly ownerDelegation: OwnerDelegationReceipt;
276
+ readonly shareKey: DelegatedShareKey;
277
+ readonly enforcerDid: string;
278
+ readonly policyCid: string;
279
+ readonly shareId: string;
280
+ readonly spaceId: string;
281
+ readonly nodeAudience: string;
282
+ readonly path: string;
283
+ readonly actions: readonly OwnerShareAction[];
284
+ readonly contentSourceDigest: string;
285
+ readonly expiresAt: string;
286
+ }): Promise<SignedDelegation>;
287
+ declare function canonicalOwnerSharePolicy(policy: OwnerSharePolicyV2): Promise<{
288
+ readonly bytes: Uint8Array;
289
+ readonly cid: string;
290
+ readonly digest: string;
291
+ }>;
292
+ declare function computeOwnerShareRegistrationCid(registration: Omit<OwnerSharePolicyRegistration, "registrationCid">): string;
293
+ declare function validateOwnerSharePolicyRegistration(value: unknown, expected: RegisterOwnerSharePolicyParams): OwnerSharePolicyRegistrationReceipt;
294
+ /** Validate the exact UTF-8 response bytes emitted by the registration route. */
295
+ declare function validateOwnerSharePolicyRegistrationBytes(bytesValue: Uint8Array, expected: RegisterOwnerSharePolicyParams): OwnerSharePolicyRegistrationReceipt;
296
+
297
+ export { type CreateOwnerDelegationParams as C, DEFAULT_SHARE_LIFETIME_MS as D, MAX_CONTENT_BYTES as M, OWNER_SHARE_REGISTRATION_DOMAIN as O, type PublishedShare as P, type RegisterOwnerSharePolicyParams as R, SHARE_CONTENT_LIMIT as S, type DelegatedShareKey as a, type OwnerDelegationPermission as b, type OwnerDelegationReceipt as c, type OwnerShareAction as d, type OwnerShareDecryption as e, type OwnerShareMatcher as f, type OwnerSharePolicyRegistration as g, type OwnerSharePolicyRegistrationReceipt as h, type OwnerSharePolicyV2 as i, type PublishedShareDeliveryMaterial as j, type PublishedShareMetadata as k, SHARE_PUBLISH_RESULT_VERSION as l, SharePublishError as m, type SharePublishErrorCode as n, type SharePublishOptions as o, type SharePublishTarget as p, type SignedDelegation as q, canonicalOwnerSharePolicy as r, computeOwnerShareRegistrationCid as s, createDelegatedShareKey as t, createPolicyEnforcementDelegation as u, redactPublishedShare as v, restoreDelegatedShareKey as w, validateOwnerSharePolicyRegistration as x, validateOwnerSharePolicyRegistrationBytes as y };