@tinycloud/sdk-core 1.0.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/LICENSE.md +320 -0
- package/dist/TinyCloud.d.ts +206 -0
- package/dist/TinyCloud.d.ts.map +1 -0
- package/dist/TinyCloud.js +244 -0
- package/dist/TinyCloud.js.map +1 -0
- package/dist/TinyCloud.schema.d.ts +173 -0
- package/dist/TinyCloud.schema.d.ts.map +1 -0
- package/dist/TinyCloud.schema.js +136 -0
- package/dist/TinyCloud.schema.js.map +1 -0
- package/dist/TinyCloud.schema.test.d.ts +5 -0
- package/dist/TinyCloud.schema.test.d.ts.map +1 -0
- package/dist/TinyCloud.schema.test.js +286 -0
- package/dist/TinyCloud.schema.test.js.map +1 -0
- package/dist/authorization/CapabilityKeyRegistry.d.ts +317 -0
- package/dist/authorization/CapabilityKeyRegistry.d.ts.map +1 -0
- package/dist/authorization/CapabilityKeyRegistry.js +509 -0
- package/dist/authorization/CapabilityKeyRegistry.js.map +1 -0
- package/dist/authorization/authorization.schema.d.ts +233 -0
- package/dist/authorization/authorization.schema.d.ts.map +1 -0
- package/dist/authorization/authorization.schema.js +220 -0
- package/dist/authorization/authorization.schema.js.map +1 -0
- package/dist/authorization/authorization.schema.test.d.ts +5 -0
- package/dist/authorization/authorization.schema.test.d.ts.map +1 -0
- package/dist/authorization/authorization.schema.test.js +618 -0
- package/dist/authorization/authorization.schema.test.js.map +1 -0
- package/dist/authorization/index.d.ts +38 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/authorization/index.js +52 -0
- package/dist/authorization/index.js.map +1 -0
- package/dist/authorization/spaceCreation.d.ts +96 -0
- package/dist/authorization/spaceCreation.d.ts.map +1 -0
- package/dist/authorization/spaceCreation.js +35 -0
- package/dist/authorization/spaceCreation.js.map +1 -0
- package/dist/authorization/spaceCreation.schema.d.ts +67 -0
- package/dist/authorization/spaceCreation.schema.d.ts.map +1 -0
- package/dist/authorization/spaceCreation.schema.js +95 -0
- package/dist/authorization/spaceCreation.schema.js.map +1 -0
- package/dist/authorization/spaceCreation.schema.test.d.ts +5 -0
- package/dist/authorization/spaceCreation.schema.test.d.ts.map +1 -0
- package/dist/authorization/spaceCreation.schema.test.js +168 -0
- package/dist/authorization/spaceCreation.schema.test.js.map +1 -0
- package/dist/authorization/strategies.d.ts +134 -0
- package/dist/authorization/strategies.d.ts.map +1 -0
- package/dist/authorization/strategies.js +15 -0
- package/dist/authorization/strategies.js.map +1 -0
- package/dist/authorization/strategies.schema.d.ts +185 -0
- package/dist/authorization/strategies.schema.d.ts.map +1 -0
- package/dist/authorization/strategies.schema.js +147 -0
- package/dist/authorization/strategies.schema.js.map +1 -0
- package/dist/authorization/strategies.schema.test.d.ts +5 -0
- package/dist/authorization/strategies.schema.test.d.ts.map +1 -0
- package/dist/authorization/strategies.schema.test.js +253 -0
- package/dist/authorization/strategies.schema.test.js.map +1 -0
- package/dist/delegations/DelegationManager.d.ts +164 -0
- package/dist/delegations/DelegationManager.d.ts.map +1 -0
- package/dist/delegations/DelegationManager.js +428 -0
- package/dist/delegations/DelegationManager.js.map +1 -0
- package/dist/delegations/SharingService.d.ts +279 -0
- package/dist/delegations/SharingService.d.ts.map +1 -0
- package/dist/delegations/SharingService.js +558 -0
- package/dist/delegations/SharingService.js.map +1 -0
- package/dist/delegations/SharingService.schema.d.ts +401 -0
- package/dist/delegations/SharingService.schema.d.ts.map +1 -0
- package/dist/delegations/SharingService.schema.js +211 -0
- package/dist/delegations/SharingService.schema.js.map +1 -0
- package/dist/delegations/index.d.ts +38 -0
- package/dist/delegations/index.d.ts.map +1 -0
- package/dist/delegations/index.js +42 -0
- package/dist/delegations/index.js.map +1 -0
- package/dist/delegations/types.d.ts +13 -0
- package/dist/delegations/types.d.ts.map +1 -0
- package/dist/delegations/types.js +42 -0
- package/dist/delegations/types.js.map +1 -0
- package/dist/delegations/types.schema.d.ts +1641 -0
- package/dist/delegations/types.schema.d.ts.map +1 -0
- package/dist/delegations/types.schema.js +535 -0
- package/dist/delegations/types.schema.js.map +1 -0
- package/dist/delegations/types.schema.test.d.ts +5 -0
- package/dist/delegations/types.schema.test.d.ts.map +1 -0
- package/dist/delegations/types.schema.test.js +627 -0
- package/dist/delegations/types.schema.test.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/json-schema.d.ts +327 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +703 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/json-schema.test.d.ts +7 -0
- package/dist/json-schema.test.d.ts.map +1 -0
- package/dist/json-schema.test.js +365 -0
- package/dist/json-schema.test.js.map +1 -0
- package/dist/signer.d.ts +28 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/signer.js +2 -0
- package/dist/signer.js.map +1 -0
- package/dist/space.d.ts +53 -0
- package/dist/space.d.ts.map +1 -0
- package/dist/space.js +67 -0
- package/dist/space.js.map +1 -0
- package/dist/space.schema.d.ts +65 -0
- package/dist/space.schema.d.ts.map +1 -0
- package/dist/space.schema.js +65 -0
- package/dist/space.schema.js.map +1 -0
- package/dist/space.schema.test.d.ts +5 -0
- package/dist/space.schema.test.d.ts.map +1 -0
- package/dist/space.schema.test.js +148 -0
- package/dist/space.schema.test.js.map +1 -0
- package/dist/spaces/Space.d.ts +175 -0
- package/dist/spaces/Space.d.ts.map +1 -0
- package/dist/spaces/Space.js +84 -0
- package/dist/spaces/Space.js.map +1 -0
- package/dist/spaces/SpaceService.d.ts +271 -0
- package/dist/spaces/SpaceService.d.ts.map +1 -0
- package/dist/spaces/SpaceService.js +715 -0
- package/dist/spaces/SpaceService.js.map +1 -0
- package/dist/spaces/index.d.ts +11 -0
- package/dist/spaces/index.d.ts.map +1 -0
- package/dist/spaces/index.js +20 -0
- package/dist/spaces/index.js.map +1 -0
- package/dist/spaces/spaces.schema.d.ts +421 -0
- package/dist/spaces/spaces.schema.d.ts.map +1 -0
- package/dist/spaces/spaces.schema.js +342 -0
- package/dist/spaces/spaces.schema.js.map +1 -0
- package/dist/spaces/spaces.schema.test.d.ts +5 -0
- package/dist/spaces/spaces.schema.test.d.ts.map +1 -0
- package/dist/spaces/spaces.schema.test.js +471 -0
- package/dist/spaces/spaces.schema.test.js.map +1 -0
- package/dist/storage.d.ts +47 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +14 -0
- package/dist/storage.js.map +1 -0
- package/dist/storage.schema.d.ts +277 -0
- package/dist/storage.schema.d.ts.map +1 -0
- package/dist/storage.schema.js +185 -0
- package/dist/storage.schema.js.map +1 -0
- package/dist/storage.schema.test.d.ts +5 -0
- package/dist/storage.schema.test.d.ts.map +1 -0
- package/dist/storage.schema.test.js +346 -0
- package/dist/storage.schema.test.js.map +1 -0
- package/dist/userAuthorization.d.ts +99 -0
- package/dist/userAuthorization.d.ts.map +1 -0
- package/dist/userAuthorization.js +3 -0
- package/dist/userAuthorization.js.map +1 -0
- package/dist/userAuthorization.schema.d.ts +259 -0
- package/dist/userAuthorization.schema.d.ts.map +1 -0
- package/dist/userAuthorization.schema.js +175 -0
- package/dist/userAuthorization.schema.js.map +1 -0
- package/dist/userAuthorization.schema.test.d.ts +5 -0
- package/dist/userAuthorization.schema.test.d.ts.map +1 -0
- package/dist/userAuthorization.schema.test.js +356 -0
- package/dist/userAuthorization.schema.test.js.map +1 -0
- package/dist/version.d.ts +30 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +54 -0
- package/dist/version.js.map +1 -0
- package/dist/wasm-validation.d.ts +287 -0
- package/dist/wasm-validation.d.ts.map +1 -0
- package/dist/wasm-validation.js +219 -0
- package/dist/wasm-validation.js.map +1 -0
- package/dist/wasm-validation.test.d.ts +5 -0
- package/dist/wasm-validation.test.d.ts.map +1 -0
- package/dist/wasm-validation.test.js +233 -0
- package/dist/wasm-validation.test.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,1641 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for delegation management types.
|
|
3
|
+
*
|
|
4
|
+
* These schemas provide runtime validation for delegation, capability key management,
|
|
5
|
+
* and sharing link functionality. Types are derived from schemas using z.infer<>.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import type { FetchFunction, InvokeFunction, ServiceSession } from "@tinycloud/sdk-services";
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Result schema for a given data type and error type.
|
|
13
|
+
* Result types provide explicit error handling instead of throwing.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createResultSchema<T extends z.ZodTypeAny, E extends z.ZodTypeAny>(dataSchema: T, errorSchema: E): z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
|
|
16
|
+
ok: z.ZodLiteral<true>;
|
|
17
|
+
data: T;
|
|
18
|
+
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
19
|
+
ok: z.ZodLiteral<true>;
|
|
20
|
+
data: T;
|
|
21
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
|
|
22
|
+
ok: z.ZodLiteral<true>;
|
|
23
|
+
data: T;
|
|
24
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>, z.ZodObject<{
|
|
25
|
+
ok: z.ZodLiteral<false>;
|
|
26
|
+
error: E;
|
|
27
|
+
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
28
|
+
ok: z.ZodLiteral<false>;
|
|
29
|
+
error: E;
|
|
30
|
+
}>, any> extends infer T_3 ? { [k_2 in keyof T_3]: T_3[k_2]; } : never, z.baseObjectInputType<{
|
|
31
|
+
ok: z.ZodLiteral<false>;
|
|
32
|
+
error: E;
|
|
33
|
+
}> extends infer T_4 ? { [k_3 in keyof T_4]: T_4[k_3]; } : never>]>;
|
|
34
|
+
/**
|
|
35
|
+
* Result type pattern for delegation operations.
|
|
36
|
+
*/
|
|
37
|
+
export type Result<T, E = DelegationError> = {
|
|
38
|
+
ok: true;
|
|
39
|
+
data: T;
|
|
40
|
+
} | {
|
|
41
|
+
ok: false;
|
|
42
|
+
error: E;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* JSON Web Key representation for cryptographic keys.
|
|
46
|
+
* Follows the JWK specification (RFC 7517).
|
|
47
|
+
*/
|
|
48
|
+
export declare const JWKSchema: z.ZodObject<{
|
|
49
|
+
/** Key type (e.g., "EC", "RSA", "OKP") */
|
|
50
|
+
kty: z.ZodString;
|
|
51
|
+
/** Curve for EC/OKP keys (e.g., "P-256", "Ed25519") */
|
|
52
|
+
crv: z.ZodOptional<z.ZodString>;
|
|
53
|
+
/** X coordinate for EC keys, public key for OKP */
|
|
54
|
+
x: z.ZodOptional<z.ZodString>;
|
|
55
|
+
/** Y coordinate for EC keys */
|
|
56
|
+
y: z.ZodOptional<z.ZodString>;
|
|
57
|
+
/** Private key value (d parameter) */
|
|
58
|
+
d: z.ZodOptional<z.ZodString>;
|
|
59
|
+
/** Public exponent for RSA keys */
|
|
60
|
+
e: z.ZodOptional<z.ZodString>;
|
|
61
|
+
/** Modulus for RSA keys */
|
|
62
|
+
n: z.ZodOptional<z.ZodString>;
|
|
63
|
+
/** Key ID */
|
|
64
|
+
kid: z.ZodOptional<z.ZodString>;
|
|
65
|
+
/** Algorithm */
|
|
66
|
+
alg: z.ZodOptional<z.ZodString>;
|
|
67
|
+
/** Key use (e.g., "sig", "enc") */
|
|
68
|
+
use: z.ZodOptional<z.ZodString>;
|
|
69
|
+
/** Key operations (e.g., ["sign", "verify"]) */
|
|
70
|
+
key_ops: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
kty: string;
|
|
73
|
+
crv?: string | undefined;
|
|
74
|
+
x?: string | undefined;
|
|
75
|
+
y?: string | undefined;
|
|
76
|
+
d?: string | undefined;
|
|
77
|
+
e?: string | undefined;
|
|
78
|
+
n?: string | undefined;
|
|
79
|
+
kid?: string | undefined;
|
|
80
|
+
alg?: string | undefined;
|
|
81
|
+
use?: string | undefined;
|
|
82
|
+
key_ops?: string[] | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
kty: string;
|
|
85
|
+
crv?: string | undefined;
|
|
86
|
+
x?: string | undefined;
|
|
87
|
+
y?: string | undefined;
|
|
88
|
+
d?: string | undefined;
|
|
89
|
+
e?: string | undefined;
|
|
90
|
+
n?: string | undefined;
|
|
91
|
+
kid?: string | undefined;
|
|
92
|
+
alg?: string | undefined;
|
|
93
|
+
use?: string | undefined;
|
|
94
|
+
key_ops?: string[] | undefined;
|
|
95
|
+
}>;
|
|
96
|
+
export type JWK = z.infer<typeof JWKSchema>;
|
|
97
|
+
/**
|
|
98
|
+
* Type of key in the capability registry.
|
|
99
|
+
*/
|
|
100
|
+
export declare const KeyTypeSchema: z.ZodEnum<["main", "session", "ingested"]>;
|
|
101
|
+
export type KeyType = z.infer<typeof KeyTypeSchema>;
|
|
102
|
+
/**
|
|
103
|
+
* Information about a cryptographic key used for delegations.
|
|
104
|
+
*/
|
|
105
|
+
export declare const KeyInfoSchema: z.ZodObject<{
|
|
106
|
+
/** Unique identifier for this key */
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
/** DID associated with this key */
|
|
109
|
+
did: z.ZodString;
|
|
110
|
+
/** Type of key determining its authority level */
|
|
111
|
+
type: z.ZodEnum<["main", "session", "ingested"]>;
|
|
112
|
+
/** Private key in JWK format */
|
|
113
|
+
jwk: z.ZodOptional<z.ZodObject<{
|
|
114
|
+
/** Key type (e.g., "EC", "RSA", "OKP") */
|
|
115
|
+
kty: z.ZodString;
|
|
116
|
+
/** Curve for EC/OKP keys (e.g., "P-256", "Ed25519") */
|
|
117
|
+
crv: z.ZodOptional<z.ZodString>;
|
|
118
|
+
/** X coordinate for EC keys, public key for OKP */
|
|
119
|
+
x: z.ZodOptional<z.ZodString>;
|
|
120
|
+
/** Y coordinate for EC keys */
|
|
121
|
+
y: z.ZodOptional<z.ZodString>;
|
|
122
|
+
/** Private key value (d parameter) */
|
|
123
|
+
d: z.ZodOptional<z.ZodString>;
|
|
124
|
+
/** Public exponent for RSA keys */
|
|
125
|
+
e: z.ZodOptional<z.ZodString>;
|
|
126
|
+
/** Modulus for RSA keys */
|
|
127
|
+
n: z.ZodOptional<z.ZodString>;
|
|
128
|
+
/** Key ID */
|
|
129
|
+
kid: z.ZodOptional<z.ZodString>;
|
|
130
|
+
/** Algorithm */
|
|
131
|
+
alg: z.ZodOptional<z.ZodString>;
|
|
132
|
+
/** Key use (e.g., "sig", "enc") */
|
|
133
|
+
use: z.ZodOptional<z.ZodString>;
|
|
134
|
+
/** Key operations (e.g., ["sign", "verify"]) */
|
|
135
|
+
key_ops: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
kty: string;
|
|
138
|
+
crv?: string | undefined;
|
|
139
|
+
x?: string | undefined;
|
|
140
|
+
y?: string | undefined;
|
|
141
|
+
d?: string | undefined;
|
|
142
|
+
e?: string | undefined;
|
|
143
|
+
n?: string | undefined;
|
|
144
|
+
kid?: string | undefined;
|
|
145
|
+
alg?: string | undefined;
|
|
146
|
+
use?: string | undefined;
|
|
147
|
+
key_ops?: string[] | undefined;
|
|
148
|
+
}, {
|
|
149
|
+
kty: string;
|
|
150
|
+
crv?: string | undefined;
|
|
151
|
+
x?: string | undefined;
|
|
152
|
+
y?: string | undefined;
|
|
153
|
+
d?: string | undefined;
|
|
154
|
+
e?: string | undefined;
|
|
155
|
+
n?: string | undefined;
|
|
156
|
+
kid?: string | undefined;
|
|
157
|
+
alg?: string | undefined;
|
|
158
|
+
use?: string | undefined;
|
|
159
|
+
key_ops?: string[] | undefined;
|
|
160
|
+
}>>;
|
|
161
|
+
/** Priority for key selection (lower = higher priority) */
|
|
162
|
+
priority: z.ZodNumber;
|
|
163
|
+
}, "strip", z.ZodTypeAny, {
|
|
164
|
+
type: "main" | "session" | "ingested";
|
|
165
|
+
id: string;
|
|
166
|
+
did: string;
|
|
167
|
+
priority: number;
|
|
168
|
+
jwk?: {
|
|
169
|
+
kty: string;
|
|
170
|
+
crv?: string | undefined;
|
|
171
|
+
x?: string | undefined;
|
|
172
|
+
y?: string | undefined;
|
|
173
|
+
d?: string | undefined;
|
|
174
|
+
e?: string | undefined;
|
|
175
|
+
n?: string | undefined;
|
|
176
|
+
kid?: string | undefined;
|
|
177
|
+
alg?: string | undefined;
|
|
178
|
+
use?: string | undefined;
|
|
179
|
+
key_ops?: string[] | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
}, {
|
|
182
|
+
type: "main" | "session" | "ingested";
|
|
183
|
+
id: string;
|
|
184
|
+
did: string;
|
|
185
|
+
priority: number;
|
|
186
|
+
jwk?: {
|
|
187
|
+
kty: string;
|
|
188
|
+
crv?: string | undefined;
|
|
189
|
+
x?: string | undefined;
|
|
190
|
+
y?: string | undefined;
|
|
191
|
+
d?: string | undefined;
|
|
192
|
+
e?: string | undefined;
|
|
193
|
+
n?: string | undefined;
|
|
194
|
+
kid?: string | undefined;
|
|
195
|
+
alg?: string | undefined;
|
|
196
|
+
use?: string | undefined;
|
|
197
|
+
key_ops?: string[] | undefined;
|
|
198
|
+
} | undefined;
|
|
199
|
+
}>;
|
|
200
|
+
export type KeyInfo = z.infer<typeof KeyInfoSchema>;
|
|
201
|
+
/**
|
|
202
|
+
* Error type for delegation operations.
|
|
203
|
+
*/
|
|
204
|
+
export declare const DelegationErrorSchema: z.ZodObject<{
|
|
205
|
+
/** Error code for programmatic handling */
|
|
206
|
+
code: z.ZodString;
|
|
207
|
+
/** Human-readable error message */
|
|
208
|
+
message: z.ZodString;
|
|
209
|
+
/** The service that produced the error */
|
|
210
|
+
service: z.ZodLiteral<"delegation">;
|
|
211
|
+
/** Original error if wrapping another error */
|
|
212
|
+
cause: z.ZodOptional<z.ZodType<Error, z.ZodTypeDef, Error>>;
|
|
213
|
+
/** Additional metadata about the error */
|
|
214
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
215
|
+
}, "strip", z.ZodTypeAny, {
|
|
216
|
+
code: string;
|
|
217
|
+
message: string;
|
|
218
|
+
service: "delegation";
|
|
219
|
+
cause?: Error | undefined;
|
|
220
|
+
meta?: Record<string, unknown> | undefined;
|
|
221
|
+
}, {
|
|
222
|
+
code: string;
|
|
223
|
+
message: string;
|
|
224
|
+
service: "delegation";
|
|
225
|
+
cause?: Error | undefined;
|
|
226
|
+
meta?: Record<string, unknown> | undefined;
|
|
227
|
+
}>;
|
|
228
|
+
export type DelegationError = z.infer<typeof DelegationErrorSchema>;
|
|
229
|
+
/**
|
|
230
|
+
* Error codes for delegation operations.
|
|
231
|
+
*/
|
|
232
|
+
export declare const DelegationErrorCodes: {
|
|
233
|
+
readonly AUTH_REQUIRED: "AUTH_REQUIRED";
|
|
234
|
+
readonly AUTH_EXPIRED: "AUTH_EXPIRED";
|
|
235
|
+
readonly NOT_INITIALIZED: "NOT_INITIALIZED";
|
|
236
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
237
|
+
readonly REVOKED: "REVOKED";
|
|
238
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
239
|
+
readonly TIMEOUT: "TIMEOUT";
|
|
240
|
+
readonly ABORTED: "ABORTED";
|
|
241
|
+
readonly INVALID_INPUT: "INVALID_INPUT";
|
|
242
|
+
readonly PERMISSION_DENIED: "PERMISSION_DENIED";
|
|
243
|
+
readonly CREATION_FAILED: "CREATION_FAILED";
|
|
244
|
+
readonly REVOCATION_FAILED: "REVOCATION_FAILED";
|
|
245
|
+
readonly INVALID_TOKEN: "INVALID_TOKEN";
|
|
246
|
+
readonly KV_SERVICE_UNAVAILABLE: "KV_SERVICE_UNAVAILABLE";
|
|
247
|
+
readonly DATA_FETCH_FAILED: "DATA_FETCH_FAILED";
|
|
248
|
+
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
249
|
+
};
|
|
250
|
+
export type DelegationErrorCode = (typeof DelegationErrorCodes)[keyof typeof DelegationErrorCodes];
|
|
251
|
+
/**
|
|
252
|
+
* Represents a delegation from one DID to another.
|
|
253
|
+
*/
|
|
254
|
+
export declare const DelegationSchema: z.ZodObject<{
|
|
255
|
+
/** Content identifier (CID) of the delegation */
|
|
256
|
+
cid: z.ZodString;
|
|
257
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
258
|
+
delegateDID: z.ZodString;
|
|
259
|
+
/** Space ID this delegation applies to */
|
|
260
|
+
spaceId: z.ZodString;
|
|
261
|
+
/** Resource path this delegation grants access to */
|
|
262
|
+
path: z.ZodString;
|
|
263
|
+
/** Actions this delegation authorizes */
|
|
264
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
265
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
266
|
+
expiry: z.ZodDate;
|
|
267
|
+
/** Whether this delegation has been revoked */
|
|
268
|
+
isRevoked: z.ZodBoolean;
|
|
269
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
270
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
271
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
272
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
273
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
274
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
275
|
+
/** Whether sub-delegation is allowed */
|
|
276
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
277
|
+
/** Authorization header (UCAN bearer token) */
|
|
278
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
279
|
+
}, "strip", z.ZodTypeAny, {
|
|
280
|
+
path: string;
|
|
281
|
+
cid: string;
|
|
282
|
+
delegateDID: string;
|
|
283
|
+
spaceId: string;
|
|
284
|
+
actions: string[];
|
|
285
|
+
expiry: Date;
|
|
286
|
+
isRevoked: boolean;
|
|
287
|
+
delegatorDID?: string | undefined;
|
|
288
|
+
createdAt?: Date | undefined;
|
|
289
|
+
parentCid?: string | undefined;
|
|
290
|
+
allowSubDelegation?: boolean | undefined;
|
|
291
|
+
authHeader?: string | undefined;
|
|
292
|
+
}, {
|
|
293
|
+
path: string;
|
|
294
|
+
cid: string;
|
|
295
|
+
delegateDID: string;
|
|
296
|
+
spaceId: string;
|
|
297
|
+
actions: string[];
|
|
298
|
+
expiry: Date;
|
|
299
|
+
isRevoked: boolean;
|
|
300
|
+
delegatorDID?: string | undefined;
|
|
301
|
+
createdAt?: Date | undefined;
|
|
302
|
+
parentCid?: string | undefined;
|
|
303
|
+
allowSubDelegation?: boolean | undefined;
|
|
304
|
+
authHeader?: string | undefined;
|
|
305
|
+
}>;
|
|
306
|
+
export type Delegation = z.infer<typeof DelegationSchema>;
|
|
307
|
+
/**
|
|
308
|
+
* Entry in the capability registry mapping a capability to available keys.
|
|
309
|
+
*/
|
|
310
|
+
export declare const CapabilityEntrySchema: z.ZodObject<{
|
|
311
|
+
/** Resource URI this capability applies to */
|
|
312
|
+
resource: z.ZodString;
|
|
313
|
+
/** Action this capability authorizes */
|
|
314
|
+
action: z.ZodString;
|
|
315
|
+
/** Keys that can exercise this capability, ordered by priority */
|
|
316
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
317
|
+
/** Unique identifier for this key */
|
|
318
|
+
id: z.ZodString;
|
|
319
|
+
/** DID associated with this key */
|
|
320
|
+
did: z.ZodString;
|
|
321
|
+
/** Type of key determining its authority level */
|
|
322
|
+
type: z.ZodEnum<["main", "session", "ingested"]>;
|
|
323
|
+
/** Private key in JWK format */
|
|
324
|
+
jwk: z.ZodOptional<z.ZodObject<{
|
|
325
|
+
/** Key type (e.g., "EC", "RSA", "OKP") */
|
|
326
|
+
kty: z.ZodString;
|
|
327
|
+
/** Curve for EC/OKP keys (e.g., "P-256", "Ed25519") */
|
|
328
|
+
crv: z.ZodOptional<z.ZodString>;
|
|
329
|
+
/** X coordinate for EC keys, public key for OKP */
|
|
330
|
+
x: z.ZodOptional<z.ZodString>;
|
|
331
|
+
/** Y coordinate for EC keys */
|
|
332
|
+
y: z.ZodOptional<z.ZodString>;
|
|
333
|
+
/** Private key value (d parameter) */
|
|
334
|
+
d: z.ZodOptional<z.ZodString>;
|
|
335
|
+
/** Public exponent for RSA keys */
|
|
336
|
+
e: z.ZodOptional<z.ZodString>;
|
|
337
|
+
/** Modulus for RSA keys */
|
|
338
|
+
n: z.ZodOptional<z.ZodString>;
|
|
339
|
+
/** Key ID */
|
|
340
|
+
kid: z.ZodOptional<z.ZodString>;
|
|
341
|
+
/** Algorithm */
|
|
342
|
+
alg: z.ZodOptional<z.ZodString>;
|
|
343
|
+
/** Key use (e.g., "sig", "enc") */
|
|
344
|
+
use: z.ZodOptional<z.ZodString>;
|
|
345
|
+
/** Key operations (e.g., ["sign", "verify"]) */
|
|
346
|
+
key_ops: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
347
|
+
}, "strip", z.ZodTypeAny, {
|
|
348
|
+
kty: string;
|
|
349
|
+
crv?: string | undefined;
|
|
350
|
+
x?: string | undefined;
|
|
351
|
+
y?: string | undefined;
|
|
352
|
+
d?: string | undefined;
|
|
353
|
+
e?: string | undefined;
|
|
354
|
+
n?: string | undefined;
|
|
355
|
+
kid?: string | undefined;
|
|
356
|
+
alg?: string | undefined;
|
|
357
|
+
use?: string | undefined;
|
|
358
|
+
key_ops?: string[] | undefined;
|
|
359
|
+
}, {
|
|
360
|
+
kty: string;
|
|
361
|
+
crv?: string | undefined;
|
|
362
|
+
x?: string | undefined;
|
|
363
|
+
y?: string | undefined;
|
|
364
|
+
d?: string | undefined;
|
|
365
|
+
e?: string | undefined;
|
|
366
|
+
n?: string | undefined;
|
|
367
|
+
kid?: string | undefined;
|
|
368
|
+
alg?: string | undefined;
|
|
369
|
+
use?: string | undefined;
|
|
370
|
+
key_ops?: string[] | undefined;
|
|
371
|
+
}>>;
|
|
372
|
+
/** Priority for key selection (lower = higher priority) */
|
|
373
|
+
priority: z.ZodNumber;
|
|
374
|
+
}, "strip", z.ZodTypeAny, {
|
|
375
|
+
type: "main" | "session" | "ingested";
|
|
376
|
+
id: string;
|
|
377
|
+
did: string;
|
|
378
|
+
priority: number;
|
|
379
|
+
jwk?: {
|
|
380
|
+
kty: string;
|
|
381
|
+
crv?: string | undefined;
|
|
382
|
+
x?: string | undefined;
|
|
383
|
+
y?: string | undefined;
|
|
384
|
+
d?: string | undefined;
|
|
385
|
+
e?: string | undefined;
|
|
386
|
+
n?: string | undefined;
|
|
387
|
+
kid?: string | undefined;
|
|
388
|
+
alg?: string | undefined;
|
|
389
|
+
use?: string | undefined;
|
|
390
|
+
key_ops?: string[] | undefined;
|
|
391
|
+
} | undefined;
|
|
392
|
+
}, {
|
|
393
|
+
type: "main" | "session" | "ingested";
|
|
394
|
+
id: string;
|
|
395
|
+
did: string;
|
|
396
|
+
priority: number;
|
|
397
|
+
jwk?: {
|
|
398
|
+
kty: string;
|
|
399
|
+
crv?: string | undefined;
|
|
400
|
+
x?: string | undefined;
|
|
401
|
+
y?: string | undefined;
|
|
402
|
+
d?: string | undefined;
|
|
403
|
+
e?: string | undefined;
|
|
404
|
+
n?: string | undefined;
|
|
405
|
+
kid?: string | undefined;
|
|
406
|
+
alg?: string | undefined;
|
|
407
|
+
use?: string | undefined;
|
|
408
|
+
key_ops?: string[] | undefined;
|
|
409
|
+
} | undefined;
|
|
410
|
+
}>, "many">;
|
|
411
|
+
/** The delegation that grants this capability */
|
|
412
|
+
delegation: z.ZodObject<{
|
|
413
|
+
/** Content identifier (CID) of the delegation */
|
|
414
|
+
cid: z.ZodString;
|
|
415
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
416
|
+
delegateDID: z.ZodString;
|
|
417
|
+
/** Space ID this delegation applies to */
|
|
418
|
+
spaceId: z.ZodString;
|
|
419
|
+
/** Resource path this delegation grants access to */
|
|
420
|
+
path: z.ZodString;
|
|
421
|
+
/** Actions this delegation authorizes */
|
|
422
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
423
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
424
|
+
expiry: z.ZodDate;
|
|
425
|
+
/** Whether this delegation has been revoked */
|
|
426
|
+
isRevoked: z.ZodBoolean;
|
|
427
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
428
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
429
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
430
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
431
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
432
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
433
|
+
/** Whether sub-delegation is allowed */
|
|
434
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
435
|
+
/** Authorization header (UCAN bearer token) */
|
|
436
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
437
|
+
}, "strip", z.ZodTypeAny, {
|
|
438
|
+
path: string;
|
|
439
|
+
cid: string;
|
|
440
|
+
delegateDID: string;
|
|
441
|
+
spaceId: string;
|
|
442
|
+
actions: string[];
|
|
443
|
+
expiry: Date;
|
|
444
|
+
isRevoked: boolean;
|
|
445
|
+
delegatorDID?: string | undefined;
|
|
446
|
+
createdAt?: Date | undefined;
|
|
447
|
+
parentCid?: string | undefined;
|
|
448
|
+
allowSubDelegation?: boolean | undefined;
|
|
449
|
+
authHeader?: string | undefined;
|
|
450
|
+
}, {
|
|
451
|
+
path: string;
|
|
452
|
+
cid: string;
|
|
453
|
+
delegateDID: string;
|
|
454
|
+
spaceId: string;
|
|
455
|
+
actions: string[];
|
|
456
|
+
expiry: Date;
|
|
457
|
+
isRevoked: boolean;
|
|
458
|
+
delegatorDID?: string | undefined;
|
|
459
|
+
createdAt?: Date | undefined;
|
|
460
|
+
parentCid?: string | undefined;
|
|
461
|
+
allowSubDelegation?: boolean | undefined;
|
|
462
|
+
authHeader?: string | undefined;
|
|
463
|
+
}>;
|
|
464
|
+
/** When this capability expires (accepts Date or ISO string from JSON) */
|
|
465
|
+
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
466
|
+
}, "strip", z.ZodTypeAny, {
|
|
467
|
+
keys: {
|
|
468
|
+
type: "main" | "session" | "ingested";
|
|
469
|
+
id: string;
|
|
470
|
+
did: string;
|
|
471
|
+
priority: number;
|
|
472
|
+
jwk?: {
|
|
473
|
+
kty: string;
|
|
474
|
+
crv?: string | undefined;
|
|
475
|
+
x?: string | undefined;
|
|
476
|
+
y?: string | undefined;
|
|
477
|
+
d?: string | undefined;
|
|
478
|
+
e?: string | undefined;
|
|
479
|
+
n?: string | undefined;
|
|
480
|
+
kid?: string | undefined;
|
|
481
|
+
alg?: string | undefined;
|
|
482
|
+
use?: string | undefined;
|
|
483
|
+
key_ops?: string[] | undefined;
|
|
484
|
+
} | undefined;
|
|
485
|
+
}[];
|
|
486
|
+
delegation: {
|
|
487
|
+
path: string;
|
|
488
|
+
cid: string;
|
|
489
|
+
delegateDID: string;
|
|
490
|
+
spaceId: string;
|
|
491
|
+
actions: string[];
|
|
492
|
+
expiry: Date;
|
|
493
|
+
isRevoked: boolean;
|
|
494
|
+
delegatorDID?: string | undefined;
|
|
495
|
+
createdAt?: Date | undefined;
|
|
496
|
+
parentCid?: string | undefined;
|
|
497
|
+
allowSubDelegation?: boolean | undefined;
|
|
498
|
+
authHeader?: string | undefined;
|
|
499
|
+
};
|
|
500
|
+
resource: string;
|
|
501
|
+
action: string;
|
|
502
|
+
expiresAt?: Date | undefined;
|
|
503
|
+
}, {
|
|
504
|
+
keys: {
|
|
505
|
+
type: "main" | "session" | "ingested";
|
|
506
|
+
id: string;
|
|
507
|
+
did: string;
|
|
508
|
+
priority: number;
|
|
509
|
+
jwk?: {
|
|
510
|
+
kty: string;
|
|
511
|
+
crv?: string | undefined;
|
|
512
|
+
x?: string | undefined;
|
|
513
|
+
y?: string | undefined;
|
|
514
|
+
d?: string | undefined;
|
|
515
|
+
e?: string | undefined;
|
|
516
|
+
n?: string | undefined;
|
|
517
|
+
kid?: string | undefined;
|
|
518
|
+
alg?: string | undefined;
|
|
519
|
+
use?: string | undefined;
|
|
520
|
+
key_ops?: string[] | undefined;
|
|
521
|
+
} | undefined;
|
|
522
|
+
}[];
|
|
523
|
+
delegation: {
|
|
524
|
+
path: string;
|
|
525
|
+
cid: string;
|
|
526
|
+
delegateDID: string;
|
|
527
|
+
spaceId: string;
|
|
528
|
+
actions: string[];
|
|
529
|
+
expiry: Date;
|
|
530
|
+
isRevoked: boolean;
|
|
531
|
+
delegatorDID?: string | undefined;
|
|
532
|
+
createdAt?: Date | undefined;
|
|
533
|
+
parentCid?: string | undefined;
|
|
534
|
+
allowSubDelegation?: boolean | undefined;
|
|
535
|
+
authHeader?: string | undefined;
|
|
536
|
+
};
|
|
537
|
+
resource: string;
|
|
538
|
+
action: string;
|
|
539
|
+
expiresAt?: Date | undefined;
|
|
540
|
+
}>;
|
|
541
|
+
export type CapabilityEntry = z.infer<typeof CapabilityEntrySchema>;
|
|
542
|
+
/**
|
|
543
|
+
* Persistent record of a delegation stored in the system.
|
|
544
|
+
*/
|
|
545
|
+
export declare const DelegationRecordSchema: z.ZodObject<{
|
|
546
|
+
/** Content identifier (CID) of the delegation */
|
|
547
|
+
cid: z.ZodString;
|
|
548
|
+
/** Space ID this delegation applies to */
|
|
549
|
+
spaceId: z.ZodString;
|
|
550
|
+
/** DID of the delegator (grantor) */
|
|
551
|
+
delegator: z.ZodString;
|
|
552
|
+
/** DID of the delegatee (recipient) */
|
|
553
|
+
delegatee: z.ZodString;
|
|
554
|
+
/** Key ID used to sign/exercise this delegation */
|
|
555
|
+
keyId: z.ZodOptional<z.ZodString>;
|
|
556
|
+
/** Resource path pattern this delegation grants access to */
|
|
557
|
+
path: z.ZodString;
|
|
558
|
+
/** Actions this delegation authorizes */
|
|
559
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
560
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
561
|
+
expiry: z.ZodOptional<z.ZodDate>;
|
|
562
|
+
/** When this delegation becomes valid (not before) (accepts Date or ISO string) */
|
|
563
|
+
notBefore: z.ZodOptional<z.ZodDate>;
|
|
564
|
+
/** Whether this delegation has been revoked */
|
|
565
|
+
isRevoked: z.ZodBoolean;
|
|
566
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
567
|
+
createdAt: z.ZodDate;
|
|
568
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
569
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
570
|
+
}, "strip", z.ZodTypeAny, {
|
|
571
|
+
path: string;
|
|
572
|
+
cid: string;
|
|
573
|
+
spaceId: string;
|
|
574
|
+
actions: string[];
|
|
575
|
+
isRevoked: boolean;
|
|
576
|
+
createdAt: Date;
|
|
577
|
+
delegator: string;
|
|
578
|
+
delegatee: string;
|
|
579
|
+
expiry?: Date | undefined;
|
|
580
|
+
parentCid?: string | undefined;
|
|
581
|
+
keyId?: string | undefined;
|
|
582
|
+
notBefore?: Date | undefined;
|
|
583
|
+
}, {
|
|
584
|
+
path: string;
|
|
585
|
+
cid: string;
|
|
586
|
+
spaceId: string;
|
|
587
|
+
actions: string[];
|
|
588
|
+
isRevoked: boolean;
|
|
589
|
+
createdAt: Date;
|
|
590
|
+
delegator: string;
|
|
591
|
+
delegatee: string;
|
|
592
|
+
expiry?: Date | undefined;
|
|
593
|
+
parentCid?: string | undefined;
|
|
594
|
+
keyId?: string | undefined;
|
|
595
|
+
notBefore?: Date | undefined;
|
|
596
|
+
}>;
|
|
597
|
+
export type DelegationRecord = z.infer<typeof DelegationRecordSchema>;
|
|
598
|
+
/**
|
|
599
|
+
* Parameters for creating a new delegation.
|
|
600
|
+
*/
|
|
601
|
+
export declare const CreateDelegationParamsSchema: z.ZodObject<{
|
|
602
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
603
|
+
delegateDID: z.ZodString;
|
|
604
|
+
/** Resource path this delegation grants access to */
|
|
605
|
+
path: z.ZodString;
|
|
606
|
+
/** Actions to authorize */
|
|
607
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
608
|
+
/** When this delegation expires (accepts Date or ISO string) */
|
|
609
|
+
expiry: z.ZodOptional<z.ZodDate>;
|
|
610
|
+
/** Whether to disable sub-delegation */
|
|
611
|
+
disableSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
612
|
+
/** Optional statement for the SIWE message */
|
|
613
|
+
statement: z.ZodOptional<z.ZodString>;
|
|
614
|
+
}, "strip", z.ZodTypeAny, {
|
|
615
|
+
path: string;
|
|
616
|
+
delegateDID: string;
|
|
617
|
+
actions: string[];
|
|
618
|
+
expiry?: Date | undefined;
|
|
619
|
+
disableSubDelegation?: boolean | undefined;
|
|
620
|
+
statement?: string | undefined;
|
|
621
|
+
}, {
|
|
622
|
+
path: string;
|
|
623
|
+
delegateDID: string;
|
|
624
|
+
actions: string[];
|
|
625
|
+
expiry?: Date | undefined;
|
|
626
|
+
disableSubDelegation?: boolean | undefined;
|
|
627
|
+
statement?: string | undefined;
|
|
628
|
+
}>;
|
|
629
|
+
export type CreateDelegationParams = z.infer<typeof CreateDelegationParamsSchema>;
|
|
630
|
+
/**
|
|
631
|
+
* A chain of delegations from root to leaf (array format).
|
|
632
|
+
*/
|
|
633
|
+
export declare const DelegationChainSchema: z.ZodArray<z.ZodObject<{
|
|
634
|
+
/** Content identifier (CID) of the delegation */
|
|
635
|
+
cid: z.ZodString;
|
|
636
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
637
|
+
delegateDID: z.ZodString;
|
|
638
|
+
/** Space ID this delegation applies to */
|
|
639
|
+
spaceId: z.ZodString;
|
|
640
|
+
/** Resource path this delegation grants access to */
|
|
641
|
+
path: z.ZodString;
|
|
642
|
+
/** Actions this delegation authorizes */
|
|
643
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
644
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
645
|
+
expiry: z.ZodDate;
|
|
646
|
+
/** Whether this delegation has been revoked */
|
|
647
|
+
isRevoked: z.ZodBoolean;
|
|
648
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
649
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
650
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
651
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
652
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
653
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
654
|
+
/** Whether sub-delegation is allowed */
|
|
655
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
656
|
+
/** Authorization header (UCAN bearer token) */
|
|
657
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
658
|
+
}, "strip", z.ZodTypeAny, {
|
|
659
|
+
path: string;
|
|
660
|
+
cid: string;
|
|
661
|
+
delegateDID: string;
|
|
662
|
+
spaceId: string;
|
|
663
|
+
actions: string[];
|
|
664
|
+
expiry: Date;
|
|
665
|
+
isRevoked: boolean;
|
|
666
|
+
delegatorDID?: string | undefined;
|
|
667
|
+
createdAt?: Date | undefined;
|
|
668
|
+
parentCid?: string | undefined;
|
|
669
|
+
allowSubDelegation?: boolean | undefined;
|
|
670
|
+
authHeader?: string | undefined;
|
|
671
|
+
}, {
|
|
672
|
+
path: string;
|
|
673
|
+
cid: string;
|
|
674
|
+
delegateDID: string;
|
|
675
|
+
spaceId: string;
|
|
676
|
+
actions: string[];
|
|
677
|
+
expiry: Date;
|
|
678
|
+
isRevoked: boolean;
|
|
679
|
+
delegatorDID?: string | undefined;
|
|
680
|
+
createdAt?: Date | undefined;
|
|
681
|
+
parentCid?: string | undefined;
|
|
682
|
+
allowSubDelegation?: boolean | undefined;
|
|
683
|
+
authHeader?: string | undefined;
|
|
684
|
+
}>, "many">;
|
|
685
|
+
export type DelegationChain = z.infer<typeof DelegationChainSchema>;
|
|
686
|
+
/**
|
|
687
|
+
* Structured delegation chain (v2 spec).
|
|
688
|
+
*/
|
|
689
|
+
export declare const DelegationChainV2Schema: z.ZodObject<{
|
|
690
|
+
/** The root delegation from the original authority */
|
|
691
|
+
root: z.ZodObject<{
|
|
692
|
+
/** Content identifier (CID) of the delegation */
|
|
693
|
+
cid: z.ZodString;
|
|
694
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
695
|
+
delegateDID: z.ZodString;
|
|
696
|
+
/** Space ID this delegation applies to */
|
|
697
|
+
spaceId: z.ZodString;
|
|
698
|
+
/** Resource path this delegation grants access to */
|
|
699
|
+
path: z.ZodString;
|
|
700
|
+
/** Actions this delegation authorizes */
|
|
701
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
702
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
703
|
+
expiry: z.ZodDate;
|
|
704
|
+
/** Whether this delegation has been revoked */
|
|
705
|
+
isRevoked: z.ZodBoolean;
|
|
706
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
707
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
708
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
709
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
710
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
711
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
712
|
+
/** Whether sub-delegation is allowed */
|
|
713
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
714
|
+
/** Authorization header (UCAN bearer token) */
|
|
715
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
716
|
+
}, "strip", z.ZodTypeAny, {
|
|
717
|
+
path: string;
|
|
718
|
+
cid: string;
|
|
719
|
+
delegateDID: string;
|
|
720
|
+
spaceId: string;
|
|
721
|
+
actions: string[];
|
|
722
|
+
expiry: Date;
|
|
723
|
+
isRevoked: boolean;
|
|
724
|
+
delegatorDID?: string | undefined;
|
|
725
|
+
createdAt?: Date | undefined;
|
|
726
|
+
parentCid?: string | undefined;
|
|
727
|
+
allowSubDelegation?: boolean | undefined;
|
|
728
|
+
authHeader?: string | undefined;
|
|
729
|
+
}, {
|
|
730
|
+
path: string;
|
|
731
|
+
cid: string;
|
|
732
|
+
delegateDID: string;
|
|
733
|
+
spaceId: string;
|
|
734
|
+
actions: string[];
|
|
735
|
+
expiry: Date;
|
|
736
|
+
isRevoked: boolean;
|
|
737
|
+
delegatorDID?: string | undefined;
|
|
738
|
+
createdAt?: Date | undefined;
|
|
739
|
+
parentCid?: string | undefined;
|
|
740
|
+
allowSubDelegation?: boolean | undefined;
|
|
741
|
+
authHeader?: string | undefined;
|
|
742
|
+
}>;
|
|
743
|
+
/** Intermediate delegations in the chain (may be empty) */
|
|
744
|
+
chain: z.ZodArray<z.ZodObject<{
|
|
745
|
+
/** Content identifier (CID) of the delegation */
|
|
746
|
+
cid: z.ZodString;
|
|
747
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
748
|
+
delegateDID: z.ZodString;
|
|
749
|
+
/** Space ID this delegation applies to */
|
|
750
|
+
spaceId: z.ZodString;
|
|
751
|
+
/** Resource path this delegation grants access to */
|
|
752
|
+
path: z.ZodString;
|
|
753
|
+
/** Actions this delegation authorizes */
|
|
754
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
755
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
756
|
+
expiry: z.ZodDate;
|
|
757
|
+
/** Whether this delegation has been revoked */
|
|
758
|
+
isRevoked: z.ZodBoolean;
|
|
759
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
760
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
761
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
762
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
763
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
764
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
765
|
+
/** Whether sub-delegation is allowed */
|
|
766
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
767
|
+
/** Authorization header (UCAN bearer token) */
|
|
768
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
769
|
+
}, "strip", z.ZodTypeAny, {
|
|
770
|
+
path: string;
|
|
771
|
+
cid: string;
|
|
772
|
+
delegateDID: string;
|
|
773
|
+
spaceId: string;
|
|
774
|
+
actions: string[];
|
|
775
|
+
expiry: Date;
|
|
776
|
+
isRevoked: boolean;
|
|
777
|
+
delegatorDID?: string | undefined;
|
|
778
|
+
createdAt?: Date | undefined;
|
|
779
|
+
parentCid?: string | undefined;
|
|
780
|
+
allowSubDelegation?: boolean | undefined;
|
|
781
|
+
authHeader?: string | undefined;
|
|
782
|
+
}, {
|
|
783
|
+
path: string;
|
|
784
|
+
cid: string;
|
|
785
|
+
delegateDID: string;
|
|
786
|
+
spaceId: string;
|
|
787
|
+
actions: string[];
|
|
788
|
+
expiry: Date;
|
|
789
|
+
isRevoked: boolean;
|
|
790
|
+
delegatorDID?: string | undefined;
|
|
791
|
+
createdAt?: Date | undefined;
|
|
792
|
+
parentCid?: string | undefined;
|
|
793
|
+
allowSubDelegation?: boolean | undefined;
|
|
794
|
+
authHeader?: string | undefined;
|
|
795
|
+
}>, "many">;
|
|
796
|
+
/** The final delegation to the current user */
|
|
797
|
+
leaf: z.ZodObject<{
|
|
798
|
+
/** Content identifier (CID) of the delegation */
|
|
799
|
+
cid: z.ZodString;
|
|
800
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
801
|
+
delegateDID: z.ZodString;
|
|
802
|
+
/** Space ID this delegation applies to */
|
|
803
|
+
spaceId: z.ZodString;
|
|
804
|
+
/** Resource path this delegation grants access to */
|
|
805
|
+
path: z.ZodString;
|
|
806
|
+
/** Actions this delegation authorizes */
|
|
807
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
808
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
809
|
+
expiry: z.ZodDate;
|
|
810
|
+
/** Whether this delegation has been revoked */
|
|
811
|
+
isRevoked: z.ZodBoolean;
|
|
812
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
813
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
814
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
815
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
816
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
817
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
818
|
+
/** Whether sub-delegation is allowed */
|
|
819
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
820
|
+
/** Authorization header (UCAN bearer token) */
|
|
821
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
822
|
+
}, "strip", z.ZodTypeAny, {
|
|
823
|
+
path: string;
|
|
824
|
+
cid: string;
|
|
825
|
+
delegateDID: string;
|
|
826
|
+
spaceId: string;
|
|
827
|
+
actions: string[];
|
|
828
|
+
expiry: Date;
|
|
829
|
+
isRevoked: boolean;
|
|
830
|
+
delegatorDID?: string | undefined;
|
|
831
|
+
createdAt?: Date | undefined;
|
|
832
|
+
parentCid?: string | undefined;
|
|
833
|
+
allowSubDelegation?: boolean | undefined;
|
|
834
|
+
authHeader?: string | undefined;
|
|
835
|
+
}, {
|
|
836
|
+
path: string;
|
|
837
|
+
cid: string;
|
|
838
|
+
delegateDID: string;
|
|
839
|
+
spaceId: string;
|
|
840
|
+
actions: string[];
|
|
841
|
+
expiry: Date;
|
|
842
|
+
isRevoked: boolean;
|
|
843
|
+
delegatorDID?: string | undefined;
|
|
844
|
+
createdAt?: Date | undefined;
|
|
845
|
+
parentCid?: string | undefined;
|
|
846
|
+
allowSubDelegation?: boolean | undefined;
|
|
847
|
+
authHeader?: string | undefined;
|
|
848
|
+
}>;
|
|
849
|
+
}, "strip", z.ZodTypeAny, {
|
|
850
|
+
root: {
|
|
851
|
+
path: string;
|
|
852
|
+
cid: string;
|
|
853
|
+
delegateDID: string;
|
|
854
|
+
spaceId: string;
|
|
855
|
+
actions: string[];
|
|
856
|
+
expiry: Date;
|
|
857
|
+
isRevoked: boolean;
|
|
858
|
+
delegatorDID?: string | undefined;
|
|
859
|
+
createdAt?: Date | undefined;
|
|
860
|
+
parentCid?: string | undefined;
|
|
861
|
+
allowSubDelegation?: boolean | undefined;
|
|
862
|
+
authHeader?: string | undefined;
|
|
863
|
+
};
|
|
864
|
+
chain: {
|
|
865
|
+
path: string;
|
|
866
|
+
cid: string;
|
|
867
|
+
delegateDID: string;
|
|
868
|
+
spaceId: string;
|
|
869
|
+
actions: string[];
|
|
870
|
+
expiry: Date;
|
|
871
|
+
isRevoked: boolean;
|
|
872
|
+
delegatorDID?: string | undefined;
|
|
873
|
+
createdAt?: Date | undefined;
|
|
874
|
+
parentCid?: string | undefined;
|
|
875
|
+
allowSubDelegation?: boolean | undefined;
|
|
876
|
+
authHeader?: string | undefined;
|
|
877
|
+
}[];
|
|
878
|
+
leaf: {
|
|
879
|
+
path: string;
|
|
880
|
+
cid: string;
|
|
881
|
+
delegateDID: string;
|
|
882
|
+
spaceId: string;
|
|
883
|
+
actions: string[];
|
|
884
|
+
expiry: Date;
|
|
885
|
+
isRevoked: boolean;
|
|
886
|
+
delegatorDID?: string | undefined;
|
|
887
|
+
createdAt?: Date | undefined;
|
|
888
|
+
parentCid?: string | undefined;
|
|
889
|
+
allowSubDelegation?: boolean | undefined;
|
|
890
|
+
authHeader?: string | undefined;
|
|
891
|
+
};
|
|
892
|
+
}, {
|
|
893
|
+
root: {
|
|
894
|
+
path: string;
|
|
895
|
+
cid: string;
|
|
896
|
+
delegateDID: string;
|
|
897
|
+
spaceId: string;
|
|
898
|
+
actions: string[];
|
|
899
|
+
expiry: Date;
|
|
900
|
+
isRevoked: boolean;
|
|
901
|
+
delegatorDID?: string | undefined;
|
|
902
|
+
createdAt?: Date | undefined;
|
|
903
|
+
parentCid?: string | undefined;
|
|
904
|
+
allowSubDelegation?: boolean | undefined;
|
|
905
|
+
authHeader?: string | undefined;
|
|
906
|
+
};
|
|
907
|
+
chain: {
|
|
908
|
+
path: string;
|
|
909
|
+
cid: string;
|
|
910
|
+
delegateDID: string;
|
|
911
|
+
spaceId: string;
|
|
912
|
+
actions: string[];
|
|
913
|
+
expiry: Date;
|
|
914
|
+
isRevoked: boolean;
|
|
915
|
+
delegatorDID?: string | undefined;
|
|
916
|
+
createdAt?: Date | undefined;
|
|
917
|
+
parentCid?: string | undefined;
|
|
918
|
+
allowSubDelegation?: boolean | undefined;
|
|
919
|
+
authHeader?: string | undefined;
|
|
920
|
+
}[];
|
|
921
|
+
leaf: {
|
|
922
|
+
path: string;
|
|
923
|
+
cid: string;
|
|
924
|
+
delegateDID: string;
|
|
925
|
+
spaceId: string;
|
|
926
|
+
actions: string[];
|
|
927
|
+
expiry: Date;
|
|
928
|
+
isRevoked: boolean;
|
|
929
|
+
delegatorDID?: string | undefined;
|
|
930
|
+
createdAt?: Date | undefined;
|
|
931
|
+
parentCid?: string | undefined;
|
|
932
|
+
allowSubDelegation?: boolean | undefined;
|
|
933
|
+
authHeader?: string | undefined;
|
|
934
|
+
};
|
|
935
|
+
}>;
|
|
936
|
+
export type DelegationChainV2 = z.infer<typeof DelegationChainV2Schema>;
|
|
937
|
+
/**
|
|
938
|
+
* Direction of delegation to filter by.
|
|
939
|
+
*/
|
|
940
|
+
export declare const DelegationDirectionSchema: z.ZodEnum<["granted", "received", "all"]>;
|
|
941
|
+
export type DelegationDirection = z.infer<typeof DelegationDirectionSchema>;
|
|
942
|
+
/**
|
|
943
|
+
* Filters for listing delegations.
|
|
944
|
+
*/
|
|
945
|
+
export declare const DelegationFiltersSchema: z.ZodObject<{
|
|
946
|
+
/** Filter by delegation direction */
|
|
947
|
+
direction: z.ZodOptional<z.ZodEnum<["granted", "received", "all"]>>;
|
|
948
|
+
/** Filter by resource path pattern */
|
|
949
|
+
path: z.ZodOptional<z.ZodString>;
|
|
950
|
+
/** Filter by required actions */
|
|
951
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
952
|
+
/** Include revoked delegations */
|
|
953
|
+
includeRevoked: z.ZodOptional<z.ZodBoolean>;
|
|
954
|
+
/** Filter by delegator DID */
|
|
955
|
+
delegator: z.ZodOptional<z.ZodString>;
|
|
956
|
+
/** Filter by delegatee DID */
|
|
957
|
+
delegatee: z.ZodOptional<z.ZodString>;
|
|
958
|
+
/** Only include delegations valid at this time */
|
|
959
|
+
validAt: z.ZodOptional<z.ZodDate>;
|
|
960
|
+
/** Maximum number of results to return */
|
|
961
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
962
|
+
/** Cursor for pagination */
|
|
963
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
964
|
+
}, "strip", z.ZodTypeAny, {
|
|
965
|
+
path?: string | undefined;
|
|
966
|
+
actions?: string[] | undefined;
|
|
967
|
+
delegator?: string | undefined;
|
|
968
|
+
delegatee?: string | undefined;
|
|
969
|
+
direction?: "received" | "granted" | "all" | undefined;
|
|
970
|
+
includeRevoked?: boolean | undefined;
|
|
971
|
+
validAt?: Date | undefined;
|
|
972
|
+
limit?: number | undefined;
|
|
973
|
+
cursor?: string | undefined;
|
|
974
|
+
}, {
|
|
975
|
+
path?: string | undefined;
|
|
976
|
+
actions?: string[] | undefined;
|
|
977
|
+
delegator?: string | undefined;
|
|
978
|
+
delegatee?: string | undefined;
|
|
979
|
+
direction?: "received" | "granted" | "all" | undefined;
|
|
980
|
+
includeRevoked?: boolean | undefined;
|
|
981
|
+
validAt?: Date | undefined;
|
|
982
|
+
limit?: number | undefined;
|
|
983
|
+
cursor?: string | undefined;
|
|
984
|
+
}>;
|
|
985
|
+
export type DelegationFilters = z.infer<typeof DelegationFiltersSchema>;
|
|
986
|
+
/**
|
|
987
|
+
* Type of space ownership.
|
|
988
|
+
*/
|
|
989
|
+
export declare const SpaceOwnershipSchema: z.ZodEnum<["owned", "delegated"]>;
|
|
990
|
+
export type SpaceOwnership = z.infer<typeof SpaceOwnershipSchema>;
|
|
991
|
+
/**
|
|
992
|
+
* Information about a space the user has access to.
|
|
993
|
+
*/
|
|
994
|
+
export declare const SpaceInfoSchema: z.ZodObject<{
|
|
995
|
+
/** Space identifier */
|
|
996
|
+
id: z.ZodString;
|
|
997
|
+
/** Human-readable name for the space */
|
|
998
|
+
name: z.ZodOptional<z.ZodString>;
|
|
999
|
+
/** DID of the space owner */
|
|
1000
|
+
owner: z.ZodString;
|
|
1001
|
+
/** Whether user owns or has delegated access */
|
|
1002
|
+
type: z.ZodEnum<["owned", "delegated"]>;
|
|
1003
|
+
/** Permissions the user has in this space */
|
|
1004
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1005
|
+
/** When the access expires (for delegated spaces) */
|
|
1006
|
+
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
1007
|
+
}, "strip", z.ZodTypeAny, {
|
|
1008
|
+
type: "owned" | "delegated";
|
|
1009
|
+
id: string;
|
|
1010
|
+
owner: string;
|
|
1011
|
+
expiresAt?: Date | undefined;
|
|
1012
|
+
name?: string | undefined;
|
|
1013
|
+
permissions?: string[] | undefined;
|
|
1014
|
+
}, {
|
|
1015
|
+
type: "owned" | "delegated";
|
|
1016
|
+
id: string;
|
|
1017
|
+
owner: string;
|
|
1018
|
+
expiresAt?: Date | undefined;
|
|
1019
|
+
name?: string | undefined;
|
|
1020
|
+
permissions?: string[] | undefined;
|
|
1021
|
+
}>;
|
|
1022
|
+
export type SpaceInfo = z.infer<typeof SpaceInfoSchema>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Schema for encoding share link data.
|
|
1025
|
+
*/
|
|
1026
|
+
export declare const ShareSchemaSchema: z.ZodEnum<["base64", "compact", "ipfs"]>;
|
|
1027
|
+
export type ShareSchema = z.infer<typeof ShareSchemaSchema>;
|
|
1028
|
+
/**
|
|
1029
|
+
* A shareable link containing delegation credentials.
|
|
1030
|
+
*/
|
|
1031
|
+
export declare const ShareLinkSchema: z.ZodObject<{
|
|
1032
|
+
/** Unique token identifying this share link */
|
|
1033
|
+
token: z.ZodString;
|
|
1034
|
+
/** Full URL for sharing */
|
|
1035
|
+
url: z.ZodString;
|
|
1036
|
+
/** The delegation this link grants access to */
|
|
1037
|
+
delegation: z.ZodObject<{
|
|
1038
|
+
/** Content identifier (CID) of the delegation */
|
|
1039
|
+
cid: z.ZodString;
|
|
1040
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
1041
|
+
delegateDID: z.ZodString;
|
|
1042
|
+
/** Space ID this delegation applies to */
|
|
1043
|
+
spaceId: z.ZodString;
|
|
1044
|
+
/** Resource path this delegation grants access to */
|
|
1045
|
+
path: z.ZodString;
|
|
1046
|
+
/** Actions this delegation authorizes */
|
|
1047
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1048
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1049
|
+
expiry: z.ZodDate;
|
|
1050
|
+
/** Whether this delegation has been revoked */
|
|
1051
|
+
isRevoked: z.ZodBoolean;
|
|
1052
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
1053
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1054
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1055
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1056
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
1057
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
1058
|
+
/** Whether sub-delegation is allowed */
|
|
1059
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1060
|
+
/** Authorization header (UCAN bearer token) */
|
|
1061
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
1062
|
+
}, "strip", z.ZodTypeAny, {
|
|
1063
|
+
path: string;
|
|
1064
|
+
cid: string;
|
|
1065
|
+
delegateDID: string;
|
|
1066
|
+
spaceId: string;
|
|
1067
|
+
actions: string[];
|
|
1068
|
+
expiry: Date;
|
|
1069
|
+
isRevoked: boolean;
|
|
1070
|
+
delegatorDID?: string | undefined;
|
|
1071
|
+
createdAt?: Date | undefined;
|
|
1072
|
+
parentCid?: string | undefined;
|
|
1073
|
+
allowSubDelegation?: boolean | undefined;
|
|
1074
|
+
authHeader?: string | undefined;
|
|
1075
|
+
}, {
|
|
1076
|
+
path: string;
|
|
1077
|
+
cid: string;
|
|
1078
|
+
delegateDID: string;
|
|
1079
|
+
spaceId: string;
|
|
1080
|
+
actions: string[];
|
|
1081
|
+
expiry: Date;
|
|
1082
|
+
isRevoked: boolean;
|
|
1083
|
+
delegatorDID?: string | undefined;
|
|
1084
|
+
createdAt?: Date | undefined;
|
|
1085
|
+
parentCid?: string | undefined;
|
|
1086
|
+
allowSubDelegation?: boolean | undefined;
|
|
1087
|
+
authHeader?: string | undefined;
|
|
1088
|
+
}>;
|
|
1089
|
+
/** Encoding schema used for the link */
|
|
1090
|
+
schema: z.ZodEnum<["base64", "compact", "ipfs"]>;
|
|
1091
|
+
/** When this share link expires */
|
|
1092
|
+
expiresAt: z.ZodOptional<z.ZodDate>;
|
|
1093
|
+
/** Human-readable description of what is being shared */
|
|
1094
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1095
|
+
}, "strip", z.ZodTypeAny, {
|
|
1096
|
+
delegation: {
|
|
1097
|
+
path: string;
|
|
1098
|
+
cid: string;
|
|
1099
|
+
delegateDID: string;
|
|
1100
|
+
spaceId: string;
|
|
1101
|
+
actions: string[];
|
|
1102
|
+
expiry: Date;
|
|
1103
|
+
isRevoked: boolean;
|
|
1104
|
+
delegatorDID?: string | undefined;
|
|
1105
|
+
createdAt?: Date | undefined;
|
|
1106
|
+
parentCid?: string | undefined;
|
|
1107
|
+
allowSubDelegation?: boolean | undefined;
|
|
1108
|
+
authHeader?: string | undefined;
|
|
1109
|
+
};
|
|
1110
|
+
token: string;
|
|
1111
|
+
url: string;
|
|
1112
|
+
schema: "base64" | "compact" | "ipfs";
|
|
1113
|
+
expiresAt?: Date | undefined;
|
|
1114
|
+
description?: string | undefined;
|
|
1115
|
+
}, {
|
|
1116
|
+
delegation: {
|
|
1117
|
+
path: string;
|
|
1118
|
+
cid: string;
|
|
1119
|
+
delegateDID: string;
|
|
1120
|
+
spaceId: string;
|
|
1121
|
+
actions: string[];
|
|
1122
|
+
expiry: Date;
|
|
1123
|
+
isRevoked: boolean;
|
|
1124
|
+
delegatorDID?: string | undefined;
|
|
1125
|
+
createdAt?: Date | undefined;
|
|
1126
|
+
parentCid?: string | undefined;
|
|
1127
|
+
allowSubDelegation?: boolean | undefined;
|
|
1128
|
+
authHeader?: string | undefined;
|
|
1129
|
+
};
|
|
1130
|
+
token: string;
|
|
1131
|
+
url: string;
|
|
1132
|
+
schema: "base64" | "compact" | "ipfs";
|
|
1133
|
+
expiresAt?: Date | undefined;
|
|
1134
|
+
description?: string | undefined;
|
|
1135
|
+
}>;
|
|
1136
|
+
export type ShareLink = z.infer<typeof ShareLinkSchema>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Data retrieved from a share link.
|
|
1139
|
+
*/
|
|
1140
|
+
export declare function createShareLinkDataSchema<T extends z.ZodTypeAny>(dataSchema: T): z.ZodObject<{
|
|
1141
|
+
/** The retrieved data */
|
|
1142
|
+
data: T;
|
|
1143
|
+
/** The delegation that authorized this access */
|
|
1144
|
+
delegation: z.ZodObject<{
|
|
1145
|
+
/** Content identifier (CID) of the delegation */
|
|
1146
|
+
cid: z.ZodString;
|
|
1147
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
1148
|
+
delegateDID: z.ZodString;
|
|
1149
|
+
/** Space ID this delegation applies to */
|
|
1150
|
+
spaceId: z.ZodString;
|
|
1151
|
+
/** Resource path this delegation grants access to */
|
|
1152
|
+
path: z.ZodString;
|
|
1153
|
+
/** Actions this delegation authorizes */
|
|
1154
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1155
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1156
|
+
expiry: z.ZodDate;
|
|
1157
|
+
/** Whether this delegation has been revoked */
|
|
1158
|
+
isRevoked: z.ZodBoolean;
|
|
1159
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
1160
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1161
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1162
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1163
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
1164
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
1165
|
+
/** Whether sub-delegation is allowed */
|
|
1166
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1167
|
+
/** Authorization header (UCAN bearer token) */
|
|
1168
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
1169
|
+
}, "strip", z.ZodTypeAny, {
|
|
1170
|
+
path: string;
|
|
1171
|
+
cid: string;
|
|
1172
|
+
delegateDID: string;
|
|
1173
|
+
spaceId: string;
|
|
1174
|
+
actions: string[];
|
|
1175
|
+
expiry: Date;
|
|
1176
|
+
isRevoked: boolean;
|
|
1177
|
+
delegatorDID?: string | undefined;
|
|
1178
|
+
createdAt?: Date | undefined;
|
|
1179
|
+
parentCid?: string | undefined;
|
|
1180
|
+
allowSubDelegation?: boolean | undefined;
|
|
1181
|
+
authHeader?: string | undefined;
|
|
1182
|
+
}, {
|
|
1183
|
+
path: string;
|
|
1184
|
+
cid: string;
|
|
1185
|
+
delegateDID: string;
|
|
1186
|
+
spaceId: string;
|
|
1187
|
+
actions: string[];
|
|
1188
|
+
expiry: Date;
|
|
1189
|
+
isRevoked: boolean;
|
|
1190
|
+
delegatorDID?: string | undefined;
|
|
1191
|
+
createdAt?: Date | undefined;
|
|
1192
|
+
parentCid?: string | undefined;
|
|
1193
|
+
allowSubDelegation?: boolean | undefined;
|
|
1194
|
+
authHeader?: string | undefined;
|
|
1195
|
+
}>;
|
|
1196
|
+
/** The space the data belongs to */
|
|
1197
|
+
spaceId: z.ZodString;
|
|
1198
|
+
/** The resource path that was accessed */
|
|
1199
|
+
path: z.ZodString;
|
|
1200
|
+
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
1201
|
+
/** The retrieved data */
|
|
1202
|
+
data: T;
|
|
1203
|
+
/** The delegation that authorized this access */
|
|
1204
|
+
delegation: z.ZodObject<{
|
|
1205
|
+
/** Content identifier (CID) of the delegation */
|
|
1206
|
+
cid: z.ZodString;
|
|
1207
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
1208
|
+
delegateDID: z.ZodString;
|
|
1209
|
+
/** Space ID this delegation applies to */
|
|
1210
|
+
spaceId: z.ZodString;
|
|
1211
|
+
/** Resource path this delegation grants access to */
|
|
1212
|
+
path: z.ZodString;
|
|
1213
|
+
/** Actions this delegation authorizes */
|
|
1214
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1215
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1216
|
+
expiry: z.ZodDate;
|
|
1217
|
+
/** Whether this delegation has been revoked */
|
|
1218
|
+
isRevoked: z.ZodBoolean;
|
|
1219
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
1220
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1221
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1222
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1223
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
1224
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
1225
|
+
/** Whether sub-delegation is allowed */
|
|
1226
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1227
|
+
/** Authorization header (UCAN bearer token) */
|
|
1228
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
1229
|
+
}, "strip", z.ZodTypeAny, {
|
|
1230
|
+
path: string;
|
|
1231
|
+
cid: string;
|
|
1232
|
+
delegateDID: string;
|
|
1233
|
+
spaceId: string;
|
|
1234
|
+
actions: string[];
|
|
1235
|
+
expiry: Date;
|
|
1236
|
+
isRevoked: boolean;
|
|
1237
|
+
delegatorDID?: string | undefined;
|
|
1238
|
+
createdAt?: Date | undefined;
|
|
1239
|
+
parentCid?: string | undefined;
|
|
1240
|
+
allowSubDelegation?: boolean | undefined;
|
|
1241
|
+
authHeader?: string | undefined;
|
|
1242
|
+
}, {
|
|
1243
|
+
path: string;
|
|
1244
|
+
cid: string;
|
|
1245
|
+
delegateDID: string;
|
|
1246
|
+
spaceId: string;
|
|
1247
|
+
actions: string[];
|
|
1248
|
+
expiry: Date;
|
|
1249
|
+
isRevoked: boolean;
|
|
1250
|
+
delegatorDID?: string | undefined;
|
|
1251
|
+
createdAt?: Date | undefined;
|
|
1252
|
+
parentCid?: string | undefined;
|
|
1253
|
+
allowSubDelegation?: boolean | undefined;
|
|
1254
|
+
authHeader?: string | undefined;
|
|
1255
|
+
}>;
|
|
1256
|
+
/** The space the data belongs to */
|
|
1257
|
+
spaceId: z.ZodString;
|
|
1258
|
+
/** The resource path that was accessed */
|
|
1259
|
+
path: z.ZodString;
|
|
1260
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
|
|
1261
|
+
/** The retrieved data */
|
|
1262
|
+
data: T;
|
|
1263
|
+
/** The delegation that authorized this access */
|
|
1264
|
+
delegation: z.ZodObject<{
|
|
1265
|
+
/** Content identifier (CID) of the delegation */
|
|
1266
|
+
cid: z.ZodString;
|
|
1267
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
1268
|
+
delegateDID: z.ZodString;
|
|
1269
|
+
/** Space ID this delegation applies to */
|
|
1270
|
+
spaceId: z.ZodString;
|
|
1271
|
+
/** Resource path this delegation grants access to */
|
|
1272
|
+
path: z.ZodString;
|
|
1273
|
+
/** Actions this delegation authorizes */
|
|
1274
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1275
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1276
|
+
expiry: z.ZodDate;
|
|
1277
|
+
/** Whether this delegation has been revoked */
|
|
1278
|
+
isRevoked: z.ZodBoolean;
|
|
1279
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
1280
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1281
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1282
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1283
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
1284
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
1285
|
+
/** Whether sub-delegation is allowed */
|
|
1286
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1287
|
+
/** Authorization header (UCAN bearer token) */
|
|
1288
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
1289
|
+
}, "strip", z.ZodTypeAny, {
|
|
1290
|
+
path: string;
|
|
1291
|
+
cid: string;
|
|
1292
|
+
delegateDID: string;
|
|
1293
|
+
spaceId: string;
|
|
1294
|
+
actions: string[];
|
|
1295
|
+
expiry: Date;
|
|
1296
|
+
isRevoked: boolean;
|
|
1297
|
+
delegatorDID?: string | undefined;
|
|
1298
|
+
createdAt?: Date | undefined;
|
|
1299
|
+
parentCid?: string | undefined;
|
|
1300
|
+
allowSubDelegation?: boolean | undefined;
|
|
1301
|
+
authHeader?: string | undefined;
|
|
1302
|
+
}, {
|
|
1303
|
+
path: string;
|
|
1304
|
+
cid: string;
|
|
1305
|
+
delegateDID: string;
|
|
1306
|
+
spaceId: string;
|
|
1307
|
+
actions: string[];
|
|
1308
|
+
expiry: Date;
|
|
1309
|
+
isRevoked: boolean;
|
|
1310
|
+
delegatorDID?: string | undefined;
|
|
1311
|
+
createdAt?: Date | undefined;
|
|
1312
|
+
parentCid?: string | undefined;
|
|
1313
|
+
allowSubDelegation?: boolean | undefined;
|
|
1314
|
+
authHeader?: string | undefined;
|
|
1315
|
+
}>;
|
|
1316
|
+
/** The space the data belongs to */
|
|
1317
|
+
spaceId: z.ZodString;
|
|
1318
|
+
/** The resource path that was accessed */
|
|
1319
|
+
path: z.ZodString;
|
|
1320
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
1321
|
+
export declare const ShareLinkDataSchema: z.ZodObject<{
|
|
1322
|
+
/** The retrieved data */
|
|
1323
|
+
data: z.ZodUnknown;
|
|
1324
|
+
/** The delegation that authorized this access */
|
|
1325
|
+
delegation: z.ZodObject<{
|
|
1326
|
+
/** Content identifier (CID) of the delegation */
|
|
1327
|
+
cid: z.ZodString;
|
|
1328
|
+
/** DID of the delegate (the party receiving the delegation) */
|
|
1329
|
+
delegateDID: z.ZodString;
|
|
1330
|
+
/** Space ID this delegation applies to */
|
|
1331
|
+
spaceId: z.ZodString;
|
|
1332
|
+
/** Resource path this delegation grants access to */
|
|
1333
|
+
path: z.ZodString;
|
|
1334
|
+
/** Actions this delegation authorizes */
|
|
1335
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1336
|
+
/** When this delegation expires (accepts Date or ISO string from JSON) */
|
|
1337
|
+
expiry: z.ZodDate;
|
|
1338
|
+
/** Whether this delegation has been revoked */
|
|
1339
|
+
isRevoked: z.ZodBoolean;
|
|
1340
|
+
/** DID of the delegator (the party granting the delegation) */
|
|
1341
|
+
delegatorDID: z.ZodOptional<z.ZodString>;
|
|
1342
|
+
/** When this delegation was created (accepts Date or ISO string from JSON) */
|
|
1343
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
1344
|
+
/** Parent delegation CID if this is a sub-delegation */
|
|
1345
|
+
parentCid: z.ZodOptional<z.ZodString>;
|
|
1346
|
+
/** Whether sub-delegation is allowed */
|
|
1347
|
+
allowSubDelegation: z.ZodOptional<z.ZodBoolean>;
|
|
1348
|
+
/** Authorization header (UCAN bearer token) */
|
|
1349
|
+
authHeader: z.ZodOptional<z.ZodString>;
|
|
1350
|
+
}, "strip", z.ZodTypeAny, {
|
|
1351
|
+
path: string;
|
|
1352
|
+
cid: string;
|
|
1353
|
+
delegateDID: string;
|
|
1354
|
+
spaceId: string;
|
|
1355
|
+
actions: string[];
|
|
1356
|
+
expiry: Date;
|
|
1357
|
+
isRevoked: boolean;
|
|
1358
|
+
delegatorDID?: string | undefined;
|
|
1359
|
+
createdAt?: Date | undefined;
|
|
1360
|
+
parentCid?: string | undefined;
|
|
1361
|
+
allowSubDelegation?: boolean | undefined;
|
|
1362
|
+
authHeader?: string | undefined;
|
|
1363
|
+
}, {
|
|
1364
|
+
path: string;
|
|
1365
|
+
cid: string;
|
|
1366
|
+
delegateDID: string;
|
|
1367
|
+
spaceId: string;
|
|
1368
|
+
actions: string[];
|
|
1369
|
+
expiry: Date;
|
|
1370
|
+
isRevoked: boolean;
|
|
1371
|
+
delegatorDID?: string | undefined;
|
|
1372
|
+
createdAt?: Date | undefined;
|
|
1373
|
+
parentCid?: string | undefined;
|
|
1374
|
+
allowSubDelegation?: boolean | undefined;
|
|
1375
|
+
authHeader?: string | undefined;
|
|
1376
|
+
}>;
|
|
1377
|
+
/** The space the data belongs to */
|
|
1378
|
+
spaceId: z.ZodString;
|
|
1379
|
+
/** The resource path that was accessed */
|
|
1380
|
+
path: z.ZodString;
|
|
1381
|
+
}, "strip", z.ZodTypeAny, {
|
|
1382
|
+
path: string;
|
|
1383
|
+
delegation: {
|
|
1384
|
+
path: string;
|
|
1385
|
+
cid: string;
|
|
1386
|
+
delegateDID: string;
|
|
1387
|
+
spaceId: string;
|
|
1388
|
+
actions: string[];
|
|
1389
|
+
expiry: Date;
|
|
1390
|
+
isRevoked: boolean;
|
|
1391
|
+
delegatorDID?: string | undefined;
|
|
1392
|
+
createdAt?: Date | undefined;
|
|
1393
|
+
parentCid?: string | undefined;
|
|
1394
|
+
allowSubDelegation?: boolean | undefined;
|
|
1395
|
+
authHeader?: string | undefined;
|
|
1396
|
+
};
|
|
1397
|
+
spaceId: string;
|
|
1398
|
+
data?: unknown;
|
|
1399
|
+
}, {
|
|
1400
|
+
path: string;
|
|
1401
|
+
delegation: {
|
|
1402
|
+
path: string;
|
|
1403
|
+
cid: string;
|
|
1404
|
+
delegateDID: string;
|
|
1405
|
+
spaceId: string;
|
|
1406
|
+
actions: string[];
|
|
1407
|
+
expiry: Date;
|
|
1408
|
+
isRevoked: boolean;
|
|
1409
|
+
delegatorDID?: string | undefined;
|
|
1410
|
+
createdAt?: Date | undefined;
|
|
1411
|
+
parentCid?: string | undefined;
|
|
1412
|
+
allowSubDelegation?: boolean | undefined;
|
|
1413
|
+
authHeader?: string | undefined;
|
|
1414
|
+
};
|
|
1415
|
+
spaceId: string;
|
|
1416
|
+
data?: unknown;
|
|
1417
|
+
}>;
|
|
1418
|
+
export type ShareLinkData<T = unknown> = {
|
|
1419
|
+
data: T;
|
|
1420
|
+
delegation: Delegation;
|
|
1421
|
+
spaceId: string;
|
|
1422
|
+
path: string;
|
|
1423
|
+
};
|
|
1424
|
+
/**
|
|
1425
|
+
* Options for ingesting an external delegation.
|
|
1426
|
+
*/
|
|
1427
|
+
export declare const IngestOptionsSchema: z.ZodObject<{
|
|
1428
|
+
/** Whether to persist the delegation to storage */
|
|
1429
|
+
persist: z.ZodOptional<z.ZodBoolean>;
|
|
1430
|
+
/** Whether to validate the full delegation chain */
|
|
1431
|
+
validateChain: z.ZodOptional<z.ZodBoolean>;
|
|
1432
|
+
/** Name for the ingested key */
|
|
1433
|
+
keyName: z.ZodOptional<z.ZodString>;
|
|
1434
|
+
/** Whether to create a session key for this delegation */
|
|
1435
|
+
createSessionKey: z.ZodOptional<z.ZodBoolean>;
|
|
1436
|
+
/** Override the priority for the ingested key */
|
|
1437
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
1438
|
+
}, "strip", z.ZodTypeAny, {
|
|
1439
|
+
priority?: number | undefined;
|
|
1440
|
+
persist?: boolean | undefined;
|
|
1441
|
+
validateChain?: boolean | undefined;
|
|
1442
|
+
keyName?: string | undefined;
|
|
1443
|
+
createSessionKey?: boolean | undefined;
|
|
1444
|
+
}, {
|
|
1445
|
+
priority?: number | undefined;
|
|
1446
|
+
persist?: boolean | undefined;
|
|
1447
|
+
validateChain?: boolean | undefined;
|
|
1448
|
+
keyName?: string | undefined;
|
|
1449
|
+
createSessionKey?: boolean | undefined;
|
|
1450
|
+
}>;
|
|
1451
|
+
export type IngestOptions = z.infer<typeof IngestOptionsSchema>;
|
|
1452
|
+
/**
|
|
1453
|
+
* Parameters for generating a share link.
|
|
1454
|
+
*/
|
|
1455
|
+
export declare const GenerateShareParamsSchema: z.ZodObject<{
|
|
1456
|
+
/** Resource path to share */
|
|
1457
|
+
path: z.ZodString;
|
|
1458
|
+
/** Actions to authorize */
|
|
1459
|
+
actions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1460
|
+
/** When the share link expires */
|
|
1461
|
+
expiry: z.ZodOptional<z.ZodDate>;
|
|
1462
|
+
/** Encoding schema for the link */
|
|
1463
|
+
schema: z.ZodOptional<z.ZodEnum<["base64", "compact", "ipfs"]>>;
|
|
1464
|
+
/** Human-readable description */
|
|
1465
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1466
|
+
/** Base URL for the share link */
|
|
1467
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
1468
|
+
}, "strip", z.ZodTypeAny, {
|
|
1469
|
+
path: string;
|
|
1470
|
+
actions?: string[] | undefined;
|
|
1471
|
+
expiry?: Date | undefined;
|
|
1472
|
+
schema?: "base64" | "compact" | "ipfs" | undefined;
|
|
1473
|
+
description?: string | undefined;
|
|
1474
|
+
baseUrl?: string | undefined;
|
|
1475
|
+
}, {
|
|
1476
|
+
path: string;
|
|
1477
|
+
actions?: string[] | undefined;
|
|
1478
|
+
expiry?: Date | undefined;
|
|
1479
|
+
schema?: "base64" | "compact" | "ipfs" | undefined;
|
|
1480
|
+
description?: string | undefined;
|
|
1481
|
+
baseUrl?: string | undefined;
|
|
1482
|
+
}>;
|
|
1483
|
+
export type GenerateShareParams = z.infer<typeof GenerateShareParamsSchema>;
|
|
1484
|
+
/**
|
|
1485
|
+
* Configuration for DelegationManager.
|
|
1486
|
+
* Note: ServiceSession, InvokeFunction, and FetchFunction are external types.
|
|
1487
|
+
*/
|
|
1488
|
+
export declare const DelegationManagerConfigSchema: z.ZodObject<{
|
|
1489
|
+
/** TinyCloud host URLs */
|
|
1490
|
+
hosts: z.ZodArray<z.ZodString, "many">;
|
|
1491
|
+
/** Active session for authentication */
|
|
1492
|
+
session: z.ZodEffects<z.ZodUnknown, ServiceSession, unknown>;
|
|
1493
|
+
/** Platform-specific invoke function */
|
|
1494
|
+
invoke: z.ZodEffects<z.ZodUnknown, InvokeFunction, unknown>;
|
|
1495
|
+
/** Optional custom fetch implementation */
|
|
1496
|
+
fetch: z.ZodOptional<z.ZodEffects<z.ZodUnknown, FetchFunction, unknown>>;
|
|
1497
|
+
}, "strip", z.ZodTypeAny, {
|
|
1498
|
+
session: ServiceSession;
|
|
1499
|
+
hosts: string[];
|
|
1500
|
+
invoke: InvokeFunction;
|
|
1501
|
+
fetch?: FetchFunction | undefined;
|
|
1502
|
+
}, {
|
|
1503
|
+
hosts: string[];
|
|
1504
|
+
session?: unknown;
|
|
1505
|
+
invoke?: unknown;
|
|
1506
|
+
fetch?: unknown;
|
|
1507
|
+
}>;
|
|
1508
|
+
export type DelegationManagerConfig = z.infer<typeof DelegationManagerConfigSchema>;
|
|
1509
|
+
/**
|
|
1510
|
+
* Provider interface for cryptographic key operations.
|
|
1511
|
+
*/
|
|
1512
|
+
export declare const KeyProviderSchema: z.ZodObject<{
|
|
1513
|
+
/** Generate a new session key, returns key ID */
|
|
1514
|
+
createSessionKey: z.ZodEffects<z.ZodUnknown, (name: string) => Promise<string>, unknown>;
|
|
1515
|
+
/** Get JWK for a key */
|
|
1516
|
+
getJWK: z.ZodEffects<z.ZodUnknown, (keyId: string) => object, unknown>;
|
|
1517
|
+
/** Get DID for a key */
|
|
1518
|
+
getDID: z.ZodEffects<z.ZodUnknown, (keyId: string) => Promise<string>, unknown>;
|
|
1519
|
+
}, "strip", z.ZodTypeAny, {
|
|
1520
|
+
createSessionKey: (name: string) => Promise<string>;
|
|
1521
|
+
getJWK: (keyId: string) => object;
|
|
1522
|
+
getDID: (keyId: string) => Promise<string>;
|
|
1523
|
+
}, {
|
|
1524
|
+
createSessionKey?: unknown;
|
|
1525
|
+
getJWK?: unknown;
|
|
1526
|
+
getDID?: unknown;
|
|
1527
|
+
}>;
|
|
1528
|
+
export type KeyProvider = z.infer<typeof KeyProviderSchema>;
|
|
1529
|
+
/**
|
|
1530
|
+
* Response from the delegation API.
|
|
1531
|
+
*/
|
|
1532
|
+
export declare const DelegationApiResponseSchema: z.ZodObject<{
|
|
1533
|
+
/** SIWE message content */
|
|
1534
|
+
siwe: z.ZodString;
|
|
1535
|
+
/** Signature of the SIWE message */
|
|
1536
|
+
signature: z.ZodString;
|
|
1537
|
+
/** Delegation version */
|
|
1538
|
+
version: z.ZodNumber;
|
|
1539
|
+
/** CID of the created delegation */
|
|
1540
|
+
cid: z.ZodOptional<z.ZodString>;
|
|
1541
|
+
}, "strip", z.ZodTypeAny, {
|
|
1542
|
+
siwe: string;
|
|
1543
|
+
signature: string;
|
|
1544
|
+
version: number;
|
|
1545
|
+
cid?: string | undefined;
|
|
1546
|
+
}, {
|
|
1547
|
+
siwe: string;
|
|
1548
|
+
signature: string;
|
|
1549
|
+
version: number;
|
|
1550
|
+
cid?: string | undefined;
|
|
1551
|
+
}>;
|
|
1552
|
+
export type DelegationApiResponse = z.infer<typeof DelegationApiResponseSchema>;
|
|
1553
|
+
/**
|
|
1554
|
+
* Input parameters for the createDelegation WASM function.
|
|
1555
|
+
*/
|
|
1556
|
+
export declare const CreateDelegationWasmParamsSchema: z.ZodObject<{
|
|
1557
|
+
/** The session containing delegation credentials */
|
|
1558
|
+
session: z.ZodEffects<z.ZodUnknown, ServiceSession, unknown>;
|
|
1559
|
+
/** DID of the delegate */
|
|
1560
|
+
delegateDID: z.ZodString;
|
|
1561
|
+
/** Space ID this delegation applies to */
|
|
1562
|
+
spaceId: z.ZodString;
|
|
1563
|
+
/** Resource path this delegation grants access to */
|
|
1564
|
+
path: z.ZodString;
|
|
1565
|
+
/** Actions to authorize */
|
|
1566
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1567
|
+
/** Expiration time in seconds since Unix epoch */
|
|
1568
|
+
expirationSecs: z.ZodNumber;
|
|
1569
|
+
/** Optional not-before time in seconds since Unix epoch */
|
|
1570
|
+
notBeforeSecs: z.ZodOptional<z.ZodNumber>;
|
|
1571
|
+
}, "strip", z.ZodTypeAny, {
|
|
1572
|
+
path: string;
|
|
1573
|
+
session: ServiceSession;
|
|
1574
|
+
delegateDID: string;
|
|
1575
|
+
spaceId: string;
|
|
1576
|
+
actions: string[];
|
|
1577
|
+
expirationSecs: number;
|
|
1578
|
+
notBeforeSecs?: number | undefined;
|
|
1579
|
+
}, {
|
|
1580
|
+
path: string;
|
|
1581
|
+
delegateDID: string;
|
|
1582
|
+
spaceId: string;
|
|
1583
|
+
actions: string[];
|
|
1584
|
+
expirationSecs: number;
|
|
1585
|
+
session?: unknown;
|
|
1586
|
+
notBeforeSecs?: number | undefined;
|
|
1587
|
+
}>;
|
|
1588
|
+
export type CreateDelegationWasmParams = z.infer<typeof CreateDelegationWasmParamsSchema>;
|
|
1589
|
+
/**
|
|
1590
|
+
* Result from the createDelegation WASM function.
|
|
1591
|
+
*/
|
|
1592
|
+
export declare const CreateDelegationWasmResultSchema: z.ZodObject<{
|
|
1593
|
+
/** Base64url-encoded UCAN delegation */
|
|
1594
|
+
delegation: z.ZodString;
|
|
1595
|
+
/** CID of the delegation */
|
|
1596
|
+
cid: z.ZodString;
|
|
1597
|
+
/** DID of the delegate */
|
|
1598
|
+
delegateDID: z.ZodString;
|
|
1599
|
+
/** Resource path the delegation grants access to */
|
|
1600
|
+
path: z.ZodString;
|
|
1601
|
+
/** Actions the delegation authorizes */
|
|
1602
|
+
actions: z.ZodArray<z.ZodString, "many">;
|
|
1603
|
+
/** Expiration time */
|
|
1604
|
+
expiry: z.ZodDate;
|
|
1605
|
+
}, "strip", z.ZodTypeAny, {
|
|
1606
|
+
path: string;
|
|
1607
|
+
delegation: string;
|
|
1608
|
+
cid: string;
|
|
1609
|
+
delegateDID: string;
|
|
1610
|
+
actions: string[];
|
|
1611
|
+
expiry: Date;
|
|
1612
|
+
}, {
|
|
1613
|
+
path: string;
|
|
1614
|
+
delegation: string;
|
|
1615
|
+
cid: string;
|
|
1616
|
+
delegateDID: string;
|
|
1617
|
+
actions: string[];
|
|
1618
|
+
expiry: Date;
|
|
1619
|
+
}>;
|
|
1620
|
+
export type CreateDelegationWasmResult = z.infer<typeof CreateDelegationWasmResultSchema>;
|
|
1621
|
+
/**
|
|
1622
|
+
* Validates a Delegation object and returns a Result.
|
|
1623
|
+
*/
|
|
1624
|
+
export declare function validateDelegation(data: unknown): Result<Delegation, DelegationError>;
|
|
1625
|
+
/**
|
|
1626
|
+
* Validates a CreateDelegationParams object and returns a Result.
|
|
1627
|
+
*/
|
|
1628
|
+
export declare function validateCreateDelegationParams(data: unknown): Result<CreateDelegationParams, DelegationError>;
|
|
1629
|
+
/**
|
|
1630
|
+
* Validates a DelegationFilters object and returns a Result.
|
|
1631
|
+
*/
|
|
1632
|
+
export declare function validateDelegationFilters(data: unknown): Result<DelegationFilters, DelegationError>;
|
|
1633
|
+
/**
|
|
1634
|
+
* Validates a ShareLink object and returns a Result.
|
|
1635
|
+
*/
|
|
1636
|
+
export declare function validateShareLink(data: unknown): Result<ShareLink, DelegationError>;
|
|
1637
|
+
/**
|
|
1638
|
+
* Generic validation function factory.
|
|
1639
|
+
*/
|
|
1640
|
+
export declare function createValidator<T>(schema: z.ZodType<T>): (data: unknown) => Result<T, DelegationError>;
|
|
1641
|
+
//# sourceMappingURL=types.schema.d.ts.map
|