@eudiplo/sdk-core 1.14.0-main.070d9f8
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/README.md +460 -0
- package/dist/api/client/client.gen.d.mts +5 -0
- package/dist/api/client/client.gen.d.ts +5 -0
- package/dist/api/client/client.gen.js +823 -0
- package/dist/api/client/client.gen.mjs +821 -0
- package/dist/api/client/index.d.mts +58 -0
- package/dist/api/client/index.d.ts +58 -0
- package/dist/api/client/index.js +1052 -0
- package/dist/api/client/index.mjs +1043 -0
- package/dist/api/client/types.gen.d.mts +1 -0
- package/dist/api/client/types.gen.d.ts +1 -0
- package/dist/api/client/types.gen.js +4 -0
- package/dist/api/client/types.gen.mjs +3 -0
- package/dist/api/client.gen.d.mts +15 -0
- package/dist/api/client.gen.d.ts +15 -0
- package/dist/api/client.gen.js +828 -0
- package/dist/api/client.gen.mjs +826 -0
- package/dist/api/index.d.mts +528 -0
- package/dist/api/index.d.ts +528 -0
- package/dist/api/index.js +1536 -0
- package/dist/api/index.mjs +1427 -0
- package/dist/index.d.mts +651 -0
- package/dist/index.d.ts +651 -0
- package/dist/index.js +2185 -0
- package/dist/index.mjs +2064 -0
- package/dist/types.gen-CxMpZyVO.d.mts +3388 -0
- package/dist/types.gen-CxMpZyVO.d.ts +3388 -0
- package/dist/types.gen-DDunhhsd.d.mts +328 -0
- package/dist/types.gen-DDunhhsd.d.ts +328 -0
- package/package.json +73 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2064 @@
|
|
|
1
|
+
// src/api/core/bodySerializer.gen.ts
|
|
2
|
+
var serializeFormDataPair = (data, key, value) => {
|
|
3
|
+
if (typeof value === "string" || value instanceof Blob) {
|
|
4
|
+
data.append(key, value);
|
|
5
|
+
} else if (value instanceof Date) {
|
|
6
|
+
data.append(key, value.toISOString());
|
|
7
|
+
} else {
|
|
8
|
+
data.append(key, JSON.stringify(value));
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
var formDataBodySerializer = {
|
|
12
|
+
bodySerializer: (body) => {
|
|
13
|
+
const data = new FormData();
|
|
14
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
15
|
+
if (value === void 0 || value === null) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (Array.isArray(value)) {
|
|
19
|
+
value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
20
|
+
} else {
|
|
21
|
+
serializeFormDataPair(data, key, value);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var jsonBodySerializer = {
|
|
28
|
+
bodySerializer: (body) => JSON.stringify(
|
|
29
|
+
body,
|
|
30
|
+
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
31
|
+
)
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/api/core/serverSentEvents.gen.ts
|
|
35
|
+
var createSseClient = ({
|
|
36
|
+
onRequest,
|
|
37
|
+
onSseError,
|
|
38
|
+
onSseEvent,
|
|
39
|
+
responseTransformer,
|
|
40
|
+
responseValidator,
|
|
41
|
+
sseDefaultRetryDelay,
|
|
42
|
+
sseMaxRetryAttempts,
|
|
43
|
+
sseMaxRetryDelay,
|
|
44
|
+
sseSleepFn,
|
|
45
|
+
url,
|
|
46
|
+
...options
|
|
47
|
+
}) => {
|
|
48
|
+
let lastEventId;
|
|
49
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
50
|
+
const createStream = async function* () {
|
|
51
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
52
|
+
let attempt = 0;
|
|
53
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
54
|
+
while (true) {
|
|
55
|
+
if (signal.aborted) break;
|
|
56
|
+
attempt++;
|
|
57
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
58
|
+
if (lastEventId !== void 0) {
|
|
59
|
+
headers.set("Last-Event-ID", lastEventId);
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const requestInit = {
|
|
63
|
+
redirect: "follow",
|
|
64
|
+
...options,
|
|
65
|
+
body: options.serializedBody,
|
|
66
|
+
headers,
|
|
67
|
+
signal
|
|
68
|
+
};
|
|
69
|
+
let request = new Request(url, requestInit);
|
|
70
|
+
if (onRequest) {
|
|
71
|
+
request = await onRequest(url, requestInit);
|
|
72
|
+
}
|
|
73
|
+
const _fetch = options.fetch ?? globalThis.fetch;
|
|
74
|
+
const response = await _fetch(request);
|
|
75
|
+
if (!response.ok)
|
|
76
|
+
throw new Error(
|
|
77
|
+
`SSE failed: ${response.status} ${response.statusText}`
|
|
78
|
+
);
|
|
79
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
80
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
81
|
+
let buffer = "";
|
|
82
|
+
const abortHandler = () => {
|
|
83
|
+
try {
|
|
84
|
+
reader.cancel();
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
signal.addEventListener("abort", abortHandler);
|
|
89
|
+
try {
|
|
90
|
+
while (true) {
|
|
91
|
+
const { done, value } = await reader.read();
|
|
92
|
+
if (done) break;
|
|
93
|
+
buffer += value;
|
|
94
|
+
buffer = buffer.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
95
|
+
const chunks = buffer.split("\n\n");
|
|
96
|
+
buffer = chunks.pop() ?? "";
|
|
97
|
+
for (const chunk of chunks) {
|
|
98
|
+
const lines = chunk.split("\n");
|
|
99
|
+
const dataLines = [];
|
|
100
|
+
let eventName;
|
|
101
|
+
for (const line of lines) {
|
|
102
|
+
if (line.startsWith("data:")) {
|
|
103
|
+
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
104
|
+
} else if (line.startsWith("event:")) {
|
|
105
|
+
eventName = line.replace(/^event:\s*/, "");
|
|
106
|
+
} else if (line.startsWith("id:")) {
|
|
107
|
+
lastEventId = line.replace(/^id:\s*/, "");
|
|
108
|
+
} else if (line.startsWith("retry:")) {
|
|
109
|
+
const parsed = Number.parseInt(
|
|
110
|
+
line.replace(/^retry:\s*/, ""),
|
|
111
|
+
10
|
|
112
|
+
);
|
|
113
|
+
if (!Number.isNaN(parsed)) {
|
|
114
|
+
retryDelay = parsed;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
let data;
|
|
119
|
+
let parsedJson = false;
|
|
120
|
+
if (dataLines.length) {
|
|
121
|
+
const rawData = dataLines.join("\n");
|
|
122
|
+
try {
|
|
123
|
+
data = JSON.parse(rawData);
|
|
124
|
+
parsedJson = true;
|
|
125
|
+
} catch {
|
|
126
|
+
data = rawData;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (parsedJson) {
|
|
130
|
+
if (responseValidator) {
|
|
131
|
+
await responseValidator(data);
|
|
132
|
+
}
|
|
133
|
+
if (responseTransformer) {
|
|
134
|
+
data = await responseTransformer(data);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
onSseEvent?.({
|
|
138
|
+
data,
|
|
139
|
+
event: eventName,
|
|
140
|
+
id: lastEventId,
|
|
141
|
+
retry: retryDelay
|
|
142
|
+
});
|
|
143
|
+
if (dataLines.length) {
|
|
144
|
+
yield data;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
} finally {
|
|
149
|
+
signal.removeEventListener("abort", abortHandler);
|
|
150
|
+
reader.releaseLock();
|
|
151
|
+
}
|
|
152
|
+
break;
|
|
153
|
+
} catch (error) {
|
|
154
|
+
onSseError?.(error);
|
|
155
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
const backoff = Math.min(
|
|
159
|
+
retryDelay * 2 ** (attempt - 1),
|
|
160
|
+
sseMaxRetryDelay ?? 3e4
|
|
161
|
+
);
|
|
162
|
+
await sleep(backoff);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const stream = createStream();
|
|
167
|
+
return { stream };
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// src/api/core/pathSerializer.gen.ts
|
|
171
|
+
var separatorArrayExplode = (style) => {
|
|
172
|
+
switch (style) {
|
|
173
|
+
case "label":
|
|
174
|
+
return ".";
|
|
175
|
+
case "matrix":
|
|
176
|
+
return ";";
|
|
177
|
+
case "simple":
|
|
178
|
+
return ",";
|
|
179
|
+
default:
|
|
180
|
+
return "&";
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
var separatorArrayNoExplode = (style) => {
|
|
184
|
+
switch (style) {
|
|
185
|
+
case "form":
|
|
186
|
+
return ",";
|
|
187
|
+
case "pipeDelimited":
|
|
188
|
+
return "|";
|
|
189
|
+
case "spaceDelimited":
|
|
190
|
+
return "%20";
|
|
191
|
+
default:
|
|
192
|
+
return ",";
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var separatorObjectExplode = (style) => {
|
|
196
|
+
switch (style) {
|
|
197
|
+
case "label":
|
|
198
|
+
return ".";
|
|
199
|
+
case "matrix":
|
|
200
|
+
return ";";
|
|
201
|
+
case "simple":
|
|
202
|
+
return ",";
|
|
203
|
+
default:
|
|
204
|
+
return "&";
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
var serializeArrayParam = ({
|
|
208
|
+
allowReserved,
|
|
209
|
+
explode,
|
|
210
|
+
name,
|
|
211
|
+
style,
|
|
212
|
+
value
|
|
213
|
+
}) => {
|
|
214
|
+
if (!explode) {
|
|
215
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
216
|
+
switch (style) {
|
|
217
|
+
case "label":
|
|
218
|
+
return `.${joinedValues2}`;
|
|
219
|
+
case "matrix":
|
|
220
|
+
return `;${name}=${joinedValues2}`;
|
|
221
|
+
case "simple":
|
|
222
|
+
return joinedValues2;
|
|
223
|
+
default:
|
|
224
|
+
return `${name}=${joinedValues2}`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
const separator = separatorArrayExplode(style);
|
|
228
|
+
const joinedValues = value.map((v) => {
|
|
229
|
+
if (style === "label" || style === "simple") {
|
|
230
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
231
|
+
}
|
|
232
|
+
return serializePrimitiveParam({
|
|
233
|
+
allowReserved,
|
|
234
|
+
name,
|
|
235
|
+
value: v
|
|
236
|
+
});
|
|
237
|
+
}).join(separator);
|
|
238
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
239
|
+
};
|
|
240
|
+
var serializePrimitiveParam = ({
|
|
241
|
+
allowReserved,
|
|
242
|
+
name,
|
|
243
|
+
value
|
|
244
|
+
}) => {
|
|
245
|
+
if (value === void 0 || value === null) {
|
|
246
|
+
return "";
|
|
247
|
+
}
|
|
248
|
+
if (typeof value === "object") {
|
|
249
|
+
throw new Error(
|
|
250
|
+
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
254
|
+
};
|
|
255
|
+
var serializeObjectParam = ({
|
|
256
|
+
allowReserved,
|
|
257
|
+
explode,
|
|
258
|
+
name,
|
|
259
|
+
style,
|
|
260
|
+
value,
|
|
261
|
+
valueOnly
|
|
262
|
+
}) => {
|
|
263
|
+
if (value instanceof Date) {
|
|
264
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
265
|
+
}
|
|
266
|
+
if (style !== "deepObject" && !explode) {
|
|
267
|
+
let values = [];
|
|
268
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
269
|
+
values = [
|
|
270
|
+
...values,
|
|
271
|
+
key,
|
|
272
|
+
allowReserved ? v : encodeURIComponent(v)
|
|
273
|
+
];
|
|
274
|
+
});
|
|
275
|
+
const joinedValues2 = values.join(",");
|
|
276
|
+
switch (style) {
|
|
277
|
+
case "form":
|
|
278
|
+
return `${name}=${joinedValues2}`;
|
|
279
|
+
case "label":
|
|
280
|
+
return `.${joinedValues2}`;
|
|
281
|
+
case "matrix":
|
|
282
|
+
return `;${name}=${joinedValues2}`;
|
|
283
|
+
default:
|
|
284
|
+
return joinedValues2;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
const separator = separatorObjectExplode(style);
|
|
288
|
+
const joinedValues = Object.entries(value).map(
|
|
289
|
+
([key, v]) => serializePrimitiveParam({
|
|
290
|
+
allowReserved,
|
|
291
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
292
|
+
value: v
|
|
293
|
+
})
|
|
294
|
+
).join(separator);
|
|
295
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
// src/api/core/utils.gen.ts
|
|
299
|
+
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
300
|
+
var defaultPathSerializer = ({ path, url: _url }) => {
|
|
301
|
+
let url = _url;
|
|
302
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
303
|
+
if (matches) {
|
|
304
|
+
for (const match of matches) {
|
|
305
|
+
let explode = false;
|
|
306
|
+
let name = match.substring(1, match.length - 1);
|
|
307
|
+
let style = "simple";
|
|
308
|
+
if (name.endsWith("*")) {
|
|
309
|
+
explode = true;
|
|
310
|
+
name = name.substring(0, name.length - 1);
|
|
311
|
+
}
|
|
312
|
+
if (name.startsWith(".")) {
|
|
313
|
+
name = name.substring(1);
|
|
314
|
+
style = "label";
|
|
315
|
+
} else if (name.startsWith(";")) {
|
|
316
|
+
name = name.substring(1);
|
|
317
|
+
style = "matrix";
|
|
318
|
+
}
|
|
319
|
+
const value = path[name];
|
|
320
|
+
if (value === void 0 || value === null) {
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
if (Array.isArray(value)) {
|
|
324
|
+
url = url.replace(
|
|
325
|
+
match,
|
|
326
|
+
serializeArrayParam({ explode, name, style, value })
|
|
327
|
+
);
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
if (typeof value === "object") {
|
|
331
|
+
url = url.replace(
|
|
332
|
+
match,
|
|
333
|
+
serializeObjectParam({
|
|
334
|
+
explode,
|
|
335
|
+
name,
|
|
336
|
+
style,
|
|
337
|
+
value,
|
|
338
|
+
valueOnly: true
|
|
339
|
+
})
|
|
340
|
+
);
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
if (style === "matrix") {
|
|
344
|
+
url = url.replace(
|
|
345
|
+
match,
|
|
346
|
+
`;${serializePrimitiveParam({
|
|
347
|
+
name,
|
|
348
|
+
value
|
|
349
|
+
})}`
|
|
350
|
+
);
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
const replaceValue = encodeURIComponent(
|
|
354
|
+
style === "label" ? `.${value}` : value
|
|
355
|
+
);
|
|
356
|
+
url = url.replace(match, replaceValue);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return url;
|
|
360
|
+
};
|
|
361
|
+
var getUrl = ({
|
|
362
|
+
baseUrl,
|
|
363
|
+
path,
|
|
364
|
+
query,
|
|
365
|
+
querySerializer,
|
|
366
|
+
url: _url
|
|
367
|
+
}) => {
|
|
368
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
369
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
370
|
+
if (path) {
|
|
371
|
+
url = defaultPathSerializer({ path, url });
|
|
372
|
+
}
|
|
373
|
+
let search = query ? querySerializer(query) : "";
|
|
374
|
+
if (search.startsWith("?")) {
|
|
375
|
+
search = search.substring(1);
|
|
376
|
+
}
|
|
377
|
+
if (search) {
|
|
378
|
+
url += `?${search}`;
|
|
379
|
+
}
|
|
380
|
+
return url;
|
|
381
|
+
};
|
|
382
|
+
function getValidRequestBody(options) {
|
|
383
|
+
const hasBody = options.body !== void 0;
|
|
384
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
385
|
+
if (isSerializedBody) {
|
|
386
|
+
if ("serializedBody" in options) {
|
|
387
|
+
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
388
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
389
|
+
}
|
|
390
|
+
return options.body !== "" ? options.body : null;
|
|
391
|
+
}
|
|
392
|
+
if (hasBody) {
|
|
393
|
+
return options.body;
|
|
394
|
+
}
|
|
395
|
+
return void 0;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// src/api/core/auth.gen.ts
|
|
399
|
+
var getAuthToken = async (auth, callback) => {
|
|
400
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
401
|
+
if (!token) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (auth.scheme === "bearer") {
|
|
405
|
+
return `Bearer ${token}`;
|
|
406
|
+
}
|
|
407
|
+
if (auth.scheme === "basic") {
|
|
408
|
+
return `Basic ${btoa(token)}`;
|
|
409
|
+
}
|
|
410
|
+
return token;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
// src/api/client/utils.gen.ts
|
|
414
|
+
var createQuerySerializer = ({
|
|
415
|
+
parameters = {},
|
|
416
|
+
...args
|
|
417
|
+
} = {}) => {
|
|
418
|
+
const querySerializer = (queryParams) => {
|
|
419
|
+
const search = [];
|
|
420
|
+
if (queryParams && typeof queryParams === "object") {
|
|
421
|
+
for (const name in queryParams) {
|
|
422
|
+
const value = queryParams[name];
|
|
423
|
+
if (value === void 0 || value === null) {
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
const options = parameters[name] || args;
|
|
427
|
+
if (Array.isArray(value)) {
|
|
428
|
+
const serializedArray = serializeArrayParam({
|
|
429
|
+
allowReserved: options.allowReserved,
|
|
430
|
+
explode: true,
|
|
431
|
+
name,
|
|
432
|
+
style: "form",
|
|
433
|
+
value,
|
|
434
|
+
...options.array
|
|
435
|
+
});
|
|
436
|
+
if (serializedArray) search.push(serializedArray);
|
|
437
|
+
} else if (typeof value === "object") {
|
|
438
|
+
const serializedObject = serializeObjectParam({
|
|
439
|
+
allowReserved: options.allowReserved,
|
|
440
|
+
explode: true,
|
|
441
|
+
name,
|
|
442
|
+
style: "deepObject",
|
|
443
|
+
value,
|
|
444
|
+
...options.object
|
|
445
|
+
});
|
|
446
|
+
if (serializedObject) search.push(serializedObject);
|
|
447
|
+
} else {
|
|
448
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
449
|
+
allowReserved: options.allowReserved,
|
|
450
|
+
name,
|
|
451
|
+
value
|
|
452
|
+
});
|
|
453
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return search.join("&");
|
|
458
|
+
};
|
|
459
|
+
return querySerializer;
|
|
460
|
+
};
|
|
461
|
+
var getParseAs = (contentType) => {
|
|
462
|
+
if (!contentType) {
|
|
463
|
+
return "stream";
|
|
464
|
+
}
|
|
465
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
466
|
+
if (!cleanContent) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
470
|
+
return "json";
|
|
471
|
+
}
|
|
472
|
+
if (cleanContent === "multipart/form-data") {
|
|
473
|
+
return "formData";
|
|
474
|
+
}
|
|
475
|
+
if (["application/", "audio/", "image/", "video/"].some(
|
|
476
|
+
(type) => cleanContent.startsWith(type)
|
|
477
|
+
)) {
|
|
478
|
+
return "blob";
|
|
479
|
+
}
|
|
480
|
+
if (cleanContent.startsWith("text/")) {
|
|
481
|
+
return "text";
|
|
482
|
+
}
|
|
483
|
+
return;
|
|
484
|
+
};
|
|
485
|
+
var checkForExistence = (options, name) => {
|
|
486
|
+
if (!name) {
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
490
|
+
return true;
|
|
491
|
+
}
|
|
492
|
+
return false;
|
|
493
|
+
};
|
|
494
|
+
var setAuthParams = async ({
|
|
495
|
+
security,
|
|
496
|
+
...options
|
|
497
|
+
}) => {
|
|
498
|
+
for (const auth of security) {
|
|
499
|
+
if (checkForExistence(options, auth.name)) {
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
const token = await getAuthToken(auth, options.auth);
|
|
503
|
+
if (!token) {
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
const name = auth.name ?? "Authorization";
|
|
507
|
+
switch (auth.in) {
|
|
508
|
+
case "query":
|
|
509
|
+
if (!options.query) {
|
|
510
|
+
options.query = {};
|
|
511
|
+
}
|
|
512
|
+
options.query[name] = token;
|
|
513
|
+
break;
|
|
514
|
+
case "cookie":
|
|
515
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
516
|
+
break;
|
|
517
|
+
case "header":
|
|
518
|
+
default:
|
|
519
|
+
options.headers.set(name, token);
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
var buildUrl = (options) => getUrl({
|
|
525
|
+
baseUrl: options.baseUrl,
|
|
526
|
+
path: options.path,
|
|
527
|
+
query: options.query,
|
|
528
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
529
|
+
url: options.url
|
|
530
|
+
});
|
|
531
|
+
var mergeConfigs = (a, b) => {
|
|
532
|
+
const config = { ...a, ...b };
|
|
533
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
534
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
535
|
+
}
|
|
536
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
537
|
+
return config;
|
|
538
|
+
};
|
|
539
|
+
var headersEntries = (headers) => {
|
|
540
|
+
const entries = [];
|
|
541
|
+
headers.forEach((value, key) => {
|
|
542
|
+
entries.push([key, value]);
|
|
543
|
+
});
|
|
544
|
+
return entries;
|
|
545
|
+
};
|
|
546
|
+
var mergeHeaders = (...headers) => {
|
|
547
|
+
const mergedHeaders = new Headers();
|
|
548
|
+
for (const header of headers) {
|
|
549
|
+
if (!header) {
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
553
|
+
for (const [key, value] of iterator) {
|
|
554
|
+
if (value === null) {
|
|
555
|
+
mergedHeaders.delete(key);
|
|
556
|
+
} else if (Array.isArray(value)) {
|
|
557
|
+
for (const v of value) {
|
|
558
|
+
mergedHeaders.append(key, v);
|
|
559
|
+
}
|
|
560
|
+
} else if (value !== void 0) {
|
|
561
|
+
mergedHeaders.set(
|
|
562
|
+
key,
|
|
563
|
+
typeof value === "object" ? JSON.stringify(value) : value
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return mergedHeaders;
|
|
569
|
+
};
|
|
570
|
+
var Interceptors = class {
|
|
571
|
+
fns = [];
|
|
572
|
+
clear() {
|
|
573
|
+
this.fns = [];
|
|
574
|
+
}
|
|
575
|
+
eject(id) {
|
|
576
|
+
const index = this.getInterceptorIndex(id);
|
|
577
|
+
if (this.fns[index]) {
|
|
578
|
+
this.fns[index] = null;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
exists(id) {
|
|
582
|
+
const index = this.getInterceptorIndex(id);
|
|
583
|
+
return Boolean(this.fns[index]);
|
|
584
|
+
}
|
|
585
|
+
getInterceptorIndex(id) {
|
|
586
|
+
if (typeof id === "number") {
|
|
587
|
+
return this.fns[id] ? id : -1;
|
|
588
|
+
}
|
|
589
|
+
return this.fns.indexOf(id);
|
|
590
|
+
}
|
|
591
|
+
update(id, fn) {
|
|
592
|
+
const index = this.getInterceptorIndex(id);
|
|
593
|
+
if (this.fns[index]) {
|
|
594
|
+
this.fns[index] = fn;
|
|
595
|
+
return id;
|
|
596
|
+
}
|
|
597
|
+
return false;
|
|
598
|
+
}
|
|
599
|
+
use(fn) {
|
|
600
|
+
this.fns.push(fn);
|
|
601
|
+
return this.fns.length - 1;
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
var createInterceptors = () => ({
|
|
605
|
+
error: new Interceptors(),
|
|
606
|
+
request: new Interceptors(),
|
|
607
|
+
response: new Interceptors()
|
|
608
|
+
});
|
|
609
|
+
var defaultQuerySerializer = createQuerySerializer({
|
|
610
|
+
allowReserved: false,
|
|
611
|
+
array: {
|
|
612
|
+
explode: true,
|
|
613
|
+
style: "form"
|
|
614
|
+
},
|
|
615
|
+
object: {
|
|
616
|
+
explode: true,
|
|
617
|
+
style: "deepObject"
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
var defaultHeaders = {
|
|
621
|
+
"Content-Type": "application/json"
|
|
622
|
+
};
|
|
623
|
+
var createConfig = (override = {}) => ({
|
|
624
|
+
...jsonBodySerializer,
|
|
625
|
+
headers: defaultHeaders,
|
|
626
|
+
parseAs: "auto",
|
|
627
|
+
querySerializer: defaultQuerySerializer,
|
|
628
|
+
...override
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
// src/api/client/client.gen.ts
|
|
632
|
+
var createClient = (config = {}) => {
|
|
633
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
634
|
+
const getConfig = () => ({ ..._config });
|
|
635
|
+
const setConfig = (config2) => {
|
|
636
|
+
_config = mergeConfigs(_config, config2);
|
|
637
|
+
return getConfig();
|
|
638
|
+
};
|
|
639
|
+
const interceptors = createInterceptors();
|
|
640
|
+
const beforeRequest = async (options) => {
|
|
641
|
+
const opts = {
|
|
642
|
+
..._config,
|
|
643
|
+
...options,
|
|
644
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
645
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
646
|
+
serializedBody: void 0
|
|
647
|
+
};
|
|
648
|
+
if (opts.security) {
|
|
649
|
+
await setAuthParams({
|
|
650
|
+
...opts,
|
|
651
|
+
security: opts.security
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
if (opts.requestValidator) {
|
|
655
|
+
await opts.requestValidator(opts);
|
|
656
|
+
}
|
|
657
|
+
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
658
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
659
|
+
}
|
|
660
|
+
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
661
|
+
opts.headers.delete("Content-Type");
|
|
662
|
+
}
|
|
663
|
+
const url = buildUrl(opts);
|
|
664
|
+
return { opts, url };
|
|
665
|
+
};
|
|
666
|
+
const request = async (options) => {
|
|
667
|
+
const { opts, url } = await beforeRequest(options);
|
|
668
|
+
const requestInit = {
|
|
669
|
+
redirect: "follow",
|
|
670
|
+
...opts,
|
|
671
|
+
body: getValidRequestBody(opts)
|
|
672
|
+
};
|
|
673
|
+
let request2 = new Request(url, requestInit);
|
|
674
|
+
for (const fn of interceptors.request.fns) {
|
|
675
|
+
if (fn) {
|
|
676
|
+
request2 = await fn(request2, opts);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
const _fetch = opts.fetch;
|
|
680
|
+
let response;
|
|
681
|
+
try {
|
|
682
|
+
response = await _fetch(request2);
|
|
683
|
+
} catch (error2) {
|
|
684
|
+
let finalError2 = error2;
|
|
685
|
+
for (const fn of interceptors.error.fns) {
|
|
686
|
+
if (fn) {
|
|
687
|
+
finalError2 = await fn(
|
|
688
|
+
error2,
|
|
689
|
+
void 0,
|
|
690
|
+
request2,
|
|
691
|
+
opts
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
finalError2 = finalError2 || {};
|
|
696
|
+
if (opts.throwOnError) {
|
|
697
|
+
throw finalError2;
|
|
698
|
+
}
|
|
699
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
700
|
+
error: finalError2,
|
|
701
|
+
request: request2,
|
|
702
|
+
response: void 0
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
for (const fn of interceptors.response.fns) {
|
|
706
|
+
if (fn) {
|
|
707
|
+
response = await fn(response, request2, opts);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
const result = {
|
|
711
|
+
request: request2,
|
|
712
|
+
response
|
|
713
|
+
};
|
|
714
|
+
if (response.ok) {
|
|
715
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
716
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
717
|
+
let emptyData;
|
|
718
|
+
switch (parseAs) {
|
|
719
|
+
case "arrayBuffer":
|
|
720
|
+
case "blob":
|
|
721
|
+
case "text":
|
|
722
|
+
emptyData = await response[parseAs]();
|
|
723
|
+
break;
|
|
724
|
+
case "formData":
|
|
725
|
+
emptyData = new FormData();
|
|
726
|
+
break;
|
|
727
|
+
case "stream":
|
|
728
|
+
emptyData = response.body;
|
|
729
|
+
break;
|
|
730
|
+
case "json":
|
|
731
|
+
default:
|
|
732
|
+
emptyData = {};
|
|
733
|
+
break;
|
|
734
|
+
}
|
|
735
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
736
|
+
data: emptyData,
|
|
737
|
+
...result
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
let data;
|
|
741
|
+
switch (parseAs) {
|
|
742
|
+
case "arrayBuffer":
|
|
743
|
+
case "blob":
|
|
744
|
+
case "formData":
|
|
745
|
+
case "text":
|
|
746
|
+
data = await response[parseAs]();
|
|
747
|
+
break;
|
|
748
|
+
case "json": {
|
|
749
|
+
const text = await response.text();
|
|
750
|
+
data = text ? JSON.parse(text) : {};
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
case "stream":
|
|
754
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
755
|
+
data: response.body,
|
|
756
|
+
...result
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
if (parseAs === "json") {
|
|
760
|
+
if (opts.responseValidator) {
|
|
761
|
+
await opts.responseValidator(data);
|
|
762
|
+
}
|
|
763
|
+
if (opts.responseTransformer) {
|
|
764
|
+
data = await opts.responseTransformer(data);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
return opts.responseStyle === "data" ? data : {
|
|
768
|
+
data,
|
|
769
|
+
...result
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
const textError = await response.text();
|
|
773
|
+
let jsonError;
|
|
774
|
+
try {
|
|
775
|
+
jsonError = JSON.parse(textError);
|
|
776
|
+
} catch {
|
|
777
|
+
}
|
|
778
|
+
const error = jsonError ?? textError;
|
|
779
|
+
let finalError = error;
|
|
780
|
+
for (const fn of interceptors.error.fns) {
|
|
781
|
+
if (fn) {
|
|
782
|
+
finalError = await fn(error, response, request2, opts);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
finalError = finalError || {};
|
|
786
|
+
if (opts.throwOnError) {
|
|
787
|
+
throw finalError;
|
|
788
|
+
}
|
|
789
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
790
|
+
error: finalError,
|
|
791
|
+
...result
|
|
792
|
+
};
|
|
793
|
+
};
|
|
794
|
+
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
795
|
+
const makeSseFn = (method) => async (options) => {
|
|
796
|
+
const { opts, url } = await beforeRequest(options);
|
|
797
|
+
return createSseClient({
|
|
798
|
+
...opts,
|
|
799
|
+
body: opts.body,
|
|
800
|
+
headers: opts.headers,
|
|
801
|
+
method,
|
|
802
|
+
onRequest: async (url2, init) => {
|
|
803
|
+
let request2 = new Request(url2, init);
|
|
804
|
+
for (const fn of interceptors.request.fns) {
|
|
805
|
+
if (fn) {
|
|
806
|
+
request2 = await fn(request2, opts);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
return request2;
|
|
810
|
+
},
|
|
811
|
+
serializedBody: getValidRequestBody(opts),
|
|
812
|
+
url
|
|
813
|
+
});
|
|
814
|
+
};
|
|
815
|
+
return {
|
|
816
|
+
buildUrl,
|
|
817
|
+
connect: makeMethodFn("CONNECT"),
|
|
818
|
+
delete: makeMethodFn("DELETE"),
|
|
819
|
+
get: makeMethodFn("GET"),
|
|
820
|
+
getConfig,
|
|
821
|
+
head: makeMethodFn("HEAD"),
|
|
822
|
+
interceptors,
|
|
823
|
+
options: makeMethodFn("OPTIONS"),
|
|
824
|
+
patch: makeMethodFn("PATCH"),
|
|
825
|
+
post: makeMethodFn("POST"),
|
|
826
|
+
put: makeMethodFn("PUT"),
|
|
827
|
+
request,
|
|
828
|
+
setConfig,
|
|
829
|
+
sse: {
|
|
830
|
+
connect: makeSseFn("CONNECT"),
|
|
831
|
+
delete: makeSseFn("DELETE"),
|
|
832
|
+
get: makeSseFn("GET"),
|
|
833
|
+
head: makeSseFn("HEAD"),
|
|
834
|
+
options: makeSseFn("OPTIONS"),
|
|
835
|
+
patch: makeSseFn("PATCH"),
|
|
836
|
+
post: makeSseFn("POST"),
|
|
837
|
+
put: makeSseFn("PUT"),
|
|
838
|
+
trace: makeSseFn("TRACE")
|
|
839
|
+
},
|
|
840
|
+
trace: makeMethodFn("TRACE")
|
|
841
|
+
};
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
// src/api/client.gen.ts
|
|
845
|
+
var client = createClient(
|
|
846
|
+
createConfig({ throwOnError: true })
|
|
847
|
+
);
|
|
848
|
+
|
|
849
|
+
// src/api/sdk.gen.ts
|
|
850
|
+
var appControllerMain = (options) => (options?.client ?? client).get({ url: "/", ...options });
|
|
851
|
+
var healthControllerCheck = (options) => (options?.client ?? client).get({ url: "/health", ...options });
|
|
852
|
+
var authControllerGetOAuth2Token = (options) => (options.client ?? client).post({
|
|
853
|
+
url: "/oauth2/token",
|
|
854
|
+
...options,
|
|
855
|
+
headers: {
|
|
856
|
+
"Content-Type": "application/json",
|
|
857
|
+
...options.headers
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
var authControllerGetOidcDiscovery = (options) => (options?.client ?? client).get({ url: "/.well-known/oauth-authorization-server", ...options });
|
|
861
|
+
var authControllerGetGlobalJwks = (options) => (options?.client ?? client).get({ url: "/.well-known/jwks.json", ...options });
|
|
862
|
+
var tenantControllerGetTenants = (options) => (options?.client ?? client).get({
|
|
863
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
864
|
+
url: "/tenant",
|
|
865
|
+
...options
|
|
866
|
+
});
|
|
867
|
+
var tenantControllerInitTenant = (options) => (options.client ?? client).post({
|
|
868
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
869
|
+
url: "/tenant",
|
|
870
|
+
...options,
|
|
871
|
+
headers: {
|
|
872
|
+
"Content-Type": "application/json",
|
|
873
|
+
...options.headers
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
var tenantControllerDeleteTenant = (options) => (options.client ?? client).delete({
|
|
877
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
878
|
+
url: "/tenant/{id}",
|
|
879
|
+
...options
|
|
880
|
+
});
|
|
881
|
+
var tenantControllerGetTenant = (options) => (options.client ?? client).get({
|
|
882
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
883
|
+
url: "/tenant/{id}",
|
|
884
|
+
...options
|
|
885
|
+
});
|
|
886
|
+
var tenantControllerUpdateTenant = (options) => (options.client ?? client).patch({
|
|
887
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
888
|
+
url: "/tenant/{id}",
|
|
889
|
+
...options,
|
|
890
|
+
headers: {
|
|
891
|
+
"Content-Type": "application/json",
|
|
892
|
+
...options.headers
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
var clientControllerGetClients = (options) => (options?.client ?? client).get({
|
|
896
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
897
|
+
url: "/client",
|
|
898
|
+
...options
|
|
899
|
+
});
|
|
900
|
+
var clientControllerCreateClient = (options) => (options.client ?? client).post({
|
|
901
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
902
|
+
url: "/client",
|
|
903
|
+
...options,
|
|
904
|
+
headers: {
|
|
905
|
+
"Content-Type": "application/json",
|
|
906
|
+
...options.headers
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
var clientControllerDeleteClient = (options) => (options.client ?? client).delete({
|
|
910
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
911
|
+
url: "/client/{id}",
|
|
912
|
+
...options
|
|
913
|
+
});
|
|
914
|
+
var clientControllerGetClient = (options) => (options.client ?? client).get({
|
|
915
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
916
|
+
url: "/client/{id}",
|
|
917
|
+
...options
|
|
918
|
+
});
|
|
919
|
+
var clientControllerUpdateClient = (options) => (options.client ?? client).patch({
|
|
920
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
921
|
+
url: "/client/{id}",
|
|
922
|
+
...options,
|
|
923
|
+
headers: {
|
|
924
|
+
"Content-Type": "application/json",
|
|
925
|
+
...options.headers
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
var clientControllerGetClientSecret = (options) => (options.client ?? client).get({
|
|
929
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
930
|
+
url: "/client/{id}/secret",
|
|
931
|
+
...options
|
|
932
|
+
});
|
|
933
|
+
var clientControllerRotateClientSecret = (options) => (options.client ?? client).post({
|
|
934
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
935
|
+
url: "/client/{id}/rotate-secret",
|
|
936
|
+
...options
|
|
937
|
+
});
|
|
938
|
+
var keyControllerGetKeys = (options) => (options?.client ?? client).get({
|
|
939
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
940
|
+
url: "/key",
|
|
941
|
+
...options
|
|
942
|
+
});
|
|
943
|
+
var keyControllerAddKey = (options) => (options.client ?? client).post({
|
|
944
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
945
|
+
url: "/key",
|
|
946
|
+
...options,
|
|
947
|
+
headers: {
|
|
948
|
+
"Content-Type": "application/json",
|
|
949
|
+
...options.headers
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
var keyControllerDeleteKey = (options) => (options.client ?? client).delete({
|
|
953
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
954
|
+
url: "/key/{id}",
|
|
955
|
+
...options
|
|
956
|
+
});
|
|
957
|
+
var keyControllerGetKey = (options) => (options.client ?? client).get({
|
|
958
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
959
|
+
url: "/key/{id}",
|
|
960
|
+
...options
|
|
961
|
+
});
|
|
962
|
+
var keyControllerUpdateKey = (options) => (options.client ?? client).put({
|
|
963
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
964
|
+
url: "/key/{id}",
|
|
965
|
+
...options,
|
|
966
|
+
headers: {
|
|
967
|
+
"Content-Type": "application/json",
|
|
968
|
+
...options.headers
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
var certControllerGetCertificates = (options) => (options?.client ?? client).get({
|
|
972
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
973
|
+
url: "/certs",
|
|
974
|
+
...options
|
|
975
|
+
});
|
|
976
|
+
var certControllerAddCertificate = (options) => (options.client ?? client).post({
|
|
977
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
978
|
+
url: "/certs",
|
|
979
|
+
...options,
|
|
980
|
+
headers: {
|
|
981
|
+
"Content-Type": "application/json",
|
|
982
|
+
...options.headers
|
|
983
|
+
}
|
|
984
|
+
});
|
|
985
|
+
var certControllerDeleteCertificate = (options) => (options.client ?? client).delete({
|
|
986
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
987
|
+
url: "/certs/{certId}",
|
|
988
|
+
...options
|
|
989
|
+
});
|
|
990
|
+
var certControllerGetCertificate = (options) => (options.client ?? client).get({
|
|
991
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
992
|
+
url: "/certs/{certId}",
|
|
993
|
+
...options
|
|
994
|
+
});
|
|
995
|
+
var certControllerUpdateCertificate = (options) => (options.client ?? client).patch({
|
|
996
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
997
|
+
url: "/certs/{certId}",
|
|
998
|
+
...options,
|
|
999
|
+
headers: {
|
|
1000
|
+
"Content-Type": "application/json",
|
|
1001
|
+
...options.headers
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
var certControllerExportConfig = (options) => (options.client ?? client).get({
|
|
1005
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1006
|
+
url: "/certs/{certId}/config",
|
|
1007
|
+
...options
|
|
1008
|
+
});
|
|
1009
|
+
var statusListControllerGetList = (options) => (options.client ?? client).get({ url: "/{tenantId}/status-management/status-list/{listId}", ...options });
|
|
1010
|
+
var statusListControllerGetStatusListAggregation = (options) => (options.client ?? client).get({
|
|
1011
|
+
url: "/{tenantId}/status-management/status-list-aggregation",
|
|
1012
|
+
...options
|
|
1013
|
+
});
|
|
1014
|
+
var statusListConfigControllerResetConfig = (options) => (options?.client ?? client).delete({
|
|
1015
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1016
|
+
url: "/status-list-config",
|
|
1017
|
+
...options
|
|
1018
|
+
});
|
|
1019
|
+
var statusListConfigControllerGetConfig = (options) => (options?.client ?? client).get({
|
|
1020
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1021
|
+
url: "/status-list-config",
|
|
1022
|
+
...options
|
|
1023
|
+
});
|
|
1024
|
+
var statusListConfigControllerUpdateConfig = (options) => (options.client ?? client).put({
|
|
1025
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1026
|
+
url: "/status-list-config",
|
|
1027
|
+
...options,
|
|
1028
|
+
headers: {
|
|
1029
|
+
"Content-Type": "application/json",
|
|
1030
|
+
...options.headers
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
var statusListManagementControllerGetLists = (options) => (options?.client ?? client).get({
|
|
1034
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1035
|
+
url: "/status-lists",
|
|
1036
|
+
...options
|
|
1037
|
+
});
|
|
1038
|
+
var statusListManagementControllerCreateList = (options) => (options.client ?? client).post({
|
|
1039
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1040
|
+
url: "/status-lists",
|
|
1041
|
+
...options,
|
|
1042
|
+
headers: {
|
|
1043
|
+
"Content-Type": "application/json",
|
|
1044
|
+
...options.headers
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
var statusListManagementControllerDeleteList = (options) => (options.client ?? client).delete({
|
|
1048
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1049
|
+
url: "/status-lists/{listId}",
|
|
1050
|
+
...options
|
|
1051
|
+
});
|
|
1052
|
+
var statusListManagementControllerGetList = (options) => (options.client ?? client).get({
|
|
1053
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1054
|
+
url: "/status-lists/{listId}",
|
|
1055
|
+
...options
|
|
1056
|
+
});
|
|
1057
|
+
var statusListManagementControllerUpdateList = (options) => (options.client ?? client).patch({
|
|
1058
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1059
|
+
url: "/status-lists/{listId}",
|
|
1060
|
+
...options,
|
|
1061
|
+
headers: {
|
|
1062
|
+
"Content-Type": "application/json",
|
|
1063
|
+
...options.headers
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
var sessionControllerGetAllSessions = (options) => (options?.client ?? client).get({
|
|
1067
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1068
|
+
url: "/session",
|
|
1069
|
+
...options
|
|
1070
|
+
});
|
|
1071
|
+
var sessionControllerDeleteSession = (options) => (options.client ?? client).delete({
|
|
1072
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1073
|
+
url: "/session/{id}",
|
|
1074
|
+
...options
|
|
1075
|
+
});
|
|
1076
|
+
var sessionControllerGetSession = (options) => (options.client ?? client).get({
|
|
1077
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1078
|
+
url: "/session/{id}",
|
|
1079
|
+
...options
|
|
1080
|
+
});
|
|
1081
|
+
var sessionControllerRevokeAll = (options) => (options.client ?? client).post({
|
|
1082
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1083
|
+
url: "/session/revoke",
|
|
1084
|
+
...options,
|
|
1085
|
+
headers: {
|
|
1086
|
+
"Content-Type": "application/json",
|
|
1087
|
+
...options.headers
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
var sessionConfigControllerResetConfig = (options) => (options?.client ?? client).delete({
|
|
1091
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1092
|
+
url: "/session-config",
|
|
1093
|
+
...options
|
|
1094
|
+
});
|
|
1095
|
+
var sessionConfigControllerGetConfig = (options) => (options?.client ?? client).get({
|
|
1096
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1097
|
+
url: "/session-config",
|
|
1098
|
+
...options
|
|
1099
|
+
});
|
|
1100
|
+
var sessionConfigControllerUpdateConfig = (options) => (options.client ?? client).put({
|
|
1101
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1102
|
+
url: "/session-config",
|
|
1103
|
+
...options,
|
|
1104
|
+
headers: {
|
|
1105
|
+
"Content-Type": "application/json",
|
|
1106
|
+
...options.headers
|
|
1107
|
+
}
|
|
1108
|
+
});
|
|
1109
|
+
var sessionEventsControllerSubscribeToSessionEvents = (options) => (options.client ?? client).get({ url: "/session/{id}/events", ...options });
|
|
1110
|
+
var issuanceConfigControllerGetIssuanceConfigurations = (options) => (options?.client ?? client).get({
|
|
1111
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1112
|
+
url: "/issuer/config",
|
|
1113
|
+
...options
|
|
1114
|
+
});
|
|
1115
|
+
var issuanceConfigControllerStoreIssuanceConfiguration = (options) => (options.client ?? client).post({
|
|
1116
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1117
|
+
url: "/issuer/config",
|
|
1118
|
+
...options,
|
|
1119
|
+
headers: {
|
|
1120
|
+
"Content-Type": "application/json",
|
|
1121
|
+
...options.headers
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
var credentialConfigControllerGetConfigs = (options) => (options?.client ?? client).get({
|
|
1125
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1126
|
+
url: "/issuer/credentials",
|
|
1127
|
+
...options
|
|
1128
|
+
});
|
|
1129
|
+
var credentialConfigControllerStoreCredentialConfiguration = (options) => (options.client ?? client).post({
|
|
1130
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1131
|
+
url: "/issuer/credentials",
|
|
1132
|
+
...options,
|
|
1133
|
+
headers: {
|
|
1134
|
+
"Content-Type": "application/json",
|
|
1135
|
+
...options.headers
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
var credentialConfigControllerDeleteIssuanceConfiguration = (options) => (options.client ?? client).delete({
|
|
1139
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1140
|
+
url: "/issuer/credentials/{id}",
|
|
1141
|
+
...options
|
|
1142
|
+
});
|
|
1143
|
+
var credentialConfigControllerGetConfigById = (options) => (options.client ?? client).get({
|
|
1144
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1145
|
+
url: "/issuer/credentials/{id}",
|
|
1146
|
+
...options
|
|
1147
|
+
});
|
|
1148
|
+
var credentialConfigControllerUpdateCredentialConfiguration = (options) => (options.client ?? client).patch({
|
|
1149
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1150
|
+
url: "/issuer/credentials/{id}",
|
|
1151
|
+
...options,
|
|
1152
|
+
headers: {
|
|
1153
|
+
"Content-Type": "application/json",
|
|
1154
|
+
...options.headers
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
var presentationManagementControllerConfiguration = (options) => (options?.client ?? client).get({
|
|
1158
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1159
|
+
url: "/verifier/config",
|
|
1160
|
+
...options
|
|
1161
|
+
});
|
|
1162
|
+
var presentationManagementControllerStorePresentationConfig = (options) => (options.client ?? client).post({
|
|
1163
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1164
|
+
url: "/verifier/config",
|
|
1165
|
+
...options,
|
|
1166
|
+
headers: {
|
|
1167
|
+
"Content-Type": "application/json",
|
|
1168
|
+
...options.headers
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
var presentationManagementControllerDeleteConfiguration = (options) => (options.client ?? client).delete({
|
|
1172
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1173
|
+
url: "/verifier/config/{id}",
|
|
1174
|
+
...options
|
|
1175
|
+
});
|
|
1176
|
+
var presentationManagementControllerGetConfiguration = (options) => (options.client ?? client).get({
|
|
1177
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1178
|
+
url: "/verifier/config/{id}",
|
|
1179
|
+
...options
|
|
1180
|
+
});
|
|
1181
|
+
var presentationManagementControllerUpdateConfiguration = (options) => (options.client ?? client).patch({
|
|
1182
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1183
|
+
url: "/verifier/config/{id}",
|
|
1184
|
+
...options,
|
|
1185
|
+
headers: {
|
|
1186
|
+
"Content-Type": "application/json",
|
|
1187
|
+
...options.headers
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
var cacheControllerGetStats = (options) => (options?.client ?? client).get({
|
|
1191
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1192
|
+
url: "/cache/stats",
|
|
1193
|
+
...options
|
|
1194
|
+
});
|
|
1195
|
+
var cacheControllerClearAllCaches = (options) => (options?.client ?? client).delete({
|
|
1196
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1197
|
+
url: "/cache",
|
|
1198
|
+
...options
|
|
1199
|
+
});
|
|
1200
|
+
var cacheControllerClearTrustListCache = (options) => (options?.client ?? client).delete({
|
|
1201
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1202
|
+
url: "/cache/trust-list",
|
|
1203
|
+
...options
|
|
1204
|
+
});
|
|
1205
|
+
var cacheControllerClearStatusListCache = (options) => (options?.client ?? client).delete({
|
|
1206
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1207
|
+
url: "/cache/status-list",
|
|
1208
|
+
...options
|
|
1209
|
+
});
|
|
1210
|
+
var oid4VciControllerCredential = (options) => (options.client ?? client).post({ url: "/{tenantId}/vci/credential", ...options });
|
|
1211
|
+
var oid4VciControllerDeferredCredential = (options) => (options.client ?? client).post({
|
|
1212
|
+
url: "/{tenantId}/vci/deferred_credential",
|
|
1213
|
+
...options,
|
|
1214
|
+
headers: {
|
|
1215
|
+
"Content-Type": "application/json",
|
|
1216
|
+
...options.headers
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
var oid4VciControllerNotifications = (options) => (options.client ?? client).post({
|
|
1220
|
+
url: "/{tenantId}/vci/notification",
|
|
1221
|
+
...options,
|
|
1222
|
+
headers: {
|
|
1223
|
+
"Content-Type": "application/json",
|
|
1224
|
+
...options.headers
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1227
|
+
var oid4VciControllerNonce = (options) => (options.client ?? client).post({ url: "/{tenantId}/vci/nonce", ...options });
|
|
1228
|
+
var authorizeControllerAuthorize = (options) => (options.client ?? client).get({ url: "/{tenantId}/authorize", ...options });
|
|
1229
|
+
var authorizeControllerPar = (options) => (options.client ?? client).post({
|
|
1230
|
+
url: "/{tenantId}/authorize/par",
|
|
1231
|
+
...options,
|
|
1232
|
+
headers: {
|
|
1233
|
+
"Content-Type": "application/json",
|
|
1234
|
+
...options.headers
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
var authorizeControllerToken = (options) => (options.client ?? client).post({ url: "/{tenantId}/authorize/token", ...options });
|
|
1238
|
+
var interactiveAuthorizationControllerInteractiveAuthorization = (options) => (options.client ?? client).post({
|
|
1239
|
+
url: "/{tenantId}/authorize/interactive",
|
|
1240
|
+
...options,
|
|
1241
|
+
headers: {
|
|
1242
|
+
"Content-Type": "application/json",
|
|
1243
|
+
...options.headers
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
var interactiveAuthorizationControllerCompleteWebAuth = (options) => (options.client ?? client).post({
|
|
1247
|
+
url: "/{tenantId}/authorize/interactive/complete-web-auth/{authSession}",
|
|
1248
|
+
...options
|
|
1249
|
+
});
|
|
1250
|
+
var chainedAsControllerPar = (options) => (options.client ?? client).post({
|
|
1251
|
+
url: "/{tenant}/chained-as/par",
|
|
1252
|
+
...options,
|
|
1253
|
+
headers: {
|
|
1254
|
+
"Content-Type": "application/json",
|
|
1255
|
+
...options.headers
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1258
|
+
var chainedAsControllerAuthorize = (options) => (options.client ?? client).get({ url: "/{tenant}/chained-as/authorize", ...options });
|
|
1259
|
+
var chainedAsControllerCallback = (options) => (options.client ?? client).get({ url: "/{tenant}/chained-as/callback", ...options });
|
|
1260
|
+
var chainedAsControllerToken = (options) => (options.client ?? client).post({
|
|
1261
|
+
url: "/{tenant}/chained-as/token",
|
|
1262
|
+
...options,
|
|
1263
|
+
headers: {
|
|
1264
|
+
"Content-Type": "application/json",
|
|
1265
|
+
...options.headers
|
|
1266
|
+
}
|
|
1267
|
+
});
|
|
1268
|
+
var chainedAsControllerJwks = (options) => (options.client ?? client).get({ url: "/{tenant}/chained-as/.well-known/jwks.json", ...options });
|
|
1269
|
+
var chainedAsControllerGetMetadata = (options) => (options.client ?? client).get({
|
|
1270
|
+
url: "/{tenant}/chained-as/.well-known/oauth-authorization-server",
|
|
1271
|
+
...options
|
|
1272
|
+
});
|
|
1273
|
+
var credentialOfferControllerGetOffer = (options) => (options.client ?? client).post({
|
|
1274
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1275
|
+
url: "/issuer/offer",
|
|
1276
|
+
...options,
|
|
1277
|
+
headers: {
|
|
1278
|
+
"Content-Type": "application/json",
|
|
1279
|
+
...options.headers
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
var deferredControllerCompleteDeferred = (options) => (options.client ?? client).post({
|
|
1283
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1284
|
+
url: "/issuer/deferred/{transactionId}/complete",
|
|
1285
|
+
...options,
|
|
1286
|
+
headers: {
|
|
1287
|
+
"Content-Type": "application/json",
|
|
1288
|
+
...options.headers
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
var deferredControllerFailDeferred = (options) => (options.client ?? client).post({
|
|
1292
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1293
|
+
url: "/issuer/deferred/{transactionId}/fail",
|
|
1294
|
+
...options,
|
|
1295
|
+
headers: {
|
|
1296
|
+
"Content-Type": "application/json",
|
|
1297
|
+
...options.headers
|
|
1298
|
+
}
|
|
1299
|
+
});
|
|
1300
|
+
var oid4VciMetadataControllerVct = (options) => (options.client ?? client).get({ url: "/{tenantId}/credentials-metadata/vct/{id}", ...options });
|
|
1301
|
+
var wellKnownControllerIssuerMetadata0 = (options) => (options.client ?? client).get({ url: "/.well-known/openid-credential-issuer/{tenantId}", ...options });
|
|
1302
|
+
var wellKnownControllerIssuerMetadata1 = (options) => (options.client ?? client).get({ url: "/{tenantId}/.well-known/openid-credential-issuer", ...options });
|
|
1303
|
+
var wellKnownControllerAuthzMetadata0 = (options) => (options.client ?? client).get({ url: "/.well-known/oauth-authorization-server/{tenantId}", ...options });
|
|
1304
|
+
var wellKnownControllerAuthzMetadata1 = (options) => (options.client ?? client).get({ url: "/{tenantId}/.well-known/oauth-authorization-server", ...options });
|
|
1305
|
+
var wellKnownControllerGetJwks0 = (options) => (options.client ?? client).get({ url: "/.well-known/jwks.json/{tenantId}", ...options });
|
|
1306
|
+
var wellKnownControllerGetJwks1 = (options) => (options.client ?? client).get({ url: "/{tenantId}/.well-known/jwks.json", ...options });
|
|
1307
|
+
var oid4VpControllerGetRequestWithSession = (options) => (options.client ?? client).get({ url: "/{session}/oid4vp/request", ...options });
|
|
1308
|
+
var oid4VpControllerGetPostRequestWithSession = (options) => (options.client ?? client).post({ url: "/{session}/oid4vp/request", ...options });
|
|
1309
|
+
var oid4VpControllerGetRequestNoRedirectWithSession = (options) => (options.client ?? client).get({ url: "/{session}/oid4vp/request/no-redirect", ...options });
|
|
1310
|
+
var oid4VpControllerGetResponse = (options) => (options.client ?? client).post({
|
|
1311
|
+
url: "/{session}/oid4vp",
|
|
1312
|
+
...options,
|
|
1313
|
+
headers: {
|
|
1314
|
+
"Content-Type": "application/json",
|
|
1315
|
+
...options.headers
|
|
1316
|
+
}
|
|
1317
|
+
});
|
|
1318
|
+
var registrarControllerDeleteConfig = (options) => (options?.client ?? client).delete({
|
|
1319
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1320
|
+
url: "/registrar/config",
|
|
1321
|
+
...options
|
|
1322
|
+
});
|
|
1323
|
+
var registrarControllerGetConfig = (options) => (options?.client ?? client).get({
|
|
1324
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1325
|
+
url: "/registrar/config",
|
|
1326
|
+
...options
|
|
1327
|
+
});
|
|
1328
|
+
var registrarControllerUpdateConfig = (options) => (options.client ?? client).patch({
|
|
1329
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1330
|
+
url: "/registrar/config",
|
|
1331
|
+
...options,
|
|
1332
|
+
headers: {
|
|
1333
|
+
"Content-Type": "application/json",
|
|
1334
|
+
...options.headers
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
var registrarControllerCreateConfig = (options) => (options.client ?? client).post({
|
|
1338
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1339
|
+
url: "/registrar/config",
|
|
1340
|
+
...options,
|
|
1341
|
+
headers: {
|
|
1342
|
+
"Content-Type": "application/json",
|
|
1343
|
+
...options.headers
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
var registrarControllerCreateAccessCertificate = (options) => (options.client ?? client).post({
|
|
1347
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1348
|
+
url: "/registrar/access-certificate",
|
|
1349
|
+
...options,
|
|
1350
|
+
headers: {
|
|
1351
|
+
"Content-Type": "application/json",
|
|
1352
|
+
...options.headers
|
|
1353
|
+
}
|
|
1354
|
+
});
|
|
1355
|
+
var trustListControllerGetAllTrustLists = (options) => (options?.client ?? client).get({
|
|
1356
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1357
|
+
url: "/trust-list",
|
|
1358
|
+
...options
|
|
1359
|
+
});
|
|
1360
|
+
var trustListControllerCreateTrustList = (options) => (options.client ?? client).post({
|
|
1361
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1362
|
+
url: "/trust-list",
|
|
1363
|
+
...options,
|
|
1364
|
+
headers: {
|
|
1365
|
+
"Content-Type": "application/json",
|
|
1366
|
+
...options.headers
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
var trustListControllerDeleteTrustList = (options) => (options.client ?? client).delete({
|
|
1370
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1371
|
+
url: "/trust-list/{id}",
|
|
1372
|
+
...options
|
|
1373
|
+
});
|
|
1374
|
+
var trustListControllerGetTrustList = (options) => (options.client ?? client).get({
|
|
1375
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1376
|
+
url: "/trust-list/{id}",
|
|
1377
|
+
...options
|
|
1378
|
+
});
|
|
1379
|
+
var trustListControllerUpdateTrustList = (options) => (options.client ?? client).put({
|
|
1380
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1381
|
+
url: "/trust-list/{id}",
|
|
1382
|
+
...options,
|
|
1383
|
+
headers: {
|
|
1384
|
+
"Content-Type": "application/json",
|
|
1385
|
+
...options.headers
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
var trustListControllerExportTrustList = (options) => (options.client ?? client).get({
|
|
1389
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1390
|
+
url: "/trust-list/{id}/export",
|
|
1391
|
+
...options
|
|
1392
|
+
});
|
|
1393
|
+
var trustListControllerGetTrustListVersions = (options) => (options.client ?? client).get({
|
|
1394
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1395
|
+
url: "/trust-list/{id}/versions",
|
|
1396
|
+
...options
|
|
1397
|
+
});
|
|
1398
|
+
var trustListControllerGetTrustListVersion = (options) => (options.client ?? client).get({
|
|
1399
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1400
|
+
url: "/trust-list/{id}/versions/{versionId}",
|
|
1401
|
+
...options
|
|
1402
|
+
});
|
|
1403
|
+
var trustListPublicControllerGetTrustListJwt = (options) => (options.client ?? client).get({ url: "/{tenantId}/trust-list/{id}", ...options });
|
|
1404
|
+
var verifierOfferControllerGetOffer = (options) => (options.client ?? client).post({
|
|
1405
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1406
|
+
url: "/verifier/offer",
|
|
1407
|
+
...options,
|
|
1408
|
+
headers: {
|
|
1409
|
+
"Content-Type": "application/json",
|
|
1410
|
+
...options.headers
|
|
1411
|
+
}
|
|
1412
|
+
});
|
|
1413
|
+
var storageControllerUpload = (options) => (options.client ?? client).post({
|
|
1414
|
+
...formDataBodySerializer,
|
|
1415
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1416
|
+
url: "/storage",
|
|
1417
|
+
...options,
|
|
1418
|
+
headers: {
|
|
1419
|
+
"Content-Type": null,
|
|
1420
|
+
...options.headers
|
|
1421
|
+
}
|
|
1422
|
+
});
|
|
1423
|
+
var storageControllerDownload = (options) => (options.client ?? client).get({ url: "/storage/{key}", ...options });
|
|
1424
|
+
|
|
1425
|
+
// src/client.ts
|
|
1426
|
+
function isDcApiAvailable() {
|
|
1427
|
+
return typeof navigator !== "undefined" && "credentials" in navigator && "get" in navigator.credentials && typeof window !== "undefined" && "DigitalCredential" in window;
|
|
1428
|
+
}
|
|
1429
|
+
function decodeJwtPayload(jwt) {
|
|
1430
|
+
const parts = jwt.split(".");
|
|
1431
|
+
if (parts.length !== 3) {
|
|
1432
|
+
throw new Error("Invalid JWT format");
|
|
1433
|
+
}
|
|
1434
|
+
const payload = parts[1];
|
|
1435
|
+
const base64 = payload.replace(/-/g, "+").replace(/_/g, "/");
|
|
1436
|
+
const jsonPayload = atob(base64);
|
|
1437
|
+
return JSON.parse(jsonPayload);
|
|
1438
|
+
}
|
|
1439
|
+
var EudiploClient = class {
|
|
1440
|
+
config;
|
|
1441
|
+
accessToken;
|
|
1442
|
+
tokenExpiresAt;
|
|
1443
|
+
refreshPromise;
|
|
1444
|
+
constructor(config) {
|
|
1445
|
+
this.config = {
|
|
1446
|
+
autoRefresh: true,
|
|
1447
|
+
...config
|
|
1448
|
+
};
|
|
1449
|
+
client.setConfig({
|
|
1450
|
+
baseUrl: config.baseUrl,
|
|
1451
|
+
fetch: config.fetch
|
|
1452
|
+
});
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Authenticate and obtain an access token.
|
|
1456
|
+
* Called automatically by other methods, but can be called explicitly.
|
|
1457
|
+
*/
|
|
1458
|
+
async authenticate() {
|
|
1459
|
+
if (this.refreshPromise) {
|
|
1460
|
+
return this.refreshPromise;
|
|
1461
|
+
}
|
|
1462
|
+
this.refreshPromise = this._doAuthenticate();
|
|
1463
|
+
try {
|
|
1464
|
+
await this.refreshPromise;
|
|
1465
|
+
} finally {
|
|
1466
|
+
this.refreshPromise = void 0;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
async _doAuthenticate() {
|
|
1470
|
+
const res = await authControllerGetOAuth2Token({
|
|
1471
|
+
body: {
|
|
1472
|
+
grant_type: "client_credentials",
|
|
1473
|
+
client_id: this.config.clientId,
|
|
1474
|
+
client_secret: this.config.clientSecret
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1477
|
+
if (!res.response.ok) {
|
|
1478
|
+
const error = await res.response.text();
|
|
1479
|
+
throw new Error(`Authentication failed: ${res.response.status} ${error}`);
|
|
1480
|
+
}
|
|
1481
|
+
const data = res.data;
|
|
1482
|
+
this.accessToken = data.access_token;
|
|
1483
|
+
this.tokenExpiresAt = Date.now() + data.expires_in * 1e3;
|
|
1484
|
+
client.setConfig({
|
|
1485
|
+
baseUrl: this.config.baseUrl,
|
|
1486
|
+
fetch: this.config.fetch,
|
|
1487
|
+
headers: {
|
|
1488
|
+
Authorization: `Bearer ${this.accessToken}`
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Ensure we have a valid access token, refreshing if necessary.
|
|
1494
|
+
*/
|
|
1495
|
+
async ensureAuthenticated() {
|
|
1496
|
+
const bufferMs = 6e4;
|
|
1497
|
+
if (!this.accessToken || !this.tokenExpiresAt) {
|
|
1498
|
+
await this.authenticate();
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
if (this.config.autoRefresh && Date.now() > this.tokenExpiresAt - bufferMs) {
|
|
1502
|
+
await this.authenticate();
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
/**
|
|
1506
|
+
* Create a credential issuance offer.
|
|
1507
|
+
*
|
|
1508
|
+
* @example
|
|
1509
|
+
* ```typescript
|
|
1510
|
+
* const { uri, sessionId } = await client.createIssuanceOffer({
|
|
1511
|
+
* credentialConfigurationIds: ['PID'],
|
|
1512
|
+
* claims: {
|
|
1513
|
+
* PID: { given_name: 'John', family_name: 'Doe' }
|
|
1514
|
+
* }
|
|
1515
|
+
* });
|
|
1516
|
+
* ```
|
|
1517
|
+
*/
|
|
1518
|
+
async createIssuanceOffer(options) {
|
|
1519
|
+
await this.ensureAuthenticated();
|
|
1520
|
+
const body = {
|
|
1521
|
+
response_type: options.responseType ?? "uri",
|
|
1522
|
+
credentialConfigurationIds: options.credentialConfigurationIds,
|
|
1523
|
+
flow: options.flow ?? "pre_authorized_code",
|
|
1524
|
+
tx_code: options.txCode
|
|
1525
|
+
};
|
|
1526
|
+
if (options.claims) {
|
|
1527
|
+
body.credentialClaims = {
|
|
1528
|
+
additionalProperties: void 0
|
|
1529
|
+
};
|
|
1530
|
+
for (const [configId, claims] of Object.entries(options.claims)) {
|
|
1531
|
+
body.credentialClaims[configId] = {
|
|
1532
|
+
type: "inline",
|
|
1533
|
+
claims
|
|
1534
|
+
};
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
const response = await credentialOfferControllerGetOffer({
|
|
1538
|
+
body
|
|
1539
|
+
});
|
|
1540
|
+
if (!response.data) {
|
|
1541
|
+
throw new Error("Failed to create issuance offer");
|
|
1542
|
+
}
|
|
1543
|
+
return {
|
|
1544
|
+
uri: response.data.uri,
|
|
1545
|
+
sessionId: response.data.session
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Create a presentation request (for verification).
|
|
1550
|
+
*
|
|
1551
|
+
* Returns two URIs:
|
|
1552
|
+
* - `uri`: For same-device flow (wallet on same device, redirect after completion)
|
|
1553
|
+
* - `crossDeviceUri`: For cross-device flow (QR code, no redirect, poll for status)
|
|
1554
|
+
*
|
|
1555
|
+
* @example Same-device flow (wallet app on user's device)
|
|
1556
|
+
* ```typescript
|
|
1557
|
+
* const { uri, sessionId } = await client.createPresentationRequest({
|
|
1558
|
+
* configId: 'age-over-18',
|
|
1559
|
+
* redirectUri: 'https://example.com/callback'
|
|
1560
|
+
* });
|
|
1561
|
+
* // Redirect user to uri - wallet will redirect back after completion
|
|
1562
|
+
* window.location.href = uri;
|
|
1563
|
+
* ```
|
|
1564
|
+
*
|
|
1565
|
+
* @example Cross-device flow (QR code scanned by separate device)
|
|
1566
|
+
* ```typescript
|
|
1567
|
+
* const { crossDeviceUri, sessionId } = await client.createPresentationRequest({
|
|
1568
|
+
* configId: 'age-over-18'
|
|
1569
|
+
* });
|
|
1570
|
+
* // Display crossDeviceUri as QR code, then poll for completion
|
|
1571
|
+
* const session = await client.waitForSession(sessionId);
|
|
1572
|
+
* ```
|
|
1573
|
+
*/
|
|
1574
|
+
async createPresentationRequest(options) {
|
|
1575
|
+
await this.ensureAuthenticated();
|
|
1576
|
+
const body = {
|
|
1577
|
+
response_type: options.responseType ?? "uri",
|
|
1578
|
+
requestId: options.configId,
|
|
1579
|
+
redirectUri: options.redirectUri
|
|
1580
|
+
};
|
|
1581
|
+
const response = await verifierOfferControllerGetOffer({
|
|
1582
|
+
body
|
|
1583
|
+
});
|
|
1584
|
+
if (!response.data) {
|
|
1585
|
+
throw new Error("Failed to create presentation request");
|
|
1586
|
+
}
|
|
1587
|
+
return {
|
|
1588
|
+
uri: response.data.uri,
|
|
1589
|
+
crossDeviceUri: response.data.crossDeviceUri ?? response.data.uri,
|
|
1590
|
+
sessionId: response.data.session
|
|
1591
|
+
};
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Get the current health of the EUDIPLO connector.
|
|
1595
|
+
* The status in the response is `ok`/`error`.
|
|
1596
|
+
* The health of the components is listed in the response under `info`/`error`/`details`.
|
|
1597
|
+
* If the EUDIPLO connector itself is unreachable, no components are listed.
|
|
1598
|
+
*/
|
|
1599
|
+
async getHealth() {
|
|
1600
|
+
const response = await healthControllerCheck({ throwOnError: false });
|
|
1601
|
+
if (!response.data) {
|
|
1602
|
+
return { status: "error" };
|
|
1603
|
+
}
|
|
1604
|
+
return response.data;
|
|
1605
|
+
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Get the current status of a session.
|
|
1608
|
+
*/
|
|
1609
|
+
async getSession(sessionId) {
|
|
1610
|
+
await this.ensureAuthenticated();
|
|
1611
|
+
const response = await sessionControllerGetSession({
|
|
1612
|
+
path: { id: sessionId }
|
|
1613
|
+
});
|
|
1614
|
+
if (!response.data) {
|
|
1615
|
+
throw new Error(`Session not found: ${sessionId}`);
|
|
1616
|
+
}
|
|
1617
|
+
return response.data;
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Wait for a session to complete (polling).
|
|
1621
|
+
*
|
|
1622
|
+
* @example
|
|
1623
|
+
* ```typescript
|
|
1624
|
+
* const session = await client.waitForSession(sessionId, {
|
|
1625
|
+
* interval: 1000,
|
|
1626
|
+
* timeout: 60000,
|
|
1627
|
+
* onUpdate: (s) => console.log('Status:', s.status)
|
|
1628
|
+
* });
|
|
1629
|
+
* ```
|
|
1630
|
+
*/
|
|
1631
|
+
async waitForSession(sessionId, options = {}) {
|
|
1632
|
+
const {
|
|
1633
|
+
interval = 1e3,
|
|
1634
|
+
timeout = 3e5,
|
|
1635
|
+
onUpdate,
|
|
1636
|
+
signal
|
|
1637
|
+
} = options;
|
|
1638
|
+
const startTime = Date.now();
|
|
1639
|
+
while (true) {
|
|
1640
|
+
if (signal?.aborted) {
|
|
1641
|
+
throw new Error("Session polling aborted");
|
|
1642
|
+
}
|
|
1643
|
+
if (Date.now() - startTime > timeout) {
|
|
1644
|
+
throw new Error(`Session polling timed out after ${timeout}ms`);
|
|
1645
|
+
}
|
|
1646
|
+
const session = await this.getSession(sessionId);
|
|
1647
|
+
if (onUpdate) {
|
|
1648
|
+
onUpdate(session);
|
|
1649
|
+
}
|
|
1650
|
+
if (session.status === "completed") {
|
|
1651
|
+
return session;
|
|
1652
|
+
}
|
|
1653
|
+
if (session.status === "expired" || session.status === "failed") {
|
|
1654
|
+
throw new Error(`Session ${session.status}: ${sessionId}`);
|
|
1655
|
+
}
|
|
1656
|
+
await this.sleep(interval, signal);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
/**
|
|
1660
|
+
* Helper to sleep with abort support
|
|
1661
|
+
*/
|
|
1662
|
+
sleep(ms, signal) {
|
|
1663
|
+
return new Promise((resolve, reject) => {
|
|
1664
|
+
const timeoutId = setTimeout(resolve, ms);
|
|
1665
|
+
if (signal) {
|
|
1666
|
+
signal.addEventListener("abort", () => {
|
|
1667
|
+
clearTimeout(timeoutId);
|
|
1668
|
+
reject(new Error("Aborted"));
|
|
1669
|
+
}, { once: true });
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
/**
|
|
1674
|
+
* Subscribe to real-time session status updates via Server-Sent Events.
|
|
1675
|
+
*
|
|
1676
|
+
* This is more efficient than polling and provides instant updates.
|
|
1677
|
+
* The connection remains open until closed or the session reaches a terminal state.
|
|
1678
|
+
*
|
|
1679
|
+
* @example
|
|
1680
|
+
* ```typescript
|
|
1681
|
+
* const subscription = await client.subscribeToSession(sessionId, {
|
|
1682
|
+
* onStatusChange: (event) => {
|
|
1683
|
+
* console.log(`Status: ${event.status}`);
|
|
1684
|
+
* if (['completed', 'expired', 'failed'].includes(event.status)) {
|
|
1685
|
+
* subscription.close();
|
|
1686
|
+
* }
|
|
1687
|
+
* },
|
|
1688
|
+
* onError: (error) => console.error('SSE error:', error)
|
|
1689
|
+
* });
|
|
1690
|
+
*
|
|
1691
|
+
* // Later, to close the connection:
|
|
1692
|
+
* subscription.close();
|
|
1693
|
+
* ```
|
|
1694
|
+
*/
|
|
1695
|
+
async subscribeToSession(sessionId, options = {}) {
|
|
1696
|
+
await this.ensureAuthenticated();
|
|
1697
|
+
const token = this.accessToken;
|
|
1698
|
+
if (!token) {
|
|
1699
|
+
throw new Error("No access token available");
|
|
1700
|
+
}
|
|
1701
|
+
if (typeof EventSource === "undefined") {
|
|
1702
|
+
throw new Error(
|
|
1703
|
+
"EventSource is not available in this environment. Use polling with waitForSession() instead, or provide a polyfill."
|
|
1704
|
+
);
|
|
1705
|
+
}
|
|
1706
|
+
const url = `${this.config.baseUrl}/session/${sessionId}/events?token=${encodeURIComponent(token)}`;
|
|
1707
|
+
const eventSource = new EventSource(url);
|
|
1708
|
+
eventSource.onopen = () => {
|
|
1709
|
+
options.onOpen?.();
|
|
1710
|
+
};
|
|
1711
|
+
eventSource.onmessage = (event) => {
|
|
1712
|
+
try {
|
|
1713
|
+
const data = JSON.parse(event.data);
|
|
1714
|
+
options.onStatusChange?.(data);
|
|
1715
|
+
} catch (error) {
|
|
1716
|
+
options.onError?.(new Error(`Failed to parse SSE event: ${error}`));
|
|
1717
|
+
}
|
|
1718
|
+
};
|
|
1719
|
+
eventSource.onerror = () => {
|
|
1720
|
+
options.onError?.(new Error("SSE connection error"));
|
|
1721
|
+
};
|
|
1722
|
+
return {
|
|
1723
|
+
close: () => eventSource.close()
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
/**
|
|
1727
|
+
* Subscribe to session and wait for completion via SSE.
|
|
1728
|
+
*
|
|
1729
|
+
* Returns a Promise that resolves when the session completes,
|
|
1730
|
+
* or rejects if it fails/expires.
|
|
1731
|
+
*
|
|
1732
|
+
* @example
|
|
1733
|
+
* ```typescript
|
|
1734
|
+
* try {
|
|
1735
|
+
* const finalStatus = await client.waitForSessionWithSse(sessionId);
|
|
1736
|
+
* console.log('Session completed:', finalStatus);
|
|
1737
|
+
* } catch (error) {
|
|
1738
|
+
* console.error('Session failed:', error);
|
|
1739
|
+
* }
|
|
1740
|
+
* ```
|
|
1741
|
+
*/
|
|
1742
|
+
async waitForSessionWithSse(sessionId, options = {}) {
|
|
1743
|
+
return new Promise(async (resolve, reject) => {
|
|
1744
|
+
try {
|
|
1745
|
+
const subscription = await this.subscribeToSession(sessionId, {
|
|
1746
|
+
onStatusChange: (event) => {
|
|
1747
|
+
options.onStatusChange?.(event);
|
|
1748
|
+
if (event.status === "completed") {
|
|
1749
|
+
subscription.close();
|
|
1750
|
+
resolve(event);
|
|
1751
|
+
} else if (event.status === "expired" || event.status === "failed") {
|
|
1752
|
+
subscription.close();
|
|
1753
|
+
reject(new Error(`Session ${event.status}: ${sessionId}`));
|
|
1754
|
+
}
|
|
1755
|
+
},
|
|
1756
|
+
onError: (error) => {
|
|
1757
|
+
console.warn("SSE connection error, reconnecting...", error);
|
|
1758
|
+
}
|
|
1759
|
+
});
|
|
1760
|
+
} catch (error) {
|
|
1761
|
+
reject(error);
|
|
1762
|
+
}
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Get the current access token (for advanced usage)
|
|
1767
|
+
*/
|
|
1768
|
+
getAccessToken() {
|
|
1769
|
+
return this.accessToken;
|
|
1770
|
+
}
|
|
1771
|
+
/**
|
|
1772
|
+
* Get the configured base URL
|
|
1773
|
+
*/
|
|
1774
|
+
getBaseUrl() {
|
|
1775
|
+
return this.config.baseUrl;
|
|
1776
|
+
}
|
|
1777
|
+
// ==========================================================================
|
|
1778
|
+
// Digital Credentials API Methods
|
|
1779
|
+
// ==========================================================================
|
|
1780
|
+
/**
|
|
1781
|
+
* Create a presentation request configured for DC API usage.
|
|
1782
|
+
* Returns a session with the signed request object needed for DC API.
|
|
1783
|
+
*
|
|
1784
|
+
* @example
|
|
1785
|
+
* ```typescript
|
|
1786
|
+
* const session = await client.createDcApiPresentationRequest({
|
|
1787
|
+
* configId: 'age-over-18'
|
|
1788
|
+
* });
|
|
1789
|
+
*
|
|
1790
|
+
* // Use the requestObject with the DC API
|
|
1791
|
+
* const result = await client.submitDcApiPresentation(session);
|
|
1792
|
+
* ```
|
|
1793
|
+
*/
|
|
1794
|
+
async createDcApiPresentationRequest(options) {
|
|
1795
|
+
await this.ensureAuthenticated();
|
|
1796
|
+
const body = {
|
|
1797
|
+
response_type: "dc-api",
|
|
1798
|
+
requestId: options.configId,
|
|
1799
|
+
redirectUri: options.redirectUri
|
|
1800
|
+
};
|
|
1801
|
+
const response = await verifierOfferControllerGetOffer({
|
|
1802
|
+
body
|
|
1803
|
+
});
|
|
1804
|
+
if (!response.data) {
|
|
1805
|
+
throw new Error("Failed to create DC API presentation request");
|
|
1806
|
+
}
|
|
1807
|
+
return this.getSession(response.data.session);
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Submit a presentation using the Digital Credentials API.
|
|
1811
|
+
* This method handles the browser DC API call and submits the response to the verifier.
|
|
1812
|
+
*
|
|
1813
|
+
* @example
|
|
1814
|
+
* ```typescript
|
|
1815
|
+
* // Check if DC API is available
|
|
1816
|
+
* if (!isDcApiAvailable()) {
|
|
1817
|
+
* throw new Error('DC API not supported in this browser');
|
|
1818
|
+
* }
|
|
1819
|
+
*
|
|
1820
|
+
* const session = await client.createDcApiPresentationRequest({
|
|
1821
|
+
* configId: 'age-over-18'
|
|
1822
|
+
* });
|
|
1823
|
+
*
|
|
1824
|
+
* const result = await client.submitDcApiPresentation(session);
|
|
1825
|
+
* console.log('Verified credentials:', result.credentials);
|
|
1826
|
+
* ```
|
|
1827
|
+
*/
|
|
1828
|
+
async submitDcApiPresentation(session, options = {}) {
|
|
1829
|
+
if (!isDcApiAvailable()) {
|
|
1830
|
+
throw new Error(
|
|
1831
|
+
"Digital Credentials API is not available in this browser. Please use a supported browser or fall back to QR code flow."
|
|
1832
|
+
);
|
|
1833
|
+
}
|
|
1834
|
+
if (!session.requestObject) {
|
|
1835
|
+
throw new Error(
|
|
1836
|
+
'Session does not contain a requestObject. Make sure to create the session with response_type: "dc-api"'
|
|
1837
|
+
);
|
|
1838
|
+
}
|
|
1839
|
+
const dcResponse = await navigator.credentials.get({
|
|
1840
|
+
mediation: "required",
|
|
1841
|
+
digital: {
|
|
1842
|
+
requests: [
|
|
1843
|
+
{
|
|
1844
|
+
protocol: "openid4vp-v1-signed",
|
|
1845
|
+
data: { request: session.requestObject }
|
|
1846
|
+
}
|
|
1847
|
+
]
|
|
1848
|
+
}
|
|
1849
|
+
});
|
|
1850
|
+
if (!dcResponse) {
|
|
1851
|
+
throw new Error("No response from Digital Credentials API");
|
|
1852
|
+
}
|
|
1853
|
+
if (dcResponse.data?.error) {
|
|
1854
|
+
throw new Error(
|
|
1855
|
+
`Wallet error: ${dcResponse.data.error}${dcResponse.data.error_description ? ` - ${dcResponse.data.error_description}` : ""}`
|
|
1856
|
+
);
|
|
1857
|
+
}
|
|
1858
|
+
const requestPayload = decodeJwtPayload(
|
|
1859
|
+
session.requestObject
|
|
1860
|
+
);
|
|
1861
|
+
if (!requestPayload.response_uri) {
|
|
1862
|
+
throw new Error("No response_uri found in request object");
|
|
1863
|
+
}
|
|
1864
|
+
const fetchImpl = this.config.fetch ?? fetch;
|
|
1865
|
+
const submitResponse = await fetchImpl(requestPayload.response_uri, {
|
|
1866
|
+
method: "POST",
|
|
1867
|
+
headers: {
|
|
1868
|
+
"Content-Type": "application/json"
|
|
1869
|
+
},
|
|
1870
|
+
body: JSON.stringify({
|
|
1871
|
+
...dcResponse.data,
|
|
1872
|
+
sendResponse: options.sendResponse ?? true
|
|
1873
|
+
})
|
|
1874
|
+
});
|
|
1875
|
+
if (!submitResponse.ok) {
|
|
1876
|
+
const errorText = await submitResponse.text();
|
|
1877
|
+
throw new Error(
|
|
1878
|
+
`Failed to submit presentation: ${submitResponse.status} ${errorText}`
|
|
1879
|
+
);
|
|
1880
|
+
}
|
|
1881
|
+
const result = await submitResponse.json();
|
|
1882
|
+
return {
|
|
1883
|
+
credentials: result.credentials ?? result,
|
|
1884
|
+
response: result,
|
|
1885
|
+
redirectUri: result.redirect_uri
|
|
1886
|
+
};
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Convenience method to create a presentation request and immediately
|
|
1890
|
+
* submit it using the Digital Credentials API.
|
|
1891
|
+
*
|
|
1892
|
+
* @example
|
|
1893
|
+
* ```typescript
|
|
1894
|
+
* const result = await client.verifyWithDcApi({
|
|
1895
|
+
* configId: 'age-over-18'
|
|
1896
|
+
* });
|
|
1897
|
+
* console.log('Verified:', result.credentials);
|
|
1898
|
+
* ```
|
|
1899
|
+
*/
|
|
1900
|
+
async verifyWithDcApi(options, dcOptions = {}) {
|
|
1901
|
+
const session = await this.createDcApiPresentationRequest(options);
|
|
1902
|
+
return this.submitDcApiPresentation(session, dcOptions);
|
|
1903
|
+
}
|
|
1904
|
+
};
|
|
1905
|
+
async function verify(options) {
|
|
1906
|
+
const client2 = new EudiploClient({
|
|
1907
|
+
baseUrl: options.baseUrl,
|
|
1908
|
+
clientId: options.clientId,
|
|
1909
|
+
clientSecret: options.clientSecret
|
|
1910
|
+
});
|
|
1911
|
+
const { uri, sessionId } = await client2.createPresentationRequest({
|
|
1912
|
+
configId: options.configId,
|
|
1913
|
+
redirectUri: options.redirectUri
|
|
1914
|
+
});
|
|
1915
|
+
return {
|
|
1916
|
+
uri,
|
|
1917
|
+
sessionId,
|
|
1918
|
+
waitForCompletion: (pollingOptions) => client2.waitForSession(sessionId, { ...options.polling, ...pollingOptions }),
|
|
1919
|
+
getStatus: () => client2.getSession(sessionId)
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1922
|
+
async function issue(options) {
|
|
1923
|
+
const client2 = new EudiploClient({
|
|
1924
|
+
baseUrl: options.baseUrl,
|
|
1925
|
+
clientId: options.clientId,
|
|
1926
|
+
clientSecret: options.clientSecret
|
|
1927
|
+
});
|
|
1928
|
+
const { uri, sessionId } = await client2.createIssuanceOffer({
|
|
1929
|
+
credentialConfigurationIds: options.credentialConfigurationIds,
|
|
1930
|
+
claims: options.claims,
|
|
1931
|
+
txCode: options.txCode
|
|
1932
|
+
});
|
|
1933
|
+
return {
|
|
1934
|
+
uri,
|
|
1935
|
+
sessionId,
|
|
1936
|
+
waitForCompletion: (pollingOptions) => client2.waitForSession(sessionId, { ...options.polling, ...pollingOptions }),
|
|
1937
|
+
getStatus: () => client2.getSession(sessionId)
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
async function verifyAndWait(options) {
|
|
1941
|
+
const { uri, waitForCompletion } = await verify(options);
|
|
1942
|
+
options.onUri(uri);
|
|
1943
|
+
return waitForCompletion(options.polling);
|
|
1944
|
+
}
|
|
1945
|
+
async function issueAndWait(options) {
|
|
1946
|
+
const { uri, waitForCompletion } = await issue(options);
|
|
1947
|
+
options.onUri(uri);
|
|
1948
|
+
return waitForCompletion(options.polling);
|
|
1949
|
+
}
|
|
1950
|
+
async function verifyWithDcApi(options) {
|
|
1951
|
+
const eudiploClient = new EudiploClient({
|
|
1952
|
+
baseUrl: options.baseUrl,
|
|
1953
|
+
clientId: options.clientId,
|
|
1954
|
+
clientSecret: options.clientSecret
|
|
1955
|
+
});
|
|
1956
|
+
return eudiploClient.verifyWithDcApi(
|
|
1957
|
+
{
|
|
1958
|
+
configId: options.configId,
|
|
1959
|
+
redirectUri: options.redirectUri
|
|
1960
|
+
},
|
|
1961
|
+
{
|
|
1962
|
+
sendResponse: options.sendResponse
|
|
1963
|
+
}
|
|
1964
|
+
);
|
|
1965
|
+
}
|
|
1966
|
+
async function createDcApiRequest(options) {
|
|
1967
|
+
const eudiploClient = new EudiploClient({
|
|
1968
|
+
baseUrl: options.baseUrl,
|
|
1969
|
+
clientId: options.clientId,
|
|
1970
|
+
clientSecret: options.clientSecret
|
|
1971
|
+
});
|
|
1972
|
+
const session = await eudiploClient.createDcApiPresentationRequest({
|
|
1973
|
+
configId: options.configId,
|
|
1974
|
+
redirectUri: options.redirectUri
|
|
1975
|
+
});
|
|
1976
|
+
return {
|
|
1977
|
+
session,
|
|
1978
|
+
submit: (dcOptions) => eudiploClient.submitDcApiPresentation(session, {
|
|
1979
|
+
sendResponse: options.sendResponse,
|
|
1980
|
+
...dcOptions
|
|
1981
|
+
})
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
async function createDcApiRequestForBrowser(options) {
|
|
1985
|
+
const eudiploClient = new EudiploClient({
|
|
1986
|
+
baseUrl: options.baseUrl,
|
|
1987
|
+
clientId: options.clientId,
|
|
1988
|
+
clientSecret: options.clientSecret
|
|
1989
|
+
});
|
|
1990
|
+
const session = await eudiploClient.createDcApiPresentationRequest({
|
|
1991
|
+
configId: options.configId,
|
|
1992
|
+
redirectUri: options.redirectUri
|
|
1993
|
+
});
|
|
1994
|
+
if (!session.requestObject) {
|
|
1995
|
+
throw new Error("Session does not contain a requestObject");
|
|
1996
|
+
}
|
|
1997
|
+
const requestPayload = decodeJwtPayload(
|
|
1998
|
+
session.requestObject
|
|
1999
|
+
);
|
|
2000
|
+
if (!requestPayload.response_uri) {
|
|
2001
|
+
throw new Error("No response_uri found in request object");
|
|
2002
|
+
}
|
|
2003
|
+
return {
|
|
2004
|
+
requestObject: session.requestObject,
|
|
2005
|
+
sessionId: session.id,
|
|
2006
|
+
responseUri: requestPayload.response_uri
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
async function callDcApi(requestObject) {
|
|
2010
|
+
if (!isDcApiAvailable()) {
|
|
2011
|
+
throw new Error(
|
|
2012
|
+
"Digital Credentials API is not available in this browser. Please use a supported browser or fall back to QR code flow."
|
|
2013
|
+
);
|
|
2014
|
+
}
|
|
2015
|
+
const dcResponse = await navigator.credentials.get({
|
|
2016
|
+
mediation: "required",
|
|
2017
|
+
digital: {
|
|
2018
|
+
requests: [
|
|
2019
|
+
{
|
|
2020
|
+
protocol: "openid4vp-v1-signed",
|
|
2021
|
+
data: { request: requestObject }
|
|
2022
|
+
}
|
|
2023
|
+
]
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
if (!dcResponse) {
|
|
2027
|
+
throw new Error("No response from Digital Credentials API");
|
|
2028
|
+
}
|
|
2029
|
+
if (dcResponse.data?.error) {
|
|
2030
|
+
throw new Error(
|
|
2031
|
+
`Wallet error: ${dcResponse.data.error}${dcResponse.data.error_description ? ` - ${dcResponse.data.error_description}` : ""}`
|
|
2032
|
+
);
|
|
2033
|
+
}
|
|
2034
|
+
return dcResponse.data;
|
|
2035
|
+
}
|
|
2036
|
+
async function submitDcApiWalletResponse(options) {
|
|
2037
|
+
const fetchImpl = options.fetch ?? fetch;
|
|
2038
|
+
const submitResponse = await fetchImpl(options.responseUri, {
|
|
2039
|
+
method: "POST",
|
|
2040
|
+
headers: {
|
|
2041
|
+
"Content-Type": "application/json"
|
|
2042
|
+
},
|
|
2043
|
+
body: JSON.stringify({
|
|
2044
|
+
...options.walletResponse,
|
|
2045
|
+
sendResponse: options.sendResponse ?? true
|
|
2046
|
+
})
|
|
2047
|
+
});
|
|
2048
|
+
if (!submitResponse.ok) {
|
|
2049
|
+
const errorText = await submitResponse.text();
|
|
2050
|
+
throw new Error(
|
|
2051
|
+
`Failed to submit presentation: ${submitResponse.status} ${errorText}`
|
|
2052
|
+
);
|
|
2053
|
+
}
|
|
2054
|
+
const result = await submitResponse.json();
|
|
2055
|
+
return {
|
|
2056
|
+
credentials: result.credentials ?? result,
|
|
2057
|
+
response: result,
|
|
2058
|
+
redirectUri: result.redirect_uri
|
|
2059
|
+
};
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
export { EudiploClient, appControllerMain, authControllerGetGlobalJwks, authControllerGetOAuth2Token, authControllerGetOidcDiscovery, authorizeControllerAuthorize, authorizeControllerPar, authorizeControllerToken, cacheControllerClearAllCaches, cacheControllerClearStatusListCache, cacheControllerClearTrustListCache, cacheControllerGetStats, callDcApi, certControllerAddCertificate, certControllerDeleteCertificate, certControllerExportConfig, certControllerGetCertificate, certControllerGetCertificates, certControllerUpdateCertificate, chainedAsControllerAuthorize, chainedAsControllerCallback, chainedAsControllerGetMetadata, chainedAsControllerJwks, chainedAsControllerPar, chainedAsControllerToken, client, clientControllerCreateClient, clientControllerDeleteClient, clientControllerGetClient, clientControllerGetClientSecret, clientControllerGetClients, clientControllerRotateClientSecret, clientControllerUpdateClient, createDcApiRequest, createDcApiRequestForBrowser, credentialConfigControllerDeleteIssuanceConfiguration, credentialConfigControllerGetConfigById, credentialConfigControllerGetConfigs, credentialConfigControllerStoreCredentialConfiguration, credentialConfigControllerUpdateCredentialConfiguration, credentialOfferControllerGetOffer, deferredControllerCompleteDeferred, deferredControllerFailDeferred, healthControllerCheck, interactiveAuthorizationControllerCompleteWebAuth, interactiveAuthorizationControllerInteractiveAuthorization, isDcApiAvailable, issuanceConfigControllerGetIssuanceConfigurations, issuanceConfigControllerStoreIssuanceConfiguration, issue, issueAndWait, keyControllerAddKey, keyControllerDeleteKey, keyControllerGetKey, keyControllerGetKeys, keyControllerUpdateKey, oid4VciControllerCredential, oid4VciControllerDeferredCredential, oid4VciControllerNonce, oid4VciControllerNotifications, oid4VciMetadataControllerVct, oid4VpControllerGetPostRequestWithSession, oid4VpControllerGetRequestNoRedirectWithSession, oid4VpControllerGetRequestWithSession, oid4VpControllerGetResponse, presentationManagementControllerConfiguration, presentationManagementControllerDeleteConfiguration, presentationManagementControllerGetConfiguration, presentationManagementControllerStorePresentationConfig, presentationManagementControllerUpdateConfiguration, registrarControllerCreateAccessCertificate, registrarControllerCreateConfig, registrarControllerDeleteConfig, registrarControllerGetConfig, registrarControllerUpdateConfig, sessionConfigControllerGetConfig, sessionConfigControllerResetConfig, sessionConfigControllerUpdateConfig, sessionControllerDeleteSession, sessionControllerGetAllSessions, sessionControllerGetSession, sessionControllerRevokeAll, sessionEventsControllerSubscribeToSessionEvents, statusListConfigControllerGetConfig, statusListConfigControllerResetConfig, statusListConfigControllerUpdateConfig, statusListControllerGetList, statusListControllerGetStatusListAggregation, statusListManagementControllerCreateList, statusListManagementControllerDeleteList, statusListManagementControllerGetList, statusListManagementControllerGetLists, statusListManagementControllerUpdateList, storageControllerDownload, storageControllerUpload, submitDcApiWalletResponse, tenantControllerDeleteTenant, tenantControllerGetTenant, tenantControllerGetTenants, tenantControllerInitTenant, tenantControllerUpdateTenant, trustListControllerCreateTrustList, trustListControllerDeleteTrustList, trustListControllerExportTrustList, trustListControllerGetAllTrustLists, trustListControllerGetTrustList, trustListControllerGetTrustListVersion, trustListControllerGetTrustListVersions, trustListControllerUpdateTrustList, trustListPublicControllerGetTrustListJwt, verifierOfferControllerGetOffer, verify, verifyAndWait, verifyWithDcApi, wellKnownControllerAuthzMetadata0, wellKnownControllerAuthzMetadata1, wellKnownControllerGetJwks0, wellKnownControllerGetJwks1, wellKnownControllerIssuerMetadata0, wellKnownControllerIssuerMetadata1 };
|
|
2063
|
+
//# sourceMappingURL=index.mjs.map
|
|
2064
|
+
//# sourceMappingURL=index.mjs.map
|