@tinycloud/sdk-core 3.8.0-beta.5 → 3.8.0
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 +64 -11
- 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 +56 -3
- 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 +406 -293
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +129 -16
- 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-D7lM-5Jo.d.cts → recipient-types.schema-BIJcihno.d.cts} +32 -1739
- package/dist/{recipient-types.schema-D7lM-5Jo.d.ts → recipient-types.schema-Ebi5aliq.d.ts} +32 -1739
- 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
|
@@ -0,0 +1,1763 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ServiceSession, InvokeFunction, InvokeAnyFunction, FetchFunction } from '@tinycloud/sdk-services';
|
|
3
|
+
|
|
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
|
+
/** The node answered 503: the delegation chain is too deep to evaluate right now. Retry later. */
|
|
231
|
+
readonly CHAIN_TOO_DEEP: "CHAIN_TOO_DEEP";
|
|
232
|
+
/** The node answered 400 "invalid delegation query cursor": malformed, foreign or from another filter. Start the listing again without it. */
|
|
233
|
+
readonly INVALID_CURSOR: "INVALID_CURSOR";
|
|
234
|
+
};
|
|
235
|
+
type DelegationErrorCode = (typeof DelegationErrorCodes)[keyof typeof DelegationErrorCodes];
|
|
236
|
+
/**
|
|
237
|
+
* Represents a delegation from one DID to another.
|
|
238
|
+
*/
|
|
239
|
+
declare const DelegationSchema: z.ZodObject<{
|
|
240
|
+
/** Content identifier (CID) of the delegation */
|
|
241
|
+
cid: z.ZodString;
|
|
242
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
243
|
+
delegateDID: z.ZodString;
|
|
244
|
+
/** Space ID this delegation applies to */
|
|
245
|
+
spaceId: z.ZodString;
|
|
246
|
+
/** Resource path this delegation grants access to */
|
|
247
|
+
path: z.ZodString;
|
|
248
|
+
/** Actions this delegation authorizes */
|
|
249
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
250
|
+
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
251
|
+
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
252
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
253
|
+
expiry: z.ZodDate;
|
|
254
|
+
/** Whether this delegation has been revoked */
|
|
255
|
+
isRevoked: z.ZodBoolean;
|
|
256
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
257
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
258
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
259
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
260
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
261
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
262
|
+
/** Whether sub-delegation is allowed */
|
|
263
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
264
|
+
/** Authorization header (UCAN bearer token) */
|
|
265
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
266
|
+
}, "strip", z.ZodTypeAny, {
|
|
267
|
+
path: string;
|
|
268
|
+
expiry: Date;
|
|
269
|
+
actions: string[];
|
|
270
|
+
spaceId: string;
|
|
271
|
+
cid: string;
|
|
272
|
+
delegateDID: string;
|
|
273
|
+
isRevoked: boolean;
|
|
274
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
275
|
+
createdAt?: Date | undefined;
|
|
276
|
+
delegatorDID?: string | undefined;
|
|
277
|
+
parentCid?: string | undefined;
|
|
278
|
+
allowSubDelegation?: boolean | undefined;
|
|
279
|
+
authHeader?: string | undefined;
|
|
280
|
+
}, {
|
|
281
|
+
path: string;
|
|
282
|
+
expiry: Date;
|
|
283
|
+
actions: string[];
|
|
284
|
+
spaceId: string;
|
|
285
|
+
cid: string;
|
|
286
|
+
delegateDID: string;
|
|
287
|
+
isRevoked: boolean;
|
|
288
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
289
|
+
createdAt?: Date | undefined;
|
|
290
|
+
delegatorDID?: string | undefined;
|
|
291
|
+
parentCid?: string | undefined;
|
|
292
|
+
allowSubDelegation?: boolean | undefined;
|
|
293
|
+
authHeader?: string | undefined;
|
|
294
|
+
}>;
|
|
295
|
+
type Delegation = z.infer<typeof DelegationSchema>;
|
|
296
|
+
/** Node-confirmed lifecycle state for one delegation. */
|
|
297
|
+
declare const DelegationStatusSchema: z.ZodEffects<z.ZodObject<{
|
|
298
|
+
cid: z.ZodString;
|
|
299
|
+
status: z.ZodEnum<["active", "revoked", "expired", "unavailable", "not_found"]>;
|
|
300
|
+
exists: z.ZodBoolean;
|
|
301
|
+
active: z.ZodBoolean;
|
|
302
|
+
revoked: z.ZodBoolean;
|
|
303
|
+
expired: z.ZodBoolean;
|
|
304
|
+
}, "strict", z.ZodTypeAny, {
|
|
305
|
+
status: "active" | "revoked" | "expired" | "unavailable" | "not_found";
|
|
306
|
+
active: boolean;
|
|
307
|
+
revoked: boolean;
|
|
308
|
+
cid: string;
|
|
309
|
+
expired: boolean;
|
|
310
|
+
exists: boolean;
|
|
311
|
+
}, {
|
|
312
|
+
status: "active" | "revoked" | "expired" | "unavailable" | "not_found";
|
|
313
|
+
active: boolean;
|
|
314
|
+
revoked: boolean;
|
|
315
|
+
cid: string;
|
|
316
|
+
expired: boolean;
|
|
317
|
+
exists: boolean;
|
|
318
|
+
}>, {
|
|
319
|
+
status: "active" | "revoked" | "expired" | "unavailable" | "not_found";
|
|
320
|
+
active: boolean;
|
|
321
|
+
revoked: boolean;
|
|
322
|
+
cid: string;
|
|
323
|
+
expired: boolean;
|
|
324
|
+
exists: boolean;
|
|
325
|
+
}, {
|
|
326
|
+
status: "active" | "revoked" | "expired" | "unavailable" | "not_found";
|
|
327
|
+
active: boolean;
|
|
328
|
+
revoked: boolean;
|
|
329
|
+
cid: string;
|
|
330
|
+
expired: boolean;
|
|
331
|
+
exists: boolean;
|
|
332
|
+
}>;
|
|
333
|
+
type DelegationStatus = z.infer<typeof DelegationStatusSchema>;
|
|
334
|
+
declare const DelegationRevocationReceiptSchema: z.ZodObject<{
|
|
335
|
+
revoked: z.ZodLiteral<true>;
|
|
336
|
+
cid: z.ZodString;
|
|
337
|
+
}, "strict", z.ZodTypeAny, {
|
|
338
|
+
revoked: true;
|
|
339
|
+
cid: string;
|
|
340
|
+
}, {
|
|
341
|
+
revoked: true;
|
|
342
|
+
cid: string;
|
|
343
|
+
}>;
|
|
344
|
+
type DelegationRevocationReceipt = z.infer<typeof DelegationRevocationReceiptSchema>;
|
|
345
|
+
declare const AccountDelegationResourceSchema: z.ZodObject<{
|
|
346
|
+
resource: z.ZodString;
|
|
347
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
348
|
+
caveats: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
349
|
+
}, "strict", z.ZodTypeAny, {
|
|
350
|
+
actions: string[];
|
|
351
|
+
caveats: Record<string, unknown>[];
|
|
352
|
+
resource: string;
|
|
353
|
+
}, {
|
|
354
|
+
actions: string[];
|
|
355
|
+
caveats: Record<string, unknown>[];
|
|
356
|
+
resource: string;
|
|
357
|
+
}>;
|
|
358
|
+
declare const AccountDelegationRecordSchema: z.ZodObject<{
|
|
359
|
+
cid: z.ZodString;
|
|
360
|
+
direction: z.ZodEnum<["granted", "received"]>;
|
|
361
|
+
delegatorDid: z.ZodString;
|
|
362
|
+
delegateDid: z.ZodString;
|
|
363
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
364
|
+
resource: z.ZodString;
|
|
365
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
366
|
+
caveats: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
367
|
+
}, "strict", z.ZodTypeAny, {
|
|
368
|
+
actions: string[];
|
|
369
|
+
caveats: Record<string, unknown>[];
|
|
370
|
+
resource: string;
|
|
371
|
+
}, {
|
|
372
|
+
actions: string[];
|
|
373
|
+
caveats: Record<string, unknown>[];
|
|
374
|
+
resource: string;
|
|
375
|
+
}>, "many">;
|
|
376
|
+
parents: z.ZodArray<z.ZodString, "many">;
|
|
377
|
+
issuedAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
378
|
+
notBefore: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
379
|
+
expiresAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
380
|
+
status: z.ZodEnum<["active", "pending", "expired", "revoked", "ancestor_revoked"]>;
|
|
381
|
+
revokedAt: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>>;
|
|
382
|
+
revokedBy: z.ZodOptional<z.ZodString>;
|
|
383
|
+
revokedAncestorCid: z.ZodOptional<z.ZodString>;
|
|
384
|
+
}, "strict", z.ZodTypeAny, {
|
|
385
|
+
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
386
|
+
notBefore: Date | null;
|
|
387
|
+
resources: {
|
|
388
|
+
actions: string[];
|
|
389
|
+
caveats: Record<string, unknown>[];
|
|
390
|
+
resource: string;
|
|
391
|
+
}[];
|
|
392
|
+
issuedAt: Date | null;
|
|
393
|
+
expiresAt: Date | null;
|
|
394
|
+
cid: string;
|
|
395
|
+
direction: "received" | "granted";
|
|
396
|
+
delegatorDid: string;
|
|
397
|
+
delegateDid: string;
|
|
398
|
+
parents: string[];
|
|
399
|
+
revokedAt?: Date | null | undefined;
|
|
400
|
+
revokedBy?: string | undefined;
|
|
401
|
+
revokedAncestorCid?: string | undefined;
|
|
402
|
+
}, {
|
|
403
|
+
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
404
|
+
notBefore: string | null;
|
|
405
|
+
resources: {
|
|
406
|
+
actions: string[];
|
|
407
|
+
caveats: Record<string, unknown>[];
|
|
408
|
+
resource: string;
|
|
409
|
+
}[];
|
|
410
|
+
issuedAt: string | null;
|
|
411
|
+
expiresAt: string | null;
|
|
412
|
+
cid: string;
|
|
413
|
+
direction: "received" | "granted";
|
|
414
|
+
delegatorDid: string;
|
|
415
|
+
delegateDid: string;
|
|
416
|
+
parents: string[];
|
|
417
|
+
revokedAt?: string | null | undefined;
|
|
418
|
+
revokedBy?: string | undefined;
|
|
419
|
+
revokedAncestorCid?: string | undefined;
|
|
420
|
+
}>;
|
|
421
|
+
declare const AccountDelegationPageSchema: z.ZodObject<{
|
|
422
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
423
|
+
items: z.ZodArray<z.ZodObject<{
|
|
424
|
+
cid: z.ZodString;
|
|
425
|
+
direction: z.ZodEnum<["granted", "received"]>;
|
|
426
|
+
delegatorDid: z.ZodString;
|
|
427
|
+
delegateDid: z.ZodString;
|
|
428
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
429
|
+
resource: z.ZodString;
|
|
430
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
431
|
+
caveats: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
432
|
+
}, "strict", z.ZodTypeAny, {
|
|
433
|
+
actions: string[];
|
|
434
|
+
caveats: Record<string, unknown>[];
|
|
435
|
+
resource: string;
|
|
436
|
+
}, {
|
|
437
|
+
actions: string[];
|
|
438
|
+
caveats: Record<string, unknown>[];
|
|
439
|
+
resource: string;
|
|
440
|
+
}>, "many">;
|
|
441
|
+
parents: z.ZodArray<z.ZodString, "many">;
|
|
442
|
+
issuedAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
443
|
+
notBefore: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
444
|
+
expiresAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
|
|
445
|
+
status: z.ZodEnum<["active", "pending", "expired", "revoked", "ancestor_revoked"]>;
|
|
446
|
+
revokedAt: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>>;
|
|
447
|
+
revokedBy: z.ZodOptional<z.ZodString>;
|
|
448
|
+
revokedAncestorCid: z.ZodOptional<z.ZodString>;
|
|
449
|
+
}, "strict", z.ZodTypeAny, {
|
|
450
|
+
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
451
|
+
notBefore: Date | null;
|
|
452
|
+
resources: {
|
|
453
|
+
actions: string[];
|
|
454
|
+
caveats: Record<string, unknown>[];
|
|
455
|
+
resource: string;
|
|
456
|
+
}[];
|
|
457
|
+
issuedAt: Date | null;
|
|
458
|
+
expiresAt: Date | null;
|
|
459
|
+
cid: string;
|
|
460
|
+
direction: "received" | "granted";
|
|
461
|
+
delegatorDid: string;
|
|
462
|
+
delegateDid: string;
|
|
463
|
+
parents: string[];
|
|
464
|
+
revokedAt?: Date | null | undefined;
|
|
465
|
+
revokedBy?: string | undefined;
|
|
466
|
+
revokedAncestorCid?: string | undefined;
|
|
467
|
+
}, {
|
|
468
|
+
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
469
|
+
notBefore: string | null;
|
|
470
|
+
resources: {
|
|
471
|
+
actions: string[];
|
|
472
|
+
caveats: Record<string, unknown>[];
|
|
473
|
+
resource: string;
|
|
474
|
+
}[];
|
|
475
|
+
issuedAt: string | null;
|
|
476
|
+
expiresAt: string | null;
|
|
477
|
+
cid: string;
|
|
478
|
+
direction: "received" | "granted";
|
|
479
|
+
delegatorDid: string;
|
|
480
|
+
delegateDid: string;
|
|
481
|
+
parents: string[];
|
|
482
|
+
revokedAt?: string | null | undefined;
|
|
483
|
+
revokedBy?: string | undefined;
|
|
484
|
+
revokedAncestorCid?: string | undefined;
|
|
485
|
+
}>, "many">;
|
|
486
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
487
|
+
}, "strict", z.ZodTypeAny, {
|
|
488
|
+
schemaVersion: 2;
|
|
489
|
+
items: {
|
|
490
|
+
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
491
|
+
notBefore: Date | null;
|
|
492
|
+
resources: {
|
|
493
|
+
actions: string[];
|
|
494
|
+
caveats: Record<string, unknown>[];
|
|
495
|
+
resource: string;
|
|
496
|
+
}[];
|
|
497
|
+
issuedAt: Date | null;
|
|
498
|
+
expiresAt: Date | null;
|
|
499
|
+
cid: string;
|
|
500
|
+
direction: "received" | "granted";
|
|
501
|
+
delegatorDid: string;
|
|
502
|
+
delegateDid: string;
|
|
503
|
+
parents: string[];
|
|
504
|
+
revokedAt?: Date | null | undefined;
|
|
505
|
+
revokedBy?: string | undefined;
|
|
506
|
+
revokedAncestorCid?: string | undefined;
|
|
507
|
+
}[];
|
|
508
|
+
nextCursor?: string | undefined;
|
|
509
|
+
}, {
|
|
510
|
+
schemaVersion: 2;
|
|
511
|
+
items: {
|
|
512
|
+
status: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked";
|
|
513
|
+
notBefore: string | null;
|
|
514
|
+
resources: {
|
|
515
|
+
actions: string[];
|
|
516
|
+
caveats: Record<string, unknown>[];
|
|
517
|
+
resource: string;
|
|
518
|
+
}[];
|
|
519
|
+
issuedAt: string | null;
|
|
520
|
+
expiresAt: string | null;
|
|
521
|
+
cid: string;
|
|
522
|
+
direction: "received" | "granted";
|
|
523
|
+
delegatorDid: string;
|
|
524
|
+
delegateDid: string;
|
|
525
|
+
parents: string[];
|
|
526
|
+
revokedAt?: string | null | undefined;
|
|
527
|
+
revokedBy?: string | undefined;
|
|
528
|
+
revokedAncestorCid?: string | undefined;
|
|
529
|
+
}[];
|
|
530
|
+
nextCursor?: string | undefined;
|
|
531
|
+
}>;
|
|
532
|
+
type AccountDelegationResource = z.infer<typeof AccountDelegationResourceSchema>;
|
|
533
|
+
type AccountDelegationRecord = z.infer<typeof AccountDelegationRecordSchema>;
|
|
534
|
+
type AccountDelegationPage = z.infer<typeof AccountDelegationPageSchema>;
|
|
535
|
+
declare const AccountDelegationQueryOptionsSchema: z.ZodObject<{
|
|
536
|
+
direction: z.ZodOptional<z.ZodEnum<["granted", "received", "all", "issued"]>>;
|
|
537
|
+
status: z.ZodOptional<z.ZodEnum<["active", "pending", "expired", "revoked", "ancestor_revoked"]>>;
|
|
538
|
+
space: z.ZodOptional<z.ZodString>;
|
|
539
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
540
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
541
|
+
}, "strict", z.ZodTypeAny, {
|
|
542
|
+
status?: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked" | undefined;
|
|
543
|
+
space?: string | undefined;
|
|
544
|
+
direction?: "received" | "all" | "granted" | "issued" | undefined;
|
|
545
|
+
limit?: number | undefined;
|
|
546
|
+
cursor?: string | undefined;
|
|
547
|
+
}, {
|
|
548
|
+
status?: "active" | "revoked" | "expired" | "pending" | "ancestor_revoked" | undefined;
|
|
549
|
+
space?: string | undefined;
|
|
550
|
+
direction?: "received" | "all" | "granted" | "issued" | undefined;
|
|
551
|
+
limit?: number | undefined;
|
|
552
|
+
cursor?: string | undefined;
|
|
553
|
+
}>;
|
|
554
|
+
type AccountDelegationQueryOptions = z.infer<typeof AccountDelegationQueryOptionsSchema>;
|
|
555
|
+
/**
|
|
556
|
+
* Entry in the capability registry mapping a capability to available keys.
|
|
557
|
+
*/
|
|
558
|
+
declare const CapabilityEntrySchema: z.ZodObject<{
|
|
559
|
+
/** Resource URI this capability applies to */
|
|
560
|
+
resource: z.ZodString;
|
|
561
|
+
/** Action this capability authorizes */
|
|
562
|
+
action: z.ZodString;
|
|
563
|
+
/** Keys that can exercise this capability, ordered by priority */
|
|
564
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
565
|
+
/** Unique identifier for this key */
|
|
566
|
+
id: z.ZodString;
|
|
567
|
+
/** DID associated with this key */
|
|
568
|
+
did: z.ZodString;
|
|
569
|
+
/** Type of key determining its authority level */
|
|
570
|
+
type: z.ZodEnum<["main", "session", "ingested"]>;
|
|
571
|
+
/** Private key in JWK format */
|
|
572
|
+
jwk: z.ZodOptional<z.ZodObject<{
|
|
573
|
+
/** Key type (e.g., "EC", "RSA", "OKP") */
|
|
574
|
+
kty: z.ZodString;
|
|
575
|
+
/** Curve for EC/OKP keys (e.g., "P-256", "Ed25519") */
|
|
576
|
+
crv: z.ZodOptional<z.ZodString>;
|
|
577
|
+
/** X coordinate for EC keys, public key for OKP */
|
|
578
|
+
x: z.ZodOptional<z.ZodString>;
|
|
579
|
+
/** Y coordinate for EC keys */
|
|
580
|
+
y: z.ZodOptional<z.ZodString>;
|
|
581
|
+
/** Private key value (d parameter) */
|
|
582
|
+
d: z.ZodOptional<z.ZodString>;
|
|
583
|
+
/** Public exponent for RSA keys */
|
|
584
|
+
e: z.ZodOptional<z.ZodString>;
|
|
585
|
+
/** Modulus for RSA keys */
|
|
586
|
+
n: z.ZodOptional<z.ZodString>;
|
|
587
|
+
/** Key ID */
|
|
588
|
+
kid: z.ZodOptional<z.ZodString>;
|
|
589
|
+
/** Algorithm */
|
|
590
|
+
alg: z.ZodOptional<z.ZodString>;
|
|
591
|
+
/** Key use (e.g., "sig", "enc") */
|
|
592
|
+
use: z.ZodOptional<z.ZodString>;
|
|
593
|
+
/** Key operations (e.g., ["sign", "verify"]) */
|
|
594
|
+
key_ops: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
595
|
+
}, "strip", z.ZodTypeAny, {
|
|
596
|
+
kty: string;
|
|
597
|
+
kid?: string | undefined;
|
|
598
|
+
alg?: string | undefined;
|
|
599
|
+
crv?: string | undefined;
|
|
600
|
+
x?: string | undefined;
|
|
601
|
+
y?: string | undefined;
|
|
602
|
+
d?: string | undefined;
|
|
603
|
+
e?: string | undefined;
|
|
604
|
+
n?: string | undefined;
|
|
605
|
+
use?: string | undefined;
|
|
606
|
+
key_ops?: string[] | undefined;
|
|
607
|
+
}, {
|
|
608
|
+
kty: string;
|
|
609
|
+
kid?: string | undefined;
|
|
610
|
+
alg?: string | undefined;
|
|
611
|
+
crv?: string | undefined;
|
|
612
|
+
x?: string | undefined;
|
|
613
|
+
y?: string | undefined;
|
|
614
|
+
d?: string | undefined;
|
|
615
|
+
e?: string | undefined;
|
|
616
|
+
n?: string | undefined;
|
|
617
|
+
use?: string | undefined;
|
|
618
|
+
key_ops?: string[] | undefined;
|
|
619
|
+
}>>;
|
|
620
|
+
/** Priority for key selection (lower = higher priority) */
|
|
621
|
+
priority: z.ZodNumber;
|
|
622
|
+
}, "strip", z.ZodTypeAny, {
|
|
623
|
+
type: "session" | "main" | "ingested";
|
|
624
|
+
did: string;
|
|
625
|
+
id: string;
|
|
626
|
+
priority: number;
|
|
627
|
+
jwk?: {
|
|
628
|
+
kty: string;
|
|
629
|
+
kid?: string | undefined;
|
|
630
|
+
alg?: string | undefined;
|
|
631
|
+
crv?: string | undefined;
|
|
632
|
+
x?: string | undefined;
|
|
633
|
+
y?: string | undefined;
|
|
634
|
+
d?: string | undefined;
|
|
635
|
+
e?: string | undefined;
|
|
636
|
+
n?: string | undefined;
|
|
637
|
+
use?: string | undefined;
|
|
638
|
+
key_ops?: string[] | undefined;
|
|
639
|
+
} | undefined;
|
|
640
|
+
}, {
|
|
641
|
+
type: "session" | "main" | "ingested";
|
|
642
|
+
did: string;
|
|
643
|
+
id: string;
|
|
644
|
+
priority: number;
|
|
645
|
+
jwk?: {
|
|
646
|
+
kty: string;
|
|
647
|
+
kid?: string | undefined;
|
|
648
|
+
alg?: string | undefined;
|
|
649
|
+
crv?: string | undefined;
|
|
650
|
+
x?: string | undefined;
|
|
651
|
+
y?: string | undefined;
|
|
652
|
+
d?: string | undefined;
|
|
653
|
+
e?: string | undefined;
|
|
654
|
+
n?: string | undefined;
|
|
655
|
+
use?: string | undefined;
|
|
656
|
+
key_ops?: string[] | undefined;
|
|
657
|
+
} | undefined;
|
|
658
|
+
}>, "many">;
|
|
659
|
+
/** The delegation that grants this capability */
|
|
660
|
+
delegation: z.ZodObject<{
|
|
661
|
+
/** Content identifier (CID) of the delegation */
|
|
662
|
+
cid: z.ZodString;
|
|
663
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
664
|
+
delegateDID: z.ZodString;
|
|
665
|
+
/** Space ID this delegation applies to */
|
|
666
|
+
spaceId: z.ZodString;
|
|
667
|
+
/** Resource path this delegation grants access to */
|
|
668
|
+
path: z.ZodString;
|
|
669
|
+
/** Actions this delegation authorizes */
|
|
670
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
671
|
+
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
672
|
+
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
673
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
674
|
+
expiry: z.ZodDate;
|
|
675
|
+
/** Whether this delegation has been revoked */
|
|
676
|
+
isRevoked: z.ZodBoolean;
|
|
677
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
678
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
679
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
680
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
681
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
682
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
683
|
+
/** Whether sub-delegation is allowed */
|
|
684
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
685
|
+
/** Authorization header (UCAN bearer token) */
|
|
686
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
687
|
+
}, "strip", z.ZodTypeAny, {
|
|
688
|
+
path: string;
|
|
689
|
+
expiry: Date;
|
|
690
|
+
actions: string[];
|
|
691
|
+
spaceId: string;
|
|
692
|
+
cid: string;
|
|
693
|
+
delegateDID: string;
|
|
694
|
+
isRevoked: boolean;
|
|
695
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
696
|
+
createdAt?: Date | undefined;
|
|
697
|
+
delegatorDID?: string | undefined;
|
|
698
|
+
parentCid?: string | undefined;
|
|
699
|
+
allowSubDelegation?: boolean | undefined;
|
|
700
|
+
authHeader?: string | undefined;
|
|
701
|
+
}, {
|
|
702
|
+
path: string;
|
|
703
|
+
expiry: Date;
|
|
704
|
+
actions: string[];
|
|
705
|
+
spaceId: string;
|
|
706
|
+
cid: string;
|
|
707
|
+
delegateDID: string;
|
|
708
|
+
isRevoked: boolean;
|
|
709
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
710
|
+
createdAt?: Date | undefined;
|
|
711
|
+
delegatorDID?: string | undefined;
|
|
712
|
+
parentCid?: string | undefined;
|
|
713
|
+
allowSubDelegation?: boolean | undefined;
|
|
714
|
+
authHeader?: string | undefined;
|
|
715
|
+
}>;
|
|
716
|
+
/** When this capability expires (accepts Date or ISO string from JSON) */
|
|
717
|
+
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
718
|
+
}, "strip", z.ZodTypeAny, {
|
|
719
|
+
keys: {
|
|
720
|
+
type: "session" | "main" | "ingested";
|
|
721
|
+
did: string;
|
|
722
|
+
id: string;
|
|
723
|
+
priority: number;
|
|
724
|
+
jwk?: {
|
|
725
|
+
kty: string;
|
|
726
|
+
kid?: string | undefined;
|
|
727
|
+
alg?: string | undefined;
|
|
728
|
+
crv?: string | undefined;
|
|
729
|
+
x?: string | undefined;
|
|
730
|
+
y?: string | undefined;
|
|
731
|
+
d?: string | undefined;
|
|
732
|
+
e?: string | undefined;
|
|
733
|
+
n?: string | undefined;
|
|
734
|
+
use?: string | undefined;
|
|
735
|
+
key_ops?: string[] | undefined;
|
|
736
|
+
} | undefined;
|
|
737
|
+
}[];
|
|
738
|
+
delegation: {
|
|
739
|
+
path: string;
|
|
740
|
+
expiry: Date;
|
|
741
|
+
actions: string[];
|
|
742
|
+
spaceId: string;
|
|
743
|
+
cid: string;
|
|
744
|
+
delegateDID: string;
|
|
745
|
+
isRevoked: boolean;
|
|
746
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
747
|
+
createdAt?: Date | undefined;
|
|
748
|
+
delegatorDID?: string | undefined;
|
|
749
|
+
parentCid?: string | undefined;
|
|
750
|
+
allowSubDelegation?: boolean | undefined;
|
|
751
|
+
authHeader?: string | undefined;
|
|
752
|
+
};
|
|
753
|
+
resource: string;
|
|
754
|
+
action: string;
|
|
755
|
+
expiresAt?: Date | undefined;
|
|
756
|
+
}, {
|
|
757
|
+
keys: {
|
|
758
|
+
type: "session" | "main" | "ingested";
|
|
759
|
+
did: string;
|
|
760
|
+
id: string;
|
|
761
|
+
priority: number;
|
|
762
|
+
jwk?: {
|
|
763
|
+
kty: string;
|
|
764
|
+
kid?: string | undefined;
|
|
765
|
+
alg?: string | undefined;
|
|
766
|
+
crv?: string | undefined;
|
|
767
|
+
x?: string | undefined;
|
|
768
|
+
y?: string | undefined;
|
|
769
|
+
d?: string | undefined;
|
|
770
|
+
e?: string | undefined;
|
|
771
|
+
n?: string | undefined;
|
|
772
|
+
use?: string | undefined;
|
|
773
|
+
key_ops?: string[] | undefined;
|
|
774
|
+
} | undefined;
|
|
775
|
+
}[];
|
|
776
|
+
delegation: {
|
|
777
|
+
path: string;
|
|
778
|
+
expiry: Date;
|
|
779
|
+
actions: string[];
|
|
780
|
+
spaceId: string;
|
|
781
|
+
cid: string;
|
|
782
|
+
delegateDID: string;
|
|
783
|
+
isRevoked: boolean;
|
|
784
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
785
|
+
createdAt?: Date | undefined;
|
|
786
|
+
delegatorDID?: string | undefined;
|
|
787
|
+
parentCid?: string | undefined;
|
|
788
|
+
allowSubDelegation?: boolean | undefined;
|
|
789
|
+
authHeader?: string | undefined;
|
|
790
|
+
};
|
|
791
|
+
resource: string;
|
|
792
|
+
action: string;
|
|
793
|
+
expiresAt?: Date | undefined;
|
|
794
|
+
}>;
|
|
795
|
+
type CapabilityEntry = z.infer<typeof CapabilityEntrySchema>;
|
|
796
|
+
/**
|
|
797
|
+
* Persistent record of a delegation stored in the system.
|
|
798
|
+
*/
|
|
799
|
+
declare const DelegationRecordSchema: z.ZodObject<{
|
|
800
|
+
/** Content identifier (CID) of the delegation */
|
|
801
|
+
cid: z.ZodString;
|
|
802
|
+
/** Space ID this delegation applies to */
|
|
803
|
+
spaceId: z.ZodString;
|
|
804
|
+
/** DID of the delegator (grantor) */
|
|
805
|
+
delegator: z.ZodString;
|
|
806
|
+
/** DID of the delegatee (recipient) */
|
|
807
|
+
delegatee: z.ZodString;
|
|
808
|
+
/** Key ID used to sign/exercise this delegation */
|
|
809
|
+
keyId: z.ZodOptional<z.ZodString>;
|
|
810
|
+
/** Resource path pattern this delegation grants access to */
|
|
811
|
+
path: z.ZodString;
|
|
812
|
+
/** Actions this delegation authorizes */
|
|
813
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
814
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
815
|
+
expiry: z.ZodOptional<z.ZodDate>;
|
|
816
|
+
/** When this delegation becomes valid (not before) (accepts Date or ISO string) */
|
|
817
|
+
notBefore: z.ZodOptional<z.ZodDate>;
|
|
818
|
+
/** Whether this delegation has been revoked */
|
|
819
|
+
isRevoked: z.ZodBoolean;
|
|
820
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
821
|
+
createdAt: z.ZodDate;
|
|
822
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
823
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
824
|
+
}, "strip", z.ZodTypeAny, {
|
|
825
|
+
path: string;
|
|
826
|
+
actions: string[];
|
|
827
|
+
createdAt: Date;
|
|
828
|
+
spaceId: string;
|
|
829
|
+
cid: string;
|
|
830
|
+
isRevoked: boolean;
|
|
831
|
+
delegator: string;
|
|
832
|
+
delegatee: string;
|
|
833
|
+
notBefore?: Date | undefined;
|
|
834
|
+
expiry?: Date | undefined;
|
|
835
|
+
parentCid?: string | undefined;
|
|
836
|
+
keyId?: string | undefined;
|
|
837
|
+
}, {
|
|
838
|
+
path: string;
|
|
839
|
+
actions: string[];
|
|
840
|
+
createdAt: Date;
|
|
841
|
+
spaceId: string;
|
|
842
|
+
cid: string;
|
|
843
|
+
isRevoked: boolean;
|
|
844
|
+
delegator: string;
|
|
845
|
+
delegatee: string;
|
|
846
|
+
notBefore?: Date | undefined;
|
|
847
|
+
expiry?: Date | undefined;
|
|
848
|
+
parentCid?: string | undefined;
|
|
849
|
+
keyId?: string | undefined;
|
|
850
|
+
}>;
|
|
851
|
+
type DelegationRecord = z.infer<typeof DelegationRecordSchema>;
|
|
852
|
+
/**
|
|
853
|
+
* Parameters for creating a new delegation.
|
|
854
|
+
*/
|
|
855
|
+
declare const CreateDelegationParamsSchema: z.ZodObject<{
|
|
856
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
857
|
+
delegateDID: z.ZodString;
|
|
858
|
+
/** Resource path this delegation grants access to */
|
|
859
|
+
path: z.ZodString;
|
|
860
|
+
/** Actions to authorize */
|
|
861
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
862
|
+
/** When this delegation expires (accepts Date or ISO string) */
|
|
863
|
+
expiry: z.ZodOptional<z.ZodDate>;
|
|
864
|
+
/** Whether to disable sub-delegation */
|
|
865
|
+
disableSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
866
|
+
/** Optional statement for the SIWE message */
|
|
867
|
+
statement: z.ZodOptional<z.ZodString>;
|
|
868
|
+
}, "strip", z.ZodTypeAny, {
|
|
869
|
+
path: string;
|
|
870
|
+
actions: string[];
|
|
871
|
+
delegateDID: string;
|
|
872
|
+
statement?: string | undefined;
|
|
873
|
+
expiry?: Date | undefined;
|
|
874
|
+
disableSubDelegation?: boolean | undefined;
|
|
875
|
+
}, {
|
|
876
|
+
path: string;
|
|
877
|
+
actions: string[];
|
|
878
|
+
delegateDID: string;
|
|
879
|
+
statement?: string | undefined;
|
|
880
|
+
expiry?: Date | undefined;
|
|
881
|
+
disableSubDelegation?: boolean | undefined;
|
|
882
|
+
}>;
|
|
883
|
+
type CreateDelegationParams = z.infer<typeof CreateDelegationParamsSchema>;
|
|
884
|
+
/**
|
|
885
|
+
* A chain of delegations from root to leaf (array format).
|
|
886
|
+
*/
|
|
887
|
+
declare const DelegationChainSchema: z.ZodArray<z.ZodObject<{
|
|
888
|
+
/** Content identifier (CID) of the delegation */
|
|
889
|
+
cid: z.ZodString;
|
|
890
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
891
|
+
delegateDID: z.ZodString;
|
|
892
|
+
/** Space ID this delegation applies to */
|
|
893
|
+
spaceId: z.ZodString;
|
|
894
|
+
/** Resource path this delegation grants access to */
|
|
895
|
+
path: z.ZodString;
|
|
896
|
+
/** Actions this delegation authorizes */
|
|
897
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
898
|
+
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
899
|
+
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
900
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
901
|
+
expiry: z.ZodDate;
|
|
902
|
+
/** Whether this delegation has been revoked */
|
|
903
|
+
isRevoked: z.ZodBoolean;
|
|
904
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
905
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
906
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
907
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
908
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
909
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
910
|
+
/** Whether sub-delegation is allowed */
|
|
911
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
912
|
+
/** Authorization header (UCAN bearer token) */
|
|
913
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
914
|
+
}, "strip", z.ZodTypeAny, {
|
|
915
|
+
path: string;
|
|
916
|
+
expiry: Date;
|
|
917
|
+
actions: string[];
|
|
918
|
+
spaceId: string;
|
|
919
|
+
cid: string;
|
|
920
|
+
delegateDID: string;
|
|
921
|
+
isRevoked: boolean;
|
|
922
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
923
|
+
createdAt?: Date | undefined;
|
|
924
|
+
delegatorDID?: string | undefined;
|
|
925
|
+
parentCid?: string | undefined;
|
|
926
|
+
allowSubDelegation?: boolean | undefined;
|
|
927
|
+
authHeader?: string | undefined;
|
|
928
|
+
}, {
|
|
929
|
+
path: string;
|
|
930
|
+
expiry: Date;
|
|
931
|
+
actions: string[];
|
|
932
|
+
spaceId: string;
|
|
933
|
+
cid: string;
|
|
934
|
+
delegateDID: string;
|
|
935
|
+
isRevoked: boolean;
|
|
936
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
937
|
+
createdAt?: Date | undefined;
|
|
938
|
+
delegatorDID?: string | undefined;
|
|
939
|
+
parentCid?: string | undefined;
|
|
940
|
+
allowSubDelegation?: boolean | undefined;
|
|
941
|
+
authHeader?: string | undefined;
|
|
942
|
+
}>, "many">;
|
|
943
|
+
type DelegationChain = z.infer<typeof DelegationChainSchema>;
|
|
944
|
+
/**
|
|
945
|
+
* Structured delegation chain (v2 spec).
|
|
946
|
+
*/
|
|
947
|
+
declare const DelegationChainV2Schema: z.ZodObject<{
|
|
948
|
+
/** The root delegation from the original authority */
|
|
949
|
+
root: z.ZodObject<{
|
|
950
|
+
/** Content identifier (CID) of the delegation */
|
|
951
|
+
cid: z.ZodString;
|
|
952
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
953
|
+
delegateDID: z.ZodString;
|
|
954
|
+
/** Space ID this delegation applies to */
|
|
955
|
+
spaceId: z.ZodString;
|
|
956
|
+
/** Resource path this delegation grants access to */
|
|
957
|
+
path: z.ZodString;
|
|
958
|
+
/** Actions this delegation authorizes */
|
|
959
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
960
|
+
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
961
|
+
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
962
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
963
|
+
expiry: z.ZodDate;
|
|
964
|
+
/** Whether this delegation has been revoked */
|
|
965
|
+
isRevoked: z.ZodBoolean;
|
|
966
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
967
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
968
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
969
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
970
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
971
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
972
|
+
/** Whether sub-delegation is allowed */
|
|
973
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
974
|
+
/** Authorization header (UCAN bearer token) */
|
|
975
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
976
|
+
}, "strip", z.ZodTypeAny, {
|
|
977
|
+
path: string;
|
|
978
|
+
expiry: Date;
|
|
979
|
+
actions: string[];
|
|
980
|
+
spaceId: string;
|
|
981
|
+
cid: string;
|
|
982
|
+
delegateDID: string;
|
|
983
|
+
isRevoked: boolean;
|
|
984
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
985
|
+
createdAt?: Date | undefined;
|
|
986
|
+
delegatorDID?: string | undefined;
|
|
987
|
+
parentCid?: string | undefined;
|
|
988
|
+
allowSubDelegation?: boolean | undefined;
|
|
989
|
+
authHeader?: string | undefined;
|
|
990
|
+
}, {
|
|
991
|
+
path: string;
|
|
992
|
+
expiry: Date;
|
|
993
|
+
actions: string[];
|
|
994
|
+
spaceId: string;
|
|
995
|
+
cid: string;
|
|
996
|
+
delegateDID: string;
|
|
997
|
+
isRevoked: boolean;
|
|
998
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
999
|
+
createdAt?: Date | undefined;
|
|
1000
|
+
delegatorDID?: string | undefined;
|
|
1001
|
+
parentCid?: string | undefined;
|
|
1002
|
+
allowSubDelegation?: boolean | undefined;
|
|
1003
|
+
authHeader?: string | undefined;
|
|
1004
|
+
}>;
|
|
1005
|
+
/** Intermediate delegations in the chain (may be empty) */
|
|
1006
|
+
chain: z.ZodArray<z.ZodObject<{
|
|
1007
|
+
/** Content identifier (CID) of the delegation */
|
|
1008
|
+
cid: z.ZodString;
|
|
1009
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
1010
|
+
delegateDID: z.ZodString;
|
|
1011
|
+
/** Space ID this delegation applies to */
|
|
1012
|
+
spaceId: z.ZodString;
|
|
1013
|
+
/** Resource path this delegation grants access to */
|
|
1014
|
+
path: z.ZodString;
|
|
1015
|
+
/** Actions this delegation authorizes */
|
|
1016
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1017
|
+
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
1018
|
+
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
1019
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1020
|
+
expiry: z.ZodDate;
|
|
1021
|
+
/** Whether this delegation has been revoked */
|
|
1022
|
+
isRevoked: z.ZodBoolean;
|
|
1023
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
1024
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1025
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1026
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1027
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
1028
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
1029
|
+
/** Whether sub-delegation is allowed */
|
|
1030
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1031
|
+
/** Authorization header (UCAN bearer token) */
|
|
1032
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
1033
|
+
}, "strip", z.ZodTypeAny, {
|
|
1034
|
+
path: string;
|
|
1035
|
+
expiry: Date;
|
|
1036
|
+
actions: string[];
|
|
1037
|
+
spaceId: string;
|
|
1038
|
+
cid: string;
|
|
1039
|
+
delegateDID: string;
|
|
1040
|
+
isRevoked: boolean;
|
|
1041
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1042
|
+
createdAt?: Date | undefined;
|
|
1043
|
+
delegatorDID?: string | undefined;
|
|
1044
|
+
parentCid?: string | undefined;
|
|
1045
|
+
allowSubDelegation?: boolean | undefined;
|
|
1046
|
+
authHeader?: string | undefined;
|
|
1047
|
+
}, {
|
|
1048
|
+
path: string;
|
|
1049
|
+
expiry: Date;
|
|
1050
|
+
actions: string[];
|
|
1051
|
+
spaceId: string;
|
|
1052
|
+
cid: string;
|
|
1053
|
+
delegateDID: string;
|
|
1054
|
+
isRevoked: boolean;
|
|
1055
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1056
|
+
createdAt?: Date | undefined;
|
|
1057
|
+
delegatorDID?: string | undefined;
|
|
1058
|
+
parentCid?: string | undefined;
|
|
1059
|
+
allowSubDelegation?: boolean | undefined;
|
|
1060
|
+
authHeader?: string | undefined;
|
|
1061
|
+
}>, "many">;
|
|
1062
|
+
/** The final delegation to the current user */
|
|
1063
|
+
leaf: z.ZodObject<{
|
|
1064
|
+
/** Content identifier (CID) of the delegation */
|
|
1065
|
+
cid: z.ZodString;
|
|
1066
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
1067
|
+
delegateDID: z.ZodString;
|
|
1068
|
+
/** Space ID this delegation applies to */
|
|
1069
|
+
spaceId: z.ZodString;
|
|
1070
|
+
/** Resource path this delegation grants access to */
|
|
1071
|
+
path: z.ZodString;
|
|
1072
|
+
/** Actions this delegation authorizes */
|
|
1073
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1074
|
+
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
1075
|
+
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
1076
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1077
|
+
expiry: z.ZodDate;
|
|
1078
|
+
/** Whether this delegation has been revoked */
|
|
1079
|
+
isRevoked: z.ZodBoolean;
|
|
1080
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
1081
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1082
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1083
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1084
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
1085
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
1086
|
+
/** Whether sub-delegation is allowed */
|
|
1087
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1088
|
+
/** Authorization header (UCAN bearer token) */
|
|
1089
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
1090
|
+
}, "strip", z.ZodTypeAny, {
|
|
1091
|
+
path: string;
|
|
1092
|
+
expiry: Date;
|
|
1093
|
+
actions: string[];
|
|
1094
|
+
spaceId: string;
|
|
1095
|
+
cid: string;
|
|
1096
|
+
delegateDID: string;
|
|
1097
|
+
isRevoked: boolean;
|
|
1098
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1099
|
+
createdAt?: Date | undefined;
|
|
1100
|
+
delegatorDID?: string | undefined;
|
|
1101
|
+
parentCid?: string | undefined;
|
|
1102
|
+
allowSubDelegation?: boolean | undefined;
|
|
1103
|
+
authHeader?: string | undefined;
|
|
1104
|
+
}, {
|
|
1105
|
+
path: string;
|
|
1106
|
+
expiry: Date;
|
|
1107
|
+
actions: string[];
|
|
1108
|
+
spaceId: string;
|
|
1109
|
+
cid: string;
|
|
1110
|
+
delegateDID: string;
|
|
1111
|
+
isRevoked: boolean;
|
|
1112
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1113
|
+
createdAt?: Date | undefined;
|
|
1114
|
+
delegatorDID?: string | undefined;
|
|
1115
|
+
parentCid?: string | undefined;
|
|
1116
|
+
allowSubDelegation?: boolean | undefined;
|
|
1117
|
+
authHeader?: string | undefined;
|
|
1118
|
+
}>;
|
|
1119
|
+
}, "strip", z.ZodTypeAny, {
|
|
1120
|
+
root: {
|
|
1121
|
+
path: string;
|
|
1122
|
+
expiry: Date;
|
|
1123
|
+
actions: string[];
|
|
1124
|
+
spaceId: string;
|
|
1125
|
+
cid: string;
|
|
1126
|
+
delegateDID: string;
|
|
1127
|
+
isRevoked: boolean;
|
|
1128
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1129
|
+
createdAt?: Date | undefined;
|
|
1130
|
+
delegatorDID?: string | undefined;
|
|
1131
|
+
parentCid?: string | undefined;
|
|
1132
|
+
allowSubDelegation?: boolean | undefined;
|
|
1133
|
+
authHeader?: string | undefined;
|
|
1134
|
+
};
|
|
1135
|
+
chain: {
|
|
1136
|
+
path: string;
|
|
1137
|
+
expiry: Date;
|
|
1138
|
+
actions: string[];
|
|
1139
|
+
spaceId: string;
|
|
1140
|
+
cid: string;
|
|
1141
|
+
delegateDID: string;
|
|
1142
|
+
isRevoked: boolean;
|
|
1143
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1144
|
+
createdAt?: Date | undefined;
|
|
1145
|
+
delegatorDID?: string | undefined;
|
|
1146
|
+
parentCid?: string | undefined;
|
|
1147
|
+
allowSubDelegation?: boolean | undefined;
|
|
1148
|
+
authHeader?: string | undefined;
|
|
1149
|
+
}[];
|
|
1150
|
+
leaf: {
|
|
1151
|
+
path: string;
|
|
1152
|
+
expiry: Date;
|
|
1153
|
+
actions: string[];
|
|
1154
|
+
spaceId: string;
|
|
1155
|
+
cid: string;
|
|
1156
|
+
delegateDID: string;
|
|
1157
|
+
isRevoked: boolean;
|
|
1158
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1159
|
+
createdAt?: Date | undefined;
|
|
1160
|
+
delegatorDID?: string | undefined;
|
|
1161
|
+
parentCid?: string | undefined;
|
|
1162
|
+
allowSubDelegation?: boolean | undefined;
|
|
1163
|
+
authHeader?: string | undefined;
|
|
1164
|
+
};
|
|
1165
|
+
}, {
|
|
1166
|
+
root: {
|
|
1167
|
+
path: string;
|
|
1168
|
+
expiry: Date;
|
|
1169
|
+
actions: string[];
|
|
1170
|
+
spaceId: string;
|
|
1171
|
+
cid: string;
|
|
1172
|
+
delegateDID: string;
|
|
1173
|
+
isRevoked: boolean;
|
|
1174
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1175
|
+
createdAt?: Date | undefined;
|
|
1176
|
+
delegatorDID?: string | undefined;
|
|
1177
|
+
parentCid?: string | undefined;
|
|
1178
|
+
allowSubDelegation?: boolean | undefined;
|
|
1179
|
+
authHeader?: string | undefined;
|
|
1180
|
+
};
|
|
1181
|
+
chain: {
|
|
1182
|
+
path: string;
|
|
1183
|
+
expiry: Date;
|
|
1184
|
+
actions: string[];
|
|
1185
|
+
spaceId: string;
|
|
1186
|
+
cid: string;
|
|
1187
|
+
delegateDID: string;
|
|
1188
|
+
isRevoked: boolean;
|
|
1189
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1190
|
+
createdAt?: Date | undefined;
|
|
1191
|
+
delegatorDID?: string | undefined;
|
|
1192
|
+
parentCid?: string | undefined;
|
|
1193
|
+
allowSubDelegation?: boolean | undefined;
|
|
1194
|
+
authHeader?: string | undefined;
|
|
1195
|
+
}[];
|
|
1196
|
+
leaf: {
|
|
1197
|
+
path: string;
|
|
1198
|
+
expiry: Date;
|
|
1199
|
+
actions: string[];
|
|
1200
|
+
spaceId: string;
|
|
1201
|
+
cid: string;
|
|
1202
|
+
delegateDID: string;
|
|
1203
|
+
isRevoked: boolean;
|
|
1204
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1205
|
+
createdAt?: Date | undefined;
|
|
1206
|
+
delegatorDID?: string | undefined;
|
|
1207
|
+
parentCid?: string | undefined;
|
|
1208
|
+
allowSubDelegation?: boolean | undefined;
|
|
1209
|
+
authHeader?: string | undefined;
|
|
1210
|
+
};
|
|
1211
|
+
}>;
|
|
1212
|
+
type DelegationChainV2 = z.infer<typeof DelegationChainV2Schema>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Direction of delegation to filter by.
|
|
1215
|
+
*/
|
|
1216
|
+
declare const DelegationDirectionSchema: z.ZodEnum<["granted", "received", "all"]>;
|
|
1217
|
+
type DelegationDirection = z.infer<typeof DelegationDirectionSchema>;
|
|
1218
|
+
/**
|
|
1219
|
+
* Filters for listing delegations.
|
|
1220
|
+
*/
|
|
1221
|
+
declare const DelegationFiltersSchema: z.ZodObject<{
|
|
1222
|
+
/** Filter by delegation direction */
|
|
1223
|
+
direction: z.ZodOptional<z.ZodEnum<["granted", "received", "all"]>>;
|
|
1224
|
+
/** Filter by resource path pattern */
|
|
1225
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1226
|
+
/** Filter by required actions */
|
|
1227
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1228
|
+
/** Include revoked delegations */
|
|
1229
|
+
includeRevoked: z.ZodOptional<z.ZodBoolean>;
|
|
1230
|
+
/** Filter by delegator DID */
|
|
1231
|
+
delegator: z.ZodOptional<z.ZodString>;
|
|
1232
|
+
/** Filter by delegatee DID */
|
|
1233
|
+
delegatee: z.ZodOptional<z.ZodString>;
|
|
1234
|
+
/** Only include delegations valid at this time */
|
|
1235
|
+
validAt: z.ZodOptional<z.ZodDate>;
|
|
1236
|
+
/** Maximum number of results to return */
|
|
1237
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
1238
|
+
/** Cursor for pagination */
|
|
1239
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
1240
|
+
}, "strip", z.ZodTypeAny, {
|
|
1241
|
+
path?: string | undefined;
|
|
1242
|
+
actions?: string[] | undefined;
|
|
1243
|
+
direction?: "received" | "all" | "granted" | undefined;
|
|
1244
|
+
limit?: number | undefined;
|
|
1245
|
+
cursor?: string | undefined;
|
|
1246
|
+
delegator?: string | undefined;
|
|
1247
|
+
delegatee?: string | undefined;
|
|
1248
|
+
includeRevoked?: boolean | undefined;
|
|
1249
|
+
validAt?: Date | undefined;
|
|
1250
|
+
}, {
|
|
1251
|
+
path?: string | undefined;
|
|
1252
|
+
actions?: string[] | undefined;
|
|
1253
|
+
direction?: "received" | "all" | "granted" | undefined;
|
|
1254
|
+
limit?: number | undefined;
|
|
1255
|
+
cursor?: string | undefined;
|
|
1256
|
+
delegator?: string | undefined;
|
|
1257
|
+
delegatee?: string | undefined;
|
|
1258
|
+
includeRevoked?: boolean | undefined;
|
|
1259
|
+
validAt?: Date | undefined;
|
|
1260
|
+
}>;
|
|
1261
|
+
type DelegationFilters = z.infer<typeof DelegationFiltersSchema>;
|
|
1262
|
+
/**
|
|
1263
|
+
* Type of space ownership.
|
|
1264
|
+
*/
|
|
1265
|
+
declare const SpaceOwnershipSchema: z.ZodEnum<["owned", "delegated"]>;
|
|
1266
|
+
type SpaceOwnership = z.infer<typeof SpaceOwnershipSchema>;
|
|
1267
|
+
/**
|
|
1268
|
+
* Information about a space the user has access to.
|
|
1269
|
+
*/
|
|
1270
|
+
declare const SpaceInfoSchema: z.ZodObject<{
|
|
1271
|
+
/** Space identifier */
|
|
1272
|
+
id: z.ZodString;
|
|
1273
|
+
/** Human-readable name for the space */
|
|
1274
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1275
|
+
/** DID of the space owner */
|
|
1276
|
+
owner: z.ZodString;
|
|
1277
|
+
/** Whether user owns or has delegated access */
|
|
1278
|
+
type: z.ZodEnum<["owned", "delegated"]>;
|
|
1279
|
+
/** Permissions the user has in this space */
|
|
1280
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1281
|
+
/** When the access expires (for delegated spaces) */
|
|
1282
|
+
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
1283
|
+
}, "strip", z.ZodTypeAny, {
|
|
1284
|
+
type: "owned" | "delegated";
|
|
1285
|
+
id: string;
|
|
1286
|
+
owner: string;
|
|
1287
|
+
expiresAt?: Date | undefined;
|
|
1288
|
+
name?: string | undefined;
|
|
1289
|
+
permissions?: string[] | undefined;
|
|
1290
|
+
}, {
|
|
1291
|
+
type: "owned" | "delegated";
|
|
1292
|
+
id: string;
|
|
1293
|
+
owner: string;
|
|
1294
|
+
expiresAt?: Date | undefined;
|
|
1295
|
+
name?: string | undefined;
|
|
1296
|
+
permissions?: string[] | undefined;
|
|
1297
|
+
}>;
|
|
1298
|
+
type SpaceInfo = z.infer<typeof SpaceInfoSchema>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Schema for encoding share link data.
|
|
1301
|
+
*/
|
|
1302
|
+
declare const ShareSchemaSchema: z.ZodEnum<["base64", "compact", "ipfs"]>;
|
|
1303
|
+
type ShareSchema = z.infer<typeof ShareSchemaSchema>;
|
|
1304
|
+
/**
|
|
1305
|
+
* A shareable link containing delegation credentials.
|
|
1306
|
+
*/
|
|
1307
|
+
declare const ShareLinkSchema: z.ZodObject<{
|
|
1308
|
+
/** Unique token identifying this share link */
|
|
1309
|
+
token: z.ZodString;
|
|
1310
|
+
/** Full URL for sharing */
|
|
1311
|
+
url: z.ZodString;
|
|
1312
|
+
/** The delegation this link grants access to */
|
|
1313
|
+
delegation: z.ZodObject<{
|
|
1314
|
+
/** Content identifier (CID) of the delegation */
|
|
1315
|
+
cid: z.ZodString;
|
|
1316
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
1317
|
+
delegateDID: z.ZodString;
|
|
1318
|
+
/** Space ID this delegation applies to */
|
|
1319
|
+
spaceId: z.ZodString;
|
|
1320
|
+
/** Resource path this delegation grants access to */
|
|
1321
|
+
path: z.ZodString;
|
|
1322
|
+
/** Actions this delegation authorizes */
|
|
1323
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1324
|
+
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
1325
|
+
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
1326
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1327
|
+
expiry: z.ZodDate;
|
|
1328
|
+
/** Whether this delegation has been revoked */
|
|
1329
|
+
isRevoked: z.ZodBoolean;
|
|
1330
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
1331
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1332
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1333
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1334
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
1335
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
1336
|
+
/** Whether sub-delegation is allowed */
|
|
1337
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1338
|
+
/** Authorization header (UCAN bearer token) */
|
|
1339
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
1340
|
+
}, "strip", z.ZodTypeAny, {
|
|
1341
|
+
path: string;
|
|
1342
|
+
expiry: Date;
|
|
1343
|
+
actions: string[];
|
|
1344
|
+
spaceId: string;
|
|
1345
|
+
cid: string;
|
|
1346
|
+
delegateDID: string;
|
|
1347
|
+
isRevoked: boolean;
|
|
1348
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1349
|
+
createdAt?: Date | undefined;
|
|
1350
|
+
delegatorDID?: string | undefined;
|
|
1351
|
+
parentCid?: string | undefined;
|
|
1352
|
+
allowSubDelegation?: boolean | undefined;
|
|
1353
|
+
authHeader?: string | undefined;
|
|
1354
|
+
}, {
|
|
1355
|
+
path: string;
|
|
1356
|
+
expiry: Date;
|
|
1357
|
+
actions: string[];
|
|
1358
|
+
spaceId: string;
|
|
1359
|
+
cid: string;
|
|
1360
|
+
delegateDID: string;
|
|
1361
|
+
isRevoked: boolean;
|
|
1362
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1363
|
+
createdAt?: Date | undefined;
|
|
1364
|
+
delegatorDID?: string | undefined;
|
|
1365
|
+
parentCid?: string | undefined;
|
|
1366
|
+
allowSubDelegation?: boolean | undefined;
|
|
1367
|
+
authHeader?: string | undefined;
|
|
1368
|
+
}>;
|
|
1369
|
+
/** Encoding schema used for the link */
|
|
1370
|
+
schema: z.ZodEnum<["base64", "compact", "ipfs"]>;
|
|
1371
|
+
/** When this share link expires */
|
|
1372
|
+
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
1373
|
+
/** Human-readable description of what is being shared */
|
|
1374
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1375
|
+
}, "strip", z.ZodTypeAny, {
|
|
1376
|
+
schema: "base64" | "compact" | "ipfs";
|
|
1377
|
+
delegation: {
|
|
1378
|
+
path: string;
|
|
1379
|
+
expiry: Date;
|
|
1380
|
+
actions: string[];
|
|
1381
|
+
spaceId: string;
|
|
1382
|
+
cid: string;
|
|
1383
|
+
delegateDID: string;
|
|
1384
|
+
isRevoked: boolean;
|
|
1385
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1386
|
+
createdAt?: Date | undefined;
|
|
1387
|
+
delegatorDID?: string | undefined;
|
|
1388
|
+
parentCid?: string | undefined;
|
|
1389
|
+
allowSubDelegation?: boolean | undefined;
|
|
1390
|
+
authHeader?: string | undefined;
|
|
1391
|
+
};
|
|
1392
|
+
url: string;
|
|
1393
|
+
token: string;
|
|
1394
|
+
expiresAt?: Date | undefined;
|
|
1395
|
+
description?: string | undefined;
|
|
1396
|
+
}, {
|
|
1397
|
+
schema: "base64" | "compact" | "ipfs";
|
|
1398
|
+
delegation: {
|
|
1399
|
+
path: string;
|
|
1400
|
+
expiry: Date;
|
|
1401
|
+
actions: string[];
|
|
1402
|
+
spaceId: string;
|
|
1403
|
+
cid: string;
|
|
1404
|
+
delegateDID: string;
|
|
1405
|
+
isRevoked: boolean;
|
|
1406
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1407
|
+
createdAt?: Date | undefined;
|
|
1408
|
+
delegatorDID?: string | undefined;
|
|
1409
|
+
parentCid?: string | undefined;
|
|
1410
|
+
allowSubDelegation?: boolean | undefined;
|
|
1411
|
+
authHeader?: string | undefined;
|
|
1412
|
+
};
|
|
1413
|
+
url: string;
|
|
1414
|
+
token: string;
|
|
1415
|
+
expiresAt?: Date | undefined;
|
|
1416
|
+
description?: string | undefined;
|
|
1417
|
+
}>;
|
|
1418
|
+
type ShareLink = z.infer<typeof ShareLinkSchema>;
|
|
1419
|
+
type ShareLinkData<T = unknown> = {
|
|
1420
|
+
data: T;
|
|
1421
|
+
delegation: Delegation;
|
|
1422
|
+
spaceId: string;
|
|
1423
|
+
path: string;
|
|
1424
|
+
};
|
|
1425
|
+
/**
|
|
1426
|
+
* Options for ingesting an external delegation.
|
|
1427
|
+
*/
|
|
1428
|
+
declare const IngestOptionsSchema: z.ZodObject<{
|
|
1429
|
+
/** Whether to persist the delegation to storage */
|
|
1430
|
+
persist: z.ZodOptional<z.ZodBoolean>;
|
|
1431
|
+
/** Whether to validate the full delegation chain */
|
|
1432
|
+
validateChain: z.ZodOptional<z.ZodBoolean>;
|
|
1433
|
+
/** Name for the ingested key */
|
|
1434
|
+
keyName: z.ZodOptional<z.ZodString>;
|
|
1435
|
+
/** Whether to create a session key for this delegation */
|
|
1436
|
+
createSessionKey: z.ZodOptional<z.ZodBoolean>;
|
|
1437
|
+
/** Override the priority for the ingested key */
|
|
1438
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
1439
|
+
}, "strip", z.ZodTypeAny, {
|
|
1440
|
+
priority?: number | undefined;
|
|
1441
|
+
persist?: boolean | undefined;
|
|
1442
|
+
validateChain?: boolean | undefined;
|
|
1443
|
+
keyName?: string | undefined;
|
|
1444
|
+
createSessionKey?: boolean | undefined;
|
|
1445
|
+
}, {
|
|
1446
|
+
priority?: number | undefined;
|
|
1447
|
+
persist?: boolean | undefined;
|
|
1448
|
+
validateChain?: boolean | undefined;
|
|
1449
|
+
keyName?: string | undefined;
|
|
1450
|
+
createSessionKey?: boolean | undefined;
|
|
1451
|
+
}>;
|
|
1452
|
+
type IngestOptions = z.infer<typeof IngestOptionsSchema>;
|
|
1453
|
+
/**
|
|
1454
|
+
* Parameters for generating a share link.
|
|
1455
|
+
*/
|
|
1456
|
+
declare const GenerateShareParamsSchema: z.ZodObject<{
|
|
1457
|
+
/** Resource path to share */
|
|
1458
|
+
path: z.ZodString;
|
|
1459
|
+
/** Actions to authorize */
|
|
1460
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1461
|
+
/** When the share link expires */
|
|
1462
|
+
expiry: z.ZodOptional<z.ZodDate>;
|
|
1463
|
+
/** Encoding schema for the link */
|
|
1464
|
+
schema: z.ZodOptional<z.ZodEnum<["base64", "compact", "ipfs"]>>;
|
|
1465
|
+
/** Human-readable description */
|
|
1466
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1467
|
+
/** Base URL for the share link */
|
|
1468
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
1469
|
+
/**
|
|
1470
|
+
* Whether the recipient may re-delegate the share. Default `true`.
|
|
1471
|
+
* `false` issues a terminal delegation: the node refuses onward `/delegate`.
|
|
1472
|
+
* Without a session-key delegation that covers the path, `false` fails with PERMISSION_DENIED.
|
|
1473
|
+
* Receive such a share with `receive(link, { autoSubdelegate: false })`; the default auto-subdelegation is refused for it.
|
|
1474
|
+
*/
|
|
1475
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1476
|
+
}, "strip", z.ZodTypeAny, {
|
|
1477
|
+
path: string;
|
|
1478
|
+
description?: string | undefined;
|
|
1479
|
+
schema?: "base64" | "compact" | "ipfs" | undefined;
|
|
1480
|
+
expiry?: Date | undefined;
|
|
1481
|
+
actions?: string[] | undefined;
|
|
1482
|
+
allowSubDelegation?: boolean | undefined;
|
|
1483
|
+
baseUrl?: string | undefined;
|
|
1484
|
+
}, {
|
|
1485
|
+
path: string;
|
|
1486
|
+
description?: string | undefined;
|
|
1487
|
+
schema?: "base64" | "compact" | "ipfs" | undefined;
|
|
1488
|
+
expiry?: Date | undefined;
|
|
1489
|
+
actions?: string[] | undefined;
|
|
1490
|
+
allowSubDelegation?: boolean | undefined;
|
|
1491
|
+
baseUrl?: string | undefined;
|
|
1492
|
+
}>;
|
|
1493
|
+
type GenerateShareParams = z.infer<typeof GenerateShareParamsSchema>;
|
|
1494
|
+
/**
|
|
1495
|
+
* Signs invocations with the session's own did:key and no proof. The node
|
|
1496
|
+
* accepts these for listing the delegations that key issued and for revoking
|
|
1497
|
+
* a delegation that key is the delegator of.
|
|
1498
|
+
*/
|
|
1499
|
+
interface SessionInvocationSigner {
|
|
1500
|
+
/** The session key's bare did:key (no fragment). */
|
|
1501
|
+
did(): string;
|
|
1502
|
+
/**
|
|
1503
|
+
* Signs one short-lived invocation carrying exactly `attenuation` and no
|
|
1504
|
+
* proof; returns the `Authorization` header value.
|
|
1505
|
+
*/
|
|
1506
|
+
sign(attenuation: Readonly<Record<string, Readonly<Record<string, readonly unknown[]>>>>): Promise<string>;
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Configuration for DelegationManager.
|
|
1510
|
+
* Note: ServiceSession, InvokeFunction, and FetchFunction are external types.
|
|
1511
|
+
*/
|
|
1512
|
+
declare const DelegationManagerConfigSchema: z.ZodObject<{
|
|
1513
|
+
/** TinyCloud host URLs */
|
|
1514
|
+
hosts: z.ZodArray<z.ZodString, "many">;
|
|
1515
|
+
/** Account space used by account-wide delegation history queries */
|
|
1516
|
+
accountSpaceId: z.ZodOptional<z.ZodString>;
|
|
1517
|
+
/** Active session for authentication */
|
|
1518
|
+
session: z.ZodEffects<z.ZodUnknown, ServiceSession, unknown>;
|
|
1519
|
+
/** Platform-specific invoke function */
|
|
1520
|
+
invoke: z.ZodEffects<z.ZodUnknown, InvokeFunction, unknown>;
|
|
1521
|
+
/** Platform-specific invoke function for raw resource URIs */
|
|
1522
|
+
invokeAny: z.ZodOptional<z.ZodEffects<z.ZodUnknown, InvokeAnyFunction, unknown>>;
|
|
1523
|
+
/** Optional owner-signed authorization for direct CID revocation */
|
|
1524
|
+
signOwnerRevocation: z.ZodOptional<z.ZodType<(cid: string) => Promise<string>, z.ZodTypeDef, (cid: string) => Promise<string>>>;
|
|
1525
|
+
/** Optional signer for proofless invocations by the session's own did:key (issued-delegation list and revoke) */
|
|
1526
|
+
sessionInvocationSigner: z.ZodOptional<z.ZodType<SessionInvocationSigner, z.ZodTypeDef, SessionInvocationSigner>>;
|
|
1527
|
+
/** Optional custom fetch implementation */
|
|
1528
|
+
fetch: z.ZodOptional<z.ZodEffects<z.ZodUnknown, FetchFunction, unknown>>;
|
|
1529
|
+
}, "strip", z.ZodTypeAny, {
|
|
1530
|
+
session: ServiceSession;
|
|
1531
|
+
hosts: string[];
|
|
1532
|
+
invoke: InvokeFunction;
|
|
1533
|
+
invokeAny?: InvokeAnyFunction | undefined;
|
|
1534
|
+
accountSpaceId?: string | undefined;
|
|
1535
|
+
signOwnerRevocation?: ((cid: string) => Promise<string>) | undefined;
|
|
1536
|
+
sessionInvocationSigner?: SessionInvocationSigner | undefined;
|
|
1537
|
+
fetch?: FetchFunction | undefined;
|
|
1538
|
+
}, {
|
|
1539
|
+
hosts: string[];
|
|
1540
|
+
session?: unknown;
|
|
1541
|
+
invokeAny?: unknown;
|
|
1542
|
+
accountSpaceId?: string | undefined;
|
|
1543
|
+
invoke?: unknown;
|
|
1544
|
+
signOwnerRevocation?: ((cid: string) => Promise<string>) | undefined;
|
|
1545
|
+
sessionInvocationSigner?: SessionInvocationSigner | undefined;
|
|
1546
|
+
fetch?: unknown;
|
|
1547
|
+
}>;
|
|
1548
|
+
type DelegationManagerConfig = z.infer<typeof DelegationManagerConfigSchema>;
|
|
1549
|
+
/**
|
|
1550
|
+
* Provider interface for cryptographic key operations.
|
|
1551
|
+
*/
|
|
1552
|
+
declare const KeyProviderSchema: z.ZodObject<{
|
|
1553
|
+
/** Generate a new session key, returns key ID */
|
|
1554
|
+
createSessionKey: z.ZodEffects<z.ZodUnknown, (name: string) => Promise<string>, unknown>;
|
|
1555
|
+
/** Get JWK for a key */
|
|
1556
|
+
getJWK: z.ZodEffects<z.ZodUnknown, (keyId: string) => object, unknown>;
|
|
1557
|
+
/** Get DID for a key */
|
|
1558
|
+
getDID: z.ZodEffects<z.ZodUnknown, (keyId: string) => Promise<string>, unknown>;
|
|
1559
|
+
}, "strip", z.ZodTypeAny, {
|
|
1560
|
+
createSessionKey: (name: string) => Promise<string>;
|
|
1561
|
+
getJWK: (keyId: string) => object;
|
|
1562
|
+
getDID: (keyId: string) => Promise<string>;
|
|
1563
|
+
}, {
|
|
1564
|
+
createSessionKey?: unknown;
|
|
1565
|
+
getJWK?: unknown;
|
|
1566
|
+
getDID?: unknown;
|
|
1567
|
+
}>;
|
|
1568
|
+
type KeyProvider = z.infer<typeof KeyProviderSchema>;
|
|
1569
|
+
/**
|
|
1570
|
+
* Response from the delegation API.
|
|
1571
|
+
*/
|
|
1572
|
+
declare const DelegationApiResponseSchema: z.ZodObject<{
|
|
1573
|
+
/** SIWE message content */
|
|
1574
|
+
siwe: z.ZodString;
|
|
1575
|
+
/** Signature of the SIWE message */
|
|
1576
|
+
signature: z.ZodString;
|
|
1577
|
+
/** Delegation version */
|
|
1578
|
+
version: z.ZodNumber;
|
|
1579
|
+
/** CID of the created delegation */
|
|
1580
|
+
cid: z.ZodOptional<z.ZodString>;
|
|
1581
|
+
}, "strip", z.ZodTypeAny, {
|
|
1582
|
+
siwe: string;
|
|
1583
|
+
signature: string;
|
|
1584
|
+
version: number;
|
|
1585
|
+
cid?: string | undefined;
|
|
1586
|
+
}, {
|
|
1587
|
+
siwe: string;
|
|
1588
|
+
signature: string;
|
|
1589
|
+
version: number;
|
|
1590
|
+
cid?: string | undefined;
|
|
1591
|
+
}>;
|
|
1592
|
+
type DelegationApiResponse = z.infer<typeof DelegationApiResponseSchema>;
|
|
1593
|
+
/**
|
|
1594
|
+
* A single (service, space, path, actions) entry inside a
|
|
1595
|
+
* createDelegation WASM result.
|
|
1596
|
+
*
|
|
1597
|
+
* Mirrors the Rust `DelegatedResource` struct in
|
|
1598
|
+
* `tinycloud-sdk-wasm/src/session.rs`. Field names match the manifest
|
|
1599
|
+
* {@link PermissionEntry} shape so callers can reconstruct what they sent
|
|
1600
|
+
* without having to re-parse the UCAN.
|
|
1601
|
+
*
|
|
1602
|
+
* `service` is the short form (e.g. `"kv"`, `"sql"`) as returned by the
|
|
1603
|
+
* Rust layer. The SDK layer translates to the long form
|
|
1604
|
+
* (`"tinycloud.kv"`) when comparing against manifests.
|
|
1605
|
+
*/
|
|
1606
|
+
declare const DelegatedResourceSchema: z.ZodObject<{
|
|
1607
|
+
/** Short-form service name, e.g. "kv", "sql", "duckdb", "capabilities", "hooks". */
|
|
1608
|
+
service: z.ZodString;
|
|
1609
|
+
/** Full space id string, e.g. "tinycloud:pkh:eip155:1:0x....:default". */
|
|
1610
|
+
space: z.ZodString;
|
|
1611
|
+
/** Resource path; empty string when the resource URI had no path segment. */
|
|
1612
|
+
path: z.ZodString;
|
|
1613
|
+
/** Full-URN ability strings, e.g. ["tinycloud.kv/get", "tinycloud.kv/put"]. */
|
|
1614
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1615
|
+
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
1616
|
+
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
1617
|
+
}, "strip", z.ZodTypeAny, {
|
|
1618
|
+
path: string;
|
|
1619
|
+
space: string;
|
|
1620
|
+
actions: string[];
|
|
1621
|
+
service: string;
|
|
1622
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1623
|
+
}, {
|
|
1624
|
+
path: string;
|
|
1625
|
+
space: string;
|
|
1626
|
+
actions: string[];
|
|
1627
|
+
service: string;
|
|
1628
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1629
|
+
}>;
|
|
1630
|
+
type DelegatedResource = z.infer<typeof DelegatedResourceSchema>;
|
|
1631
|
+
/**
|
|
1632
|
+
* Input parameters for the createDelegation WASM function.
|
|
1633
|
+
*
|
|
1634
|
+
* A single call may encode multiple `(service, path, actions)` entries
|
|
1635
|
+
* via the `abilities` map — the underlying UCAN will contain one
|
|
1636
|
+
* attenuation entry per `(service, path)` pair, all signed by the same
|
|
1637
|
+
* session key in one blob.
|
|
1638
|
+
*
|
|
1639
|
+
* The `abilities` shape is identical to what `prepareSession` accepts
|
|
1640
|
+
* (`Record<shortService, Record<path, actionURNs[]>>`), so manifest
|
|
1641
|
+
* resolution can feed both sides from one data structure.
|
|
1642
|
+
*/
|
|
1643
|
+
declare const CreateDelegationWasmParamsSchema: z.ZodObject<{
|
|
1644
|
+
/** The session containing delegation credentials */
|
|
1645
|
+
session: z.ZodEffects<z.ZodUnknown, ServiceSession, unknown>;
|
|
1646
|
+
/** DID of the delegate */
|
|
1647
|
+
delegateDID: z.ZodString;
|
|
1648
|
+
/** Space ID this delegation applies to */
|
|
1649
|
+
spaceId: z.ZodString;
|
|
1650
|
+
/**
|
|
1651
|
+
* Multi-resource abilities map: short-service → path → full-URN actions.
|
|
1652
|
+
* Matches the shape accepted by `prepareSession`.
|
|
1653
|
+
*
|
|
1654
|
+
* Example:
|
|
1655
|
+
* ```
|
|
1656
|
+
* {
|
|
1657
|
+
* kv: {
|
|
1658
|
+
* "com.listen.app/": ["tinycloud.kv/get", "tinycloud.kv/put"]
|
|
1659
|
+
* },
|
|
1660
|
+
* sql: {
|
|
1661
|
+
* "com.listen.app/data.sqlite": ["tinycloud.sql/read"]
|
|
1662
|
+
* }
|
|
1663
|
+
* }
|
|
1664
|
+
* ```
|
|
1665
|
+
*/
|
|
1666
|
+
abilities: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
1667
|
+
/** Expiration time in seconds since Unix epoch */
|
|
1668
|
+
expirationSecs: z.ZodNumber;
|
|
1669
|
+
/** Optional not-before time in seconds since Unix epoch */
|
|
1670
|
+
notBeforeSecs: z.ZodOptional<z.ZodNumber>;
|
|
1671
|
+
/** Issue a terminal delegation: the node refuses onward delegation. Default `false`. */
|
|
1672
|
+
disableSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1673
|
+
}, "strip", z.ZodTypeAny, {
|
|
1674
|
+
abilities: Record<string, Record<string, string[]>>;
|
|
1675
|
+
session: ServiceSession;
|
|
1676
|
+
spaceId: string;
|
|
1677
|
+
delegateDID: string;
|
|
1678
|
+
expirationSecs: number;
|
|
1679
|
+
disableSubDelegation?: boolean | undefined;
|
|
1680
|
+
notBeforeSecs?: number | undefined;
|
|
1681
|
+
}, {
|
|
1682
|
+
abilities: Record<string, Record<string, string[]>>;
|
|
1683
|
+
spaceId: string;
|
|
1684
|
+
delegateDID: string;
|
|
1685
|
+
expirationSecs: number;
|
|
1686
|
+
session?: unknown;
|
|
1687
|
+
disableSubDelegation?: boolean | undefined;
|
|
1688
|
+
notBeforeSecs?: number | undefined;
|
|
1689
|
+
}>;
|
|
1690
|
+
type CreateDelegationWasmParams = z.infer<typeof CreateDelegationWasmParamsSchema>;
|
|
1691
|
+
/**
|
|
1692
|
+
* Result from the createDelegation WASM function.
|
|
1693
|
+
*
|
|
1694
|
+
* A single UCAN may cover multiple resources. The `resources` array
|
|
1695
|
+
* describes every `(service, space, path, actions)` entry granted, in
|
|
1696
|
+
* deterministic (service, path) lexicographic order (the Rust side sorts
|
|
1697
|
+
* the HashMap entries before signing).
|
|
1698
|
+
*/
|
|
1699
|
+
declare const CreateDelegationWasmResultSchema: z.ZodObject<{
|
|
1700
|
+
/** Base64url-encoded UCAN delegation */
|
|
1701
|
+
delegation: z.ZodString;
|
|
1702
|
+
/** CID of the delegation */
|
|
1703
|
+
cid: z.ZodString;
|
|
1704
|
+
/** DID of the delegate */
|
|
1705
|
+
delegateDID: z.ZodString;
|
|
1706
|
+
/** Expiration time */
|
|
1707
|
+
expiry: z.ZodDate;
|
|
1708
|
+
/**
|
|
1709
|
+
* All (service, space, path, actions) entries granted by this delegation.
|
|
1710
|
+
* Always non-empty on success.
|
|
1711
|
+
*/
|
|
1712
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
1713
|
+
/** Short-form service name, e.g. "kv", "sql", "duckdb", "capabilities", "hooks". */
|
|
1714
|
+
service: z.ZodString;
|
|
1715
|
+
/** Full space id string, e.g. "tinycloud:pkh:eip155:1:0x....:default". */
|
|
1716
|
+
space: z.ZodString;
|
|
1717
|
+
/** Resource path; empty string when the resource URI had no path segment. */
|
|
1718
|
+
path: z.ZodString;
|
|
1719
|
+
/** Full-URN ability strings, e.g. ["tinycloud.kv/get", "tinycloud.kv/put"]. */
|
|
1720
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1721
|
+
/** Exact ReCap caveats that constrain every action in this scope. */
|
|
1722
|
+
caveats: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
1723
|
+
}, "strip", z.ZodTypeAny, {
|
|
1724
|
+
path: string;
|
|
1725
|
+
space: string;
|
|
1726
|
+
actions: string[];
|
|
1727
|
+
service: string;
|
|
1728
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1729
|
+
}, {
|
|
1730
|
+
path: string;
|
|
1731
|
+
space: string;
|
|
1732
|
+
actions: string[];
|
|
1733
|
+
service: string;
|
|
1734
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1735
|
+
}>, "many">;
|
|
1736
|
+
}, "strip", z.ZodTypeAny, {
|
|
1737
|
+
resources: {
|
|
1738
|
+
path: string;
|
|
1739
|
+
space: string;
|
|
1740
|
+
actions: string[];
|
|
1741
|
+
service: string;
|
|
1742
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1743
|
+
}[];
|
|
1744
|
+
delegation: string;
|
|
1745
|
+
expiry: Date;
|
|
1746
|
+
cid: string;
|
|
1747
|
+
delegateDID: string;
|
|
1748
|
+
}, {
|
|
1749
|
+
resources: {
|
|
1750
|
+
path: string;
|
|
1751
|
+
space: string;
|
|
1752
|
+
actions: string[];
|
|
1753
|
+
service: string;
|
|
1754
|
+
caveats?: Record<string, unknown>[] | undefined;
|
|
1755
|
+
}[];
|
|
1756
|
+
delegation: string;
|
|
1757
|
+
expiry: Date;
|
|
1758
|
+
cid: string;
|
|
1759
|
+
delegateDID: string;
|
|
1760
|
+
}>;
|
|
1761
|
+
type CreateDelegationWasmResult = z.infer<typeof CreateDelegationWasmResultSchema>;
|
|
1762
|
+
|
|
1763
|
+
export { type AccountDelegationPage as A, type CapabilityEntry as C, type DelegationError as D, type GenerateShareParams as G, type IngestOptions as I, type JWK as J, type KeyInfo as K, type Result as R, type SessionInvocationSigner as S, type AccountDelegationQueryOptions as a, type AccountDelegationRecord as b, type AccountDelegationResource as c, type CreateDelegationParams as d, type CreateDelegationWasmParams as e, type CreateDelegationWasmResult as f, type DelegatedResource as g, type Delegation as h, type DelegationApiResponse as i, type DelegationChain as j, type DelegationChainV2 as k, type DelegationDirection as l, type DelegationErrorCode as m, DelegationErrorCodes as n, type DelegationFilters as o, type DelegationManagerConfig as p, type DelegationRecord as q, type DelegationRevocationReceipt as r, type DelegationStatus as s, type KeyProvider as t, type KeyType as u, type ShareLink as v, type ShareLinkData as w, type ShareSchema as x, type SpaceInfo as y, type SpaceOwnership as z };
|