@tinycloud/sdk-core 3.8.0-beta.2 → 3.8.0-beta.20
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/{credential-admission-Cg1M9uyV.d.cts → credential-admission-B7_F6Yb3.d.cts} +1 -0
- package/dist/{credential-admission-7I_ymo-C.d.ts → credential-admission-DCJhDFFv.d.ts} +1 -0
- package/dist/delegations/index.cjs +76 -14
- package/dist/delegations/index.cjs.map +1 -1
- package/dist/delegations/index.d.cts +4 -2
- package/dist/delegations/index.d.ts +4 -2
- package/dist/delegations/index.js +69 -7
- package/dist/delegations/index.js.map +1 -1
- package/dist/delegations/issued.cjs +697 -0
- package/dist/delegations/issued.cjs.map +1 -0
- package/dist/delegations/issued.d.cts +54 -0
- package/dist/delegations/issued.d.ts +54 -0
- package/dist/delegations/issued.js +674 -0
- package/dist/delegations/issued.js.map +1 -0
- package/dist/index.cjs +442 -294
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -5
- package/dist/index.d.ts +21 -5
- package/dist/index.js +171 -23
- package/dist/index.js.map +1 -1
- package/dist/policy/index.cjs +4 -6
- package/dist/policy/index.cjs.map +1 -1
- package/dist/policy/index.d.cts +2 -2
- package/dist/policy/index.d.ts +2 -2
- package/dist/policy/index.js +4 -6
- package/dist/policy/index.js.map +1 -1
- package/dist/{recipient-types.schema-BApcOn1t.d.cts → recipient-types.schema-BIJcihno.d.cts} +42 -1741
- package/dist/{recipient-types.schema-BApcOn1t.d.ts → recipient-types.schema-Ebi5aliq.d.ts} +42 -1741
- package/dist/types.schema-BmN-OnCA.d.cts +1763 -0
- package/dist/types.schema-BmN-OnCA.d.ts +1763 -0
- package/package.json +9 -4
package/dist/{recipient-types.schema-BApcOn1t.d.cts → recipient-types.schema-BIJcihno.d.cts}
RENAMED
|
@@ -1,1743 +1,7 @@
|
|
|
1
|
-
import { ServiceSession,
|
|
1
|
+
import { ServiceSession, Result as Result$1, ServiceError, FetchFunction, InvokeFunction, IKVService, ServiceHeaders } from '@tinycloud/sdk-services';
|
|
2
|
+
import { p as DelegationManagerConfig, R as Result, r as DelegationRevocationReceipt, s as DelegationStatus, a as AccountDelegationQueryOptions, A as AccountDelegationPage, b as AccountDelegationRecord, j as DelegationChain, K as KeyInfo, h as Delegation, C as CapabilityEntry, I as IngestOptions, g as DelegatedResource, G as GenerateShareParams, v as ShareLink, D as DelegationError, J as JWK, x as ShareSchema, t as KeyProvider, d as CreateDelegationParams, e as CreateDelegationWasmParams, f as CreateDelegationWasmResult } from './types.schema-BmN-OnCA.cjs';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
4
|
-
/**
|
|
5
|
-
* Zod schemas for delegation management types.
|
|
6
|
-
*
|
|
7
|
-
* These schemas provide runtime validation for delegation, capability key management,
|
|
8
|
-
* and sharing link functionality. Types are derived from schemas using z.infer<>.
|
|
9
|
-
*
|
|
10
|
-
* @packageDocumentation
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Result type pattern for delegation operations.
|
|
15
|
-
*/
|
|
16
|
-
type Result<T, E = DelegationError> = {
|
|
17
|
-
ok: true;
|
|
18
|
-
data: T;
|
|
19
|
-
} | {
|
|
20
|
-
ok: false;
|
|
21
|
-
error: E;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* JSON Web Key representation for cryptographic keys.
|
|
25
|
-
* Follows the JWK specification (RFC 7517).
|
|
26
|
-
*/
|
|
27
|
-
declare const JWKSchema: z.ZodObject<{
|
|
28
|
-
/** Key type (e.g., "EC", "RSA", "OKP") */
|
|
29
|
-
kty: z.ZodString;
|
|
30
|
-
/** Curve for EC/OKP keys (e.g., "P-256", "Ed25519") */
|
|
31
|
-
crv: z.ZodOptional<z.ZodString>;
|
|
32
|
-
/** X coordinate for EC keys, public key for OKP */
|
|
33
|
-
x: z.ZodOptional<z.ZodString>;
|
|
34
|
-
/** Y coordinate for EC keys */
|
|
35
|
-
y: z.ZodOptional<z.ZodString>;
|
|
36
|
-
/** Private key value (d parameter) */
|
|
37
|
-
d: z.ZodOptional<z.ZodString>;
|
|
38
|
-
/** Public exponent for RSA keys */
|
|
39
|
-
e: z.ZodOptional<z.ZodString>;
|
|
40
|
-
/** Modulus for RSA keys */
|
|
41
|
-
n: z.ZodOptional<z.ZodString>;
|
|
42
|
-
/** Key ID */
|
|
43
|
-
kid: z.ZodOptional<z.ZodString>;
|
|
44
|
-
/** Algorithm */
|
|
45
|
-
alg: z.ZodOptional<z.ZodString>;
|
|
46
|
-
/** Key use (e.g., "sig", "enc") */
|
|
47
|
-
use: z.ZodOptional<z.ZodString>;
|
|
48
|
-
/** Key operations (e.g., ["sign", "verify"]) */
|
|
49
|
-
key_ops: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
50
|
-
}, "strip", z.ZodTypeAny, {
|
|
51
|
-
kty: string;
|
|
52
|
-
kid?: string | undefined;
|
|
53
|
-
alg?: string | undefined;
|
|
54
|
-
crv?: string | undefined;
|
|
55
|
-
x?: string | undefined;
|
|
56
|
-
y?: string | undefined;
|
|
57
|
-
d?: string | undefined;
|
|
58
|
-
e?: string | undefined;
|
|
59
|
-
n?: string | undefined;
|
|
60
|
-
use?: string | undefined;
|
|
61
|
-
key_ops?: string[] | undefined;
|
|
62
|
-
}, {
|
|
63
|
-
kty: string;
|
|
64
|
-
kid?: string | undefined;
|
|
65
|
-
alg?: string | undefined;
|
|
66
|
-
crv?: string | undefined;
|
|
67
|
-
x?: string | undefined;
|
|
68
|
-
y?: string | undefined;
|
|
69
|
-
d?: string | undefined;
|
|
70
|
-
e?: string | undefined;
|
|
71
|
-
n?: string | undefined;
|
|
72
|
-
use?: string | undefined;
|
|
73
|
-
key_ops?: string[] | undefined;
|
|
74
|
-
}>;
|
|
75
|
-
type JWK = z.infer<typeof JWKSchema>;
|
|
76
|
-
/**
|
|
77
|
-
* Type of key in the capability registry.
|
|
78
|
-
*/
|
|
79
|
-
declare const KeyTypeSchema: z.ZodEnum<["main", "session", "ingested"]>;
|
|
80
|
-
type KeyType = z.infer<typeof KeyTypeSchema>;
|
|
81
|
-
/**
|
|
82
|
-
* Information about a cryptographic key used for delegations.
|
|
83
|
-
*/
|
|
84
|
-
declare const KeyInfoSchema: z.ZodObject<{
|
|
85
|
-
/** Unique identifier for this key */
|
|
86
|
-
id: z.ZodString;
|
|
87
|
-
/** DID associated with this key */
|
|
88
|
-
did: z.ZodString;
|
|
89
|
-
/** Type of key determining its authority level */
|
|
90
|
-
type: z.ZodEnum<["main", "session", "ingested"]>;
|
|
91
|
-
/** Private key in JWK format */
|
|
92
|
-
jwk: z.ZodOptional<z.ZodObject<{
|
|
93
|
-
/** Key type (e.g., "EC", "RSA", "OKP") */
|
|
94
|
-
kty: z.ZodString;
|
|
95
|
-
/** Curve for EC/OKP keys (e.g., "P-256", "Ed25519") */
|
|
96
|
-
crv: z.ZodOptional<z.ZodString>;
|
|
97
|
-
/** X coordinate for EC keys, public key for OKP */
|
|
98
|
-
x: z.ZodOptional<z.ZodString>;
|
|
99
|
-
/** Y coordinate for EC keys */
|
|
100
|
-
y: z.ZodOptional<z.ZodString>;
|
|
101
|
-
/** Private key value (d parameter) */
|
|
102
|
-
d: z.ZodOptional<z.ZodString>;
|
|
103
|
-
/** Public exponent for RSA keys */
|
|
104
|
-
e: z.ZodOptional<z.ZodString>;
|
|
105
|
-
/** Modulus for RSA keys */
|
|
106
|
-
n: z.ZodOptional<z.ZodString>;
|
|
107
|
-
/** Key ID */
|
|
108
|
-
kid: z.ZodOptional<z.ZodString>;
|
|
109
|
-
/** Algorithm */
|
|
110
|
-
alg: z.ZodOptional<z.ZodString>;
|
|
111
|
-
/** Key use (e.g., "sig", "enc") */
|
|
112
|
-
use: z.ZodOptional<z.ZodString>;
|
|
113
|
-
/** Key operations (e.g., ["sign", "verify"]) */
|
|
114
|
-
key_ops: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
115
|
-
}, "strip", z.ZodTypeAny, {
|
|
116
|
-
kty: string;
|
|
117
|
-
kid?: string | undefined;
|
|
118
|
-
alg?: string | undefined;
|
|
119
|
-
crv?: string | undefined;
|
|
120
|
-
x?: string | undefined;
|
|
121
|
-
y?: string | undefined;
|
|
122
|
-
d?: string | undefined;
|
|
123
|
-
e?: string | undefined;
|
|
124
|
-
n?: string | undefined;
|
|
125
|
-
use?: string | undefined;
|
|
126
|
-
key_ops?: string[] | undefined;
|
|
127
|
-
}, {
|
|
128
|
-
kty: string;
|
|
129
|
-
kid?: string | undefined;
|
|
130
|
-
alg?: string | undefined;
|
|
131
|
-
crv?: string | undefined;
|
|
132
|
-
x?: string | undefined;
|
|
133
|
-
y?: string | undefined;
|
|
134
|
-
d?: string | undefined;
|
|
135
|
-
e?: string | undefined;
|
|
136
|
-
n?: string | undefined;
|
|
137
|
-
use?: string | undefined;
|
|
138
|
-
key_ops?: string[] | undefined;
|
|
139
|
-
}>>;
|
|
140
|
-
/** Priority for key selection (lower = higher priority) */
|
|
141
|
-
priority: z.ZodNumber;
|
|
142
|
-
}, "strip", z.ZodTypeAny, {
|
|
143
|
-
type: "session" | "main" | "ingested";
|
|
144
|
-
did: string;
|
|
145
|
-
id: string;
|
|
146
|
-
priority: number;
|
|
147
|
-
jwk?: {
|
|
148
|
-
kty: string;
|
|
149
|
-
kid?: string | undefined;
|
|
150
|
-
alg?: string | undefined;
|
|
151
|
-
crv?: string | undefined;
|
|
152
|
-
x?: string | undefined;
|
|
153
|
-
y?: string | undefined;
|
|
154
|
-
d?: string | undefined;
|
|
155
|
-
e?: string | undefined;
|
|
156
|
-
n?: string | undefined;
|
|
157
|
-
use?: string | undefined;
|
|
158
|
-
key_ops?: string[] | undefined;
|
|
159
|
-
} | undefined;
|
|
160
|
-
}, {
|
|
161
|
-
type: "session" | "main" | "ingested";
|
|
162
|
-
did: string;
|
|
163
|
-
id: string;
|
|
164
|
-
priority: number;
|
|
165
|
-
jwk?: {
|
|
166
|
-
kty: string;
|
|
167
|
-
kid?: string | undefined;
|
|
168
|
-
alg?: string | undefined;
|
|
169
|
-
crv?: string | undefined;
|
|
170
|
-
x?: string | undefined;
|
|
171
|
-
y?: string | undefined;
|
|
172
|
-
d?: string | undefined;
|
|
173
|
-
e?: string | undefined;
|
|
174
|
-
n?: string | undefined;
|
|
175
|
-
use?: string | undefined;
|
|
176
|
-
key_ops?: string[] | undefined;
|
|
177
|
-
} | undefined;
|
|
178
|
-
}>;
|
|
179
|
-
type KeyInfo = z.infer<typeof KeyInfoSchema>;
|
|
180
|
-
/**
|
|
181
|
-
* Error type for delegation operations.
|
|
182
|
-
*/
|
|
183
|
-
declare const DelegationErrorSchema: z.ZodObject<{
|
|
184
|
-
/** Error code for programmatic handling */
|
|
185
|
-
code: z.ZodString;
|
|
186
|
-
/** Human-readable error message */
|
|
187
|
-
message: z.ZodString;
|
|
188
|
-
/** The service that produced the error */
|
|
189
|
-
service: z.ZodLiteral<"delegation">;
|
|
190
|
-
/** Original error if wrapping another error */
|
|
191
|
-
cause: z.ZodOptional<z.ZodType<Error, z.ZodTypeDef, Error>>;
|
|
192
|
-
/** Additional metadata about the error */
|
|
193
|
-
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
194
|
-
}, "strip", z.ZodTypeAny, {
|
|
195
|
-
code: string;
|
|
196
|
-
message: string;
|
|
197
|
-
service: "delegation";
|
|
198
|
-
cause?: Error | undefined;
|
|
199
|
-
meta?: Record<string, unknown> | undefined;
|
|
200
|
-
}, {
|
|
201
|
-
code: string;
|
|
202
|
-
message: string;
|
|
203
|
-
service: "delegation";
|
|
204
|
-
cause?: Error | undefined;
|
|
205
|
-
meta?: Record<string, unknown> | undefined;
|
|
206
|
-
}>;
|
|
207
|
-
type DelegationError = z.infer<typeof DelegationErrorSchema>;
|
|
208
|
-
/**
|
|
209
|
-
* Error codes for delegation operations.
|
|
210
|
-
*/
|
|
211
|
-
declare const DelegationErrorCodes: {
|
|
212
|
-
readonly AUTH_REQUIRED: "AUTH_REQUIRED";
|
|
213
|
-
readonly AUTH_UNAUTHORIZED: "AUTH_UNAUTHORIZED";
|
|
214
|
-
readonly AUTH_EXPIRED: "AUTH_EXPIRED";
|
|
215
|
-
readonly NOT_INITIALIZED: "NOT_INITIALIZED";
|
|
216
|
-
readonly NOT_FOUND: "NOT_FOUND";
|
|
217
|
-
readonly REVOKED: "REVOKED";
|
|
218
|
-
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
219
|
-
readonly TIMEOUT: "TIMEOUT";
|
|
220
|
-
readonly ABORTED: "ABORTED";
|
|
221
|
-
readonly INVALID_INPUT: "INVALID_INPUT";
|
|
222
|
-
readonly PERMISSION_DENIED: "PERMISSION_DENIED";
|
|
223
|
-
readonly CREATION_FAILED: "CREATION_FAILED";
|
|
224
|
-
readonly REVOCATION_FAILED: "REVOCATION_FAILED";
|
|
225
|
-
readonly INVALID_TOKEN: "INVALID_TOKEN";
|
|
226
|
-
readonly KV_SERVICE_UNAVAILABLE: "KV_SERVICE_UNAVAILABLE";
|
|
227
|
-
readonly DATA_FETCH_FAILED: "DATA_FETCH_FAILED";
|
|
228
|
-
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
229
|
-
readonly UNSUPPORTED_OPERATION: "UNSUPPORTED_OPERATION";
|
|
230
|
-
};
|
|
231
|
-
type DelegationErrorCode = (typeof DelegationErrorCodes)[keyof typeof DelegationErrorCodes];
|
|
232
|
-
/**
|
|
233
|
-
* Represents a delegation from one DID to another.
|
|
234
|
-
*/
|
|
235
|
-
declare const DelegationSchema: z.ZodObject<{
|
|
236
|
-
/** Content identifier (CID) of the delegation */
|
|
237
|
-
cid: z.ZodString;
|
|
238
|
-
/** DID of the delegate (the party receiving the delegation) */
|
|
239
|
-
delegateDID: z.ZodString;
|
|
240
|
-
/** Space ID this delegation applies to */
|
|
241
|
-
spaceId: z.ZodString;
|
|
242
|
-
/** Resource path this delegation grants access to */
|
|
243
|
-
path: z.ZodString;
|
|
244
|
-
/** Actions this delegation authorizes */
|
|
245
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
246
|
-
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
247
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
248
|
-
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
249
|
-
expiry: z.ZodDate;
|
|
250
|
-
/** Whether this delegation has been revoked */
|
|
251
|
-
isRevoked: z.ZodBoolean;
|
|
252
|
-
/** DID of the delegator (the party granting the delegation) */
|
|
253
|
-
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
254
|
-
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
255
|
-
createdAt: z.ZodOptional<z.ZodDate>;
|
|
256
|
-
/** Parent delegation CID if this is a sub-delegation */
|
|
257
|
-
parentCid: z.ZodOptional<z.ZodString>;
|
|
258
|
-
/** Whether sub-delegation is allowed */
|
|
259
|
-
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
260
|
-
/** Authorization header (UCAN bearer token) */
|
|
261
|
-
authHeader: z.ZodOptional<z.ZodString>;
|
|
262
|
-
}, "strip", z.ZodTypeAny, {
|
|
263
|
-
path: string;
|
|
264
|
-
expiry: Date;
|
|
265
|
-
actions: string[];
|
|
266
|
-
spaceId: string;
|
|
267
|
-
cid: string;
|
|
268
|
-
delegateDID: string;
|
|
269
|
-
isRevoked: boolean;
|
|
270
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
271
|
-
createdAt?: Date | undefined;
|
|
272
|
-
delegatorDID?: string | undefined;
|
|
273
|
-
parentCid?: string | undefined;
|
|
274
|
-
allowSubDelegation?: boolean | undefined;
|
|
275
|
-
authHeader?: string | undefined;
|
|
276
|
-
}, {
|
|
277
|
-
path: string;
|
|
278
|
-
expiry: Date;
|
|
279
|
-
actions: string[];
|
|
280
|
-
spaceId: string;
|
|
281
|
-
cid: string;
|
|
282
|
-
delegateDID: string;
|
|
283
|
-
isRevoked: boolean;
|
|
284
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
285
|
-
createdAt?: Date | undefined;
|
|
286
|
-
delegatorDID?: string | undefined;
|
|
287
|
-
parentCid?: string | undefined;
|
|
288
|
-
allowSubDelegation?: boolean | undefined;
|
|
289
|
-
authHeader?: string | undefined;
|
|
290
|
-
}>;
|
|
291
|
-
type Delegation = z.infer<typeof DelegationSchema>;
|
|
292
|
-
/** Node-confirmed lifecycle state for one delegation. */
|
|
293
|
-
declare const DelegationStatusSchema: z.ZodEffects<z.ZodObject<{
|
|
294
|
-
cid: z.ZodString;
|
|
295
|
-
status: z.ZodEnum<["active", "revoked", "expired", "unavailable", "not_found"]>;
|
|
296
|
-
exists: z.ZodBoolean;
|
|
297
|
-
active: z.ZodBoolean;
|
|
298
|
-
revoked: z.ZodBoolean;
|
|
299
|
-
expired: z.ZodBoolean;
|
|
300
|
-
}, "strict", z.ZodTypeAny, {
|
|
301
|
-
status: "active" | "revoked" | "expired" | "unavailable" | "not_found";
|
|
302
|
-
active: boolean;
|
|
303
|
-
revoked: boolean;
|
|
304
|
-
cid: string;
|
|
305
|
-
expired: boolean;
|
|
306
|
-
exists: boolean;
|
|
307
|
-
}, {
|
|
308
|
-
status: "active" | "revoked" | "expired" | "unavailable" | "not_found";
|
|
309
|
-
active: boolean;
|
|
310
|
-
revoked: boolean;
|
|
311
|
-
cid: string;
|
|
312
|
-
expired: boolean;
|
|
313
|
-
exists: boolean;
|
|
314
|
-
}>, {
|
|
315
|
-
status: "active" | "revoked" | "expired" | "unavailable" | "not_found";
|
|
316
|
-
active: boolean;
|
|
317
|
-
revoked: boolean;
|
|
318
|
-
cid: string;
|
|
319
|
-
expired: boolean;
|
|
320
|
-
exists: boolean;
|
|
321
|
-
}, {
|
|
322
|
-
status: "active" | "revoked" | "expired" | "unavailable" | "not_found";
|
|
323
|
-
active: boolean;
|
|
324
|
-
revoked: boolean;
|
|
325
|
-
cid: string;
|
|
326
|
-
expired: boolean;
|
|
327
|
-
exists: boolean;
|
|
328
|
-
}>;
|
|
329
|
-
type DelegationStatus = z.infer<typeof DelegationStatusSchema>;
|
|
330
|
-
declare const DelegationRevocationReceiptSchema: z.ZodObject<{
|
|
331
|
-
revoked: z.ZodLiteral<true>;
|
|
332
|
-
cid: z.ZodString;
|
|
333
|
-
}, "strict", z.ZodTypeAny, {
|
|
334
|
-
revoked: true;
|
|
335
|
-
cid: string;
|
|
336
|
-
}, {
|
|
337
|
-
revoked: true;
|
|
338
|
-
cid: string;
|
|
339
|
-
}>;
|
|
340
|
-
type DelegationRevocationReceipt = z.infer<typeof DelegationRevocationReceiptSchema>;
|
|
341
|
-
declare const AccountDelegationResourceSchema: z.ZodObject<{
|
|
342
|
-
resource: z.ZodString;
|
|
343
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
344
|
-
caveats: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
345
|
-
}, "strict", z.ZodTypeAny, {
|
|
346
|
-
actions: string[];
|
|
347
|
-
caveats: Record<string, unknown>[];
|
|
348
|
-
resource: string;
|
|
349
|
-
}, {
|
|
350
|
-
actions: string[];
|
|
351
|
-
caveats: Record<string, unknown>[];
|
|
352
|
-
resource: string;
|
|
353
|
-
}>;
|
|
354
|
-
declare const AccountDelegationRecordSchema: z.ZodObject<{
|
|
355
|
-
cid: z.ZodString;
|
|
356
|
-
direction: z.ZodEnum<["granted", "received"]>;
|
|
357
|
-
delegatorDid: z.ZodString;
|
|
358
|
-
delegateDid: z.ZodString;
|
|
359
|
-
resources: z.ZodArray<z.ZodObject<{
|
|
360
|
-
resource: z.ZodString;
|
|
361
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
362
|
-
caveats: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
363
|
-
}, "strict", z.ZodTypeAny, {
|
|
364
|
-
actions: string[];
|
|
365
|
-
caveats: Record<string, unknown>[];
|
|
366
|
-
resource: string;
|
|
367
|
-
}, {
|
|
368
|
-
actions: string[];
|
|
369
|
-
caveats: Record<string, unknown>[];
|
|
370
|
-
resource: string;
|
|
371
|
-
}>, "many">;
|
|
372
|
-
parents: z.ZodArray<z.ZodString, "many">;
|
|
373
|
-
issuedAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
374
|
-
notBefore: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
375
|
-
expiresAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
376
|
-
status: z.ZodEnum<["active", "pending", "expired", "revoked", "ancestor_revoked"]>;
|
|
377
|
-
revokedAt: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>>;
|
|
378
|
-
revokedBy: z.ZodOptional<z.ZodString>;
|
|
379
|
-
revokedAncestorCid: z.ZodOptional<z.ZodString>;
|
|
380
|
-
}, "strict", z.ZodTypeAny, {
|
|
381
|
-
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
382
|
-
notBefore: Date | null;
|
|
383
|
-
resources: {
|
|
384
|
-
actions: string[];
|
|
385
|
-
caveats: Record<string, unknown>[];
|
|
386
|
-
resource: string;
|
|
387
|
-
}[];
|
|
388
|
-
issuedAt: Date | null;
|
|
389
|
-
expiresAt: Date | null;
|
|
390
|
-
cid: string;
|
|
391
|
-
direction: "received" | "granted";
|
|
392
|
-
delegatorDid: string;
|
|
393
|
-
delegateDid: string;
|
|
394
|
-
parents: string[];
|
|
395
|
-
revokedAt?: Date | null | undefined;
|
|
396
|
-
revokedBy?: string | undefined;
|
|
397
|
-
revokedAncestorCid?: string | undefined;
|
|
398
|
-
}, {
|
|
399
|
-
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
400
|
-
notBefore: string | null;
|
|
401
|
-
resources: {
|
|
402
|
-
actions: string[];
|
|
403
|
-
caveats: Record<string, unknown>[];
|
|
404
|
-
resource: string;
|
|
405
|
-
}[];
|
|
406
|
-
issuedAt: string | null;
|
|
407
|
-
expiresAt: string | null;
|
|
408
|
-
cid: string;
|
|
409
|
-
direction: "received" | "granted";
|
|
410
|
-
delegatorDid: string;
|
|
411
|
-
delegateDid: string;
|
|
412
|
-
parents: string[];
|
|
413
|
-
revokedAt?: string | null | undefined;
|
|
414
|
-
revokedBy?: string | undefined;
|
|
415
|
-
revokedAncestorCid?: string | undefined;
|
|
416
|
-
}>;
|
|
417
|
-
declare const AccountDelegationPageSchema: z.ZodObject<{
|
|
418
|
-
schemaVersion: z.ZodLiteral<2>;
|
|
419
|
-
items: z.ZodArray<z.ZodObject<{
|
|
420
|
-
cid: z.ZodString;
|
|
421
|
-
direction: z.ZodEnum<["granted", "received"]>;
|
|
422
|
-
delegatorDid: z.ZodString;
|
|
423
|
-
delegateDid: z.ZodString;
|
|
424
|
-
resources: z.ZodArray<z.ZodObject<{
|
|
425
|
-
resource: z.ZodString;
|
|
426
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
427
|
-
caveats: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
428
|
-
}, "strict", z.ZodTypeAny, {
|
|
429
|
-
actions: string[];
|
|
430
|
-
caveats: Record<string, unknown>[];
|
|
431
|
-
resource: string;
|
|
432
|
-
}, {
|
|
433
|
-
actions: string[];
|
|
434
|
-
caveats: Record<string, unknown>[];
|
|
435
|
-
resource: string;
|
|
436
|
-
}>, "many">;
|
|
437
|
-
parents: z.ZodArray<z.ZodString, "many">;
|
|
438
|
-
issuedAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
439
|
-
notBefore: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
440
|
-
expiresAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
441
|
-
status: z.ZodEnum<["active", "pending", "expired", "revoked", "ancestor_revoked"]>;
|
|
442
|
-
revokedAt: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>>;
|
|
443
|
-
revokedBy: z.ZodOptional<z.ZodString>;
|
|
444
|
-
revokedAncestorCid: z.ZodOptional<z.ZodString>;
|
|
445
|
-
}, "strict", z.ZodTypeAny, {
|
|
446
|
-
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
447
|
-
notBefore: Date | null;
|
|
448
|
-
resources: {
|
|
449
|
-
actions: string[];
|
|
450
|
-
caveats: Record<string, unknown>[];
|
|
451
|
-
resource: string;
|
|
452
|
-
}[];
|
|
453
|
-
issuedAt: Date | null;
|
|
454
|
-
expiresAt: Date | null;
|
|
455
|
-
cid: string;
|
|
456
|
-
direction: "received" | "granted";
|
|
457
|
-
delegatorDid: string;
|
|
458
|
-
delegateDid: string;
|
|
459
|
-
parents: string[];
|
|
460
|
-
revokedAt?: Date | null | undefined;
|
|
461
|
-
revokedBy?: string | undefined;
|
|
462
|
-
revokedAncestorCid?: string | undefined;
|
|
463
|
-
}, {
|
|
464
|
-
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
465
|
-
notBefore: string | null;
|
|
466
|
-
resources: {
|
|
467
|
-
actions: string[];
|
|
468
|
-
caveats: Record<string, unknown>[];
|
|
469
|
-
resource: string;
|
|
470
|
-
}[];
|
|
471
|
-
issuedAt: string | null;
|
|
472
|
-
expiresAt: string | null;
|
|
473
|
-
cid: string;
|
|
474
|
-
direction: "received" | "granted";
|
|
475
|
-
delegatorDid: string;
|
|
476
|
-
delegateDid: string;
|
|
477
|
-
parents: string[];
|
|
478
|
-
revokedAt?: string | null | undefined;
|
|
479
|
-
revokedBy?: string | undefined;
|
|
480
|
-
revokedAncestorCid?: string | undefined;
|
|
481
|
-
}>, "many">;
|
|
482
|
-
nextCursor: z.ZodOptional<z.ZodString>;
|
|
483
|
-
}, "strict", z.ZodTypeAny, {
|
|
484
|
-
schemaVersion: 2;
|
|
485
|
-
items: {
|
|
486
|
-
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
487
|
-
notBefore: Date | null;
|
|
488
|
-
resources: {
|
|
489
|
-
actions: string[];
|
|
490
|
-
caveats: Record<string, unknown>[];
|
|
491
|
-
resource: string;
|
|
492
|
-
}[];
|
|
493
|
-
issuedAt: Date | null;
|
|
494
|
-
expiresAt: Date | null;
|
|
495
|
-
cid: string;
|
|
496
|
-
direction: "received" | "granted";
|
|
497
|
-
delegatorDid: string;
|
|
498
|
-
delegateDid: string;
|
|
499
|
-
parents: string[];
|
|
500
|
-
revokedAt?: Date | null | undefined;
|
|
501
|
-
revokedBy?: string | undefined;
|
|
502
|
-
revokedAncestorCid?: string | undefined;
|
|
503
|
-
}[];
|
|
504
|
-
nextCursor?: string | undefined;
|
|
505
|
-
}, {
|
|
506
|
-
schemaVersion: 2;
|
|
507
|
-
items: {
|
|
508
|
-
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
509
|
-
notBefore: string | null;
|
|
510
|
-
resources: {
|
|
511
|
-
actions: string[];
|
|
512
|
-
caveats: Record<string, unknown>[];
|
|
513
|
-
resource: string;
|
|
514
|
-
}[];
|
|
515
|
-
issuedAt: string | null;
|
|
516
|
-
expiresAt: string | null;
|
|
517
|
-
cid: string;
|
|
518
|
-
direction: "received" | "granted";
|
|
519
|
-
delegatorDid: string;
|
|
520
|
-
delegateDid: string;
|
|
521
|
-
parents: string[];
|
|
522
|
-
revokedAt?: string | null | undefined;
|
|
523
|
-
revokedBy?: string | undefined;
|
|
524
|
-
revokedAncestorCid?: string | undefined;
|
|
525
|
-
}[];
|
|
526
|
-
nextCursor?: string | undefined;
|
|
527
|
-
}>;
|
|
528
|
-
type AccountDelegationResource = z.infer<typeof AccountDelegationResourceSchema>;
|
|
529
|
-
type AccountDelegationRecord = z.infer<typeof AccountDelegationRecordSchema>;
|
|
530
|
-
type AccountDelegationPage = z.infer<typeof AccountDelegationPageSchema>;
|
|
531
|
-
declare const AccountDelegationQueryOptionsSchema: z.ZodObject<{
|
|
532
|
-
direction: z.ZodOptional<z.ZodEnum<["granted", "received", "all"]>>;
|
|
533
|
-
status: z.ZodOptional<z.ZodEnum<["active", "pending", "expired", "revoked", "ancestor_revoked"]>>;
|
|
534
|
-
space: z.ZodOptional<z.ZodString>;
|
|
535
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
536
|
-
cursor: z.ZodOptional<z.ZodString>;
|
|
537
|
-
}, "strict", z.ZodTypeAny, {
|
|
538
|
-
status?: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked" | undefined;
|
|
539
|
-
space?: string | undefined;
|
|
540
|
-
direction?: "received" | "all" | "granted" | undefined;
|
|
541
|
-
limit?: number | undefined;
|
|
542
|
-
cursor?: string | undefined;
|
|
543
|
-
}, {
|
|
544
|
-
status?: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked" | undefined;
|
|
545
|
-
space?: string | undefined;
|
|
546
|
-
direction?: "received" | "all" | "granted" | undefined;
|
|
547
|
-
limit?: number | undefined;
|
|
548
|
-
cursor?: string | undefined;
|
|
549
|
-
}>;
|
|
550
|
-
type AccountDelegationQueryOptions = z.infer<typeof AccountDelegationQueryOptionsSchema>;
|
|
551
|
-
/**
|
|
552
|
-
* Entry in the capability registry mapping a capability to available keys.
|
|
553
|
-
*/
|
|
554
|
-
declare const CapabilityEntrySchema: z.ZodObject<{
|
|
555
|
-
/** Resource URI this capability applies to */
|
|
556
|
-
resource: z.ZodString;
|
|
557
|
-
/** Action this capability authorizes */
|
|
558
|
-
action: z.ZodString;
|
|
559
|
-
/** Keys that can exercise this capability, ordered by priority */
|
|
560
|
-
keys: z.ZodArray<z.ZodObject<{
|
|
561
|
-
/** Unique identifier for this key */
|
|
562
|
-
id: z.ZodString;
|
|
563
|
-
/** DID associated with this key */
|
|
564
|
-
did: z.ZodString;
|
|
565
|
-
/** Type of key determining its authority level */
|
|
566
|
-
type: z.ZodEnum<["main", "session", "ingested"]>;
|
|
567
|
-
/** Private key in JWK format */
|
|
568
|
-
jwk: z.ZodOptional<z.ZodObject<{
|
|
569
|
-
/** Key type (e.g., "EC", "RSA", "OKP") */
|
|
570
|
-
kty: z.ZodString;
|
|
571
|
-
/** Curve for EC/OKP keys (e.g., "P-256", "Ed25519") */
|
|
572
|
-
crv: z.ZodOptional<z.ZodString>;
|
|
573
|
-
/** X coordinate for EC keys, public key for OKP */
|
|
574
|
-
x: z.ZodOptional<z.ZodString>;
|
|
575
|
-
/** Y coordinate for EC keys */
|
|
576
|
-
y: z.ZodOptional<z.ZodString>;
|
|
577
|
-
/** Private key value (d parameter) */
|
|
578
|
-
d: z.ZodOptional<z.ZodString>;
|
|
579
|
-
/** Public exponent for RSA keys */
|
|
580
|
-
e: z.ZodOptional<z.ZodString>;
|
|
581
|
-
/** Modulus for RSA keys */
|
|
582
|
-
n: z.ZodOptional<z.ZodString>;
|
|
583
|
-
/** Key ID */
|
|
584
|
-
kid: z.ZodOptional<z.ZodString>;
|
|
585
|
-
/** Algorithm */
|
|
586
|
-
alg: z.ZodOptional<z.ZodString>;
|
|
587
|
-
/** Key use (e.g., "sig", "enc") */
|
|
588
|
-
use: z.ZodOptional<z.ZodString>;
|
|
589
|
-
/** Key operations (e.g., ["sign", "verify"]) */
|
|
590
|
-
key_ops: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
591
|
-
}, "strip", z.ZodTypeAny, {
|
|
592
|
-
kty: string;
|
|
593
|
-
kid?: string | undefined;
|
|
594
|
-
alg?: string | undefined;
|
|
595
|
-
crv?: string | undefined;
|
|
596
|
-
x?: string | undefined;
|
|
597
|
-
y?: string | undefined;
|
|
598
|
-
d?: string | undefined;
|
|
599
|
-
e?: string | undefined;
|
|
600
|
-
n?: string | undefined;
|
|
601
|
-
use?: string | undefined;
|
|
602
|
-
key_ops?: string[] | undefined;
|
|
603
|
-
}, {
|
|
604
|
-
kty: string;
|
|
605
|
-
kid?: string | undefined;
|
|
606
|
-
alg?: string | undefined;
|
|
607
|
-
crv?: string | undefined;
|
|
608
|
-
x?: string | undefined;
|
|
609
|
-
y?: string | undefined;
|
|
610
|
-
d?: string | undefined;
|
|
611
|
-
e?: string | undefined;
|
|
612
|
-
n?: string | undefined;
|
|
613
|
-
use?: string | undefined;
|
|
614
|
-
key_ops?: string[] | undefined;
|
|
615
|
-
}>>;
|
|
616
|
-
/** Priority for key selection (lower = higher priority) */
|
|
617
|
-
priority: z.ZodNumber;
|
|
618
|
-
}, "strip", z.ZodTypeAny, {
|
|
619
|
-
type: "session" | "main" | "ingested";
|
|
620
|
-
did: string;
|
|
621
|
-
id: string;
|
|
622
|
-
priority: number;
|
|
623
|
-
jwk?: {
|
|
624
|
-
kty: string;
|
|
625
|
-
kid?: string | undefined;
|
|
626
|
-
alg?: string | undefined;
|
|
627
|
-
crv?: string | undefined;
|
|
628
|
-
x?: string | undefined;
|
|
629
|
-
y?: string | undefined;
|
|
630
|
-
d?: string | undefined;
|
|
631
|
-
e?: string | undefined;
|
|
632
|
-
n?: string | undefined;
|
|
633
|
-
use?: string | undefined;
|
|
634
|
-
key_ops?: string[] | undefined;
|
|
635
|
-
} | undefined;
|
|
636
|
-
}, {
|
|
637
|
-
type: "session" | "main" | "ingested";
|
|
638
|
-
did: string;
|
|
639
|
-
id: string;
|
|
640
|
-
priority: number;
|
|
641
|
-
jwk?: {
|
|
642
|
-
kty: string;
|
|
643
|
-
kid?: string | undefined;
|
|
644
|
-
alg?: string | undefined;
|
|
645
|
-
crv?: string | undefined;
|
|
646
|
-
x?: string | undefined;
|
|
647
|
-
y?: string | undefined;
|
|
648
|
-
d?: string | undefined;
|
|
649
|
-
e?: string | undefined;
|
|
650
|
-
n?: string | undefined;
|
|
651
|
-
use?: string | undefined;
|
|
652
|
-
key_ops?: string[] | undefined;
|
|
653
|
-
} | undefined;
|
|
654
|
-
}>, "many">;
|
|
655
|
-
/** The delegation that grants this capability */
|
|
656
|
-
delegation: z.ZodObject<{
|
|
657
|
-
/** Content identifier (CID) of the delegation */
|
|
658
|
-
cid: z.ZodString;
|
|
659
|
-
/** DID of the delegate (the party receiving the delegation) */
|
|
660
|
-
delegateDID: z.ZodString;
|
|
661
|
-
/** Space ID this delegation applies to */
|
|
662
|
-
spaceId: z.ZodString;
|
|
663
|
-
/** Resource path this delegation grants access to */
|
|
664
|
-
path: z.ZodString;
|
|
665
|
-
/** Actions this delegation authorizes */
|
|
666
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
667
|
-
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
668
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
669
|
-
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
670
|
-
expiry: z.ZodDate;
|
|
671
|
-
/** Whether this delegation has been revoked */
|
|
672
|
-
isRevoked: z.ZodBoolean;
|
|
673
|
-
/** DID of the delegator (the party granting the delegation) */
|
|
674
|
-
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
675
|
-
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
676
|
-
createdAt: z.ZodOptional<z.ZodDate>;
|
|
677
|
-
/** Parent delegation CID if this is a sub-delegation */
|
|
678
|
-
parentCid: z.ZodOptional<z.ZodString>;
|
|
679
|
-
/** Whether sub-delegation is allowed */
|
|
680
|
-
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
681
|
-
/** Authorization header (UCAN bearer token) */
|
|
682
|
-
authHeader: z.ZodOptional<z.ZodString>;
|
|
683
|
-
}, "strip", z.ZodTypeAny, {
|
|
684
|
-
path: string;
|
|
685
|
-
expiry: Date;
|
|
686
|
-
actions: string[];
|
|
687
|
-
spaceId: string;
|
|
688
|
-
cid: string;
|
|
689
|
-
delegateDID: string;
|
|
690
|
-
isRevoked: boolean;
|
|
691
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
692
|
-
createdAt?: Date | undefined;
|
|
693
|
-
delegatorDID?: string | undefined;
|
|
694
|
-
parentCid?: string | undefined;
|
|
695
|
-
allowSubDelegation?: boolean | undefined;
|
|
696
|
-
authHeader?: string | undefined;
|
|
697
|
-
}, {
|
|
698
|
-
path: string;
|
|
699
|
-
expiry: Date;
|
|
700
|
-
actions: string[];
|
|
701
|
-
spaceId: string;
|
|
702
|
-
cid: string;
|
|
703
|
-
delegateDID: string;
|
|
704
|
-
isRevoked: boolean;
|
|
705
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
706
|
-
createdAt?: Date | undefined;
|
|
707
|
-
delegatorDID?: string | undefined;
|
|
708
|
-
parentCid?: string | undefined;
|
|
709
|
-
allowSubDelegation?: boolean | undefined;
|
|
710
|
-
authHeader?: string | undefined;
|
|
711
|
-
}>;
|
|
712
|
-
/** When this capability expires (accepts Date or ISO string from JSON) */
|
|
713
|
-
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
714
|
-
}, "strip", z.ZodTypeAny, {
|
|
715
|
-
keys: {
|
|
716
|
-
type: "session" | "main" | "ingested";
|
|
717
|
-
did: string;
|
|
718
|
-
id: string;
|
|
719
|
-
priority: number;
|
|
720
|
-
jwk?: {
|
|
721
|
-
kty: string;
|
|
722
|
-
kid?: string | undefined;
|
|
723
|
-
alg?: string | undefined;
|
|
724
|
-
crv?: string | undefined;
|
|
725
|
-
x?: string | undefined;
|
|
726
|
-
y?: string | undefined;
|
|
727
|
-
d?: string | undefined;
|
|
728
|
-
e?: string | undefined;
|
|
729
|
-
n?: string | undefined;
|
|
730
|
-
use?: string | undefined;
|
|
731
|
-
key_ops?: string[] | undefined;
|
|
732
|
-
} | undefined;
|
|
733
|
-
}[];
|
|
734
|
-
delegation: {
|
|
735
|
-
path: string;
|
|
736
|
-
expiry: Date;
|
|
737
|
-
actions: string[];
|
|
738
|
-
spaceId: string;
|
|
739
|
-
cid: string;
|
|
740
|
-
delegateDID: string;
|
|
741
|
-
isRevoked: boolean;
|
|
742
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
743
|
-
createdAt?: Date | undefined;
|
|
744
|
-
delegatorDID?: string | undefined;
|
|
745
|
-
parentCid?: string | undefined;
|
|
746
|
-
allowSubDelegation?: boolean | undefined;
|
|
747
|
-
authHeader?: string | undefined;
|
|
748
|
-
};
|
|
749
|
-
resource: string;
|
|
750
|
-
action: string;
|
|
751
|
-
expiresAt?: Date | undefined;
|
|
752
|
-
}, {
|
|
753
|
-
keys: {
|
|
754
|
-
type: "session" | "main" | "ingested";
|
|
755
|
-
did: string;
|
|
756
|
-
id: string;
|
|
757
|
-
priority: number;
|
|
758
|
-
jwk?: {
|
|
759
|
-
kty: string;
|
|
760
|
-
kid?: string | undefined;
|
|
761
|
-
alg?: string | undefined;
|
|
762
|
-
crv?: string | undefined;
|
|
763
|
-
x?: string | undefined;
|
|
764
|
-
y?: string | undefined;
|
|
765
|
-
d?: string | undefined;
|
|
766
|
-
e?: string | undefined;
|
|
767
|
-
n?: string | undefined;
|
|
768
|
-
use?: string | undefined;
|
|
769
|
-
key_ops?: string[] | undefined;
|
|
770
|
-
} | undefined;
|
|
771
|
-
}[];
|
|
772
|
-
delegation: {
|
|
773
|
-
path: string;
|
|
774
|
-
expiry: Date;
|
|
775
|
-
actions: string[];
|
|
776
|
-
spaceId: string;
|
|
777
|
-
cid: string;
|
|
778
|
-
delegateDID: string;
|
|
779
|
-
isRevoked: boolean;
|
|
780
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
781
|
-
createdAt?: Date | undefined;
|
|
782
|
-
delegatorDID?: string | undefined;
|
|
783
|
-
parentCid?: string | undefined;
|
|
784
|
-
allowSubDelegation?: boolean | undefined;
|
|
785
|
-
authHeader?: string | undefined;
|
|
786
|
-
};
|
|
787
|
-
resource: string;
|
|
788
|
-
action: string;
|
|
789
|
-
expiresAt?: Date | undefined;
|
|
790
|
-
}>;
|
|
791
|
-
type CapabilityEntry = z.infer<typeof CapabilityEntrySchema>;
|
|
792
|
-
/**
|
|
793
|
-
* Persistent record of a delegation stored in the system.
|
|
794
|
-
*/
|
|
795
|
-
declare const DelegationRecordSchema: z.ZodObject<{
|
|
796
|
-
/** Content identifier (CID) of the delegation */
|
|
797
|
-
cid: z.ZodString;
|
|
798
|
-
/** Space ID this delegation applies to */
|
|
799
|
-
spaceId: z.ZodString;
|
|
800
|
-
/** DID of the delegator (grantor) */
|
|
801
|
-
delegator: z.ZodString;
|
|
802
|
-
/** DID of the delegatee (recipient) */
|
|
803
|
-
delegatee: z.ZodString;
|
|
804
|
-
/** Key ID used to sign/exercise this delegation */
|
|
805
|
-
keyId: z.ZodOptional<z.ZodString>;
|
|
806
|
-
/** Resource path pattern this delegation grants access to */
|
|
807
|
-
path: z.ZodString;
|
|
808
|
-
/** Actions this delegation authorizes */
|
|
809
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
810
|
-
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
811
|
-
expiry: z.ZodOptional<z.ZodDate>;
|
|
812
|
-
/** When this delegation becomes valid (not before) (accepts Date or ISO string) */
|
|
813
|
-
notBefore: z.ZodOptional<z.ZodDate>;
|
|
814
|
-
/** Whether this delegation has been revoked */
|
|
815
|
-
isRevoked: z.ZodBoolean;
|
|
816
|
-
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
817
|
-
createdAt: z.ZodDate;
|
|
818
|
-
/** Parent delegation CID if this is a sub-delegation */
|
|
819
|
-
parentCid: z.ZodOptional<z.ZodString>;
|
|
820
|
-
}, "strip", z.ZodTypeAny, {
|
|
821
|
-
path: string;
|
|
822
|
-
actions: string[];
|
|
823
|
-
createdAt: Date;
|
|
824
|
-
spaceId: string;
|
|
825
|
-
cid: string;
|
|
826
|
-
isRevoked: boolean;
|
|
827
|
-
delegator: string;
|
|
828
|
-
delegatee: string;
|
|
829
|
-
notBefore?: Date | undefined;
|
|
830
|
-
expiry?: Date | undefined;
|
|
831
|
-
parentCid?: string | undefined;
|
|
832
|
-
keyId?: string | undefined;
|
|
833
|
-
}, {
|
|
834
|
-
path: string;
|
|
835
|
-
actions: string[];
|
|
836
|
-
createdAt: Date;
|
|
837
|
-
spaceId: string;
|
|
838
|
-
cid: string;
|
|
839
|
-
isRevoked: boolean;
|
|
840
|
-
delegator: string;
|
|
841
|
-
delegatee: string;
|
|
842
|
-
notBefore?: Date | undefined;
|
|
843
|
-
expiry?: Date | undefined;
|
|
844
|
-
parentCid?: string | undefined;
|
|
845
|
-
keyId?: string | undefined;
|
|
846
|
-
}>;
|
|
847
|
-
type DelegationRecord = z.infer<typeof DelegationRecordSchema>;
|
|
848
|
-
/**
|
|
849
|
-
* Parameters for creating a new delegation.
|
|
850
|
-
*/
|
|
851
|
-
declare const CreateDelegationParamsSchema: z.ZodObject<{
|
|
852
|
-
/** DID of the delegate (the party receiving the delegation) */
|
|
853
|
-
delegateDID: z.ZodString;
|
|
854
|
-
/** Resource path this delegation grants access to */
|
|
855
|
-
path: z.ZodString;
|
|
856
|
-
/** Actions to authorize */
|
|
857
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
858
|
-
/** When this delegation expires (accepts Date or ISO string) */
|
|
859
|
-
expiry: z.ZodOptional<z.ZodDate>;
|
|
860
|
-
/** Whether to disable sub-delegation */
|
|
861
|
-
disableSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
862
|
-
/** Optional statement for the SIWE message */
|
|
863
|
-
statement: z.ZodOptional<z.ZodString>;
|
|
864
|
-
}, "strip", z.ZodTypeAny, {
|
|
865
|
-
path: string;
|
|
866
|
-
actions: string[];
|
|
867
|
-
delegateDID: string;
|
|
868
|
-
statement?: string | undefined;
|
|
869
|
-
expiry?: Date | undefined;
|
|
870
|
-
disableSubDelegation?: boolean | undefined;
|
|
871
|
-
}, {
|
|
872
|
-
path: string;
|
|
873
|
-
actions: string[];
|
|
874
|
-
delegateDID: string;
|
|
875
|
-
statement?: string | undefined;
|
|
876
|
-
expiry?: Date | undefined;
|
|
877
|
-
disableSubDelegation?: boolean | undefined;
|
|
878
|
-
}>;
|
|
879
|
-
type CreateDelegationParams = z.infer<typeof CreateDelegationParamsSchema>;
|
|
880
|
-
/**
|
|
881
|
-
* A chain of delegations from root to leaf (array format).
|
|
882
|
-
*/
|
|
883
|
-
declare const DelegationChainSchema: z.ZodArray<z.ZodObject<{
|
|
884
|
-
/** Content identifier (CID) of the delegation */
|
|
885
|
-
cid: z.ZodString;
|
|
886
|
-
/** DID of the delegate (the party receiving the delegation) */
|
|
887
|
-
delegateDID: z.ZodString;
|
|
888
|
-
/** Space ID this delegation applies to */
|
|
889
|
-
spaceId: z.ZodString;
|
|
890
|
-
/** Resource path this delegation grants access to */
|
|
891
|
-
path: z.ZodString;
|
|
892
|
-
/** Actions this delegation authorizes */
|
|
893
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
894
|
-
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
895
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
896
|
-
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
897
|
-
expiry: z.ZodDate;
|
|
898
|
-
/** Whether this delegation has been revoked */
|
|
899
|
-
isRevoked: z.ZodBoolean;
|
|
900
|
-
/** DID of the delegator (the party granting the delegation) */
|
|
901
|
-
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
902
|
-
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
903
|
-
createdAt: z.ZodOptional<z.ZodDate>;
|
|
904
|
-
/** Parent delegation CID if this is a sub-delegation */
|
|
905
|
-
parentCid: z.ZodOptional<z.ZodString>;
|
|
906
|
-
/** Whether sub-delegation is allowed */
|
|
907
|
-
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
908
|
-
/** Authorization header (UCAN bearer token) */
|
|
909
|
-
authHeader: z.ZodOptional<z.ZodString>;
|
|
910
|
-
}, "strip", z.ZodTypeAny, {
|
|
911
|
-
path: string;
|
|
912
|
-
expiry: Date;
|
|
913
|
-
actions: string[];
|
|
914
|
-
spaceId: string;
|
|
915
|
-
cid: string;
|
|
916
|
-
delegateDID: string;
|
|
917
|
-
isRevoked: boolean;
|
|
918
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
919
|
-
createdAt?: Date | undefined;
|
|
920
|
-
delegatorDID?: string | undefined;
|
|
921
|
-
parentCid?: string | undefined;
|
|
922
|
-
allowSubDelegation?: boolean | undefined;
|
|
923
|
-
authHeader?: string | undefined;
|
|
924
|
-
}, {
|
|
925
|
-
path: string;
|
|
926
|
-
expiry: Date;
|
|
927
|
-
actions: string[];
|
|
928
|
-
spaceId: string;
|
|
929
|
-
cid: string;
|
|
930
|
-
delegateDID: string;
|
|
931
|
-
isRevoked: boolean;
|
|
932
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
933
|
-
createdAt?: Date | undefined;
|
|
934
|
-
delegatorDID?: string | undefined;
|
|
935
|
-
parentCid?: string | undefined;
|
|
936
|
-
allowSubDelegation?: boolean | undefined;
|
|
937
|
-
authHeader?: string | undefined;
|
|
938
|
-
}>, "many">;
|
|
939
|
-
type DelegationChain = z.infer<typeof DelegationChainSchema>;
|
|
940
|
-
/**
|
|
941
|
-
* Structured delegation chain (v2 spec).
|
|
942
|
-
*/
|
|
943
|
-
declare const DelegationChainV2Schema: z.ZodObject<{
|
|
944
|
-
/** The root delegation from the original authority */
|
|
945
|
-
root: z.ZodObject<{
|
|
946
|
-
/** Content identifier (CID) of the delegation */
|
|
947
|
-
cid: z.ZodString;
|
|
948
|
-
/** DID of the delegate (the party receiving the delegation) */
|
|
949
|
-
delegateDID: z.ZodString;
|
|
950
|
-
/** Space ID this delegation applies to */
|
|
951
|
-
spaceId: z.ZodString;
|
|
952
|
-
/** Resource path this delegation grants access to */
|
|
953
|
-
path: z.ZodString;
|
|
954
|
-
/** Actions this delegation authorizes */
|
|
955
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
956
|
-
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
957
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
958
|
-
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
959
|
-
expiry: z.ZodDate;
|
|
960
|
-
/** Whether this delegation has been revoked */
|
|
961
|
-
isRevoked: z.ZodBoolean;
|
|
962
|
-
/** DID of the delegator (the party granting the delegation) */
|
|
963
|
-
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
964
|
-
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
965
|
-
createdAt: z.ZodOptional<z.ZodDate>;
|
|
966
|
-
/** Parent delegation CID if this is a sub-delegation */
|
|
967
|
-
parentCid: z.ZodOptional<z.ZodString>;
|
|
968
|
-
/** Whether sub-delegation is allowed */
|
|
969
|
-
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
970
|
-
/** Authorization header (UCAN bearer token) */
|
|
971
|
-
authHeader: z.ZodOptional<z.ZodString>;
|
|
972
|
-
}, "strip", z.ZodTypeAny, {
|
|
973
|
-
path: string;
|
|
974
|
-
expiry: Date;
|
|
975
|
-
actions: string[];
|
|
976
|
-
spaceId: string;
|
|
977
|
-
cid: string;
|
|
978
|
-
delegateDID: string;
|
|
979
|
-
isRevoked: boolean;
|
|
980
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
981
|
-
createdAt?: Date | undefined;
|
|
982
|
-
delegatorDID?: string | undefined;
|
|
983
|
-
parentCid?: string | undefined;
|
|
984
|
-
allowSubDelegation?: boolean | undefined;
|
|
985
|
-
authHeader?: string | undefined;
|
|
986
|
-
}, {
|
|
987
|
-
path: string;
|
|
988
|
-
expiry: Date;
|
|
989
|
-
actions: string[];
|
|
990
|
-
spaceId: string;
|
|
991
|
-
cid: string;
|
|
992
|
-
delegateDID: string;
|
|
993
|
-
isRevoked: boolean;
|
|
994
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
995
|
-
createdAt?: Date | undefined;
|
|
996
|
-
delegatorDID?: string | undefined;
|
|
997
|
-
parentCid?: string | undefined;
|
|
998
|
-
allowSubDelegation?: boolean | undefined;
|
|
999
|
-
authHeader?: string | undefined;
|
|
1000
|
-
}>;
|
|
1001
|
-
/** Intermediate delegations in the chain (may be empty) */
|
|
1002
|
-
chain: z.ZodArray<z.ZodObject<{
|
|
1003
|
-
/** Content identifier (CID) of the delegation */
|
|
1004
|
-
cid: z.ZodString;
|
|
1005
|
-
/** DID of the delegate (the party receiving the delegation) */
|
|
1006
|
-
delegateDID: z.ZodString;
|
|
1007
|
-
/** Space ID this delegation applies to */
|
|
1008
|
-
spaceId: z.ZodString;
|
|
1009
|
-
/** Resource path this delegation grants access to */
|
|
1010
|
-
path: z.ZodString;
|
|
1011
|
-
/** Actions this delegation authorizes */
|
|
1012
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
1013
|
-
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
1014
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
1015
|
-
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1016
|
-
expiry: z.ZodDate;
|
|
1017
|
-
/** Whether this delegation has been revoked */
|
|
1018
|
-
isRevoked: z.ZodBoolean;
|
|
1019
|
-
/** DID of the delegator (the party granting the delegation) */
|
|
1020
|
-
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1021
|
-
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1022
|
-
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1023
|
-
/** Parent delegation CID if this is a sub-delegation */
|
|
1024
|
-
parentCid: z.ZodOptional<z.ZodString>;
|
|
1025
|
-
/** Whether sub-delegation is allowed */
|
|
1026
|
-
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1027
|
-
/** Authorization header (UCAN bearer token) */
|
|
1028
|
-
authHeader: z.ZodOptional<z.ZodString>;
|
|
1029
|
-
}, "strip", z.ZodTypeAny, {
|
|
1030
|
-
path: string;
|
|
1031
|
-
expiry: Date;
|
|
1032
|
-
actions: string[];
|
|
1033
|
-
spaceId: string;
|
|
1034
|
-
cid: string;
|
|
1035
|
-
delegateDID: string;
|
|
1036
|
-
isRevoked: boolean;
|
|
1037
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1038
|
-
createdAt?: Date | undefined;
|
|
1039
|
-
delegatorDID?: string | undefined;
|
|
1040
|
-
parentCid?: string | undefined;
|
|
1041
|
-
allowSubDelegation?: boolean | undefined;
|
|
1042
|
-
authHeader?: string | undefined;
|
|
1043
|
-
}, {
|
|
1044
|
-
path: string;
|
|
1045
|
-
expiry: Date;
|
|
1046
|
-
actions: string[];
|
|
1047
|
-
spaceId: string;
|
|
1048
|
-
cid: string;
|
|
1049
|
-
delegateDID: string;
|
|
1050
|
-
isRevoked: boolean;
|
|
1051
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1052
|
-
createdAt?: Date | undefined;
|
|
1053
|
-
delegatorDID?: string | undefined;
|
|
1054
|
-
parentCid?: string | undefined;
|
|
1055
|
-
allowSubDelegation?: boolean | undefined;
|
|
1056
|
-
authHeader?: string | undefined;
|
|
1057
|
-
}>, "many">;
|
|
1058
|
-
/** The final delegation to the current user */
|
|
1059
|
-
leaf: z.ZodObject<{
|
|
1060
|
-
/** Content identifier (CID) of the delegation */
|
|
1061
|
-
cid: z.ZodString;
|
|
1062
|
-
/** DID of the delegate (the party receiving the delegation) */
|
|
1063
|
-
delegateDID: z.ZodString;
|
|
1064
|
-
/** Space ID this delegation applies to */
|
|
1065
|
-
spaceId: z.ZodString;
|
|
1066
|
-
/** Resource path this delegation grants access to */
|
|
1067
|
-
path: z.ZodString;
|
|
1068
|
-
/** Actions this delegation authorizes */
|
|
1069
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
1070
|
-
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
1071
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
1072
|
-
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1073
|
-
expiry: z.ZodDate;
|
|
1074
|
-
/** Whether this delegation has been revoked */
|
|
1075
|
-
isRevoked: z.ZodBoolean;
|
|
1076
|
-
/** DID of the delegator (the party granting the delegation) */
|
|
1077
|
-
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1078
|
-
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1079
|
-
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1080
|
-
/** Parent delegation CID if this is a sub-delegation */
|
|
1081
|
-
parentCid: z.ZodOptional<z.ZodString>;
|
|
1082
|
-
/** Whether sub-delegation is allowed */
|
|
1083
|
-
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1084
|
-
/** Authorization header (UCAN bearer token) */
|
|
1085
|
-
authHeader: z.ZodOptional<z.ZodString>;
|
|
1086
|
-
}, "strip", z.ZodTypeAny, {
|
|
1087
|
-
path: string;
|
|
1088
|
-
expiry: Date;
|
|
1089
|
-
actions: string[];
|
|
1090
|
-
spaceId: string;
|
|
1091
|
-
cid: string;
|
|
1092
|
-
delegateDID: string;
|
|
1093
|
-
isRevoked: boolean;
|
|
1094
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1095
|
-
createdAt?: Date | undefined;
|
|
1096
|
-
delegatorDID?: string | undefined;
|
|
1097
|
-
parentCid?: string | undefined;
|
|
1098
|
-
allowSubDelegation?: boolean | undefined;
|
|
1099
|
-
authHeader?: string | undefined;
|
|
1100
|
-
}, {
|
|
1101
|
-
path: string;
|
|
1102
|
-
expiry: Date;
|
|
1103
|
-
actions: string[];
|
|
1104
|
-
spaceId: string;
|
|
1105
|
-
cid: string;
|
|
1106
|
-
delegateDID: string;
|
|
1107
|
-
isRevoked: boolean;
|
|
1108
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1109
|
-
createdAt?: Date | undefined;
|
|
1110
|
-
delegatorDID?: string | undefined;
|
|
1111
|
-
parentCid?: string | undefined;
|
|
1112
|
-
allowSubDelegation?: boolean | undefined;
|
|
1113
|
-
authHeader?: string | undefined;
|
|
1114
|
-
}>;
|
|
1115
|
-
}, "strip", z.ZodTypeAny, {
|
|
1116
|
-
root: {
|
|
1117
|
-
path: string;
|
|
1118
|
-
expiry: Date;
|
|
1119
|
-
actions: string[];
|
|
1120
|
-
spaceId: string;
|
|
1121
|
-
cid: string;
|
|
1122
|
-
delegateDID: string;
|
|
1123
|
-
isRevoked: boolean;
|
|
1124
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1125
|
-
createdAt?: Date | undefined;
|
|
1126
|
-
delegatorDID?: string | undefined;
|
|
1127
|
-
parentCid?: string | undefined;
|
|
1128
|
-
allowSubDelegation?: boolean | undefined;
|
|
1129
|
-
authHeader?: string | undefined;
|
|
1130
|
-
};
|
|
1131
|
-
chain: {
|
|
1132
|
-
path: string;
|
|
1133
|
-
expiry: Date;
|
|
1134
|
-
actions: string[];
|
|
1135
|
-
spaceId: string;
|
|
1136
|
-
cid: string;
|
|
1137
|
-
delegateDID: string;
|
|
1138
|
-
isRevoked: boolean;
|
|
1139
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1140
|
-
createdAt?: Date | undefined;
|
|
1141
|
-
delegatorDID?: string | undefined;
|
|
1142
|
-
parentCid?: string | undefined;
|
|
1143
|
-
allowSubDelegation?: boolean | undefined;
|
|
1144
|
-
authHeader?: string | undefined;
|
|
1145
|
-
}[];
|
|
1146
|
-
leaf: {
|
|
1147
|
-
path: string;
|
|
1148
|
-
expiry: Date;
|
|
1149
|
-
actions: string[];
|
|
1150
|
-
spaceId: string;
|
|
1151
|
-
cid: string;
|
|
1152
|
-
delegateDID: string;
|
|
1153
|
-
isRevoked: boolean;
|
|
1154
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1155
|
-
createdAt?: Date | undefined;
|
|
1156
|
-
delegatorDID?: string | undefined;
|
|
1157
|
-
parentCid?: string | undefined;
|
|
1158
|
-
allowSubDelegation?: boolean | undefined;
|
|
1159
|
-
authHeader?: string | undefined;
|
|
1160
|
-
};
|
|
1161
|
-
}, {
|
|
1162
|
-
root: {
|
|
1163
|
-
path: string;
|
|
1164
|
-
expiry: Date;
|
|
1165
|
-
actions: string[];
|
|
1166
|
-
spaceId: string;
|
|
1167
|
-
cid: string;
|
|
1168
|
-
delegateDID: string;
|
|
1169
|
-
isRevoked: boolean;
|
|
1170
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1171
|
-
createdAt?: Date | undefined;
|
|
1172
|
-
delegatorDID?: string | undefined;
|
|
1173
|
-
parentCid?: string | undefined;
|
|
1174
|
-
allowSubDelegation?: boolean | undefined;
|
|
1175
|
-
authHeader?: string | undefined;
|
|
1176
|
-
};
|
|
1177
|
-
chain: {
|
|
1178
|
-
path: string;
|
|
1179
|
-
expiry: Date;
|
|
1180
|
-
actions: string[];
|
|
1181
|
-
spaceId: string;
|
|
1182
|
-
cid: string;
|
|
1183
|
-
delegateDID: string;
|
|
1184
|
-
isRevoked: boolean;
|
|
1185
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1186
|
-
createdAt?: Date | undefined;
|
|
1187
|
-
delegatorDID?: string | undefined;
|
|
1188
|
-
parentCid?: string | undefined;
|
|
1189
|
-
allowSubDelegation?: boolean | undefined;
|
|
1190
|
-
authHeader?: string | undefined;
|
|
1191
|
-
}[];
|
|
1192
|
-
leaf: {
|
|
1193
|
-
path: string;
|
|
1194
|
-
expiry: Date;
|
|
1195
|
-
actions: string[];
|
|
1196
|
-
spaceId: string;
|
|
1197
|
-
cid: string;
|
|
1198
|
-
delegateDID: string;
|
|
1199
|
-
isRevoked: boolean;
|
|
1200
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1201
|
-
createdAt?: Date | undefined;
|
|
1202
|
-
delegatorDID?: string | undefined;
|
|
1203
|
-
parentCid?: string | undefined;
|
|
1204
|
-
allowSubDelegation?: boolean | undefined;
|
|
1205
|
-
authHeader?: string | undefined;
|
|
1206
|
-
};
|
|
1207
|
-
}>;
|
|
1208
|
-
type DelegationChainV2 = z.infer<typeof DelegationChainV2Schema>;
|
|
1209
|
-
/**
|
|
1210
|
-
* Direction of delegation to filter by.
|
|
1211
|
-
*/
|
|
1212
|
-
declare const DelegationDirectionSchema: z.ZodEnum<["granted", "received", "all"]>;
|
|
1213
|
-
type DelegationDirection = z.infer<typeof DelegationDirectionSchema>;
|
|
1214
|
-
/**
|
|
1215
|
-
* Filters for listing delegations.
|
|
1216
|
-
*/
|
|
1217
|
-
declare const DelegationFiltersSchema: z.ZodObject<{
|
|
1218
|
-
/** Filter by delegation direction */
|
|
1219
|
-
direction: z.ZodOptional<z.ZodEnum<["granted", "received", "all"]>>;
|
|
1220
|
-
/** Filter by resource path pattern */
|
|
1221
|
-
path: z.ZodOptional<z.ZodString>;
|
|
1222
|
-
/** Filter by required actions */
|
|
1223
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1224
|
-
/** Include revoked delegations */
|
|
1225
|
-
includeRevoked: z.ZodOptional<z.ZodBoolean>;
|
|
1226
|
-
/** Filter by delegator DID */
|
|
1227
|
-
delegator: z.ZodOptional<z.ZodString>;
|
|
1228
|
-
/** Filter by delegatee DID */
|
|
1229
|
-
delegatee: z.ZodOptional<z.ZodString>;
|
|
1230
|
-
/** Only include delegations valid at this time */
|
|
1231
|
-
validAt: z.ZodOptional<z.ZodDate>;
|
|
1232
|
-
/** Maximum number of results to return */
|
|
1233
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
1234
|
-
/** Cursor for pagination */
|
|
1235
|
-
cursor: z.ZodOptional<z.ZodString>;
|
|
1236
|
-
}, "strip", z.ZodTypeAny, {
|
|
1237
|
-
path?: string | undefined;
|
|
1238
|
-
actions?: string[] | undefined;
|
|
1239
|
-
direction?: "received" | "all" | "granted" | undefined;
|
|
1240
|
-
limit?: number | undefined;
|
|
1241
|
-
cursor?: string | undefined;
|
|
1242
|
-
delegator?: string | undefined;
|
|
1243
|
-
delegatee?: string | undefined;
|
|
1244
|
-
includeRevoked?: boolean | undefined;
|
|
1245
|
-
validAt?: Date | undefined;
|
|
1246
|
-
}, {
|
|
1247
|
-
path?: string | undefined;
|
|
1248
|
-
actions?: string[] | undefined;
|
|
1249
|
-
direction?: "received" | "all" | "granted" | undefined;
|
|
1250
|
-
limit?: number | undefined;
|
|
1251
|
-
cursor?: string | undefined;
|
|
1252
|
-
delegator?: string | undefined;
|
|
1253
|
-
delegatee?: string | undefined;
|
|
1254
|
-
includeRevoked?: boolean | undefined;
|
|
1255
|
-
validAt?: Date | undefined;
|
|
1256
|
-
}>;
|
|
1257
|
-
type DelegationFilters = z.infer<typeof DelegationFiltersSchema>;
|
|
1258
|
-
/**
|
|
1259
|
-
* Type of space ownership.
|
|
1260
|
-
*/
|
|
1261
|
-
declare const SpaceOwnershipSchema: z.ZodEnum<["owned", "delegated"]>;
|
|
1262
|
-
type SpaceOwnership = z.infer<typeof SpaceOwnershipSchema>;
|
|
1263
|
-
/**
|
|
1264
|
-
* Information about a space the user has access to.
|
|
1265
|
-
*/
|
|
1266
|
-
declare const SpaceInfoSchema: z.ZodObject<{
|
|
1267
|
-
/** Space identifier */
|
|
1268
|
-
id: z.ZodString;
|
|
1269
|
-
/** Human-readable name for the space */
|
|
1270
|
-
name: z.ZodOptional<z.ZodString>;
|
|
1271
|
-
/** DID of the space owner */
|
|
1272
|
-
owner: z.ZodString;
|
|
1273
|
-
/** Whether user owns or has delegated access */
|
|
1274
|
-
type: z.ZodEnum<["owned", "delegated"]>;
|
|
1275
|
-
/** Permissions the user has in this space */
|
|
1276
|
-
permissions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1277
|
-
/** When the access expires (for delegated spaces) */
|
|
1278
|
-
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
1279
|
-
}, "strip", z.ZodTypeAny, {
|
|
1280
|
-
type: "owned" | "delegated";
|
|
1281
|
-
id: string;
|
|
1282
|
-
owner: string;
|
|
1283
|
-
expiresAt?: Date | undefined;
|
|
1284
|
-
name?: string | undefined;
|
|
1285
|
-
permissions?: string[] | undefined;
|
|
1286
|
-
}, {
|
|
1287
|
-
type: "owned" | "delegated";
|
|
1288
|
-
id: string;
|
|
1289
|
-
owner: string;
|
|
1290
|
-
expiresAt?: Date | undefined;
|
|
1291
|
-
name?: string | undefined;
|
|
1292
|
-
permissions?: string[] | undefined;
|
|
1293
|
-
}>;
|
|
1294
|
-
type SpaceInfo = z.infer<typeof SpaceInfoSchema>;
|
|
1295
|
-
/**
|
|
1296
|
-
* Schema for encoding share link data.
|
|
1297
|
-
*/
|
|
1298
|
-
declare const ShareSchemaSchema: z.ZodEnum<["base64", "compact", "ipfs"]>;
|
|
1299
|
-
type ShareSchema = z.infer<typeof ShareSchemaSchema>;
|
|
1300
|
-
/**
|
|
1301
|
-
* A shareable link containing delegation credentials.
|
|
1302
|
-
*/
|
|
1303
|
-
declare const ShareLinkSchema: z.ZodObject<{
|
|
1304
|
-
/** Unique token identifying this share link */
|
|
1305
|
-
token: z.ZodString;
|
|
1306
|
-
/** Full URL for sharing */
|
|
1307
|
-
url: z.ZodString;
|
|
1308
|
-
/** The delegation this link grants access to */
|
|
1309
|
-
delegation: z.ZodObject<{
|
|
1310
|
-
/** Content identifier (CID) of the delegation */
|
|
1311
|
-
cid: z.ZodString;
|
|
1312
|
-
/** DID of the delegate (the party receiving the delegation) */
|
|
1313
|
-
delegateDID: z.ZodString;
|
|
1314
|
-
/** Space ID this delegation applies to */
|
|
1315
|
-
spaceId: z.ZodString;
|
|
1316
|
-
/** Resource path this delegation grants access to */
|
|
1317
|
-
path: z.ZodString;
|
|
1318
|
-
/** Actions this delegation authorizes */
|
|
1319
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
1320
|
-
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
1321
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
1322
|
-
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1323
|
-
expiry: z.ZodDate;
|
|
1324
|
-
/** Whether this delegation has been revoked */
|
|
1325
|
-
isRevoked: z.ZodBoolean;
|
|
1326
|
-
/** DID of the delegator (the party granting the delegation) */
|
|
1327
|
-
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1328
|
-
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1329
|
-
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1330
|
-
/** Parent delegation CID if this is a sub-delegation */
|
|
1331
|
-
parentCid: z.ZodOptional<z.ZodString>;
|
|
1332
|
-
/** Whether sub-delegation is allowed */
|
|
1333
|
-
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1334
|
-
/** Authorization header (UCAN bearer token) */
|
|
1335
|
-
authHeader: z.ZodOptional<z.ZodString>;
|
|
1336
|
-
}, "strip", z.ZodTypeAny, {
|
|
1337
|
-
path: string;
|
|
1338
|
-
expiry: Date;
|
|
1339
|
-
actions: string[];
|
|
1340
|
-
spaceId: string;
|
|
1341
|
-
cid: string;
|
|
1342
|
-
delegateDID: string;
|
|
1343
|
-
isRevoked: boolean;
|
|
1344
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1345
|
-
createdAt?: Date | undefined;
|
|
1346
|
-
delegatorDID?: string | undefined;
|
|
1347
|
-
parentCid?: string | undefined;
|
|
1348
|
-
allowSubDelegation?: boolean | undefined;
|
|
1349
|
-
authHeader?: string | undefined;
|
|
1350
|
-
}, {
|
|
1351
|
-
path: string;
|
|
1352
|
-
expiry: Date;
|
|
1353
|
-
actions: string[];
|
|
1354
|
-
spaceId: string;
|
|
1355
|
-
cid: string;
|
|
1356
|
-
delegateDID: string;
|
|
1357
|
-
isRevoked: boolean;
|
|
1358
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1359
|
-
createdAt?: Date | undefined;
|
|
1360
|
-
delegatorDID?: string | undefined;
|
|
1361
|
-
parentCid?: string | undefined;
|
|
1362
|
-
allowSubDelegation?: boolean | undefined;
|
|
1363
|
-
authHeader?: string | undefined;
|
|
1364
|
-
}>;
|
|
1365
|
-
/** Encoding schema used for the link */
|
|
1366
|
-
schema: z.ZodEnum<["base64", "compact", "ipfs"]>;
|
|
1367
|
-
/** When this share link expires */
|
|
1368
|
-
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
1369
|
-
/** Human-readable description of what is being shared */
|
|
1370
|
-
description: z.ZodOptional<z.ZodString>;
|
|
1371
|
-
}, "strip", z.ZodTypeAny, {
|
|
1372
|
-
schema: "base64" | "compact" | "ipfs";
|
|
1373
|
-
delegation: {
|
|
1374
|
-
path: string;
|
|
1375
|
-
expiry: Date;
|
|
1376
|
-
actions: string[];
|
|
1377
|
-
spaceId: string;
|
|
1378
|
-
cid: string;
|
|
1379
|
-
delegateDID: string;
|
|
1380
|
-
isRevoked: boolean;
|
|
1381
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1382
|
-
createdAt?: Date | undefined;
|
|
1383
|
-
delegatorDID?: string | undefined;
|
|
1384
|
-
parentCid?: string | undefined;
|
|
1385
|
-
allowSubDelegation?: boolean | undefined;
|
|
1386
|
-
authHeader?: string | undefined;
|
|
1387
|
-
};
|
|
1388
|
-
url: string;
|
|
1389
|
-
token: string;
|
|
1390
|
-
expiresAt?: Date | undefined;
|
|
1391
|
-
description?: string | undefined;
|
|
1392
|
-
}, {
|
|
1393
|
-
schema: "base64" | "compact" | "ipfs";
|
|
1394
|
-
delegation: {
|
|
1395
|
-
path: string;
|
|
1396
|
-
expiry: Date;
|
|
1397
|
-
actions: string[];
|
|
1398
|
-
spaceId: string;
|
|
1399
|
-
cid: string;
|
|
1400
|
-
delegateDID: string;
|
|
1401
|
-
isRevoked: boolean;
|
|
1402
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1403
|
-
createdAt?: Date | undefined;
|
|
1404
|
-
delegatorDID?: string | undefined;
|
|
1405
|
-
parentCid?: string | undefined;
|
|
1406
|
-
allowSubDelegation?: boolean | undefined;
|
|
1407
|
-
authHeader?: string | undefined;
|
|
1408
|
-
};
|
|
1409
|
-
url: string;
|
|
1410
|
-
token: string;
|
|
1411
|
-
expiresAt?: Date | undefined;
|
|
1412
|
-
description?: string | undefined;
|
|
1413
|
-
}>;
|
|
1414
|
-
type ShareLink = z.infer<typeof ShareLinkSchema>;
|
|
1415
|
-
type ShareLinkData<T = unknown> = {
|
|
1416
|
-
data: T;
|
|
1417
|
-
delegation: Delegation;
|
|
1418
|
-
spaceId: string;
|
|
1419
|
-
path: string;
|
|
1420
|
-
};
|
|
1421
|
-
/**
|
|
1422
|
-
* Options for ingesting an external delegation.
|
|
1423
|
-
*/
|
|
1424
|
-
declare const IngestOptionsSchema: z.ZodObject<{
|
|
1425
|
-
/** Whether to persist the delegation to storage */
|
|
1426
|
-
persist: z.ZodOptional<z.ZodBoolean>;
|
|
1427
|
-
/** Whether to validate the full delegation chain */
|
|
1428
|
-
validateChain: z.ZodOptional<z.ZodBoolean>;
|
|
1429
|
-
/** Name for the ingested key */
|
|
1430
|
-
keyName: z.ZodOptional<z.ZodString>;
|
|
1431
|
-
/** Whether to create a session key for this delegation */
|
|
1432
|
-
createSessionKey: z.ZodOptional<z.ZodBoolean>;
|
|
1433
|
-
/** Override the priority for the ingested key */
|
|
1434
|
-
priority: z.ZodOptional<z.ZodNumber>;
|
|
1435
|
-
}, "strip", z.ZodTypeAny, {
|
|
1436
|
-
priority?: number | undefined;
|
|
1437
|
-
persist?: boolean | undefined;
|
|
1438
|
-
validateChain?: boolean | undefined;
|
|
1439
|
-
keyName?: string | undefined;
|
|
1440
|
-
createSessionKey?: boolean | undefined;
|
|
1441
|
-
}, {
|
|
1442
|
-
priority?: number | undefined;
|
|
1443
|
-
persist?: boolean | undefined;
|
|
1444
|
-
validateChain?: boolean | undefined;
|
|
1445
|
-
keyName?: string | undefined;
|
|
1446
|
-
createSessionKey?: boolean | undefined;
|
|
1447
|
-
}>;
|
|
1448
|
-
type IngestOptions = z.infer<typeof IngestOptionsSchema>;
|
|
1449
|
-
/**
|
|
1450
|
-
* Parameters for generating a share link.
|
|
1451
|
-
*/
|
|
1452
|
-
declare const GenerateShareParamsSchema: z.ZodObject<{
|
|
1453
|
-
/** Resource path to share */
|
|
1454
|
-
path: z.ZodString;
|
|
1455
|
-
/** Actions to authorize */
|
|
1456
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1457
|
-
/** When the share link expires */
|
|
1458
|
-
expiry: z.ZodOptional<z.ZodDate>;
|
|
1459
|
-
/** Encoding schema for the link */
|
|
1460
|
-
schema: z.ZodOptional<z.ZodEnum<["base64", "compact", "ipfs"]>>;
|
|
1461
|
-
/** Human-readable description */
|
|
1462
|
-
description: z.ZodOptional<z.ZodString>;
|
|
1463
|
-
/** Base URL for the share link */
|
|
1464
|
-
baseUrl: z.ZodOptional<z.ZodString>;
|
|
1465
|
-
/**
|
|
1466
|
-
* Whether the recipient may re-delegate the share. Default `true`.
|
|
1467
|
-
* `false` issues a terminal delegation: the node refuses onward `/delegate`.
|
|
1468
|
-
* Without a session-key delegation that covers the path, `false` fails with PERMISSION_DENIED.
|
|
1469
|
-
* Receive such a share with `receive(link, { autoSubdelegate: false })`; the default auto-subdelegation is refused for it.
|
|
1470
|
-
*/
|
|
1471
|
-
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1472
|
-
}, "strip", z.ZodTypeAny, {
|
|
1473
|
-
path: string;
|
|
1474
|
-
description?: string | undefined;
|
|
1475
|
-
schema?: "base64" | "compact" | "ipfs" | undefined;
|
|
1476
|
-
expiry?: Date | undefined;
|
|
1477
|
-
actions?: string[] | undefined;
|
|
1478
|
-
allowSubDelegation?: boolean | undefined;
|
|
1479
|
-
baseUrl?: string | undefined;
|
|
1480
|
-
}, {
|
|
1481
|
-
path: string;
|
|
1482
|
-
description?: string | undefined;
|
|
1483
|
-
schema?: "base64" | "compact" | "ipfs" | undefined;
|
|
1484
|
-
expiry?: Date | undefined;
|
|
1485
|
-
actions?: string[] | undefined;
|
|
1486
|
-
allowSubDelegation?: boolean | undefined;
|
|
1487
|
-
baseUrl?: string | undefined;
|
|
1488
|
-
}>;
|
|
1489
|
-
type GenerateShareParams = z.infer<typeof GenerateShareParamsSchema>;
|
|
1490
|
-
/**
|
|
1491
|
-
* Configuration for DelegationManager.
|
|
1492
|
-
* Note: ServiceSession, InvokeFunction, and FetchFunction are external types.
|
|
1493
|
-
*/
|
|
1494
|
-
declare const DelegationManagerConfigSchema: z.ZodObject<{
|
|
1495
|
-
/** TinyCloud host URLs */
|
|
1496
|
-
hosts: z.ZodArray<z.ZodString, "many">;
|
|
1497
|
-
/** Account space used by account-wide delegation history queries */
|
|
1498
|
-
accountSpaceId: z.ZodOptional<z.ZodString>;
|
|
1499
|
-
/** Active session for authentication */
|
|
1500
|
-
session: z.ZodEffects<z.ZodUnknown, ServiceSession, unknown>;
|
|
1501
|
-
/** Platform-specific invoke function */
|
|
1502
|
-
invoke: z.ZodEffects<z.ZodUnknown, InvokeFunction, unknown>;
|
|
1503
|
-
/** Platform-specific invoke function for raw resource URIs */
|
|
1504
|
-
invokeAny: z.ZodOptional<z.ZodEffects<z.ZodUnknown, InvokeAnyFunction, unknown>>;
|
|
1505
|
-
/** Optional owner-signed authorization for direct CID revocation */
|
|
1506
|
-
signOwnerRevocation: z.ZodOptional<z.ZodType<(cid: string) => Promise<string>, z.ZodTypeDef, (cid: string) => Promise<string>>>;
|
|
1507
|
-
/** Optional custom fetch implementation */
|
|
1508
|
-
fetch: z.ZodOptional<z.ZodEffects<z.ZodUnknown, FetchFunction, unknown>>;
|
|
1509
|
-
}, "strip", z.ZodTypeAny, {
|
|
1510
|
-
session: ServiceSession;
|
|
1511
|
-
hosts: string[];
|
|
1512
|
-
invoke: InvokeFunction;
|
|
1513
|
-
invokeAny?: InvokeAnyFunction | undefined;
|
|
1514
|
-
accountSpaceId?: string | undefined;
|
|
1515
|
-
signOwnerRevocation?: ((cid: string) => Promise<string>) | undefined;
|
|
1516
|
-
fetch?: FetchFunction | undefined;
|
|
1517
|
-
}, {
|
|
1518
|
-
hosts: string[];
|
|
1519
|
-
session?: unknown;
|
|
1520
|
-
invokeAny?: unknown;
|
|
1521
|
-
accountSpaceId?: string | undefined;
|
|
1522
|
-
invoke?: unknown;
|
|
1523
|
-
signOwnerRevocation?: ((cid: string) => Promise<string>) | undefined;
|
|
1524
|
-
fetch?: unknown;
|
|
1525
|
-
}>;
|
|
1526
|
-
type DelegationManagerConfig = z.infer<typeof DelegationManagerConfigSchema>;
|
|
1527
|
-
/**
|
|
1528
|
-
* Provider interface for cryptographic key operations.
|
|
1529
|
-
*/
|
|
1530
|
-
declare const KeyProviderSchema: z.ZodObject<{
|
|
1531
|
-
/** Generate a new session key, returns key ID */
|
|
1532
|
-
createSessionKey: z.ZodEffects<z.ZodUnknown, (name: string) => Promise<string>, unknown>;
|
|
1533
|
-
/** Get JWK for a key */
|
|
1534
|
-
getJWK: z.ZodEffects<z.ZodUnknown, (keyId: string) => object, unknown>;
|
|
1535
|
-
/** Get DID for a key */
|
|
1536
|
-
getDID: z.ZodEffects<z.ZodUnknown, (keyId: string) => Promise<string>, unknown>;
|
|
1537
|
-
}, "strip", z.ZodTypeAny, {
|
|
1538
|
-
createSessionKey: (name: string) => Promise<string>;
|
|
1539
|
-
getJWK: (keyId: string) => object;
|
|
1540
|
-
getDID: (keyId: string) => Promise<string>;
|
|
1541
|
-
}, {
|
|
1542
|
-
createSessionKey?: unknown;
|
|
1543
|
-
getJWK?: unknown;
|
|
1544
|
-
getDID?: unknown;
|
|
1545
|
-
}>;
|
|
1546
|
-
type KeyProvider = z.infer<typeof KeyProviderSchema>;
|
|
1547
|
-
/**
|
|
1548
|
-
* Response from the delegation API.
|
|
1549
|
-
*/
|
|
1550
|
-
declare const DelegationApiResponseSchema: z.ZodObject<{
|
|
1551
|
-
/** SIWE message content */
|
|
1552
|
-
siwe: z.ZodString;
|
|
1553
|
-
/** Signature of the SIWE message */
|
|
1554
|
-
signature: z.ZodString;
|
|
1555
|
-
/** Delegation version */
|
|
1556
|
-
version: z.ZodNumber;
|
|
1557
|
-
/** CID of the created delegation */
|
|
1558
|
-
cid: z.ZodOptional<z.ZodString>;
|
|
1559
|
-
}, "strip", z.ZodTypeAny, {
|
|
1560
|
-
siwe: string;
|
|
1561
|
-
signature: string;
|
|
1562
|
-
version: number;
|
|
1563
|
-
cid?: string | undefined;
|
|
1564
|
-
}, {
|
|
1565
|
-
siwe: string;
|
|
1566
|
-
signature: string;
|
|
1567
|
-
version: number;
|
|
1568
|
-
cid?: string | undefined;
|
|
1569
|
-
}>;
|
|
1570
|
-
type DelegationApiResponse = z.infer<typeof DelegationApiResponseSchema>;
|
|
1571
|
-
/**
|
|
1572
|
-
* A single (service, space, path, actions) entry inside a
|
|
1573
|
-
* createDelegation WASM result.
|
|
1574
|
-
*
|
|
1575
|
-
* Mirrors the Rust `DelegatedResource` struct in
|
|
1576
|
-
* `tinycloud-sdk-wasm/src/session.rs`. Field names match the manifest
|
|
1577
|
-
* {@link PermissionEntry} shape so callers can reconstruct what they sent
|
|
1578
|
-
* without having to re-parse the UCAN.
|
|
1579
|
-
*
|
|
1580
|
-
* `service` is the short form (e.g. `"kv"`, `"sql"`) as returned by the
|
|
1581
|
-
* Rust layer. The SDK layer translates to the long form
|
|
1582
|
-
* (`"tinycloud.kv"`) when comparing against manifests.
|
|
1583
|
-
*/
|
|
1584
|
-
declare const DelegatedResourceSchema: z.ZodObject<{
|
|
1585
|
-
/** Short-form service name, e.g. "kv", "sql", "duckdb", "capabilities", "hooks". */
|
|
1586
|
-
service: z.ZodString;
|
|
1587
|
-
/** Full space id string, e.g. "tinycloud:pkh:eip155:1:0x....:default". */
|
|
1588
|
-
space: z.ZodString;
|
|
1589
|
-
/** Resource path; empty string when the resource URI had no path segment. */
|
|
1590
|
-
path: z.ZodString;
|
|
1591
|
-
/** Full-URN ability strings, e.g. ["tinycloud.kv/get", "tinycloud.kv/put"]. */
|
|
1592
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
1593
|
-
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
1594
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
1595
|
-
}, "strip", z.ZodTypeAny, {
|
|
1596
|
-
path: string;
|
|
1597
|
-
space: string;
|
|
1598
|
-
actions: string[];
|
|
1599
|
-
service: string;
|
|
1600
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1601
|
-
}, {
|
|
1602
|
-
path: string;
|
|
1603
|
-
space: string;
|
|
1604
|
-
actions: string[];
|
|
1605
|
-
service: string;
|
|
1606
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1607
|
-
}>;
|
|
1608
|
-
type DelegatedResource = z.infer<typeof DelegatedResourceSchema>;
|
|
1609
|
-
/**
|
|
1610
|
-
* Input parameters for the createDelegation WASM function.
|
|
1611
|
-
*
|
|
1612
|
-
* A single call may encode multiple `(service, path, actions)` entries
|
|
1613
|
-
* via the `abilities` map — the underlying UCAN will contain one
|
|
1614
|
-
* attenuation entry per `(service, path)` pair, all signed by the same
|
|
1615
|
-
* session key in one blob.
|
|
1616
|
-
*
|
|
1617
|
-
* The `abilities` shape is identical to what `prepareSession` accepts
|
|
1618
|
-
* (`Record<shortService, Record<path, actionURNs[]>>`), so manifest
|
|
1619
|
-
* resolution can feed both sides from one data structure.
|
|
1620
|
-
*/
|
|
1621
|
-
declare const CreateDelegationWasmParamsSchema: z.ZodObject<{
|
|
1622
|
-
/** The session containing delegation credentials */
|
|
1623
|
-
session: z.ZodEffects<z.ZodUnknown, ServiceSession, unknown>;
|
|
1624
|
-
/** DID of the delegate */
|
|
1625
|
-
delegateDID: z.ZodString;
|
|
1626
|
-
/** Space ID this delegation applies to */
|
|
1627
|
-
spaceId: z.ZodString;
|
|
1628
|
-
/**
|
|
1629
|
-
* Multi-resource abilities map: short-service → path → full-URN actions.
|
|
1630
|
-
* Matches the shape accepted by `prepareSession`.
|
|
1631
|
-
*
|
|
1632
|
-
* Example:
|
|
1633
|
-
* ```
|
|
1634
|
-
* {
|
|
1635
|
-
* kv: {
|
|
1636
|
-
* "com.listen.app/": ["tinycloud.kv/get", "tinycloud.kv/put"]
|
|
1637
|
-
* },
|
|
1638
|
-
* sql: {
|
|
1639
|
-
* "com.listen.app/data.sqlite": ["tinycloud.sql/read"]
|
|
1640
|
-
* }
|
|
1641
|
-
* }
|
|
1642
|
-
* ```
|
|
1643
|
-
*/
|
|
1644
|
-
abilities: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
1645
|
-
/** Expiration time in seconds since Unix epoch */
|
|
1646
|
-
expirationSecs: z.ZodNumber;
|
|
1647
|
-
/** Optional not-before time in seconds since Unix epoch */
|
|
1648
|
-
notBeforeSecs: z.ZodOptional<z.ZodNumber>;
|
|
1649
|
-
/** Issue a terminal delegation: the node refuses onward delegation. Default `false`. */
|
|
1650
|
-
disableSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1651
|
-
}, "strip", z.ZodTypeAny, {
|
|
1652
|
-
session: ServiceSession;
|
|
1653
|
-
spaceId: string;
|
|
1654
|
-
delegateDID: string;
|
|
1655
|
-
abilities: Record<string, Record<string, string[]>>;
|
|
1656
|
-
expirationSecs: number;
|
|
1657
|
-
disableSubDelegation?: boolean | undefined;
|
|
1658
|
-
notBeforeSecs?: number | undefined;
|
|
1659
|
-
}, {
|
|
1660
|
-
spaceId: string;
|
|
1661
|
-
delegateDID: string;
|
|
1662
|
-
abilities: Record<string, Record<string, string[]>>;
|
|
1663
|
-
expirationSecs: number;
|
|
1664
|
-
session?: unknown;
|
|
1665
|
-
disableSubDelegation?: boolean | undefined;
|
|
1666
|
-
notBeforeSecs?: number | undefined;
|
|
1667
|
-
}>;
|
|
1668
|
-
type CreateDelegationWasmParams = z.infer<typeof CreateDelegationWasmParamsSchema>;
|
|
1669
|
-
/**
|
|
1670
|
-
* Result from the createDelegation WASM function.
|
|
1671
|
-
*
|
|
1672
|
-
* A single UCAN may cover multiple resources. The `resources` array
|
|
1673
|
-
* describes every `(service, space, path, actions)` entry granted, in
|
|
1674
|
-
* deterministic (service, path) lexicographic order (the Rust side sorts
|
|
1675
|
-
* the HashMap entries before signing).
|
|
1676
|
-
*/
|
|
1677
|
-
declare const CreateDelegationWasmResultSchema: z.ZodObject<{
|
|
1678
|
-
/** Base64url-encoded UCAN delegation */
|
|
1679
|
-
delegation: z.ZodString;
|
|
1680
|
-
/** CID of the delegation */
|
|
1681
|
-
cid: z.ZodString;
|
|
1682
|
-
/** DID of the delegate */
|
|
1683
|
-
delegateDID: z.ZodString;
|
|
1684
|
-
/** Expiration time */
|
|
1685
|
-
expiry: z.ZodDate;
|
|
1686
|
-
/**
|
|
1687
|
-
* All (service, space, path, actions) entries granted by this delegation.
|
|
1688
|
-
* Always non-empty on success.
|
|
1689
|
-
*/
|
|
1690
|
-
resources: z.ZodArray<z.ZodObject<{
|
|
1691
|
-
/** Short-form service name, e.g. "kv", "sql", "duckdb", "capabilities", "hooks". */
|
|
1692
|
-
service: z.ZodString;
|
|
1693
|
-
/** Full space id string, e.g. "tinycloud:pkh:eip155:1:0x....:default". */
|
|
1694
|
-
space: z.ZodString;
|
|
1695
|
-
/** Resource path; empty string when the resource URI had no path segment. */
|
|
1696
|
-
path: z.ZodString;
|
|
1697
|
-
/** Full-URN ability strings, e.g. ["tinycloud.kv/get", "tinycloud.kv/put"]. */
|
|
1698
|
-
actions: z.ZodArray<z.ZodString, "many">;
|
|
1699
|
-
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
1700
|
-
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
1701
|
-
}, "strip", z.ZodTypeAny, {
|
|
1702
|
-
path: string;
|
|
1703
|
-
space: string;
|
|
1704
|
-
actions: string[];
|
|
1705
|
-
service: string;
|
|
1706
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1707
|
-
}, {
|
|
1708
|
-
path: string;
|
|
1709
|
-
space: string;
|
|
1710
|
-
actions: string[];
|
|
1711
|
-
service: string;
|
|
1712
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1713
|
-
}>, "many">;
|
|
1714
|
-
}, "strip", z.ZodTypeAny, {
|
|
1715
|
-
resources: {
|
|
1716
|
-
path: string;
|
|
1717
|
-
space: string;
|
|
1718
|
-
actions: string[];
|
|
1719
|
-
service: string;
|
|
1720
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1721
|
-
}[];
|
|
1722
|
-
delegation: string;
|
|
1723
|
-
expiry: Date;
|
|
1724
|
-
cid: string;
|
|
1725
|
-
delegateDID: string;
|
|
1726
|
-
}, {
|
|
1727
|
-
resources: {
|
|
1728
|
-
path: string;
|
|
1729
|
-
space: string;
|
|
1730
|
-
actions: string[];
|
|
1731
|
-
service: string;
|
|
1732
|
-
caveats?: Record<string, unknown>[] | undefined;
|
|
1733
|
-
}[];
|
|
1734
|
-
delegation: string;
|
|
1735
|
-
expiry: Date;
|
|
1736
|
-
cid: string;
|
|
1737
|
-
delegateDID: string;
|
|
1738
|
-
}>;
|
|
1739
|
-
type CreateDelegationWasmResult = z.infer<typeof CreateDelegationWasmResultSchema>;
|
|
1740
|
-
|
|
1741
5
|
/**
|
|
1742
6
|
* DelegationManager - Handles delegation CRUD operations.
|
|
1743
7
|
*
|
|
@@ -1777,6 +41,8 @@ declare class DelegationManager {
|
|
|
1777
41
|
private signOwnerRevocation?;
|
|
1778
42
|
private fetchFn;
|
|
1779
43
|
private accountSpaceId?;
|
|
44
|
+
private sessionInvocationSigner?;
|
|
45
|
+
private issuedState;
|
|
1780
46
|
/**
|
|
1781
47
|
* Creates a new DelegationManager instance.
|
|
1782
48
|
*
|
|
@@ -1826,8 +92,43 @@ declare class DelegationManager {
|
|
|
1826
92
|
* exposing delegation metadata.
|
|
1827
93
|
*/
|
|
1828
94
|
status(cid: string): Promise<Result<DelegationStatus>>;
|
|
1829
|
-
/**
|
|
1830
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Query lifecycle-complete delegation history for the authenticated account.
|
|
97
|
+
*
|
|
98
|
+
* `scope.spaces` lists the spaces to sign `tinycloud.delegation/list` for, in order. Omitted, the
|
|
99
|
+
* account space is tried, then the session's own space. A caller that knows which of them the session
|
|
100
|
+
* holds passes only those; an empty list sends nothing and answers PERMISSION_DENIED.
|
|
101
|
+
*/
|
|
102
|
+
query(options?: AccountDelegationQueryOptions, scope?: {
|
|
103
|
+
readonly spaces?: readonly string[];
|
|
104
|
+
}): Promise<Result<AccountDelegationPage>>;
|
|
105
|
+
/** The state the lazily loaded issued-delegation module reads and updates. */
|
|
106
|
+
private issuedContext;
|
|
107
|
+
/**
|
|
108
|
+
* Lists the delegations this session's own key issued (`direction: "issued"`).
|
|
109
|
+
* The implementation loads on first use.
|
|
110
|
+
*/
|
|
111
|
+
private queryIssued;
|
|
112
|
+
/**
|
|
113
|
+
* Every delegation this session's key issued, following `nextCursor` until
|
|
114
|
+
* it is absent. `maxItems` stops early once that many are collected;
|
|
115
|
+
* `untilCid` stops after the page that contains that delegation. Items come
|
|
116
|
+
* in CID order (each carries `issuedAt`). The implementation loads on first use.
|
|
117
|
+
*/
|
|
118
|
+
queryAllIssued(options?: Pick<AccountDelegationQueryOptions, "status" | "space"> & {
|
|
119
|
+
pageSize?: number;
|
|
120
|
+
maxItems?: number;
|
|
121
|
+
untilCid?: string;
|
|
122
|
+
}): Promise<Result<AccountDelegationRecord[]>>;
|
|
123
|
+
/**
|
|
124
|
+
* Revokes a delegation this session's key issued, with no proof: a UCAN
|
|
125
|
+
* signed by the session's own did:key carrying `urn:cid:<cid>` and
|
|
126
|
+
* `tinycloud.delegation/revoke`. Revoking a delegation that is already revoked
|
|
127
|
+
* succeeds. A refusal (the key is not the delegator) carries the node's
|
|
128
|
+
* message; 503 means the chain is too deep right now, retry later.
|
|
129
|
+
* The implementation loads on first use.
|
|
130
|
+
*/
|
|
131
|
+
revokeIssued(cid: string): Promise<Result<DelegationRevocationReceipt>>;
|
|
1831
132
|
/**
|
|
1832
133
|
* Gets the full delegation chain for a given delegation.
|
|
1833
134
|
*
|
|
@@ -4568,4 +2869,4 @@ declare const ShareNativeResponseSchema: z.ZodDiscriminatedUnion<"action", [z.Zo
|
|
|
4568
2869
|
}>]>;
|
|
4569
2870
|
type ShareNativeResponse = z.infer<typeof ShareNativeResponseSchema>;
|
|
4570
2871
|
|
|
4571
|
-
export { type
|
|
2872
|
+
export { type ShareCacheMetadata as $, type ShareAccess as A, ShareAccessError as B, CREDENTIAL_INVITATION_REQUEST_DOMAIN as C, DELIVERY_ADMISSION_DOMAIN as D, type EncodedShareData as E, type ShareAccessV2 as F, type ShareAction as G, ShareActionSchema as H, type ICapabilityKeyRegistry as I, type ShareAddressedDelegationEnvelopeV2 as J, ShareAddressedDelegationEnvelopeV2Schema as K, type ShareAddressedDelegationRequestV2 as L, MAX_CONTENT_BYTES as M, ShareAddressedDelegationRequestV2Schema as N, type OwnerDelegationPermission as O, type PortableDelegationImportReceipt as P, type ShareAddressedDelegationResponseV2 as Q, type ReceiveOptions as R, type SenderShareKeyStorage as S, ShareAddressedDelegationResponseV2Schema as T, type ShareAddressedRecipientMatcher as U, type ShareArtifactInput as V, type ShareArtifactResult as W, type ShareArtifactV2 as X, type ShareCache as Y, type ShareCacheEntry as Z, type ShareCacheKey as _, type CreateOwnerDelegationParams as a, encryptShareBytes as a$, type ShareCapabilityLike as a0, ShareConflict as a1, type ShareContentMetadata as a2, type ShareContentSource as a3, type ShareDelegationPreflight as a4, type ShareDeliveryAuthorizationV3Receipt as a5, type ShareDeliveryAuthorizationV3Request as a6, ShareDeliveryRefusedError as a7, type ShareDetachedProof as a8, ShareEnvelopeError as a9, ShareRecipientPolicySchema as aA, type ShareRecipientResult as aB, type ShareRecipientTarget as aC, ShareRecipientTargetSchema as aD, type ShareResource as aE, ShareResourceSchema as aF, type ShareSaveOptions as aG, type ShareSqlContentSource as aH, type ShareWireAction as aI, SharingService as aJ, type SharingServiceConfig as aK, type SignedDelegation as aL, type VerifyShareEnvelopeOptions as aM, canonicalOwnerSharePolicy as aN, computeOwnerShareRegistrationCid as aO, computeShareCid as aP, createDelegatedShareKey as aQ, createPolicyEnforcementDelegation as aR, createShareArtifact as aS, createShareArtifactAsync as aT, createSharePolicy as aU, createSharingService as aV, decryptShareBytesAsync as aW, delegatePortablePolicySession as aX, encodeInlineShareUrl as aY, encodeShareArtifact as aZ, encodeShareUrl as a_, type ShareEnvelopeV2 as aa, type ShareExpiryBounds as ab, type ShareKvContentSource as ac, type ShareLinkLocation as ad, type ShareListEntry as ae, type ShareListResult as af, type ShareNativeAction as ag, type ShareNativeInvokeEnvelopeV1 as ah, type ShareNativeInvokeErrorResult as ai, type ShareNativeInvokeInput as aj, type ShareNativeInvokeResult as ak, type ShareNativeInvokeSuccessResult as al, type ShareNativeResponse as am, ShareNativeResponseSchema as an, type SharePolicy as ao, type SharePolicyBinding as ap, type SharePolicySession as aq, type SharePolicySessionV1 as ar, type SharePolicySessionWireV1 as as, type PortableDelegation as at, type ShareReadInvocationV1 as au, type ShareReadResult as av, ShareRecipientClient as aw, type ShareRecipientClientOptions as ax, ShareRecipientClientOptionsSchema as ay, type ShareRecipientPolicy as az, type CredentialInvitationRequest as b, encryptShareBytesAsync as b0, importPortableDelegation as b1, intersectShareCapabilities as b2, isV2ShareLink as b3, normalizeShareActions as b4, normalizeShareRecipientTarget as b5, normalizeShareResource as b6, parsePortableDelegation as b7, parseShareArtifact as b8, parseShareUrl as b9, restoreDelegatedShareKey as ba, serializePortableDelegation as bb, shareCapabilityAllows as bc, shortDeliveryLinkBodyCid as bd, signShareEnvelope as be, validateOwnerSharePolicyRegistration as bf, validateOwnerSharePolicyRegistrationBytes as bg, verifyShareCid as bh, verifyShareDeliveryAuthorizationV3Bytes as bi, verifyShareEnvelope as bj, withoutShareLink as bk, CapabilityKeyRegistry as bl, type CapabilityKeyRegistryErrorCode as bm, CapabilityKeyRegistryErrorCodes as bn, type StoredDelegationChain as bo, createCapabilityKeyRegistry as bp, type DelegateReceivedShareParams as c, type DelegatedShareAccess as d, type DelegatedShareKey as e, DelegationManager as f, type DeliveryAdmission as g, type ISharingService as h, MAX_SEALED_SHARE_CONTENT_BYTES as i, MAX_SHARE_ARTIFACT_BYTES as j, MAX_SHARE_CONTENT_BYTES as k, MemorySenderShareKeyStorage as l, MemorySenderShareRecordStorage as m, MemoryShareCache as n, type OwnerDelegationReceipt as o, type OwnerShareAction as p, type OwnerShareDecryption as q, type OwnerShareMatcher as r, type OwnerSharePolicyRegistration as s, type OwnerSharePolicyRegistrationReceipt as t, type OwnerSharePolicyV2 as u, type RegisterOwnerSharePolicyParams as v, type SenderShareRecord as w, type SenderShareRecordStorage as x, type SenderShareRevocationScope as y, SenderShareStore as z };
|