@twin.org/standards-w3c-did 0.9.3-next.2 → 0.10.1-next.1

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.
Files changed (34) hide show
  1. package/dist/es/compiled/validators.js +4087 -0
  2. package/dist/es/compiled/validators.js.map +1 -0
  3. package/dist/es/dataTypes/didDataTypes.js +55 -26
  4. package/dist/es/dataTypes/didDataTypes.js.map +1 -1
  5. package/dist/es/index.js +1 -0
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/types/compiled/validators.d.ts +93 -0
  8. package/dist/types/index.d.ts +1 -0
  9. package/docs/changelog.md +61 -0
  10. package/docs/reference/index.md +23 -0
  11. package/docs/reference/variables/CompiledDataIntegrityProof.md +5 -0
  12. package/docs/reference/variables/CompiledDidCredentialSchema.md +5 -0
  13. package/docs/reference/variables/CompiledDidCredentialStatus.md +5 -0
  14. package/docs/reference/variables/CompiledDidCryptoSuites.md +5 -0
  15. package/docs/reference/variables/CompiledDidDocument.md +5 -0
  16. package/docs/reference/variables/CompiledDidDocumentVerificationMethod.md +5 -0
  17. package/docs/reference/variables/CompiledDidLabel.md +5 -0
  18. package/docs/reference/variables/CompiledDidPresentationVerification.md +5 -0
  19. package/docs/reference/variables/CompiledDidService.md +5 -0
  20. package/docs/reference/variables/CompiledDidTypes.md +5 -0
  21. package/docs/reference/variables/CompiledDidVerifiableCredential.md +5 -0
  22. package/docs/reference/variables/CompiledDidVerifiableCredentialCommon.md +5 -0
  23. package/docs/reference/variables/CompiledDidVerifiableCredentialV1.md +5 -0
  24. package/docs/reference/variables/CompiledDidVerifiableCredentialV2.md +5 -0
  25. package/docs/reference/variables/CompiledDidVerifiablePresentation.md +5 -0
  26. package/docs/reference/variables/CompiledDidVerifiablePresentationCommon.md +5 -0
  27. package/docs/reference/variables/CompiledDidVerifiablePresentationV1.md +5 -0
  28. package/docs/reference/variables/CompiledDidVerifiablePresentationV2.md +5 -0
  29. package/docs/reference/variables/CompiledDidVerificationMethodType.md +5 -0
  30. package/docs/reference/variables/CompiledJsonWebSignature2020Proof.md +5 -0
  31. package/docs/reference/variables/CompiledMultikey.md +5 -0
  32. package/docs/reference/variables/CompiledProof.md +5 -0
  33. package/docs/reference/variables/CompiledProofTypes.md +5 -0
  34. package/package.json +1 -1
@@ -0,0 +1,4087 @@
1
+ // Copyright 2026 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ // This file is generated by ts-to-schema, do not edit it directly.
4
+ // @ts-nocheck
5
+ /* cspell:disable */
6
+ import { JsonSchemaFormats } from "@twin.org/data-core";
7
+ import * as external0 from "../models/didCryptoSuites.js";
8
+ import * as external1 from "../models/didTypes.js";
9
+ import * as external2 from "@twin.org/data-json-ld";
10
+ import * as external3 from "../models/proofTypes.js";
11
+ const MESSAGES = ["must be equal to constant", "must match a schema in anyOf", "must NOT have fewer than 1 items", "must contain at least 1 and no more than 1 valid item(s)", "must be array", "must be string", "must be object", "must be boolean", "must match exactly one schema in oneOf"];
12
+ function createError(instancePath, schemaPath, keyword, params, message) {
13
+ return { instancePath, schemaPath, keyword, params, ["message"]: typeof message === "number" ? MESSAGES[message] : message };
14
+ }
15
+ function pushError(errors, error) {
16
+ if (errors === null) {
17
+ return [error];
18
+ }
19
+ errors.push(error);
20
+ return errors;
21
+ }
22
+ /**
23
+ * Compiled validator for the DidCryptoSuites schema.
24
+ */
25
+ export const CompiledDidCryptoSuites = validate52;
26
+ const keyword0 = Object.values(external0["DidCryptoSuites"]);
27
+ function validate52(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
28
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidCryptoSuites" */ ;
29
+ let vErrors = null;
30
+ let errors = 0;
31
+ const evaluated0 = validate52.evaluated;
32
+ if (evaluated0.dynamicProps) {
33
+ evaluated0.props = undefined;
34
+ }
35
+ if (evaluated0.dynamicItems) {
36
+ evaluated0.items = undefined;
37
+ }
38
+ if (!keyword0.includes(data)) {
39
+ for (let i0 = 0; i0 < keyword0.length; i0++) {
40
+ vErrors = pushError(vErrors, createError(instancePath, "#/anyOf" + "/" + i0 + "/const", "const", { allowedValue: keyword0[i0] }, "must be equal to constant"));
41
+ errors++;
42
+ }
43
+ vErrors = pushError(vErrors, createError(instancePath, "#/anyOf", "anyOf", {}, "must match a schema in anyOf"));
44
+ errors++;
45
+ }
46
+ validate52.errors = vErrors;
47
+ return errors === 0;
48
+ }
49
+ validate52.evaluated = { "dynamicProps": false, "dynamicItems": false };
50
+ /**
51
+ * Compiled validator for the DidTypes schema.
52
+ */
53
+ export const CompiledDidTypes = validate53;
54
+ const keyword1 = Object.values(external1["DidTypes"]);
55
+ function validate53(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
56
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidTypes" */ ;
57
+ let vErrors = null;
58
+ let errors = 0;
59
+ const evaluated0 = validate53.evaluated;
60
+ if (evaluated0.dynamicProps) {
61
+ evaluated0.props = undefined;
62
+ }
63
+ if (evaluated0.dynamicItems) {
64
+ evaluated0.items = undefined;
65
+ }
66
+ if (!keyword1.includes(data)) {
67
+ for (let i0 = 0; i0 < keyword1.length; i0++) {
68
+ vErrors = pushError(vErrors, createError(instancePath, "#/anyOf" + "/" + i0 + "/const", "const", { allowedValue: keyword1[i0] }, "must be equal to constant"));
69
+ errors++;
70
+ }
71
+ vErrors = pushError(vErrors, createError(instancePath, "#/anyOf", "anyOf", {}, "must match a schema in anyOf"));
72
+ errors++;
73
+ }
74
+ validate53.errors = vErrors;
75
+ return errors === 0;
76
+ }
77
+ validate53.evaluated = { "dynamicProps": false, "dynamicItems": false };
78
+ /**
79
+ * Compiled validator for the DidVerificationMethodType schema.
80
+ */
81
+ export const CompiledDidVerificationMethodType = validate54;
82
+ function validate54(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
83
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidVerificationMethodType" */ ;
84
+ let vErrors = null;
85
+ let errors = 0;
86
+ const evaluated0 = validate54.evaluated;
87
+ if (evaluated0.dynamicProps) {
88
+ evaluated0.props = undefined;
89
+ }
90
+ if (evaluated0.dynamicItems) {
91
+ evaluated0.items = undefined;
92
+ }
93
+ const _errs0 = errors;
94
+ let valid0 = false;
95
+ const _errs1 = errors;
96
+ if ("verificationMethod" !== data) {
97
+ const err0 = createError(instancePath, "#/anyOf/0/const", "const", { allowedValue: "verificationMethod" }, 0);
98
+ vErrors = pushError(vErrors, err0);
99
+ errors++;
100
+ }
101
+ var _valid0 = _errs1 === errors;
102
+ valid0 = valid0 || _valid0;
103
+ const _errs2 = errors;
104
+ if ("authentication" !== data) {
105
+ const err1 = createError(instancePath, "#/anyOf/1/const", "const", { allowedValue: "authentication" }, 0);
106
+ vErrors = pushError(vErrors, err1);
107
+ errors++;
108
+ }
109
+ var _valid0 = _errs2 === errors;
110
+ valid0 = valid0 || _valid0;
111
+ const _errs3 = errors;
112
+ if ("assertionMethod" !== data) {
113
+ const err2 = createError(instancePath, "#/anyOf/2/const", "const", { allowedValue: "assertionMethod" }, 0);
114
+ vErrors = pushError(vErrors, err2);
115
+ errors++;
116
+ }
117
+ var _valid0 = _errs3 === errors;
118
+ valid0 = valid0 || _valid0;
119
+ const _errs4 = errors;
120
+ if ("keyAgreement" !== data) {
121
+ const err3 = createError(instancePath, "#/anyOf/3/const", "const", { allowedValue: "keyAgreement" }, 0);
122
+ vErrors = pushError(vErrors, err3);
123
+ errors++;
124
+ }
125
+ var _valid0 = _errs4 === errors;
126
+ valid0 = valid0 || _valid0;
127
+ const _errs5 = errors;
128
+ if ("capabilityInvocation" !== data) {
129
+ const err4 = createError(instancePath, "#/anyOf/4/const", "const", { allowedValue: "capabilityInvocation" }, 0);
130
+ vErrors = pushError(vErrors, err4);
131
+ errors++;
132
+ }
133
+ var _valid0 = _errs5 === errors;
134
+ valid0 = valid0 || _valid0;
135
+ const _errs6 = errors;
136
+ if ("capabilityDelegation" !== data) {
137
+ const err5 = createError(instancePath, "#/anyOf/5/const", "const", { allowedValue: "capabilityDelegation" }, 0);
138
+ vErrors = pushError(vErrors, err5);
139
+ errors++;
140
+ }
141
+ var _valid0 = _errs6 === errors;
142
+ valid0 = valid0 || _valid0;
143
+ if (!valid0) {
144
+ const err6 = createError(instancePath, "#/anyOf", "anyOf", {}, 1);
145
+ vErrors = pushError(vErrors, err6);
146
+ errors++;
147
+ }
148
+ else {
149
+ errors = _errs0;
150
+ if (vErrors !== null) {
151
+ if (_errs0) {
152
+ vErrors.length = _errs0;
153
+ }
154
+ else {
155
+ vErrors = null;
156
+ }
157
+ }
158
+ }
159
+ validate54.errors = vErrors;
160
+ return errors === 0;
161
+ }
162
+ validate54.evaluated = { "dynamicProps": false, "dynamicItems": false };
163
+ /**
164
+ * Compiled validator for the DataIntegrityProof schema.
165
+ */
166
+ export const CompiledDataIntegrityProof = validate55;
167
+ const keyword2 = external2["CompiledJsonLdContextDefinitionElement"];
168
+ function validate55(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
169
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DataIntegrityProof" */ ;
170
+ let vErrors = null;
171
+ let errors = 0;
172
+ const evaluated0 = validate55.evaluated;
173
+ if (evaluated0.dynamicProps) {
174
+ evaluated0.props = undefined;
175
+ }
176
+ if (evaluated0.dynamicItems) {
177
+ evaluated0.items = undefined;
178
+ }
179
+ if (data && typeof data == "object" && !Array.isArray(data)) {
180
+ if (data.type === undefined) {
181
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "type" }, "must have required property '" + "type" + "'");
182
+ vErrors = pushError(vErrors, err0);
183
+ errors++;
184
+ }
185
+ if (data.cryptosuite === undefined) {
186
+ const err1 = createError(instancePath, "#/required", "required", { missingProperty: "cryptosuite" }, "must have required property '" + "cryptosuite" + "'");
187
+ vErrors = pushError(vErrors, err1);
188
+ errors++;
189
+ }
190
+ if (data.proofPurpose === undefined) {
191
+ const err2 = createError(instancePath, "#/required", "required", { missingProperty: "proofPurpose" }, "must have required property '" + "proofPurpose" + "'");
192
+ vErrors = pushError(vErrors, err2);
193
+ errors++;
194
+ }
195
+ if (data["@context"] !== undefined) {
196
+ let data0 = data["@context"];
197
+ const _errs2 = errors;
198
+ let valid1 = false;
199
+ const _errs3 = errors;
200
+ if ("https://w3id.org/security/data-integrity/v2" !== data0) {
201
+ const err3 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/0/const", "const", { allowedValue: "https://w3id.org/security/data-integrity/v2" }, 0);
202
+ vErrors = pushError(vErrors, err3);
203
+ errors++;
204
+ }
205
+ var _valid0 = _errs3 === errors;
206
+ valid1 = valid1 || _valid0;
207
+ const _errs4 = errors;
208
+ if (Array.isArray(data0)) {
209
+ if (data0.length < 1) {
210
+ const err4 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/minItems", "minItems", { limit: 1 }, 2);
211
+ vErrors = pushError(vErrors, err4);
212
+ errors++;
213
+ }
214
+ const len0 = data0.length;
215
+ for (let i0 = 0; i0 < len0; i0++) {
216
+ let data1 = data0[i0];
217
+ const _errs7 = errors;
218
+ let valid4 = false;
219
+ const _errs8 = errors;
220
+ if (!(keyword2(data1, { instancePath: instancePath + "/@context/" + i0, parentData: data0, parentDataProperty: i0, rootData, dynamicAnchors }))) {
221
+ vErrors = vErrors === null ? keyword2.errors : vErrors.concat(keyword2.errors);
222
+ errors = vErrors.length;
223
+ }
224
+ var _valid1 = _errs8 === errors;
225
+ valid4 = valid4 || _valid1;
226
+ const _errs9 = errors;
227
+ if ("https://w3id.org/security/data-integrity/v2" !== data1) {
228
+ const err5 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf/1/const", "const", { allowedValue: "https://w3id.org/security/data-integrity/v2" }, 0);
229
+ vErrors = pushError(vErrors, err5);
230
+ errors++;
231
+ }
232
+ var _valid1 = _errs9 === errors;
233
+ valid4 = valid4 || _valid1;
234
+ if (!valid4) {
235
+ const err6 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf", "anyOf", {}, 1);
236
+ vErrors = pushError(vErrors, err6);
237
+ errors++;
238
+ }
239
+ else {
240
+ errors = _errs7;
241
+ if (vErrors !== null) {
242
+ if (_errs7) {
243
+ vErrors.length = _errs7;
244
+ }
245
+ else {
246
+ vErrors = null;
247
+ }
248
+ }
249
+ }
250
+ }
251
+ const _errs10 = errors;
252
+ const len1 = data0.length;
253
+ let valid5 = false;
254
+ let count0 = 0;
255
+ for (let i1 = 0; i1 < len1; i1++) {
256
+ const _errs11 = errors;
257
+ if ("https://w3id.org/security/data-integrity/v2" !== data0[i1]) {
258
+ const err7 = createError(instancePath + "/@context/" + i1, "#/properties/%40context/anyOf/1/contains/const", "const", { allowedValue: "https://w3id.org/security/data-integrity/v2" }, 0);
259
+ vErrors = pushError(vErrors, err7);
260
+ errors++;
261
+ }
262
+ var _valid2 = _errs11 === errors;
263
+ if (_valid2) {
264
+ count0++;
265
+ if (count0 > 1) {
266
+ valid5 = false;
267
+ break;
268
+ }
269
+ valid5 = true;
270
+ }
271
+ }
272
+ if (!valid5) {
273
+ const err8 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/contains", "contains", { minContains: 1, maxContains: 1 }, 3);
274
+ vErrors = pushError(vErrors, err8);
275
+ errors++;
276
+ }
277
+ else {
278
+ errors = _errs10;
279
+ if (vErrors !== null) {
280
+ if (_errs10) {
281
+ vErrors.length = _errs10;
282
+ }
283
+ else {
284
+ vErrors = null;
285
+ }
286
+ }
287
+ }
288
+ }
289
+ else {
290
+ const err9 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/type", "type", { type: "array" }, 4);
291
+ vErrors = pushError(vErrors, err9);
292
+ errors++;
293
+ }
294
+ var _valid0 = _errs4 === errors;
295
+ valid1 = valid1 || _valid0;
296
+ if (!valid1) {
297
+ const err10 = createError(instancePath + "/@context", "#/properties/%40context/anyOf", "anyOf", {}, 1);
298
+ vErrors = pushError(vErrors, err10);
299
+ errors++;
300
+ }
301
+ else {
302
+ errors = _errs2;
303
+ if (vErrors !== null) {
304
+ if (_errs2) {
305
+ vErrors.length = _errs2;
306
+ }
307
+ else {
308
+ vErrors = null;
309
+ }
310
+ }
311
+ }
312
+ }
313
+ if (data.type !== undefined) {
314
+ if ("DataIntegrityProof" !== data.type) {
315
+ const err11 = createError(instancePath + "/type", "#/properties/type/const", "const", { allowedValue: "DataIntegrityProof" }, 0);
316
+ vErrors = pushError(vErrors, err11);
317
+ errors++;
318
+ }
319
+ }
320
+ if (data.cryptosuite !== undefined) {
321
+ let data4 = data.cryptosuite;
322
+ const _errs14 = errors;
323
+ let valid6 = false;
324
+ const _errs15 = errors;
325
+ if (!(validate52(data4, { instancePath: instancePath + "/cryptosuite", parentData: data, parentDataProperty: "cryptosuite", rootData, dynamicAnchors }))) {
326
+ vErrors = vErrors === null ? validate52.errors : vErrors.concat(validate52.errors);
327
+ errors = vErrors.length;
328
+ }
329
+ var _valid3 = _errs15 === errors;
330
+ valid6 = valid6 || _valid3;
331
+ const _errs16 = errors;
332
+ if (typeof data4 !== "string") {
333
+ const err12 = createError(instancePath + "/cryptosuite", "#/properties/cryptosuite/anyOf/1/type", "type", { type: "string" }, 5);
334
+ vErrors = pushError(vErrors, err12);
335
+ errors++;
336
+ }
337
+ var _valid3 = _errs16 === errors;
338
+ valid6 = valid6 || _valid3;
339
+ if (!valid6) {
340
+ const err13 = createError(instancePath + "/cryptosuite", "#/properties/cryptosuite/anyOf", "anyOf", {}, 1);
341
+ vErrors = pushError(vErrors, err13);
342
+ errors++;
343
+ }
344
+ else {
345
+ errors = _errs14;
346
+ if (vErrors !== null) {
347
+ if (_errs14) {
348
+ vErrors.length = _errs14;
349
+ }
350
+ else {
351
+ vErrors = null;
352
+ }
353
+ }
354
+ }
355
+ }
356
+ if (data.id !== undefined) {
357
+ if (typeof data.id !== "string") {
358
+ const err14 = createError(instancePath + "/id", "#/properties/id/type", "type", { type: "string" }, 5);
359
+ vErrors = pushError(vErrors, err14);
360
+ errors++;
361
+ }
362
+ }
363
+ if (data.proofPurpose !== undefined) {
364
+ if (typeof data.proofPurpose !== "string") {
365
+ const err15 = createError(instancePath + "/proofPurpose", "#/properties/proofPurpose/type", "type", { type: "string" }, 5);
366
+ vErrors = pushError(vErrors, err15);
367
+ errors++;
368
+ }
369
+ }
370
+ if (data.proofValue !== undefined) {
371
+ if (typeof data.proofValue !== "string") {
372
+ const err16 = createError(instancePath + "/proofValue", "#/properties/proofValue/type", "type", { type: "string" }, 5);
373
+ vErrors = pushError(vErrors, err16);
374
+ errors++;
375
+ }
376
+ }
377
+ if (data.verificationMethod !== undefined) {
378
+ if (typeof data.verificationMethod !== "string") {
379
+ const err17 = createError(instancePath + "/verificationMethod", "#/properties/verificationMethod/type", "type", { type: "string" }, 5);
380
+ vErrors = pushError(vErrors, err17);
381
+ errors++;
382
+ }
383
+ }
384
+ if (data.created !== undefined) {
385
+ if (typeof data.created !== "string") {
386
+ const err18 = createError(instancePath + "/created", "#/properties/created/type", "type", { type: "string" }, 5);
387
+ vErrors = pushError(vErrors, err18);
388
+ errors++;
389
+ }
390
+ }
391
+ if (data.expires !== undefined) {
392
+ if (typeof data.expires !== "string") {
393
+ const err19 = createError(instancePath + "/expires", "#/properties/expires/type", "type", { type: "string" }, 5);
394
+ vErrors = pushError(vErrors, err19);
395
+ errors++;
396
+ }
397
+ }
398
+ if (data.domain !== undefined) {
399
+ let data11 = data.domain;
400
+ const _errs31 = errors;
401
+ let valid7 = false;
402
+ const _errs32 = errors;
403
+ if (typeof data11 !== "string") {
404
+ const err20 = createError(instancePath + "/domain", "#/properties/domain/anyOf/0/type", "type", { type: "string" }, 5);
405
+ vErrors = pushError(vErrors, err20);
406
+ errors++;
407
+ }
408
+ var _valid4 = _errs32 === errors;
409
+ valid7 = valid7 || _valid4;
410
+ const _errs34 = errors;
411
+ if (Array.isArray(data11)) {
412
+ const len2 = data11.length;
413
+ for (let i2 = 0; i2 < len2; i2++) {
414
+ if (typeof data11[i2] !== "string") {
415
+ const err21 = createError(instancePath + "/domain/" + i2, "#/properties/domain/anyOf/1/items/type", "type", { type: "string" }, 5);
416
+ vErrors = pushError(vErrors, err21);
417
+ errors++;
418
+ }
419
+ }
420
+ }
421
+ else {
422
+ const err22 = createError(instancePath + "/domain", "#/properties/domain/anyOf/1/type", "type", { type: "array" }, 4);
423
+ vErrors = pushError(vErrors, err22);
424
+ errors++;
425
+ }
426
+ var _valid4 = _errs34 === errors;
427
+ valid7 = valid7 || _valid4;
428
+ if (!valid7) {
429
+ const err23 = createError(instancePath + "/domain", "#/properties/domain/anyOf", "anyOf", {}, 1);
430
+ vErrors = pushError(vErrors, err23);
431
+ errors++;
432
+ }
433
+ else {
434
+ errors = _errs31;
435
+ if (vErrors !== null) {
436
+ if (_errs31) {
437
+ vErrors.length = _errs31;
438
+ }
439
+ else {
440
+ vErrors = null;
441
+ }
442
+ }
443
+ }
444
+ }
445
+ if (data.challenge !== undefined) {
446
+ let data13 = data.challenge;
447
+ const _errs39 = errors;
448
+ let valid10 = false;
449
+ const _errs40 = errors;
450
+ if (typeof data13 !== "string") {
451
+ const err24 = createError(instancePath + "/challenge", "#/properties/challenge/anyOf/0/type", "type", { type: "string" }, 5);
452
+ vErrors = pushError(vErrors, err24);
453
+ errors++;
454
+ }
455
+ var _valid5 = _errs40 === errors;
456
+ valid10 = valid10 || _valid5;
457
+ const _errs42 = errors;
458
+ if (Array.isArray(data13)) {
459
+ const len3 = data13.length;
460
+ for (let i3 = 0; i3 < len3; i3++) {
461
+ if (typeof data13[i3] !== "string") {
462
+ const err25 = createError(instancePath + "/challenge/" + i3, "#/properties/challenge/anyOf/1/items/type", "type", { type: "string" }, 5);
463
+ vErrors = pushError(vErrors, err25);
464
+ errors++;
465
+ }
466
+ }
467
+ }
468
+ else {
469
+ const err26 = createError(instancePath + "/challenge", "#/properties/challenge/anyOf/1/type", "type", { type: "array" }, 4);
470
+ vErrors = pushError(vErrors, err26);
471
+ errors++;
472
+ }
473
+ var _valid5 = _errs42 === errors;
474
+ valid10 = valid10 || _valid5;
475
+ if (!valid10) {
476
+ const err27 = createError(instancePath + "/challenge", "#/properties/challenge/anyOf", "anyOf", {}, 1);
477
+ vErrors = pushError(vErrors, err27);
478
+ errors++;
479
+ }
480
+ else {
481
+ errors = _errs39;
482
+ if (vErrors !== null) {
483
+ if (_errs39) {
484
+ vErrors.length = _errs39;
485
+ }
486
+ else {
487
+ vErrors = null;
488
+ }
489
+ }
490
+ }
491
+ }
492
+ if (data.previousProof !== undefined) {
493
+ if (typeof data.previousProof !== "string") {
494
+ const err28 = createError(instancePath + "/previousProof", "#/properties/previousProof/type", "type", { type: "string" }, 5);
495
+ vErrors = pushError(vErrors, err28);
496
+ errors++;
497
+ }
498
+ }
499
+ if (data.nonce !== undefined) {
500
+ if (typeof data.nonce !== "string") {
501
+ const err29 = createError(instancePath + "/nonce", "#/properties/nonce/type", "type", { type: "string" }, 5);
502
+ vErrors = pushError(vErrors, err29);
503
+ errors++;
504
+ }
505
+ }
506
+ }
507
+ else {
508
+ const err30 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
509
+ vErrors = pushError(vErrors, err30);
510
+ errors++;
511
+ }
512
+ validate55.errors = vErrors;
513
+ return errors === 0;
514
+ }
515
+ validate55.evaluated = { "props": { "@context": true, "type": true, "cryptosuite": true, "id": true, "proofPurpose": true, "proofValue": true, "verificationMethod": true, "created": true, "expires": true, "domain": true, "challenge": true, "previousProof": true, "nonce": true }, "dynamicProps": false, "dynamicItems": false };
516
+ /**
517
+ * Compiled validator for the DidCredentialSchema schema.
518
+ */
519
+ export const CompiledDidCredentialSchema = validate57;
520
+ function validate57(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
521
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidCredentialSchema" */ ;
522
+ let vErrors = null;
523
+ let errors = 0;
524
+ const evaluated0 = validate57.evaluated;
525
+ if (evaluated0.dynamicProps) {
526
+ evaluated0.props = undefined;
527
+ }
528
+ if (evaluated0.dynamicItems) {
529
+ evaluated0.items = undefined;
530
+ }
531
+ if (data && typeof data == "object" && !Array.isArray(data)) {
532
+ if (data.id === undefined) {
533
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "id" }, "must have required property '" + "id" + "'");
534
+ vErrors = pushError(vErrors, err0);
535
+ errors++;
536
+ }
537
+ if (data.type === undefined) {
538
+ const err1 = createError(instancePath, "#/required", "required", { missingProperty: "type" }, "must have required property '" + "type" + "'");
539
+ vErrors = pushError(vErrors, err1);
540
+ errors++;
541
+ }
542
+ if (data.id !== undefined) {
543
+ if (typeof data.id !== "string") {
544
+ const err2 = createError(instancePath + "/id", "#/properties/id/type", "type", { type: "string" }, 5);
545
+ vErrors = pushError(vErrors, err2);
546
+ errors++;
547
+ }
548
+ }
549
+ if (data.type !== undefined) {
550
+ if (typeof data.type !== "string") {
551
+ const err3 = createError(instancePath + "/type", "#/properties/type/type", "type", { type: "string" }, 5);
552
+ vErrors = pushError(vErrors, err3);
553
+ errors++;
554
+ }
555
+ }
556
+ }
557
+ else {
558
+ const err4 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
559
+ vErrors = pushError(vErrors, err4);
560
+ errors++;
561
+ }
562
+ validate57.errors = vErrors;
563
+ return errors === 0;
564
+ }
565
+ validate57.evaluated = { "props": { "id": true, "type": true }, "dynamicProps": false, "dynamicItems": false };
566
+ /**
567
+ * Compiled validator for the DidCredentialStatus schema.
568
+ */
569
+ export const CompiledDidCredentialStatus = validate58;
570
+ function validate58(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
571
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidCredentialStatus" */ ;
572
+ let vErrors = null;
573
+ let errors = 0;
574
+ const evaluated0 = validate58.evaluated;
575
+ if (evaluated0.dynamicProps) {
576
+ evaluated0.props = undefined;
577
+ }
578
+ if (evaluated0.dynamicItems) {
579
+ evaluated0.items = undefined;
580
+ }
581
+ if (data && typeof data == "object" && !Array.isArray(data)) {
582
+ if (data.id === undefined) {
583
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "id" }, "must have required property '" + "id" + "'");
584
+ vErrors = pushError(vErrors, err0);
585
+ errors++;
586
+ }
587
+ if (data.type === undefined) {
588
+ const err1 = createError(instancePath, "#/required", "required", { missingProperty: "type" }, "must have required property '" + "type" + "'");
589
+ vErrors = pushError(vErrors, err1);
590
+ errors++;
591
+ }
592
+ if (data.id !== undefined) {
593
+ if (typeof data.id !== "string") {
594
+ const err2 = createError(instancePath + "/id", "#/properties/id/type", "type", { type: "string" }, 5);
595
+ vErrors = pushError(vErrors, err2);
596
+ errors++;
597
+ }
598
+ }
599
+ if (data.type !== undefined) {
600
+ if (typeof data.type !== "string") {
601
+ const err3 = createError(instancePath + "/type", "#/properties/type/type", "type", { type: "string" }, 5);
602
+ vErrors = pushError(vErrors, err3);
603
+ errors++;
604
+ }
605
+ }
606
+ }
607
+ else {
608
+ const err4 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
609
+ vErrors = pushError(vErrors, err4);
610
+ errors++;
611
+ }
612
+ validate58.errors = vErrors;
613
+ return errors === 0;
614
+ }
615
+ validate58.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
616
+ /**
617
+ * Compiled validator for the DidDocument schema.
618
+ */
619
+ export const CompiledDidDocument = validate61;
620
+ const formats0 = JsonSchemaFormats.uri;
621
+ function validate63(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
622
+ /*# sourceURL="https://schema.twindev.org/framework/Jwk" */ ;
623
+ let vErrors = null;
624
+ let errors = 0;
625
+ const evaluated0 = validate63.evaluated;
626
+ if (evaluated0.dynamicProps) {
627
+ evaluated0.props = undefined;
628
+ }
629
+ if (evaluated0.dynamicItems) {
630
+ evaluated0.items = undefined;
631
+ }
632
+ if (data && typeof data == "object" && !Array.isArray(data)) {
633
+ if (data.kty === undefined) {
634
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "kty" }, "must have required property '" + "kty" + "'");
635
+ vErrors = pushError(vErrors, err0);
636
+ errors++;
637
+ }
638
+ if (data.kty !== undefined) {
639
+ if (typeof data.kty !== "string") {
640
+ const err1 = createError(instancePath + "/kty", "#/properties/kty/type", "type", { type: "string" }, 5);
641
+ vErrors = pushError(vErrors, err1);
642
+ errors++;
643
+ }
644
+ }
645
+ if (data.use !== undefined) {
646
+ if (typeof data.use !== "string") {
647
+ const err2 = createError(instancePath + "/use", "#/properties/use/type", "type", { type: "string" }, 5);
648
+ vErrors = pushError(vErrors, err2);
649
+ errors++;
650
+ }
651
+ }
652
+ if (data.key_ops !== undefined) {
653
+ let data2 = data.key_ops;
654
+ if (Array.isArray(data2)) {
655
+ const len0 = data2.length;
656
+ for (let i0 = 0; i0 < len0; i0++) {
657
+ if (typeof data2[i0] !== "string") {
658
+ const err3 = createError(instancePath + "/key_ops/" + i0, "#/properties/key_ops/items/type", "type", { type: "string" }, 5);
659
+ vErrors = pushError(vErrors, err3);
660
+ errors++;
661
+ }
662
+ }
663
+ }
664
+ else {
665
+ const err4 = createError(instancePath + "/key_ops", "#/properties/key_ops/type", "type", { type: "array" }, 4);
666
+ vErrors = pushError(vErrors, err4);
667
+ errors++;
668
+ }
669
+ }
670
+ if (data.alg !== undefined) {
671
+ if (typeof data.alg !== "string") {
672
+ const err5 = createError(instancePath + "/alg", "#/properties/alg/type", "type", { type: "string" }, 5);
673
+ vErrors = pushError(vErrors, err5);
674
+ errors++;
675
+ }
676
+ }
677
+ if (data.kid !== undefined) {
678
+ if (typeof data.kid !== "string") {
679
+ const err6 = createError(instancePath + "/kid", "#/properties/kid/type", "type", { type: "string" }, 5);
680
+ vErrors = pushError(vErrors, err6);
681
+ errors++;
682
+ }
683
+ }
684
+ if (data.x5u !== undefined) {
685
+ let data6 = data.x5u;
686
+ if (typeof data6 === "string") {
687
+ if (!(formats0(data6))) {
688
+ const err7 = createError(instancePath + "/x5u", "#/properties/x5u/format", "format", { format: "uri" }, "must match format \"" + "uri" + "\"");
689
+ vErrors = pushError(vErrors, err7);
690
+ errors++;
691
+ }
692
+ }
693
+ else {
694
+ const err8 = createError(instancePath + "/x5u", "#/properties/x5u/type", "type", { type: "string" }, 5);
695
+ vErrors = pushError(vErrors, err8);
696
+ errors++;
697
+ }
698
+ }
699
+ if (data.x5c !== undefined) {
700
+ let data7 = data.x5c;
701
+ if (Array.isArray(data7)) {
702
+ const len1 = data7.length;
703
+ for (let i1 = 0; i1 < len1; i1++) {
704
+ if (typeof data7[i1] !== "string") {
705
+ const err9 = createError(instancePath + "/x5c/" + i1, "#/properties/x5c/items/type", "type", { type: "string" }, 5);
706
+ vErrors = pushError(vErrors, err9);
707
+ errors++;
708
+ }
709
+ }
710
+ }
711
+ else {
712
+ const err10 = createError(instancePath + "/x5c", "#/properties/x5c/type", "type", { type: "array" }, 4);
713
+ vErrors = pushError(vErrors, err10);
714
+ errors++;
715
+ }
716
+ }
717
+ if (data.x5t !== undefined) {
718
+ if (typeof data.x5t !== "string") {
719
+ const err11 = createError(instancePath + "/x5t", "#/properties/x5t/type", "type", { type: "string" }, 5);
720
+ vErrors = pushError(vErrors, err11);
721
+ errors++;
722
+ }
723
+ }
724
+ if (data["x5t#S256"] !== undefined) {
725
+ if (typeof data["x5t#S256"] !== "string") {
726
+ const err12 = createError(instancePath + "/x5t#S256", "#/properties/x5t%23S256/type", "type", { type: "string" }, 5);
727
+ vErrors = pushError(vErrors, err12);
728
+ errors++;
729
+ }
730
+ }
731
+ if (data.ext !== undefined) {
732
+ if (typeof data.ext !== "boolean") {
733
+ const err13 = createError(instancePath + "/ext", "#/properties/ext/type", "type", { type: "boolean" }, 7);
734
+ vErrors = pushError(vErrors, err13);
735
+ errors++;
736
+ }
737
+ }
738
+ if (data.crv !== undefined) {
739
+ if (typeof data.crv !== "string") {
740
+ const err14 = createError(instancePath + "/crv", "#/properties/crv/type", "type", { type: "string" }, 5);
741
+ vErrors = pushError(vErrors, err14);
742
+ errors++;
743
+ }
744
+ }
745
+ if (data.x !== undefined) {
746
+ if (typeof data.x !== "string") {
747
+ const err15 = createError(instancePath + "/x", "#/properties/x/type", "type", { type: "string" }, 5);
748
+ vErrors = pushError(vErrors, err15);
749
+ errors++;
750
+ }
751
+ }
752
+ if (data.y !== undefined) {
753
+ if (typeof data.y !== "string") {
754
+ const err16 = createError(instancePath + "/y", "#/properties/y/type", "type", { type: "string" }, 5);
755
+ vErrors = pushError(vErrors, err16);
756
+ errors++;
757
+ }
758
+ }
759
+ if (data.d !== undefined) {
760
+ if (typeof data.d !== "string") {
761
+ const err17 = createError(instancePath + "/d", "#/properties/d/type", "type", { type: "string" }, 5);
762
+ vErrors = pushError(vErrors, err17);
763
+ errors++;
764
+ }
765
+ }
766
+ if (data.n !== undefined) {
767
+ if (typeof data.n !== "string") {
768
+ const err18 = createError(instancePath + "/n", "#/properties/n/type", "type", { type: "string" }, 5);
769
+ vErrors = pushError(vErrors, err18);
770
+ errors++;
771
+ }
772
+ }
773
+ if (data.e !== undefined) {
774
+ if (typeof data.e !== "string") {
775
+ const err19 = createError(instancePath + "/e", "#/properties/e/type", "type", { type: "string" }, 5);
776
+ vErrors = pushError(vErrors, err19);
777
+ errors++;
778
+ }
779
+ }
780
+ if (data.p !== undefined) {
781
+ if (typeof data.p !== "string") {
782
+ const err20 = createError(instancePath + "/p", "#/properties/p/type", "type", { type: "string" }, 5);
783
+ vErrors = pushError(vErrors, err20);
784
+ errors++;
785
+ }
786
+ }
787
+ if (data.q !== undefined) {
788
+ if (typeof data.q !== "string") {
789
+ const err21 = createError(instancePath + "/q", "#/properties/q/type", "type", { type: "string" }, 5);
790
+ vErrors = pushError(vErrors, err21);
791
+ errors++;
792
+ }
793
+ }
794
+ if (data.dp !== undefined) {
795
+ if (typeof data.dp !== "string") {
796
+ const err22 = createError(instancePath + "/dp", "#/properties/dp/type", "type", { type: "string" }, 5);
797
+ vErrors = pushError(vErrors, err22);
798
+ errors++;
799
+ }
800
+ }
801
+ if (data.dq !== undefined) {
802
+ if (typeof data.dq !== "string") {
803
+ const err23 = createError(instancePath + "/dq", "#/properties/dq/type", "type", { type: "string" }, 5);
804
+ vErrors = pushError(vErrors, err23);
805
+ errors++;
806
+ }
807
+ }
808
+ if (data.qi !== undefined) {
809
+ if (typeof data.qi !== "string") {
810
+ const err24 = createError(instancePath + "/qi", "#/properties/qi/type", "type", { type: "string" }, 5);
811
+ vErrors = pushError(vErrors, err24);
812
+ errors++;
813
+ }
814
+ }
815
+ if (data.oth !== undefined) {
816
+ let data23 = data.oth;
817
+ if (Array.isArray(data23)) {
818
+ const len2 = data23.length;
819
+ for (let i2 = 0; i2 < len2; i2++) {
820
+ let data24 = data23[i2];
821
+ if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
822
+ if (data24.r !== undefined) {
823
+ if (typeof data24.r !== "string") {
824
+ const err25 = createError(instancePath + "/oth/" + i2 + "/r", "#/properties/oth/items/properties/r/type", "type", { type: "string" }, 5);
825
+ vErrors = pushError(vErrors, err25);
826
+ errors++;
827
+ }
828
+ }
829
+ if (data24.d !== undefined) {
830
+ if (typeof data24.d !== "string") {
831
+ const err26 = createError(instancePath + "/oth/" + i2 + "/d", "#/properties/oth/items/properties/d/type", "type", { type: "string" }, 5);
832
+ vErrors = pushError(vErrors, err26);
833
+ errors++;
834
+ }
835
+ }
836
+ if (data24.t !== undefined) {
837
+ if (typeof data24.t !== "string") {
838
+ const err27 = createError(instancePath + "/oth/" + i2 + "/t", "#/properties/oth/items/properties/t/type", "type", { type: "string" }, 5);
839
+ vErrors = pushError(vErrors, err27);
840
+ errors++;
841
+ }
842
+ }
843
+ }
844
+ else {
845
+ const err28 = createError(instancePath + "/oth/" + i2, "#/properties/oth/items/type", "type", { type: "object" }, 6);
846
+ vErrors = pushError(vErrors, err28);
847
+ errors++;
848
+ }
849
+ }
850
+ }
851
+ else {
852
+ const err29 = createError(instancePath + "/oth", "#/properties/oth/type", "type", { type: "array" }, 4);
853
+ vErrors = pushError(vErrors, err29);
854
+ errors++;
855
+ }
856
+ }
857
+ if (data.k !== undefined) {
858
+ if (typeof data.k !== "string") {
859
+ const err30 = createError(instancePath + "/k", "#/properties/k/type", "type", { type: "string" }, 5);
860
+ vErrors = pushError(vErrors, err30);
861
+ errors++;
862
+ }
863
+ }
864
+ if (data.pub !== undefined) {
865
+ if (typeof data.pub !== "string") {
866
+ const err31 = createError(instancePath + "/pub", "#/properties/pub/type", "type", { type: "string" }, 5);
867
+ vErrors = pushError(vErrors, err31);
868
+ errors++;
869
+ }
870
+ }
871
+ if (data.priv !== undefined) {
872
+ if (typeof data.priv !== "string") {
873
+ const err32 = createError(instancePath + "/priv", "#/properties/priv/type", "type", { type: "string" }, 5);
874
+ vErrors = pushError(vErrors, err32);
875
+ errors++;
876
+ }
877
+ }
878
+ }
879
+ else {
880
+ const err33 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
881
+ vErrors = pushError(vErrors, err33);
882
+ errors++;
883
+ }
884
+ validate63.errors = vErrors;
885
+ return errors === 0;
886
+ }
887
+ validate63.evaluated = { "props": { "kty": true, "use": true, "key_ops": true, "alg": true, "kid": true, "x5u": true, "x5c": true, "x5t": true, "x5t#S256": true, "ext": true, "crv": true, "x": true, "y": true, "d": true, "n": true, "e": true, "p": true, "q": true, "dp": true, "dq": true, "qi": true, "oth": true, "k": true, "pub": true, "priv": true }, "dynamicProps": false, "dynamicItems": false };
888
+ const keyword5 = external2["CompiledJsonLdNodeObject"];
889
+ function validate62(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
890
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidDocumentVerificationMethod" */ ;
891
+ let vErrors = null;
892
+ let errors = 0;
893
+ const evaluated0 = validate62.evaluated;
894
+ if (evaluated0.dynamicProps) {
895
+ evaluated0.props = undefined;
896
+ }
897
+ if (evaluated0.dynamicItems) {
898
+ evaluated0.items = undefined;
899
+ }
900
+ if (data && typeof data == "object" && !Array.isArray(data)) {
901
+ if (data.id === undefined) {
902
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "id" }, "must have required property '" + "id" + "'");
903
+ vErrors = pushError(vErrors, err0);
904
+ errors++;
905
+ }
906
+ if (data.controller === undefined) {
907
+ const err1 = createError(instancePath, "#/required", "required", { missingProperty: "controller" }, "must have required property '" + "controller" + "'");
908
+ vErrors = pushError(vErrors, err1);
909
+ errors++;
910
+ }
911
+ if (data.type === undefined) {
912
+ const err2 = createError(instancePath, "#/required", "required", { missingProperty: "type" }, "must have required property '" + "type" + "'");
913
+ vErrors = pushError(vErrors, err2);
914
+ errors++;
915
+ }
916
+ if (data.id !== undefined) {
917
+ if (typeof data.id !== "string") {
918
+ const err3 = createError(instancePath + "/id", "#/properties/id/type", "type", { type: "string" }, 5);
919
+ vErrors = pushError(vErrors, err3);
920
+ errors++;
921
+ }
922
+ }
923
+ if (data.controller !== undefined) {
924
+ if (typeof data.controller !== "string") {
925
+ const err4 = createError(instancePath + "/controller", "#/properties/controller/type", "type", { type: "string" }, 5);
926
+ vErrors = pushError(vErrors, err4);
927
+ errors++;
928
+ }
929
+ }
930
+ if (data.type !== undefined) {
931
+ if (typeof data.type !== "string") {
932
+ const err5 = createError(instancePath + "/type", "#/properties/type/type", "type", { type: "string" }, 5);
933
+ vErrors = pushError(vErrors, err5);
934
+ errors++;
935
+ }
936
+ }
937
+ if (data.publicKeyMultibase !== undefined) {
938
+ if (typeof data.publicKeyMultibase !== "string") {
939
+ const err6 = createError(instancePath + "/publicKeyMultibase", "#/properties/publicKeyMultibase/type", "type", { type: "string" }, 5);
940
+ vErrors = pushError(vErrors, err6);
941
+ errors++;
942
+ }
943
+ }
944
+ if (data.publicKeyJwk !== undefined) {
945
+ let data4 = data.publicKeyJwk;
946
+ if (!(validate63(data4, { instancePath: instancePath + "/publicKeyJwk", parentData: data, parentDataProperty: "publicKeyJwk", rootData, dynamicAnchors }))) {
947
+ vErrors = vErrors === null ? validate63.errors : vErrors.concat(validate63.errors);
948
+ errors = vErrors.length;
949
+ }
950
+ if (!(keyword5(data4, { instancePath: instancePath + "/publicKeyJwk", parentData: data, parentDataProperty: "publicKeyJwk", rootData, dynamicAnchors }))) {
951
+ vErrors = vErrors === null ? keyword5.errors : vErrors.concat(keyword5.errors);
952
+ errors = vErrors.length;
953
+ }
954
+ }
955
+ if (data.revocation !== undefined) {
956
+ if (typeof data.revocation !== "string") {
957
+ const err7 = createError(instancePath + "/revocation", "#/properties/revocation/type", "type", { type: "string" }, 5);
958
+ vErrors = pushError(vErrors, err7);
959
+ errors++;
960
+ }
961
+ }
962
+ }
963
+ else {
964
+ const err8 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
965
+ vErrors = pushError(vErrors, err8);
966
+ errors++;
967
+ }
968
+ validate62.errors = vErrors;
969
+ return errors === 0;
970
+ }
971
+ validate62.evaluated = { "props": { "id": true, "controller": true, "type": true, "publicKeyMultibase": true, "publicKeyJwk": true, "revocation": true }, "dynamicProps": false, "dynamicItems": false };
972
+ function validate71(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
973
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidService" */ ;
974
+ let vErrors = null;
975
+ let errors = 0;
976
+ const evaluated0 = validate71.evaluated;
977
+ if (evaluated0.dynamicProps) {
978
+ evaluated0.props = undefined;
979
+ }
980
+ if (evaluated0.dynamicItems) {
981
+ evaluated0.items = undefined;
982
+ }
983
+ if (data && typeof data == "object" && !Array.isArray(data)) {
984
+ if (data.id === undefined) {
985
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "id" }, "must have required property '" + "id" + "'");
986
+ vErrors = pushError(vErrors, err0);
987
+ errors++;
988
+ }
989
+ if (data.type === undefined) {
990
+ const err1 = createError(instancePath, "#/required", "required", { missingProperty: "type" }, "must have required property '" + "type" + "'");
991
+ vErrors = pushError(vErrors, err1);
992
+ errors++;
993
+ }
994
+ if (data.serviceEndpoint === undefined) {
995
+ const err2 = createError(instancePath, "#/required", "required", { missingProperty: "serviceEndpoint" }, "must have required property '" + "serviceEndpoint" + "'");
996
+ vErrors = pushError(vErrors, err2);
997
+ errors++;
998
+ }
999
+ if (data.id !== undefined) {
1000
+ if (typeof data.id !== "string") {
1001
+ const err3 = createError(instancePath + "/id", "#/properties/id/type", "type", { type: "string" }, 5);
1002
+ vErrors = pushError(vErrors, err3);
1003
+ errors++;
1004
+ }
1005
+ }
1006
+ if (data.type !== undefined) {
1007
+ let data1 = data.type;
1008
+ const _errs4 = errors;
1009
+ let valid1 = false;
1010
+ const _errs5 = errors;
1011
+ if (typeof data1 !== "string") {
1012
+ const err4 = createError(instancePath + "/type", "#/properties/type/anyOf/0/type", "type", { type: "string" }, 5);
1013
+ vErrors = pushError(vErrors, err4);
1014
+ errors++;
1015
+ }
1016
+ var _valid0 = _errs5 === errors;
1017
+ valid1 = valid1 || _valid0;
1018
+ const _errs7 = errors;
1019
+ if (Array.isArray(data1)) {
1020
+ const len0 = data1.length;
1021
+ for (let i0 = 0; i0 < len0; i0++) {
1022
+ if (typeof data1[i0] !== "string") {
1023
+ const err5 = createError(instancePath + "/type/" + i0, "#/properties/type/anyOf/1/items/type", "type", { type: "string" }, 5);
1024
+ vErrors = pushError(vErrors, err5);
1025
+ errors++;
1026
+ }
1027
+ }
1028
+ }
1029
+ else {
1030
+ const err6 = createError(instancePath + "/type", "#/properties/type/anyOf/1/type", "type", { type: "array" }, 4);
1031
+ vErrors = pushError(vErrors, err6);
1032
+ errors++;
1033
+ }
1034
+ var _valid0 = _errs7 === errors;
1035
+ valid1 = valid1 || _valid0;
1036
+ if (!valid1) {
1037
+ const err7 = createError(instancePath + "/type", "#/properties/type/anyOf", "anyOf", {}, 1);
1038
+ vErrors = pushError(vErrors, err7);
1039
+ errors++;
1040
+ }
1041
+ else {
1042
+ errors = _errs4;
1043
+ if (vErrors !== null) {
1044
+ if (_errs4) {
1045
+ vErrors.length = _errs4;
1046
+ }
1047
+ else {
1048
+ vErrors = null;
1049
+ }
1050
+ }
1051
+ }
1052
+ }
1053
+ if (data.serviceEndpoint !== undefined) {
1054
+ let data3 = data.serviceEndpoint;
1055
+ const _errs12 = errors;
1056
+ let valid4 = false;
1057
+ const _errs13 = errors;
1058
+ if (typeof data3 !== "string") {
1059
+ const err8 = createError(instancePath + "/serviceEndpoint", "#/properties/serviceEndpoint/anyOf/0/type", "type", { type: "string" }, 5);
1060
+ vErrors = pushError(vErrors, err8);
1061
+ errors++;
1062
+ }
1063
+ var _valid1 = _errs13 === errors;
1064
+ valid4 = valid4 || _valid1;
1065
+ const _errs15 = errors;
1066
+ if (Array.isArray(data3)) {
1067
+ const len1 = data3.length;
1068
+ for (let i1 = 0; i1 < len1; i1++) {
1069
+ if (typeof data3[i1] !== "string") {
1070
+ const err9 = createError(instancePath + "/serviceEndpoint/" + i1, "#/properties/serviceEndpoint/anyOf/1/items/type", "type", { type: "string" }, 5);
1071
+ vErrors = pushError(vErrors, err9);
1072
+ errors++;
1073
+ }
1074
+ }
1075
+ }
1076
+ else {
1077
+ const err10 = createError(instancePath + "/serviceEndpoint", "#/properties/serviceEndpoint/anyOf/1/type", "type", { type: "array" }, 4);
1078
+ vErrors = pushError(vErrors, err10);
1079
+ errors++;
1080
+ }
1081
+ var _valid1 = _errs15 === errors;
1082
+ valid4 = valid4 || _valid1;
1083
+ if (!valid4) {
1084
+ const err11 = createError(instancePath + "/serviceEndpoint", "#/properties/serviceEndpoint/anyOf", "anyOf", {}, 1);
1085
+ vErrors = pushError(vErrors, err11);
1086
+ errors++;
1087
+ }
1088
+ else {
1089
+ errors = _errs12;
1090
+ if (vErrors !== null) {
1091
+ if (_errs12) {
1092
+ vErrors.length = _errs12;
1093
+ }
1094
+ else {
1095
+ vErrors = null;
1096
+ }
1097
+ }
1098
+ }
1099
+ }
1100
+ }
1101
+ else {
1102
+ const err12 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
1103
+ vErrors = pushError(vErrors, err12);
1104
+ errors++;
1105
+ }
1106
+ validate71.errors = vErrors;
1107
+ return errors === 0;
1108
+ }
1109
+ validate71.evaluated = { "props": { "id": true, "type": true, "serviceEndpoint": true }, "dynamicProps": false, "dynamicItems": false };
1110
+ function validate61(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
1111
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidDocument" */ ;
1112
+ let vErrors = null;
1113
+ let errors = 0;
1114
+ const evaluated0 = validate61.evaluated;
1115
+ if (evaluated0.dynamicProps) {
1116
+ evaluated0.props = undefined;
1117
+ }
1118
+ if (evaluated0.dynamicItems) {
1119
+ evaluated0.items = undefined;
1120
+ }
1121
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1122
+ if (data["@context"] === undefined) {
1123
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "@context" }, "must have required property '" + "@context" + "'");
1124
+ vErrors = pushError(vErrors, err0);
1125
+ errors++;
1126
+ }
1127
+ if (data.id === undefined) {
1128
+ const err1 = createError(instancePath, "#/required", "required", { missingProperty: "id" }, "must have required property '" + "id" + "'");
1129
+ vErrors = pushError(vErrors, err1);
1130
+ errors++;
1131
+ }
1132
+ if (data["@context"] !== undefined) {
1133
+ let data0 = data["@context"];
1134
+ const _errs2 = errors;
1135
+ let valid1 = false;
1136
+ const _errs3 = errors;
1137
+ if ("https://www.w3.org/ns/did/v1" !== data0) {
1138
+ const err2 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/0/const", "const", { allowedValue: "https://www.w3.org/ns/did/v1" }, 0);
1139
+ vErrors = pushError(vErrors, err2);
1140
+ errors++;
1141
+ }
1142
+ var _valid0 = _errs3 === errors;
1143
+ valid1 = valid1 || _valid0;
1144
+ const _errs4 = errors;
1145
+ if (Array.isArray(data0)) {
1146
+ if (data0.length < 1) {
1147
+ const err3 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/minItems", "minItems", { limit: 1 }, 2);
1148
+ vErrors = pushError(vErrors, err3);
1149
+ errors++;
1150
+ }
1151
+ const len0 = data0.length;
1152
+ for (let i0 = 0; i0 < len0; i0++) {
1153
+ let data1 = data0[i0];
1154
+ const _errs7 = errors;
1155
+ let valid4 = false;
1156
+ const _errs8 = errors;
1157
+ if (!(keyword2(data1, { instancePath: instancePath + "/@context/" + i0, parentData: data0, parentDataProperty: i0, rootData, dynamicAnchors }))) {
1158
+ vErrors = vErrors === null ? keyword2.errors : vErrors.concat(keyword2.errors);
1159
+ errors = vErrors.length;
1160
+ }
1161
+ var _valid1 = _errs8 === errors;
1162
+ valid4 = valid4 || _valid1;
1163
+ const _errs9 = errors;
1164
+ if ("https://www.w3.org/ns/did/v1" !== data1) {
1165
+ const err4 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf/1/const", "const", { allowedValue: "https://www.w3.org/ns/did/v1" }, 0);
1166
+ vErrors = pushError(vErrors, err4);
1167
+ errors++;
1168
+ }
1169
+ var _valid1 = _errs9 === errors;
1170
+ valid4 = valid4 || _valid1;
1171
+ if (!valid4) {
1172
+ const err5 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf", "anyOf", {}, 1);
1173
+ vErrors = pushError(vErrors, err5);
1174
+ errors++;
1175
+ }
1176
+ else {
1177
+ errors = _errs7;
1178
+ if (vErrors !== null) {
1179
+ if (_errs7) {
1180
+ vErrors.length = _errs7;
1181
+ }
1182
+ else {
1183
+ vErrors = null;
1184
+ }
1185
+ }
1186
+ }
1187
+ }
1188
+ const _errs10 = errors;
1189
+ const len1 = data0.length;
1190
+ let valid5 = false;
1191
+ let count0 = 0;
1192
+ for (let i1 = 0; i1 < len1; i1++) {
1193
+ const _errs11 = errors;
1194
+ if ("https://www.w3.org/ns/did/v1" !== data0[i1]) {
1195
+ const err6 = createError(instancePath + "/@context/" + i1, "#/properties/%40context/anyOf/1/contains/const", "const", { allowedValue: "https://www.w3.org/ns/did/v1" }, 0);
1196
+ vErrors = pushError(vErrors, err6);
1197
+ errors++;
1198
+ }
1199
+ var _valid2 = _errs11 === errors;
1200
+ if (_valid2) {
1201
+ count0++;
1202
+ if (count0 > 1) {
1203
+ valid5 = false;
1204
+ break;
1205
+ }
1206
+ valid5 = true;
1207
+ }
1208
+ }
1209
+ if (!valid5) {
1210
+ const err7 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/contains", "contains", { minContains: 1, maxContains: 1 }, 3);
1211
+ vErrors = pushError(vErrors, err7);
1212
+ errors++;
1213
+ }
1214
+ else {
1215
+ errors = _errs10;
1216
+ if (vErrors !== null) {
1217
+ if (_errs10) {
1218
+ vErrors.length = _errs10;
1219
+ }
1220
+ else {
1221
+ vErrors = null;
1222
+ }
1223
+ }
1224
+ }
1225
+ }
1226
+ else {
1227
+ const err8 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/type", "type", { type: "array" }, 4);
1228
+ vErrors = pushError(vErrors, err8);
1229
+ errors++;
1230
+ }
1231
+ var _valid0 = _errs4 === errors;
1232
+ valid1 = valid1 || _valid0;
1233
+ if (!valid1) {
1234
+ const err9 = createError(instancePath + "/@context", "#/properties/%40context/anyOf", "anyOf", {}, 1);
1235
+ vErrors = pushError(vErrors, err9);
1236
+ errors++;
1237
+ }
1238
+ else {
1239
+ errors = _errs2;
1240
+ if (vErrors !== null) {
1241
+ if (_errs2) {
1242
+ vErrors.length = _errs2;
1243
+ }
1244
+ else {
1245
+ vErrors = null;
1246
+ }
1247
+ }
1248
+ }
1249
+ }
1250
+ if (data.id !== undefined) {
1251
+ if (typeof data.id !== "string") {
1252
+ const err10 = createError(instancePath + "/id", "#/properties/id/type", "type", { type: "string" }, 5);
1253
+ vErrors = pushError(vErrors, err10);
1254
+ errors++;
1255
+ }
1256
+ }
1257
+ if (data.alsoKnownAs !== undefined) {
1258
+ let data4 = data.alsoKnownAs;
1259
+ const _errs15 = errors;
1260
+ let valid6 = false;
1261
+ const _errs16 = errors;
1262
+ if (typeof data4 !== "string") {
1263
+ const err11 = createError(instancePath + "/alsoKnownAs", "#/properties/alsoKnownAs/anyOf/0/type", "type", { type: "string" }, 5);
1264
+ vErrors = pushError(vErrors, err11);
1265
+ errors++;
1266
+ }
1267
+ var _valid3 = _errs16 === errors;
1268
+ valid6 = valid6 || _valid3;
1269
+ const _errs18 = errors;
1270
+ if (Array.isArray(data4)) {
1271
+ const len2 = data4.length;
1272
+ for (let i2 = 0; i2 < len2; i2++) {
1273
+ if (typeof data4[i2] !== "string") {
1274
+ const err12 = createError(instancePath + "/alsoKnownAs/" + i2, "#/properties/alsoKnownAs/anyOf/1/items/type", "type", { type: "string" }, 5);
1275
+ vErrors = pushError(vErrors, err12);
1276
+ errors++;
1277
+ }
1278
+ }
1279
+ }
1280
+ else {
1281
+ const err13 = createError(instancePath + "/alsoKnownAs", "#/properties/alsoKnownAs/anyOf/1/type", "type", { type: "array" }, 4);
1282
+ vErrors = pushError(vErrors, err13);
1283
+ errors++;
1284
+ }
1285
+ var _valid3 = _errs18 === errors;
1286
+ valid6 = valid6 || _valid3;
1287
+ if (!valid6) {
1288
+ const err14 = createError(instancePath + "/alsoKnownAs", "#/properties/alsoKnownAs/anyOf", "anyOf", {}, 1);
1289
+ vErrors = pushError(vErrors, err14);
1290
+ errors++;
1291
+ }
1292
+ else {
1293
+ errors = _errs15;
1294
+ if (vErrors !== null) {
1295
+ if (_errs15) {
1296
+ vErrors.length = _errs15;
1297
+ }
1298
+ else {
1299
+ vErrors = null;
1300
+ }
1301
+ }
1302
+ }
1303
+ }
1304
+ if (data.controller !== undefined) {
1305
+ let data6 = data.controller;
1306
+ const _errs23 = errors;
1307
+ let valid9 = false;
1308
+ const _errs24 = errors;
1309
+ if (typeof data6 !== "string") {
1310
+ const err15 = createError(instancePath + "/controller", "#/properties/controller/anyOf/0/type", "type", { type: "string" }, 5);
1311
+ vErrors = pushError(vErrors, err15);
1312
+ errors++;
1313
+ }
1314
+ var _valid4 = _errs24 === errors;
1315
+ valid9 = valid9 || _valid4;
1316
+ const _errs26 = errors;
1317
+ if (Array.isArray(data6)) {
1318
+ const len3 = data6.length;
1319
+ for (let i3 = 0; i3 < len3; i3++) {
1320
+ if (typeof data6[i3] !== "string") {
1321
+ const err16 = createError(instancePath + "/controller/" + i3, "#/properties/controller/anyOf/1/items/type", "type", { type: "string" }, 5);
1322
+ vErrors = pushError(vErrors, err16);
1323
+ errors++;
1324
+ }
1325
+ }
1326
+ }
1327
+ else {
1328
+ const err17 = createError(instancePath + "/controller", "#/properties/controller/anyOf/1/type", "type", { type: "array" }, 4);
1329
+ vErrors = pushError(vErrors, err17);
1330
+ errors++;
1331
+ }
1332
+ var _valid4 = _errs26 === errors;
1333
+ valid9 = valid9 || _valid4;
1334
+ if (!valid9) {
1335
+ const err18 = createError(instancePath + "/controller", "#/properties/controller/anyOf", "anyOf", {}, 1);
1336
+ vErrors = pushError(vErrors, err18);
1337
+ errors++;
1338
+ }
1339
+ else {
1340
+ errors = _errs23;
1341
+ if (vErrors !== null) {
1342
+ if (_errs23) {
1343
+ vErrors.length = _errs23;
1344
+ }
1345
+ else {
1346
+ vErrors = null;
1347
+ }
1348
+ }
1349
+ }
1350
+ }
1351
+ if (data.verificationMethod !== undefined) {
1352
+ let data8 = data.verificationMethod;
1353
+ if (Array.isArray(data8)) {
1354
+ const len4 = data8.length;
1355
+ for (let i4 = 0; i4 < len4; i4++) {
1356
+ let data9 = data8[i4];
1357
+ const _errs33 = errors;
1358
+ let valid14 = false;
1359
+ const _errs34 = errors;
1360
+ if (typeof data9 !== "string") {
1361
+ const err19 = createError(instancePath + "/verificationMethod/" + i4, "#/properties/verificationMethod/items/anyOf/0/type", "type", { type: "string" }, 5);
1362
+ vErrors = pushError(vErrors, err19);
1363
+ errors++;
1364
+ }
1365
+ var _valid5 = _errs34 === errors;
1366
+ valid14 = valid14 || _valid5;
1367
+ const _errs36 = errors;
1368
+ if (!(validate62(data9, { instancePath: instancePath + "/verificationMethod/" + i4, parentData: data8, parentDataProperty: i4, rootData, dynamicAnchors }))) {
1369
+ vErrors = vErrors === null ? validate62.errors : vErrors.concat(validate62.errors);
1370
+ errors = vErrors.length;
1371
+ }
1372
+ var _valid5 = _errs36 === errors;
1373
+ valid14 = valid14 || _valid5;
1374
+ if (_valid5) {
1375
+ var props1 = {};
1376
+ props1.id = true;
1377
+ props1.controller = true;
1378
+ props1.type = true;
1379
+ props1.publicKeyMultibase = true;
1380
+ props1.publicKeyJwk = true;
1381
+ props1.revocation = true;
1382
+ }
1383
+ if (!valid14) {
1384
+ const err20 = createError(instancePath + "/verificationMethod/" + i4, "#/properties/verificationMethod/items/anyOf", "anyOf", {}, 1);
1385
+ vErrors = pushError(vErrors, err20);
1386
+ errors++;
1387
+ }
1388
+ else {
1389
+ errors = _errs33;
1390
+ if (vErrors !== null) {
1391
+ if (_errs33) {
1392
+ vErrors.length = _errs33;
1393
+ }
1394
+ else {
1395
+ vErrors = null;
1396
+ }
1397
+ }
1398
+ }
1399
+ }
1400
+ }
1401
+ else {
1402
+ const err21 = createError(instancePath + "/verificationMethod", "#/properties/verificationMethod/type", "type", { type: "array" }, 4);
1403
+ vErrors = pushError(vErrors, err21);
1404
+ errors++;
1405
+ }
1406
+ }
1407
+ if (data.authentication !== undefined) {
1408
+ let data10 = data.authentication;
1409
+ if (Array.isArray(data10)) {
1410
+ const len5 = data10.length;
1411
+ for (let i5 = 0; i5 < len5; i5++) {
1412
+ let data11 = data10[i5];
1413
+ const _errs40 = errors;
1414
+ let valid17 = false;
1415
+ const _errs41 = errors;
1416
+ if (typeof data11 !== "string") {
1417
+ const err22 = createError(instancePath + "/authentication/" + i5, "#/properties/authentication/items/anyOf/0/type", "type", { type: "string" }, 5);
1418
+ vErrors = pushError(vErrors, err22);
1419
+ errors++;
1420
+ }
1421
+ var _valid6 = _errs41 === errors;
1422
+ valid17 = valid17 || _valid6;
1423
+ const _errs43 = errors;
1424
+ if (!(validate62(data11, { instancePath: instancePath + "/authentication/" + i5, parentData: data10, parentDataProperty: i5, rootData, dynamicAnchors }))) {
1425
+ vErrors = vErrors === null ? validate62.errors : vErrors.concat(validate62.errors);
1426
+ errors = vErrors.length;
1427
+ }
1428
+ var _valid6 = _errs43 === errors;
1429
+ valid17 = valid17 || _valid6;
1430
+ if (_valid6) {
1431
+ var props2 = {};
1432
+ props2.id = true;
1433
+ props2.controller = true;
1434
+ props2.type = true;
1435
+ props2.publicKeyMultibase = true;
1436
+ props2.publicKeyJwk = true;
1437
+ props2.revocation = true;
1438
+ }
1439
+ if (!valid17) {
1440
+ const err23 = createError(instancePath + "/authentication/" + i5, "#/properties/authentication/items/anyOf", "anyOf", {}, 1);
1441
+ vErrors = pushError(vErrors, err23);
1442
+ errors++;
1443
+ }
1444
+ else {
1445
+ errors = _errs40;
1446
+ if (vErrors !== null) {
1447
+ if (_errs40) {
1448
+ vErrors.length = _errs40;
1449
+ }
1450
+ else {
1451
+ vErrors = null;
1452
+ }
1453
+ }
1454
+ }
1455
+ }
1456
+ }
1457
+ else {
1458
+ const err24 = createError(instancePath + "/authentication", "#/properties/authentication/type", "type", { type: "array" }, 4);
1459
+ vErrors = pushError(vErrors, err24);
1460
+ errors++;
1461
+ }
1462
+ }
1463
+ if (data.assertionMethod !== undefined) {
1464
+ let data12 = data.assertionMethod;
1465
+ if (Array.isArray(data12)) {
1466
+ const len6 = data12.length;
1467
+ for (let i6 = 0; i6 < len6; i6++) {
1468
+ let data13 = data12[i6];
1469
+ const _errs47 = errors;
1470
+ let valid20 = false;
1471
+ const _errs48 = errors;
1472
+ if (typeof data13 !== "string") {
1473
+ const err25 = createError(instancePath + "/assertionMethod/" + i6, "#/properties/assertionMethod/items/anyOf/0/type", "type", { type: "string" }, 5);
1474
+ vErrors = pushError(vErrors, err25);
1475
+ errors++;
1476
+ }
1477
+ var _valid7 = _errs48 === errors;
1478
+ valid20 = valid20 || _valid7;
1479
+ const _errs50 = errors;
1480
+ if (!(validate62(data13, { instancePath: instancePath + "/assertionMethod/" + i6, parentData: data12, parentDataProperty: i6, rootData, dynamicAnchors }))) {
1481
+ vErrors = vErrors === null ? validate62.errors : vErrors.concat(validate62.errors);
1482
+ errors = vErrors.length;
1483
+ }
1484
+ var _valid7 = _errs50 === errors;
1485
+ valid20 = valid20 || _valid7;
1486
+ if (_valid7) {
1487
+ var props3 = {};
1488
+ props3.id = true;
1489
+ props3.controller = true;
1490
+ props3.type = true;
1491
+ props3.publicKeyMultibase = true;
1492
+ props3.publicKeyJwk = true;
1493
+ props3.revocation = true;
1494
+ }
1495
+ if (!valid20) {
1496
+ const err26 = createError(instancePath + "/assertionMethod/" + i6, "#/properties/assertionMethod/items/anyOf", "anyOf", {}, 1);
1497
+ vErrors = pushError(vErrors, err26);
1498
+ errors++;
1499
+ }
1500
+ else {
1501
+ errors = _errs47;
1502
+ if (vErrors !== null) {
1503
+ if (_errs47) {
1504
+ vErrors.length = _errs47;
1505
+ }
1506
+ else {
1507
+ vErrors = null;
1508
+ }
1509
+ }
1510
+ }
1511
+ }
1512
+ }
1513
+ else {
1514
+ const err27 = createError(instancePath + "/assertionMethod", "#/properties/assertionMethod/type", "type", { type: "array" }, 4);
1515
+ vErrors = pushError(vErrors, err27);
1516
+ errors++;
1517
+ }
1518
+ }
1519
+ if (data.keyAgreement !== undefined) {
1520
+ let data14 = data.keyAgreement;
1521
+ if (Array.isArray(data14)) {
1522
+ const len7 = data14.length;
1523
+ for (let i7 = 0; i7 < len7; i7++) {
1524
+ let data15 = data14[i7];
1525
+ const _errs54 = errors;
1526
+ let valid23 = false;
1527
+ const _errs55 = errors;
1528
+ if (typeof data15 !== "string") {
1529
+ const err28 = createError(instancePath + "/keyAgreement/" + i7, "#/properties/keyAgreement/items/anyOf/0/type", "type", { type: "string" }, 5);
1530
+ vErrors = pushError(vErrors, err28);
1531
+ errors++;
1532
+ }
1533
+ var _valid8 = _errs55 === errors;
1534
+ valid23 = valid23 || _valid8;
1535
+ const _errs57 = errors;
1536
+ if (!(validate62(data15, { instancePath: instancePath + "/keyAgreement/" + i7, parentData: data14, parentDataProperty: i7, rootData, dynamicAnchors }))) {
1537
+ vErrors = vErrors === null ? validate62.errors : vErrors.concat(validate62.errors);
1538
+ errors = vErrors.length;
1539
+ }
1540
+ var _valid8 = _errs57 === errors;
1541
+ valid23 = valid23 || _valid8;
1542
+ if (_valid8) {
1543
+ var props4 = {};
1544
+ props4.id = true;
1545
+ props4.controller = true;
1546
+ props4.type = true;
1547
+ props4.publicKeyMultibase = true;
1548
+ props4.publicKeyJwk = true;
1549
+ props4.revocation = true;
1550
+ }
1551
+ if (!valid23) {
1552
+ const err29 = createError(instancePath + "/keyAgreement/" + i7, "#/properties/keyAgreement/items/anyOf", "anyOf", {}, 1);
1553
+ vErrors = pushError(vErrors, err29);
1554
+ errors++;
1555
+ }
1556
+ else {
1557
+ errors = _errs54;
1558
+ if (vErrors !== null) {
1559
+ if (_errs54) {
1560
+ vErrors.length = _errs54;
1561
+ }
1562
+ else {
1563
+ vErrors = null;
1564
+ }
1565
+ }
1566
+ }
1567
+ }
1568
+ }
1569
+ else {
1570
+ const err30 = createError(instancePath + "/keyAgreement", "#/properties/keyAgreement/type", "type", { type: "array" }, 4);
1571
+ vErrors = pushError(vErrors, err30);
1572
+ errors++;
1573
+ }
1574
+ }
1575
+ if (data.capabilityInvocation !== undefined) {
1576
+ let data16 = data.capabilityInvocation;
1577
+ if (Array.isArray(data16)) {
1578
+ const len8 = data16.length;
1579
+ for (let i8 = 0; i8 < len8; i8++) {
1580
+ let data17 = data16[i8];
1581
+ const _errs61 = errors;
1582
+ let valid26 = false;
1583
+ const _errs62 = errors;
1584
+ if (typeof data17 !== "string") {
1585
+ const err31 = createError(instancePath + "/capabilityInvocation/" + i8, "#/properties/capabilityInvocation/items/anyOf/0/type", "type", { type: "string" }, 5);
1586
+ vErrors = pushError(vErrors, err31);
1587
+ errors++;
1588
+ }
1589
+ var _valid9 = _errs62 === errors;
1590
+ valid26 = valid26 || _valid9;
1591
+ const _errs64 = errors;
1592
+ if (!(validate62(data17, { instancePath: instancePath + "/capabilityInvocation/" + i8, parentData: data16, parentDataProperty: i8, rootData, dynamicAnchors }))) {
1593
+ vErrors = vErrors === null ? validate62.errors : vErrors.concat(validate62.errors);
1594
+ errors = vErrors.length;
1595
+ }
1596
+ var _valid9 = _errs64 === errors;
1597
+ valid26 = valid26 || _valid9;
1598
+ if (_valid9) {
1599
+ var props5 = {};
1600
+ props5.id = true;
1601
+ props5.controller = true;
1602
+ props5.type = true;
1603
+ props5.publicKeyMultibase = true;
1604
+ props5.publicKeyJwk = true;
1605
+ props5.revocation = true;
1606
+ }
1607
+ if (!valid26) {
1608
+ const err32 = createError(instancePath + "/capabilityInvocation/" + i8, "#/properties/capabilityInvocation/items/anyOf", "anyOf", {}, 1);
1609
+ vErrors = pushError(vErrors, err32);
1610
+ errors++;
1611
+ }
1612
+ else {
1613
+ errors = _errs61;
1614
+ if (vErrors !== null) {
1615
+ if (_errs61) {
1616
+ vErrors.length = _errs61;
1617
+ }
1618
+ else {
1619
+ vErrors = null;
1620
+ }
1621
+ }
1622
+ }
1623
+ }
1624
+ }
1625
+ else {
1626
+ const err33 = createError(instancePath + "/capabilityInvocation", "#/properties/capabilityInvocation/type", "type", { type: "array" }, 4);
1627
+ vErrors = pushError(vErrors, err33);
1628
+ errors++;
1629
+ }
1630
+ }
1631
+ if (data.capabilityDelegation !== undefined) {
1632
+ let data18 = data.capabilityDelegation;
1633
+ if (Array.isArray(data18)) {
1634
+ const len9 = data18.length;
1635
+ for (let i9 = 0; i9 < len9; i9++) {
1636
+ let data19 = data18[i9];
1637
+ const _errs68 = errors;
1638
+ let valid29 = false;
1639
+ const _errs69 = errors;
1640
+ if (typeof data19 !== "string") {
1641
+ const err34 = createError(instancePath + "/capabilityDelegation/" + i9, "#/properties/capabilityDelegation/items/anyOf/0/type", "type", { type: "string" }, 5);
1642
+ vErrors = pushError(vErrors, err34);
1643
+ errors++;
1644
+ }
1645
+ var _valid10 = _errs69 === errors;
1646
+ valid29 = valid29 || _valid10;
1647
+ const _errs71 = errors;
1648
+ if (!(validate62(data19, { instancePath: instancePath + "/capabilityDelegation/" + i9, parentData: data18, parentDataProperty: i9, rootData, dynamicAnchors }))) {
1649
+ vErrors = vErrors === null ? validate62.errors : vErrors.concat(validate62.errors);
1650
+ errors = vErrors.length;
1651
+ }
1652
+ var _valid10 = _errs71 === errors;
1653
+ valid29 = valid29 || _valid10;
1654
+ if (_valid10) {
1655
+ var props6 = {};
1656
+ props6.id = true;
1657
+ props6.controller = true;
1658
+ props6.type = true;
1659
+ props6.publicKeyMultibase = true;
1660
+ props6.publicKeyJwk = true;
1661
+ props6.revocation = true;
1662
+ }
1663
+ if (!valid29) {
1664
+ const err35 = createError(instancePath + "/capabilityDelegation/" + i9, "#/properties/capabilityDelegation/items/anyOf", "anyOf", {}, 1);
1665
+ vErrors = pushError(vErrors, err35);
1666
+ errors++;
1667
+ }
1668
+ else {
1669
+ errors = _errs68;
1670
+ if (vErrors !== null) {
1671
+ if (_errs68) {
1672
+ vErrors.length = _errs68;
1673
+ }
1674
+ else {
1675
+ vErrors = null;
1676
+ }
1677
+ }
1678
+ }
1679
+ }
1680
+ }
1681
+ else {
1682
+ const err36 = createError(instancePath + "/capabilityDelegation", "#/properties/capabilityDelegation/type", "type", { type: "array" }, 4);
1683
+ vErrors = pushError(vErrors, err36);
1684
+ errors++;
1685
+ }
1686
+ }
1687
+ if (data.service !== undefined) {
1688
+ let data20 = data.service;
1689
+ if (Array.isArray(data20)) {
1690
+ const len10 = data20.length;
1691
+ for (let i10 = 0; i10 < len10; i10++) {
1692
+ if (!(validate71(data20[i10], { instancePath: instancePath + "/service/" + i10, parentData: data20, parentDataProperty: i10, rootData, dynamicAnchors }))) {
1693
+ vErrors = vErrors === null ? validate71.errors : vErrors.concat(validate71.errors);
1694
+ errors = vErrors.length;
1695
+ }
1696
+ }
1697
+ }
1698
+ else {
1699
+ const err37 = createError(instancePath + "/service", "#/properties/service/type", "type", { type: "array" }, 4);
1700
+ vErrors = pushError(vErrors, err37);
1701
+ errors++;
1702
+ }
1703
+ }
1704
+ }
1705
+ else {
1706
+ const err38 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
1707
+ vErrors = pushError(vErrors, err38);
1708
+ errors++;
1709
+ }
1710
+ validate61.errors = vErrors;
1711
+ return errors === 0;
1712
+ }
1713
+ validate61.evaluated = { "props": { "@context": true, "id": true, "alsoKnownAs": true, "controller": true, "verificationMethod": true, "authentication": true, "assertionMethod": true, "keyAgreement": true, "capabilityInvocation": true, "capabilityDelegation": true, "service": true }, "dynamicProps": false, "dynamicItems": false };
1714
+ /**
1715
+ * Compiled validator for the DidDocumentVerificationMethod schema.
1716
+ */
1717
+ export const CompiledDidDocumentVerificationMethod = validate62;
1718
+ /**
1719
+ * Compiled validator for the DidLabel schema.
1720
+ */
1721
+ export const CompiledDidLabel = validate73;
1722
+ function validate73(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
1723
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidLabel" */ ;
1724
+ let vErrors = null;
1725
+ let errors = 0;
1726
+ const evaluated0 = validate73.evaluated;
1727
+ if (evaluated0.dynamicProps) {
1728
+ evaluated0.props = undefined;
1729
+ }
1730
+ if (evaluated0.dynamicItems) {
1731
+ evaluated0.items = undefined;
1732
+ }
1733
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1734
+ if (data["@value"] === undefined) {
1735
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "@value" }, "must have required property '" + "@value" + "'");
1736
+ vErrors = pushError(vErrors, err0);
1737
+ errors++;
1738
+ }
1739
+ if (data["@language"] === undefined) {
1740
+ const err1 = createError(instancePath, "#/required", "required", { missingProperty: "@language" }, "must have required property '" + "@language" + "'");
1741
+ vErrors = pushError(vErrors, err1);
1742
+ errors++;
1743
+ }
1744
+ if (data["@value"] !== undefined) {
1745
+ if (typeof data["@value"] !== "string") {
1746
+ const err2 = createError(instancePath + "/@value", "#/properties/%40value/type", "type", { type: "string" }, 5);
1747
+ vErrors = pushError(vErrors, err2);
1748
+ errors++;
1749
+ }
1750
+ }
1751
+ if (data["@language"] !== undefined) {
1752
+ if (typeof data["@language"] !== "string") {
1753
+ const err3 = createError(instancePath + "/@language", "#/properties/%40language/type", "type", { type: "string" }, 5);
1754
+ vErrors = pushError(vErrors, err3);
1755
+ errors++;
1756
+ }
1757
+ }
1758
+ if (data["@direction"] !== undefined) {
1759
+ if (typeof data["@direction"] !== "string") {
1760
+ const err4 = createError(instancePath + "/@direction", "#/properties/%40direction/type", "type", { type: "string" }, 5);
1761
+ vErrors = pushError(vErrors, err4);
1762
+ errors++;
1763
+ }
1764
+ }
1765
+ }
1766
+ else {
1767
+ const err5 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
1768
+ vErrors = pushError(vErrors, err5);
1769
+ errors++;
1770
+ }
1771
+ validate73.errors = vErrors;
1772
+ return errors === 0;
1773
+ }
1774
+ validate73.evaluated = { "props": { "@value": true, "@language": true, "@direction": true }, "dynamicProps": false, "dynamicItems": false };
1775
+ /**
1776
+ * Compiled validator for the DidPresentationVerification schema.
1777
+ */
1778
+ export const CompiledDidPresentationVerification = validate74;
1779
+ function validate74(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
1780
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidPresentationVerification" */ ;
1781
+ let vErrors = null;
1782
+ let errors = 0;
1783
+ const evaluated0 = validate74.evaluated;
1784
+ if (evaluated0.dynamicProps) {
1785
+ evaluated0.props = undefined;
1786
+ }
1787
+ if (evaluated0.dynamicItems) {
1788
+ evaluated0.items = undefined;
1789
+ }
1790
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1791
+ if (data.isVerified === undefined) {
1792
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "isVerified" }, "must have required property '" + "isVerified" + "'");
1793
+ vErrors = pushError(vErrors, err0);
1794
+ errors++;
1795
+ }
1796
+ if (data.isVerified !== undefined) {
1797
+ if (typeof data.isVerified !== "boolean") {
1798
+ const err1 = createError(instancePath + "/isVerified", "#/properties/isVerified/type", "type", { type: "boolean" }, 7);
1799
+ vErrors = pushError(vErrors, err1);
1800
+ errors++;
1801
+ }
1802
+ }
1803
+ if (data.holder !== undefined) {
1804
+ let data1 = data.holder;
1805
+ if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
1806
+ if (data1.id === undefined) {
1807
+ const err2 = createError(instancePath + "/holder", "#/properties/holder/required", "required", { missingProperty: "id" }, "must have required property '" + "id" + "'");
1808
+ vErrors = pushError(vErrors, err2);
1809
+ errors++;
1810
+ }
1811
+ if (data1.isVerified === undefined) {
1812
+ const err3 = createError(instancePath + "/holder", "#/properties/holder/required", "required", { missingProperty: "isVerified" }, "must have required property '" + "isVerified" + "'");
1813
+ vErrors = pushError(vErrors, err3);
1814
+ errors++;
1815
+ }
1816
+ if (data1.id !== undefined) {
1817
+ if (typeof data1.id !== "string") {
1818
+ const err4 = createError(instancePath + "/holder/id", "#/properties/holder/properties/id/type", "type", { type: "string" }, 5);
1819
+ vErrors = pushError(vErrors, err4);
1820
+ errors++;
1821
+ }
1822
+ }
1823
+ if (data1.isVerified !== undefined) {
1824
+ if (typeof data1.isVerified !== "boolean") {
1825
+ const err5 = createError(instancePath + "/holder/isVerified", "#/properties/holder/properties/isVerified/type", "type", { type: "boolean" }, 7);
1826
+ vErrors = pushError(vErrors, err5);
1827
+ errors++;
1828
+ }
1829
+ }
1830
+ if (data1.document !== undefined) {
1831
+ if (!(validate61(data1.document, { instancePath: instancePath + "/holder/document", parentData: data1, parentDataProperty: "document", rootData, dynamicAnchors }))) {
1832
+ vErrors = vErrors === null ? validate61.errors : vErrors.concat(validate61.errors);
1833
+ errors = vErrors.length;
1834
+ }
1835
+ }
1836
+ }
1837
+ else {
1838
+ const err6 = createError(instancePath + "/holder", "#/properties/holder/type", "type", { type: "object" }, 6);
1839
+ vErrors = pushError(vErrors, err6);
1840
+ errors++;
1841
+ }
1842
+ }
1843
+ }
1844
+ else {
1845
+ const err7 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
1846
+ vErrors = pushError(vErrors, err7);
1847
+ errors++;
1848
+ }
1849
+ validate74.errors = vErrors;
1850
+ return errors === 0;
1851
+ }
1852
+ validate74.evaluated = { "props": { "isVerified": true, "holder": true }, "dynamicProps": false, "dynamicItems": false };
1853
+ /**
1854
+ * Compiled validator for the DidService schema.
1855
+ */
1856
+ export const CompiledDidService = validate71;
1857
+ /**
1858
+ * Compiled validator for the DidVerifiableCredential schema.
1859
+ */
1860
+ export const CompiledDidVerifiableCredential = validate76;
1861
+ function validate89(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
1862
+ /*# sourceURL="https://schema.twindev.org/w3c-did/JsonWebSignature2020Proof" */ ;
1863
+ let vErrors = null;
1864
+ let errors = 0;
1865
+ const evaluated0 = validate89.evaluated;
1866
+ if (evaluated0.dynamicProps) {
1867
+ evaluated0.props = undefined;
1868
+ }
1869
+ if (evaluated0.dynamicItems) {
1870
+ evaluated0.items = undefined;
1871
+ }
1872
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1873
+ if (data.type === undefined) {
1874
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "type" }, "must have required property '" + "type" + "'");
1875
+ vErrors = pushError(vErrors, err0);
1876
+ errors++;
1877
+ }
1878
+ if (data.proofPurpose === undefined) {
1879
+ const err1 = createError(instancePath, "#/required", "required", { missingProperty: "proofPurpose" }, "must have required property '" + "proofPurpose" + "'");
1880
+ vErrors = pushError(vErrors, err1);
1881
+ errors++;
1882
+ }
1883
+ if (data["@context"] !== undefined) {
1884
+ let data0 = data["@context"];
1885
+ const _errs2 = errors;
1886
+ let valid1 = false;
1887
+ const _errs3 = errors;
1888
+ if ("https://w3id.org/security/suites/jws-2020/v1" !== data0) {
1889
+ const err2 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/0/const", "const", { allowedValue: "https://w3id.org/security/suites/jws-2020/v1" }, 0);
1890
+ vErrors = pushError(vErrors, err2);
1891
+ errors++;
1892
+ }
1893
+ var _valid0 = _errs3 === errors;
1894
+ valid1 = valid1 || _valid0;
1895
+ const _errs4 = errors;
1896
+ if (Array.isArray(data0)) {
1897
+ if (data0.length < 1) {
1898
+ const err3 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/minItems", "minItems", { limit: 1 }, 2);
1899
+ vErrors = pushError(vErrors, err3);
1900
+ errors++;
1901
+ }
1902
+ const len0 = data0.length;
1903
+ for (let i0 = 0; i0 < len0; i0++) {
1904
+ let data1 = data0[i0];
1905
+ const _errs7 = errors;
1906
+ let valid4 = false;
1907
+ const _errs8 = errors;
1908
+ if (!(keyword2(data1, { instancePath: instancePath + "/@context/" + i0, parentData: data0, parentDataProperty: i0, rootData, dynamicAnchors }))) {
1909
+ vErrors = vErrors === null ? keyword2.errors : vErrors.concat(keyword2.errors);
1910
+ errors = vErrors.length;
1911
+ }
1912
+ var _valid1 = _errs8 === errors;
1913
+ valid4 = valid4 || _valid1;
1914
+ const _errs9 = errors;
1915
+ if ("https://w3id.org/security/suites/jws-2020/v1" !== data1) {
1916
+ const err4 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf/1/const", "const", { allowedValue: "https://w3id.org/security/suites/jws-2020/v1" }, 0);
1917
+ vErrors = pushError(vErrors, err4);
1918
+ errors++;
1919
+ }
1920
+ var _valid1 = _errs9 === errors;
1921
+ valid4 = valid4 || _valid1;
1922
+ if (!valid4) {
1923
+ const err5 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf", "anyOf", {}, 1);
1924
+ vErrors = pushError(vErrors, err5);
1925
+ errors++;
1926
+ }
1927
+ else {
1928
+ errors = _errs7;
1929
+ if (vErrors !== null) {
1930
+ if (_errs7) {
1931
+ vErrors.length = _errs7;
1932
+ }
1933
+ else {
1934
+ vErrors = null;
1935
+ }
1936
+ }
1937
+ }
1938
+ }
1939
+ const _errs10 = errors;
1940
+ const len1 = data0.length;
1941
+ let valid5 = false;
1942
+ let count0 = 0;
1943
+ for (let i1 = 0; i1 < len1; i1++) {
1944
+ const _errs11 = errors;
1945
+ if ("https://w3id.org/security/suites/jws-2020/v1" !== data0[i1]) {
1946
+ const err6 = createError(instancePath + "/@context/" + i1, "#/properties/%40context/anyOf/1/contains/const", "const", { allowedValue: "https://w3id.org/security/suites/jws-2020/v1" }, 0);
1947
+ vErrors = pushError(vErrors, err6);
1948
+ errors++;
1949
+ }
1950
+ var _valid2 = _errs11 === errors;
1951
+ if (_valid2) {
1952
+ count0++;
1953
+ if (count0 > 1) {
1954
+ valid5 = false;
1955
+ break;
1956
+ }
1957
+ valid5 = true;
1958
+ }
1959
+ }
1960
+ if (!valid5) {
1961
+ const err7 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/contains", "contains", { minContains: 1, maxContains: 1 }, 3);
1962
+ vErrors = pushError(vErrors, err7);
1963
+ errors++;
1964
+ }
1965
+ else {
1966
+ errors = _errs10;
1967
+ if (vErrors !== null) {
1968
+ if (_errs10) {
1969
+ vErrors.length = _errs10;
1970
+ }
1971
+ else {
1972
+ vErrors = null;
1973
+ }
1974
+ }
1975
+ }
1976
+ }
1977
+ else {
1978
+ const err8 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/type", "type", { type: "array" }, 4);
1979
+ vErrors = pushError(vErrors, err8);
1980
+ errors++;
1981
+ }
1982
+ var _valid0 = _errs4 === errors;
1983
+ valid1 = valid1 || _valid0;
1984
+ if (!valid1) {
1985
+ const err9 = createError(instancePath + "/@context", "#/properties/%40context/anyOf", "anyOf", {}, 1);
1986
+ vErrors = pushError(vErrors, err9);
1987
+ errors++;
1988
+ }
1989
+ else {
1990
+ errors = _errs2;
1991
+ if (vErrors !== null) {
1992
+ if (_errs2) {
1993
+ vErrors.length = _errs2;
1994
+ }
1995
+ else {
1996
+ vErrors = null;
1997
+ }
1998
+ }
1999
+ }
2000
+ }
2001
+ if (data.type !== undefined) {
2002
+ if ("JsonWebSignature2020" !== data.type) {
2003
+ const err10 = createError(instancePath + "/type", "#/properties/type/const", "const", { allowedValue: "JsonWebSignature2020" }, 0);
2004
+ vErrors = pushError(vErrors, err10);
2005
+ errors++;
2006
+ }
2007
+ }
2008
+ if (data.proofPurpose !== undefined) {
2009
+ if (typeof data.proofPurpose !== "string") {
2010
+ const err11 = createError(instancePath + "/proofPurpose", "#/properties/proofPurpose/type", "type", { type: "string" }, 5);
2011
+ vErrors = pushError(vErrors, err11);
2012
+ errors++;
2013
+ }
2014
+ }
2015
+ if (data.verificationMethod !== undefined) {
2016
+ if (typeof data.verificationMethod !== "string") {
2017
+ const err12 = createError(instancePath + "/verificationMethod", "#/properties/verificationMethod/type", "type", { type: "string" }, 5);
2018
+ vErrors = pushError(vErrors, err12);
2019
+ errors++;
2020
+ }
2021
+ }
2022
+ if (data.created !== undefined) {
2023
+ if (typeof data.created !== "string") {
2024
+ const err13 = createError(instancePath + "/created", "#/properties/created/type", "type", { type: "string" }, 5);
2025
+ vErrors = pushError(vErrors, err13);
2026
+ errors++;
2027
+ }
2028
+ }
2029
+ if (data.jws !== undefined) {
2030
+ if (typeof data.jws !== "string") {
2031
+ const err14 = createError(instancePath + "/jws", "#/properties/jws/type", "type", { type: "string" }, 5);
2032
+ vErrors = pushError(vErrors, err14);
2033
+ errors++;
2034
+ }
2035
+ }
2036
+ }
2037
+ else {
2038
+ const err15 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
2039
+ vErrors = pushError(vErrors, err15);
2040
+ errors++;
2041
+ }
2042
+ validate89.errors = vErrors;
2043
+ return errors === 0;
2044
+ }
2045
+ validate89.evaluated = { "props": { "@context": true, "type": true, "proofPurpose": true, "verificationMethod": true, "created": true, "jws": true }, "dynamicProps": false, "dynamicItems": false };
2046
+ function validate87(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
2047
+ /*# sourceURL="https://schema.twindev.org/w3c-did/Proof" */ ;
2048
+ let vErrors = null;
2049
+ let errors = 0;
2050
+ const evaluated0 = validate87.evaluated;
2051
+ if (evaluated0.dynamicProps) {
2052
+ evaluated0.props = undefined;
2053
+ }
2054
+ if (evaluated0.dynamicItems) {
2055
+ evaluated0.items = undefined;
2056
+ }
2057
+ const _errs0 = errors;
2058
+ let valid0 = false;
2059
+ let passing0 = null;
2060
+ const _errs1 = errors;
2061
+ if (!(validate55(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
2062
+ vErrors = vErrors === null ? validate55.errors : vErrors.concat(validate55.errors);
2063
+ errors = vErrors.length;
2064
+ }
2065
+ var _valid0 = _errs1 === errors;
2066
+ if (_valid0) {
2067
+ valid0 = true;
2068
+ passing0 = 0;
2069
+ var props0 = {};
2070
+ props0["@context"] = true;
2071
+ props0.type = true;
2072
+ props0.cryptosuite = true;
2073
+ props0.id = true;
2074
+ props0.proofPurpose = true;
2075
+ props0.proofValue = true;
2076
+ props0.verificationMethod = true;
2077
+ props0.created = true;
2078
+ props0.expires = true;
2079
+ props0.domain = true;
2080
+ props0.challenge = true;
2081
+ props0.previousProof = true;
2082
+ props0.nonce = true;
2083
+ }
2084
+ const _errs2 = errors;
2085
+ if (!(validate89(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
2086
+ vErrors = vErrors === null ? validate89.errors : vErrors.concat(validate89.errors);
2087
+ errors = vErrors.length;
2088
+ }
2089
+ var _valid0 = _errs2 === errors;
2090
+ if (_valid0 && valid0) {
2091
+ valid0 = false;
2092
+ passing0 = [passing0, 1];
2093
+ }
2094
+ else {
2095
+ if (_valid0) {
2096
+ valid0 = true;
2097
+ passing0 = 1;
2098
+ if (props0 !== true) {
2099
+ props0 = props0 || {};
2100
+ props0["@context"] = true;
2101
+ props0.type = true;
2102
+ props0.proofPurpose = true;
2103
+ props0.verificationMethod = true;
2104
+ props0.created = true;
2105
+ props0.jws = true;
2106
+ }
2107
+ }
2108
+ }
2109
+ if (!valid0) {
2110
+ const err0 = createError(instancePath, "#/oneOf", "oneOf", { passingSchemas: passing0 }, 8);
2111
+ vErrors = pushError(vErrors, err0);
2112
+ errors++;
2113
+ }
2114
+ else {
2115
+ errors = _errs0;
2116
+ if (vErrors !== null) {
2117
+ if (_errs0) {
2118
+ vErrors.length = _errs0;
2119
+ }
2120
+ else {
2121
+ vErrors = null;
2122
+ }
2123
+ }
2124
+ }
2125
+ validate87.errors = vErrors;
2126
+ evaluated0.props = props0;
2127
+ return errors === 0;
2128
+ }
2129
+ validate87.evaluated = { "dynamicProps": true, "dynamicItems": false };
2130
+ function validate78(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
2131
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidVerifiableCredentialCommon" */ ;
2132
+ let vErrors = null;
2133
+ let errors = 0;
2134
+ const evaluated0 = validate78.evaluated;
2135
+ if (evaluated0.dynamicProps) {
2136
+ evaluated0.props = undefined;
2137
+ }
2138
+ if (evaluated0.dynamicItems) {
2139
+ evaluated0.items = undefined;
2140
+ }
2141
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2142
+ if (data.type === undefined) {
2143
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "type" }, "must have required property '" + "type" + "'");
2144
+ vErrors = pushError(vErrors, err0);
2145
+ errors++;
2146
+ }
2147
+ if (data.id !== undefined) {
2148
+ if (typeof data.id !== "string") {
2149
+ const err1 = createError(instancePath + "/id", "#/properties/id/type", "type", { type: "string" }, 5);
2150
+ vErrors = pushError(vErrors, err1);
2151
+ errors++;
2152
+ }
2153
+ }
2154
+ if (data.type !== undefined) {
2155
+ let data1 = data.type;
2156
+ const _errs4 = errors;
2157
+ let valid1 = false;
2158
+ const _errs5 = errors;
2159
+ if (typeof data1 !== "string") {
2160
+ const err2 = createError(instancePath + "/type", "#/properties/type/anyOf/0/type", "type", { type: "string" }, 5);
2161
+ vErrors = pushError(vErrors, err2);
2162
+ errors++;
2163
+ }
2164
+ var _valid0 = _errs5 === errors;
2165
+ valid1 = valid1 || _valid0;
2166
+ const _errs7 = errors;
2167
+ if (Array.isArray(data1)) {
2168
+ const len0 = data1.length;
2169
+ for (let i0 = 0; i0 < len0; i0++) {
2170
+ if (typeof data1[i0] !== "string") {
2171
+ const err3 = createError(instancePath + "/type/" + i0, "#/properties/type/anyOf/1/items/type", "type", { type: "string" }, 5);
2172
+ vErrors = pushError(vErrors, err3);
2173
+ errors++;
2174
+ }
2175
+ }
2176
+ }
2177
+ else {
2178
+ const err4 = createError(instancePath + "/type", "#/properties/type/anyOf/1/type", "type", { type: "array" }, 4);
2179
+ vErrors = pushError(vErrors, err4);
2180
+ errors++;
2181
+ }
2182
+ var _valid0 = _errs7 === errors;
2183
+ valid1 = valid1 || _valid0;
2184
+ if (!valid1) {
2185
+ const err5 = createError(instancePath + "/type", "#/properties/type/anyOf", "anyOf", {}, 1);
2186
+ vErrors = pushError(vErrors, err5);
2187
+ errors++;
2188
+ }
2189
+ else {
2190
+ errors = _errs4;
2191
+ if (vErrors !== null) {
2192
+ if (_errs4) {
2193
+ vErrors.length = _errs4;
2194
+ }
2195
+ else {
2196
+ vErrors = null;
2197
+ }
2198
+ }
2199
+ }
2200
+ }
2201
+ if (data.credentialSubject !== undefined) {
2202
+ let data3 = data.credentialSubject;
2203
+ const _errs12 = errors;
2204
+ let valid4 = false;
2205
+ const _errs13 = errors;
2206
+ if (!(keyword5(data3, { instancePath: instancePath + "/credentialSubject", parentData: data, parentDataProperty: "credentialSubject", rootData, dynamicAnchors }))) {
2207
+ vErrors = vErrors === null ? keyword5.errors : vErrors.concat(keyword5.errors);
2208
+ errors = vErrors.length;
2209
+ }
2210
+ var _valid1 = _errs13 === errors;
2211
+ valid4 = valid4 || _valid1;
2212
+ const _errs14 = errors;
2213
+ if (Array.isArray(data3)) {
2214
+ const len1 = data3.length;
2215
+ for (let i1 = 0; i1 < len1; i1++) {
2216
+ if (!(keyword5(data3[i1], { instancePath: instancePath + "/credentialSubject/" + i1, parentData: data3, parentDataProperty: i1, rootData, dynamicAnchors }))) {
2217
+ vErrors = vErrors === null ? keyword5.errors : vErrors.concat(keyword5.errors);
2218
+ errors = vErrors.length;
2219
+ }
2220
+ }
2221
+ }
2222
+ else {
2223
+ const err6 = createError(instancePath + "/credentialSubject", "#/properties/credentialSubject/anyOf/1/type", "type", { type: "array" }, 4);
2224
+ vErrors = pushError(vErrors, err6);
2225
+ errors++;
2226
+ }
2227
+ var _valid1 = _errs14 === errors;
2228
+ valid4 = valid4 || _valid1;
2229
+ if (!valid4) {
2230
+ const err7 = createError(instancePath + "/credentialSubject", "#/properties/credentialSubject/anyOf", "anyOf", {}, 1);
2231
+ vErrors = pushError(vErrors, err7);
2232
+ errors++;
2233
+ }
2234
+ else {
2235
+ errors = _errs12;
2236
+ if (vErrors !== null) {
2237
+ if (_errs12) {
2238
+ vErrors.length = _errs12;
2239
+ }
2240
+ else {
2241
+ vErrors = null;
2242
+ }
2243
+ }
2244
+ }
2245
+ }
2246
+ if (data.credentialStatus !== undefined) {
2247
+ let data5 = data.credentialStatus;
2248
+ const _errs18 = errors;
2249
+ let valid7 = false;
2250
+ const _errs19 = errors;
2251
+ if (!(validate58(data5, { instancePath: instancePath + "/credentialStatus", parentData: data, parentDataProperty: "credentialStatus", rootData, dynamicAnchors }))) {
2252
+ vErrors = vErrors === null ? validate58.errors : vErrors.concat(validate58.errors);
2253
+ errors = vErrors.length;
2254
+ }
2255
+ var _valid2 = _errs19 === errors;
2256
+ valid7 = valid7 || _valid2;
2257
+ const _errs20 = errors;
2258
+ if (Array.isArray(data5)) {
2259
+ const len2 = data5.length;
2260
+ for (let i2 = 0; i2 < len2; i2++) {
2261
+ if (!(validate58(data5[i2], { instancePath: instancePath + "/credentialStatus/" + i2, parentData: data5, parentDataProperty: i2, rootData, dynamicAnchors }))) {
2262
+ vErrors = vErrors === null ? validate58.errors : vErrors.concat(validate58.errors);
2263
+ errors = vErrors.length;
2264
+ }
2265
+ }
2266
+ }
2267
+ else {
2268
+ const err8 = createError(instancePath + "/credentialStatus", "#/properties/credentialStatus/anyOf/1/type", "type", { type: "array" }, 4);
2269
+ vErrors = pushError(vErrors, err8);
2270
+ errors++;
2271
+ }
2272
+ var _valid2 = _errs20 === errors;
2273
+ valid7 = valid7 || _valid2;
2274
+ if (!valid7) {
2275
+ const err9 = createError(instancePath + "/credentialStatus", "#/properties/credentialStatus/anyOf", "anyOf", {}, 1);
2276
+ vErrors = pushError(vErrors, err9);
2277
+ errors++;
2278
+ }
2279
+ else {
2280
+ errors = _errs18;
2281
+ if (vErrors !== null) {
2282
+ if (_errs18) {
2283
+ vErrors.length = _errs18;
2284
+ }
2285
+ else {
2286
+ vErrors = null;
2287
+ }
2288
+ }
2289
+ }
2290
+ }
2291
+ if (data.credentialSchema !== undefined) {
2292
+ let data7 = data.credentialSchema;
2293
+ const _errs24 = errors;
2294
+ let valid10 = false;
2295
+ const _errs25 = errors;
2296
+ if (!(validate57(data7, { instancePath: instancePath + "/credentialSchema", parentData: data, parentDataProperty: "credentialSchema", rootData, dynamicAnchors }))) {
2297
+ vErrors = vErrors === null ? validate57.errors : vErrors.concat(validate57.errors);
2298
+ errors = vErrors.length;
2299
+ }
2300
+ var _valid3 = _errs25 === errors;
2301
+ valid10 = valid10 || _valid3;
2302
+ if (_valid3) {
2303
+ var props2 = {};
2304
+ props2.id = true;
2305
+ props2.type = true;
2306
+ }
2307
+ const _errs26 = errors;
2308
+ if (Array.isArray(data7)) {
2309
+ const len3 = data7.length;
2310
+ for (let i3 = 0; i3 < len3; i3++) {
2311
+ if (!(validate57(data7[i3], { instancePath: instancePath + "/credentialSchema/" + i3, parentData: data7, parentDataProperty: i3, rootData, dynamicAnchors }))) {
2312
+ vErrors = vErrors === null ? validate57.errors : vErrors.concat(validate57.errors);
2313
+ errors = vErrors.length;
2314
+ }
2315
+ }
2316
+ }
2317
+ else {
2318
+ const err10 = createError(instancePath + "/credentialSchema", "#/properties/credentialSchema/anyOf/1/type", "type", { type: "array" }, 4);
2319
+ vErrors = pushError(vErrors, err10);
2320
+ errors++;
2321
+ }
2322
+ var _valid3 = _errs26 === errors;
2323
+ valid10 = valid10 || _valid3;
2324
+ if (!valid10) {
2325
+ const err11 = createError(instancePath + "/credentialSchema", "#/properties/credentialSchema/anyOf", "anyOf", {}, 1);
2326
+ vErrors = pushError(vErrors, err11);
2327
+ errors++;
2328
+ }
2329
+ else {
2330
+ errors = _errs24;
2331
+ if (vErrors !== null) {
2332
+ if (_errs24) {
2333
+ vErrors.length = _errs24;
2334
+ }
2335
+ else {
2336
+ vErrors = null;
2337
+ }
2338
+ }
2339
+ }
2340
+ }
2341
+ if (data.issuer !== undefined) {
2342
+ let data9 = data.issuer;
2343
+ const _errs30 = errors;
2344
+ let valid13 = false;
2345
+ const _errs31 = errors;
2346
+ if (typeof data9 !== "string") {
2347
+ const err12 = createError(instancePath + "/issuer", "#/properties/issuer/anyOf/0/type", "type", { type: "string" }, 5);
2348
+ vErrors = pushError(vErrors, err12);
2349
+ errors++;
2350
+ }
2351
+ var _valid4 = _errs31 === errors;
2352
+ valid13 = valid13 || _valid4;
2353
+ const _errs33 = errors;
2354
+ if (data9 && typeof data9 == "object" && !Array.isArray(data9)) {
2355
+ if (data9.id === undefined) {
2356
+ const err13 = createError(instancePath + "/issuer", "#/properties/issuer/anyOf/1/required", "required", { missingProperty: "id" }, "must have required property '" + "id" + "'");
2357
+ vErrors = pushError(vErrors, err13);
2358
+ errors++;
2359
+ }
2360
+ if (data9.id !== undefined) {
2361
+ if (typeof data9.id !== "string") {
2362
+ const err14 = createError(instancePath + "/issuer/id", "#/properties/issuer/anyOf/1/properties/id/type", "type", { type: "string" }, 5);
2363
+ vErrors = pushError(vErrors, err14);
2364
+ errors++;
2365
+ }
2366
+ }
2367
+ if (data9.name !== undefined) {
2368
+ let data11 = data9.name;
2369
+ const _errs38 = errors;
2370
+ let valid15 = false;
2371
+ const _errs39 = errors;
2372
+ if (typeof data11 !== "string") {
2373
+ const err15 = createError(instancePath + "/issuer/name", "#/properties/issuer/anyOf/1/properties/name/anyOf/0/type", "type", { type: "string" }, 5);
2374
+ vErrors = pushError(vErrors, err15);
2375
+ errors++;
2376
+ }
2377
+ var _valid5 = _errs39 === errors;
2378
+ valid15 = valid15 || _valid5;
2379
+ const _errs41 = errors;
2380
+ if (Array.isArray(data11)) {
2381
+ const len4 = data11.length;
2382
+ for (let i4 = 0; i4 < len4; i4++) {
2383
+ if (!(validate73(data11[i4], { instancePath: instancePath + "/issuer/name/" + i4, parentData: data11, parentDataProperty: i4, rootData, dynamicAnchors }))) {
2384
+ vErrors = vErrors === null ? validate73.errors : vErrors.concat(validate73.errors);
2385
+ errors = vErrors.length;
2386
+ }
2387
+ }
2388
+ }
2389
+ else {
2390
+ const err16 = createError(instancePath + "/issuer/name", "#/properties/issuer/anyOf/1/properties/name/anyOf/1/type", "type", { type: "array" }, 4);
2391
+ vErrors = pushError(vErrors, err16);
2392
+ errors++;
2393
+ }
2394
+ var _valid5 = _errs41 === errors;
2395
+ valid15 = valid15 || _valid5;
2396
+ if (!valid15) {
2397
+ const err17 = createError(instancePath + "/issuer/name", "#/properties/issuer/anyOf/1/properties/name/anyOf", "anyOf", {}, 1);
2398
+ vErrors = pushError(vErrors, err17);
2399
+ errors++;
2400
+ }
2401
+ else {
2402
+ errors = _errs38;
2403
+ if (vErrors !== null) {
2404
+ if (_errs38) {
2405
+ vErrors.length = _errs38;
2406
+ }
2407
+ else {
2408
+ vErrors = null;
2409
+ }
2410
+ }
2411
+ }
2412
+ }
2413
+ if (data9.description !== undefined) {
2414
+ let data13 = data9.description;
2415
+ const _errs45 = errors;
2416
+ let valid18 = false;
2417
+ const _errs46 = errors;
2418
+ if (typeof data13 !== "string") {
2419
+ const err18 = createError(instancePath + "/issuer/description", "#/properties/issuer/anyOf/1/properties/description/anyOf/0/type", "type", { type: "string" }, 5);
2420
+ vErrors = pushError(vErrors, err18);
2421
+ errors++;
2422
+ }
2423
+ var _valid6 = _errs46 === errors;
2424
+ valid18 = valid18 || _valid6;
2425
+ const _errs48 = errors;
2426
+ if (Array.isArray(data13)) {
2427
+ const len5 = data13.length;
2428
+ for (let i5 = 0; i5 < len5; i5++) {
2429
+ if (!(validate73(data13[i5], { instancePath: instancePath + "/issuer/description/" + i5, parentData: data13, parentDataProperty: i5, rootData, dynamicAnchors }))) {
2430
+ vErrors = vErrors === null ? validate73.errors : vErrors.concat(validate73.errors);
2431
+ errors = vErrors.length;
2432
+ }
2433
+ }
2434
+ }
2435
+ else {
2436
+ const err19 = createError(instancePath + "/issuer/description", "#/properties/issuer/anyOf/1/properties/description/anyOf/1/type", "type", { type: "array" }, 4);
2437
+ vErrors = pushError(vErrors, err19);
2438
+ errors++;
2439
+ }
2440
+ var _valid6 = _errs48 === errors;
2441
+ valid18 = valid18 || _valid6;
2442
+ if (!valid18) {
2443
+ const err20 = createError(instancePath + "/issuer/description", "#/properties/issuer/anyOf/1/properties/description/anyOf", "anyOf", {}, 1);
2444
+ vErrors = pushError(vErrors, err20);
2445
+ errors++;
2446
+ }
2447
+ else {
2448
+ errors = _errs45;
2449
+ if (vErrors !== null) {
2450
+ if (_errs45) {
2451
+ vErrors.length = _errs45;
2452
+ }
2453
+ else {
2454
+ vErrors = null;
2455
+ }
2456
+ }
2457
+ }
2458
+ }
2459
+ }
2460
+ else {
2461
+ const err21 = createError(instancePath + "/issuer", "#/properties/issuer/anyOf/1/type", "type", { type: "object" }, 6);
2462
+ vErrors = pushError(vErrors, err21);
2463
+ errors++;
2464
+ }
2465
+ var _valid4 = _errs33 === errors;
2466
+ valid13 = valid13 || _valid4;
2467
+ if (_valid4) {
2468
+ var props3 = {};
2469
+ props3.id = true;
2470
+ props3.name = true;
2471
+ props3.description = true;
2472
+ }
2473
+ if (!valid13) {
2474
+ const err22 = createError(instancePath + "/issuer", "#/properties/issuer/anyOf", "anyOf", {}, 1);
2475
+ vErrors = pushError(vErrors, err22);
2476
+ errors++;
2477
+ }
2478
+ else {
2479
+ errors = _errs30;
2480
+ if (vErrors !== null) {
2481
+ if (_errs30) {
2482
+ vErrors.length = _errs30;
2483
+ }
2484
+ else {
2485
+ vErrors = null;
2486
+ }
2487
+ }
2488
+ }
2489
+ }
2490
+ if (data.name !== undefined) {
2491
+ let data15 = data.name;
2492
+ const _errs52 = errors;
2493
+ let valid21 = false;
2494
+ const _errs53 = errors;
2495
+ if (typeof data15 !== "string") {
2496
+ const err23 = createError(instancePath + "/name", "#/properties/name/anyOf/0/type", "type", { type: "string" }, 5);
2497
+ vErrors = pushError(vErrors, err23);
2498
+ errors++;
2499
+ }
2500
+ var _valid7 = _errs53 === errors;
2501
+ valid21 = valid21 || _valid7;
2502
+ const _errs55 = errors;
2503
+ if (Array.isArray(data15)) {
2504
+ const len6 = data15.length;
2505
+ for (let i6 = 0; i6 < len6; i6++) {
2506
+ if (!(validate73(data15[i6], { instancePath: instancePath + "/name/" + i6, parentData: data15, parentDataProperty: i6, rootData, dynamicAnchors }))) {
2507
+ vErrors = vErrors === null ? validate73.errors : vErrors.concat(validate73.errors);
2508
+ errors = vErrors.length;
2509
+ }
2510
+ }
2511
+ }
2512
+ else {
2513
+ const err24 = createError(instancePath + "/name", "#/properties/name/anyOf/1/type", "type", { type: "array" }, 4);
2514
+ vErrors = pushError(vErrors, err24);
2515
+ errors++;
2516
+ }
2517
+ var _valid7 = _errs55 === errors;
2518
+ valid21 = valid21 || _valid7;
2519
+ if (!valid21) {
2520
+ const err25 = createError(instancePath + "/name", "#/properties/name/anyOf", "anyOf", {}, 1);
2521
+ vErrors = pushError(vErrors, err25);
2522
+ errors++;
2523
+ }
2524
+ else {
2525
+ errors = _errs52;
2526
+ if (vErrors !== null) {
2527
+ if (_errs52) {
2528
+ vErrors.length = _errs52;
2529
+ }
2530
+ else {
2531
+ vErrors = null;
2532
+ }
2533
+ }
2534
+ }
2535
+ }
2536
+ if (data.description !== undefined) {
2537
+ let data17 = data.description;
2538
+ const _errs59 = errors;
2539
+ let valid24 = false;
2540
+ const _errs60 = errors;
2541
+ if (typeof data17 !== "string") {
2542
+ const err26 = createError(instancePath + "/description", "#/properties/description/anyOf/0/type", "type", { type: "string" }, 5);
2543
+ vErrors = pushError(vErrors, err26);
2544
+ errors++;
2545
+ }
2546
+ var _valid8 = _errs60 === errors;
2547
+ valid24 = valid24 || _valid8;
2548
+ const _errs62 = errors;
2549
+ if (Array.isArray(data17)) {
2550
+ const len7 = data17.length;
2551
+ for (let i7 = 0; i7 < len7; i7++) {
2552
+ if (!(validate73(data17[i7], { instancePath: instancePath + "/description/" + i7, parentData: data17, parentDataProperty: i7, rootData, dynamicAnchors }))) {
2553
+ vErrors = vErrors === null ? validate73.errors : vErrors.concat(validate73.errors);
2554
+ errors = vErrors.length;
2555
+ }
2556
+ }
2557
+ }
2558
+ else {
2559
+ const err27 = createError(instancePath + "/description", "#/properties/description/anyOf/1/type", "type", { type: "array" }, 4);
2560
+ vErrors = pushError(vErrors, err27);
2561
+ errors++;
2562
+ }
2563
+ var _valid8 = _errs62 === errors;
2564
+ valid24 = valid24 || _valid8;
2565
+ if (!valid24) {
2566
+ const err28 = createError(instancePath + "/description", "#/properties/description/anyOf", "anyOf", {}, 1);
2567
+ vErrors = pushError(vErrors, err28);
2568
+ errors++;
2569
+ }
2570
+ else {
2571
+ errors = _errs59;
2572
+ if (vErrors !== null) {
2573
+ if (_errs59) {
2574
+ vErrors.length = _errs59;
2575
+ }
2576
+ else {
2577
+ vErrors = null;
2578
+ }
2579
+ }
2580
+ }
2581
+ }
2582
+ if (data.evidence !== undefined) {
2583
+ let data19 = data.evidence;
2584
+ const _errs66 = errors;
2585
+ let valid27 = false;
2586
+ const _errs67 = errors;
2587
+ if (!(keyword5(data19, { instancePath: instancePath + "/evidence", parentData: data, parentDataProperty: "evidence", rootData, dynamicAnchors }))) {
2588
+ vErrors = vErrors === null ? keyword5.errors : vErrors.concat(keyword5.errors);
2589
+ errors = vErrors.length;
2590
+ }
2591
+ var _valid9 = _errs67 === errors;
2592
+ valid27 = valid27 || _valid9;
2593
+ const _errs68 = errors;
2594
+ if (Array.isArray(data19)) {
2595
+ const len8 = data19.length;
2596
+ for (let i8 = 0; i8 < len8; i8++) {
2597
+ if (!(keyword5(data19[i8], { instancePath: instancePath + "/evidence/" + i8, parentData: data19, parentDataProperty: i8, rootData, dynamicAnchors }))) {
2598
+ vErrors = vErrors === null ? keyword5.errors : vErrors.concat(keyword5.errors);
2599
+ errors = vErrors.length;
2600
+ }
2601
+ }
2602
+ }
2603
+ else {
2604
+ const err29 = createError(instancePath + "/evidence", "#/properties/evidence/anyOf/1/type", "type", { type: "array" }, 4);
2605
+ vErrors = pushError(vErrors, err29);
2606
+ errors++;
2607
+ }
2608
+ var _valid9 = _errs68 === errors;
2609
+ valid27 = valid27 || _valid9;
2610
+ if (!valid27) {
2611
+ const err30 = createError(instancePath + "/evidence", "#/properties/evidence/anyOf", "anyOf", {}, 1);
2612
+ vErrors = pushError(vErrors, err30);
2613
+ errors++;
2614
+ }
2615
+ else {
2616
+ errors = _errs66;
2617
+ if (vErrors !== null) {
2618
+ if (_errs66) {
2619
+ vErrors.length = _errs66;
2620
+ }
2621
+ else {
2622
+ vErrors = null;
2623
+ }
2624
+ }
2625
+ }
2626
+ }
2627
+ if (data.proof !== undefined) {
2628
+ let data21 = data.proof;
2629
+ const _errs72 = errors;
2630
+ let valid30 = false;
2631
+ const _errs73 = errors;
2632
+ if (!(validate87(data21, { instancePath: instancePath + "/proof", parentData: data, parentDataProperty: "proof", rootData, dynamicAnchors }))) {
2633
+ vErrors = vErrors === null ? validate87.errors : vErrors.concat(validate87.errors);
2634
+ errors = vErrors.length;
2635
+ }
2636
+ var _valid10 = _errs73 === errors;
2637
+ valid30 = valid30 || _valid10;
2638
+ const _errs74 = errors;
2639
+ if (Array.isArray(data21)) {
2640
+ const len9 = data21.length;
2641
+ for (let i9 = 0; i9 < len9; i9++) {
2642
+ if (!(validate87(data21[i9], { instancePath: instancePath + "/proof/" + i9, parentData: data21, parentDataProperty: i9, rootData, dynamicAnchors }))) {
2643
+ vErrors = vErrors === null ? validate87.errors : vErrors.concat(validate87.errors);
2644
+ errors = vErrors.length;
2645
+ }
2646
+ }
2647
+ }
2648
+ else {
2649
+ const err31 = createError(instancePath + "/proof", "#/properties/proof/anyOf/1/type", "type", { type: "array" }, 4);
2650
+ vErrors = pushError(vErrors, err31);
2651
+ errors++;
2652
+ }
2653
+ var _valid10 = _errs74 === errors;
2654
+ valid30 = valid30 || _valid10;
2655
+ if (!valid30) {
2656
+ const err32 = createError(instancePath + "/proof", "#/properties/proof/anyOf", "anyOf", {}, 1);
2657
+ vErrors = pushError(vErrors, err32);
2658
+ errors++;
2659
+ }
2660
+ else {
2661
+ errors = _errs72;
2662
+ if (vErrors !== null) {
2663
+ if (_errs72) {
2664
+ vErrors.length = _errs72;
2665
+ }
2666
+ else {
2667
+ vErrors = null;
2668
+ }
2669
+ }
2670
+ }
2671
+ }
2672
+ }
2673
+ else {
2674
+ const err33 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
2675
+ vErrors = pushError(vErrors, err33);
2676
+ errors++;
2677
+ }
2678
+ validate78.errors = vErrors;
2679
+ return errors === 0;
2680
+ }
2681
+ validate78.evaluated = { "props": { "id": true, "type": true, "credentialSubject": true, "credentialStatus": true, "credentialSchema": true, "issuer": true, "name": true, "description": true, "evidence": true, "proof": true }, "dynamicProps": false, "dynamicItems": false };
2682
+ function validate77(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
2683
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidVerifiableCredentialV1" */ ;
2684
+ let vErrors = null;
2685
+ let errors = 0;
2686
+ const evaluated0 = validate77.evaluated;
2687
+ if (evaluated0.dynamicProps) {
2688
+ evaluated0.props = undefined;
2689
+ }
2690
+ if (evaluated0.dynamicItems) {
2691
+ evaluated0.items = undefined;
2692
+ }
2693
+ if (!(validate78(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
2694
+ vErrors = vErrors === null ? validate78.errors : vErrors.concat(validate78.errors);
2695
+ errors = vErrors.length;
2696
+ }
2697
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2698
+ if (data["@context"] === undefined) {
2699
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "@context" }, "must have required property '" + "@context" + "'");
2700
+ vErrors = pushError(vErrors, err0);
2701
+ errors++;
2702
+ }
2703
+ if (data["@context"] !== undefined) {
2704
+ let data0 = data["@context"];
2705
+ const _errs3 = errors;
2706
+ let valid2 = false;
2707
+ const _errs4 = errors;
2708
+ if ("https://www.w3.org/2018/credentials/v1" !== data0) {
2709
+ const err1 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/0/const", "const", { allowedValue: "https://www.w3.org/2018/credentials/v1" }, 0);
2710
+ vErrors = pushError(vErrors, err1);
2711
+ errors++;
2712
+ }
2713
+ var _valid0 = _errs4 === errors;
2714
+ valid2 = valid2 || _valid0;
2715
+ const _errs5 = errors;
2716
+ if (Array.isArray(data0)) {
2717
+ if (data0.length < 1) {
2718
+ const err2 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/minItems", "minItems", { limit: 1 }, 2);
2719
+ vErrors = pushError(vErrors, err2);
2720
+ errors++;
2721
+ }
2722
+ const len0 = data0.length;
2723
+ for (let i0 = 0; i0 < len0; i0++) {
2724
+ let data1 = data0[i0];
2725
+ const _errs8 = errors;
2726
+ let valid5 = false;
2727
+ const _errs9 = errors;
2728
+ if (!(keyword2(data1, { instancePath: instancePath + "/@context/" + i0, parentData: data0, parentDataProperty: i0, rootData, dynamicAnchors }))) {
2729
+ vErrors = vErrors === null ? keyword2.errors : vErrors.concat(keyword2.errors);
2730
+ errors = vErrors.length;
2731
+ }
2732
+ var _valid1 = _errs9 === errors;
2733
+ valid5 = valid5 || _valid1;
2734
+ const _errs10 = errors;
2735
+ if ("https://www.w3.org/2018/credentials/v1" !== data1) {
2736
+ const err3 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf/1/const", "const", { allowedValue: "https://www.w3.org/2018/credentials/v1" }, 0);
2737
+ vErrors = pushError(vErrors, err3);
2738
+ errors++;
2739
+ }
2740
+ var _valid1 = _errs10 === errors;
2741
+ valid5 = valid5 || _valid1;
2742
+ if (!valid5) {
2743
+ const err4 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf", "anyOf", {}, 1);
2744
+ vErrors = pushError(vErrors, err4);
2745
+ errors++;
2746
+ }
2747
+ else {
2748
+ errors = _errs8;
2749
+ if (vErrors !== null) {
2750
+ if (_errs8) {
2751
+ vErrors.length = _errs8;
2752
+ }
2753
+ else {
2754
+ vErrors = null;
2755
+ }
2756
+ }
2757
+ }
2758
+ }
2759
+ const _errs11 = errors;
2760
+ const len1 = data0.length;
2761
+ let valid6 = false;
2762
+ let count0 = 0;
2763
+ for (let i1 = 0; i1 < len1; i1++) {
2764
+ const _errs12 = errors;
2765
+ if ("https://www.w3.org/2018/credentials/v1" !== data0[i1]) {
2766
+ const err5 = createError(instancePath + "/@context/" + i1, "#/properties/%40context/anyOf/1/contains/const", "const", { allowedValue: "https://www.w3.org/2018/credentials/v1" }, 0);
2767
+ vErrors = pushError(vErrors, err5);
2768
+ errors++;
2769
+ }
2770
+ var _valid2 = _errs12 === errors;
2771
+ if (_valid2) {
2772
+ count0++;
2773
+ if (count0 > 1) {
2774
+ valid6 = false;
2775
+ break;
2776
+ }
2777
+ valid6 = true;
2778
+ }
2779
+ }
2780
+ if (!valid6) {
2781
+ const err6 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/contains", "contains", { minContains: 1, maxContains: 1 }, 3);
2782
+ vErrors = pushError(vErrors, err6);
2783
+ errors++;
2784
+ }
2785
+ else {
2786
+ errors = _errs11;
2787
+ if (vErrors !== null) {
2788
+ if (_errs11) {
2789
+ vErrors.length = _errs11;
2790
+ }
2791
+ else {
2792
+ vErrors = null;
2793
+ }
2794
+ }
2795
+ }
2796
+ }
2797
+ else {
2798
+ const err7 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/type", "type", { type: "array" }, 4);
2799
+ vErrors = pushError(vErrors, err7);
2800
+ errors++;
2801
+ }
2802
+ var _valid0 = _errs5 === errors;
2803
+ valid2 = valid2 || _valid0;
2804
+ if (!valid2) {
2805
+ const err8 = createError(instancePath + "/@context", "#/properties/%40context/anyOf", "anyOf", {}, 1);
2806
+ vErrors = pushError(vErrors, err8);
2807
+ errors++;
2808
+ }
2809
+ else {
2810
+ errors = _errs3;
2811
+ if (vErrors !== null) {
2812
+ if (_errs3) {
2813
+ vErrors.length = _errs3;
2814
+ }
2815
+ else {
2816
+ vErrors = null;
2817
+ }
2818
+ }
2819
+ }
2820
+ }
2821
+ if (data.issuanceDate !== undefined) {
2822
+ if (typeof data.issuanceDate !== "string") {
2823
+ const err9 = createError(instancePath + "/issuanceDate", "#/properties/issuanceDate/type", "type", { type: "string" }, 5);
2824
+ vErrors = pushError(vErrors, err9);
2825
+ errors++;
2826
+ }
2827
+ }
2828
+ if (data.expirationDate !== undefined) {
2829
+ if (typeof data.expirationDate !== "string") {
2830
+ const err10 = createError(instancePath + "/expirationDate", "#/properties/expirationDate/type", "type", { type: "string" }, 5);
2831
+ vErrors = pushError(vErrors, err10);
2832
+ errors++;
2833
+ }
2834
+ }
2835
+ }
2836
+ else {
2837
+ const err11 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
2838
+ vErrors = pushError(vErrors, err11);
2839
+ errors++;
2840
+ }
2841
+ validate77.errors = vErrors;
2842
+ return errors === 0;
2843
+ }
2844
+ validate77.evaluated = { "props": { "@context": true, "issuanceDate": true, "expirationDate": true, "id": true, "type": true, "credentialSubject": true, "credentialStatus": true, "credentialSchema": true, "issuer": true, "name": true, "description": true, "evidence": true, "proof": true }, "dynamicProps": false, "dynamicItems": false };
2845
+ function validate95(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
2846
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidVerifiableCredentialV2" */ ;
2847
+ let vErrors = null;
2848
+ let errors = 0;
2849
+ const evaluated0 = validate95.evaluated;
2850
+ if (evaluated0.dynamicProps) {
2851
+ evaluated0.props = undefined;
2852
+ }
2853
+ if (evaluated0.dynamicItems) {
2854
+ evaluated0.items = undefined;
2855
+ }
2856
+ if (!(validate78(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
2857
+ vErrors = vErrors === null ? validate78.errors : vErrors.concat(validate78.errors);
2858
+ errors = vErrors.length;
2859
+ }
2860
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2861
+ if (data["@context"] === undefined) {
2862
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "@context" }, "must have required property '" + "@context" + "'");
2863
+ vErrors = pushError(vErrors, err0);
2864
+ errors++;
2865
+ }
2866
+ if (data["@context"] !== undefined) {
2867
+ let data0 = data["@context"];
2868
+ const _errs3 = errors;
2869
+ let valid2 = false;
2870
+ const _errs4 = errors;
2871
+ if ("https://www.w3.org/ns/credentials/v2" !== data0) {
2872
+ const err1 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/0/const", "const", { allowedValue: "https://www.w3.org/ns/credentials/v2" }, 0);
2873
+ vErrors = pushError(vErrors, err1);
2874
+ errors++;
2875
+ }
2876
+ var _valid0 = _errs4 === errors;
2877
+ valid2 = valid2 || _valid0;
2878
+ const _errs5 = errors;
2879
+ if (Array.isArray(data0)) {
2880
+ if (data0.length < 1) {
2881
+ const err2 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/minItems", "minItems", { limit: 1 }, 2);
2882
+ vErrors = pushError(vErrors, err2);
2883
+ errors++;
2884
+ }
2885
+ const len0 = data0.length;
2886
+ for (let i0 = 0; i0 < len0; i0++) {
2887
+ let data1 = data0[i0];
2888
+ const _errs8 = errors;
2889
+ let valid5 = false;
2890
+ const _errs9 = errors;
2891
+ if (!(keyword2(data1, { instancePath: instancePath + "/@context/" + i0, parentData: data0, parentDataProperty: i0, rootData, dynamicAnchors }))) {
2892
+ vErrors = vErrors === null ? keyword2.errors : vErrors.concat(keyword2.errors);
2893
+ errors = vErrors.length;
2894
+ }
2895
+ var _valid1 = _errs9 === errors;
2896
+ valid5 = valid5 || _valid1;
2897
+ const _errs10 = errors;
2898
+ if ("https://www.w3.org/ns/credentials/v2" !== data1) {
2899
+ const err3 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf/1/const", "const", { allowedValue: "https://www.w3.org/ns/credentials/v2" }, 0);
2900
+ vErrors = pushError(vErrors, err3);
2901
+ errors++;
2902
+ }
2903
+ var _valid1 = _errs10 === errors;
2904
+ valid5 = valid5 || _valid1;
2905
+ if (!valid5) {
2906
+ const err4 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf", "anyOf", {}, 1);
2907
+ vErrors = pushError(vErrors, err4);
2908
+ errors++;
2909
+ }
2910
+ else {
2911
+ errors = _errs8;
2912
+ if (vErrors !== null) {
2913
+ if (_errs8) {
2914
+ vErrors.length = _errs8;
2915
+ }
2916
+ else {
2917
+ vErrors = null;
2918
+ }
2919
+ }
2920
+ }
2921
+ }
2922
+ const _errs11 = errors;
2923
+ const len1 = data0.length;
2924
+ let valid6 = false;
2925
+ let count0 = 0;
2926
+ for (let i1 = 0; i1 < len1; i1++) {
2927
+ const _errs12 = errors;
2928
+ if ("https://www.w3.org/ns/credentials/v2" !== data0[i1]) {
2929
+ const err5 = createError(instancePath + "/@context/" + i1, "#/properties/%40context/anyOf/1/contains/const", "const", { allowedValue: "https://www.w3.org/ns/credentials/v2" }, 0);
2930
+ vErrors = pushError(vErrors, err5);
2931
+ errors++;
2932
+ }
2933
+ var _valid2 = _errs12 === errors;
2934
+ if (_valid2) {
2935
+ count0++;
2936
+ if (count0 > 1) {
2937
+ valid6 = false;
2938
+ break;
2939
+ }
2940
+ valid6 = true;
2941
+ }
2942
+ }
2943
+ if (!valid6) {
2944
+ const err6 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/contains", "contains", { minContains: 1, maxContains: 1 }, 3);
2945
+ vErrors = pushError(vErrors, err6);
2946
+ errors++;
2947
+ }
2948
+ else {
2949
+ errors = _errs11;
2950
+ if (vErrors !== null) {
2951
+ if (_errs11) {
2952
+ vErrors.length = _errs11;
2953
+ }
2954
+ else {
2955
+ vErrors = null;
2956
+ }
2957
+ }
2958
+ }
2959
+ }
2960
+ else {
2961
+ const err7 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/type", "type", { type: "array" }, 4);
2962
+ vErrors = pushError(vErrors, err7);
2963
+ errors++;
2964
+ }
2965
+ var _valid0 = _errs5 === errors;
2966
+ valid2 = valid2 || _valid0;
2967
+ if (!valid2) {
2968
+ const err8 = createError(instancePath + "/@context", "#/properties/%40context/anyOf", "anyOf", {}, 1);
2969
+ vErrors = pushError(vErrors, err8);
2970
+ errors++;
2971
+ }
2972
+ else {
2973
+ errors = _errs3;
2974
+ if (vErrors !== null) {
2975
+ if (_errs3) {
2976
+ vErrors.length = _errs3;
2977
+ }
2978
+ else {
2979
+ vErrors = null;
2980
+ }
2981
+ }
2982
+ }
2983
+ }
2984
+ if (data.validFrom !== undefined) {
2985
+ if (typeof data.validFrom !== "string") {
2986
+ const err9 = createError(instancePath + "/validFrom", "#/properties/validFrom/type", "type", { type: "string" }, 5);
2987
+ vErrors = pushError(vErrors, err9);
2988
+ errors++;
2989
+ }
2990
+ }
2991
+ if (data.validUntil !== undefined) {
2992
+ if (typeof data.validUntil !== "string") {
2993
+ const err10 = createError(instancePath + "/validUntil", "#/properties/validUntil/type", "type", { type: "string" }, 5);
2994
+ vErrors = pushError(vErrors, err10);
2995
+ errors++;
2996
+ }
2997
+ }
2998
+ }
2999
+ else {
3000
+ const err11 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
3001
+ vErrors = pushError(vErrors, err11);
3002
+ errors++;
3003
+ }
3004
+ validate95.errors = vErrors;
3005
+ return errors === 0;
3006
+ }
3007
+ validate95.evaluated = { "props": { "@context": true, "validFrom": true, "validUntil": true, "id": true, "type": true, "credentialSubject": true, "credentialStatus": true, "credentialSchema": true, "issuer": true, "name": true, "description": true, "evidence": true, "proof": true }, "dynamicProps": false, "dynamicItems": false };
3008
+ function validate76(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
3009
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidVerifiableCredential" */ ;
3010
+ let vErrors = null;
3011
+ let errors = 0;
3012
+ const evaluated0 = validate76.evaluated;
3013
+ if (evaluated0.dynamicProps) {
3014
+ evaluated0.props = undefined;
3015
+ }
3016
+ if (evaluated0.dynamicItems) {
3017
+ evaluated0.items = undefined;
3018
+ }
3019
+ const _errs0 = errors;
3020
+ let valid0 = false;
3021
+ const _errs1 = errors;
3022
+ if (!(validate77(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
3023
+ vErrors = vErrors === null ? validate77.errors : vErrors.concat(validate77.errors);
3024
+ errors = vErrors.length;
3025
+ }
3026
+ var _valid0 = _errs1 === errors;
3027
+ valid0 = valid0 || _valid0;
3028
+ if (_valid0) {
3029
+ var props0 = {};
3030
+ props0["@context"] = true;
3031
+ props0.issuanceDate = true;
3032
+ props0.expirationDate = true;
3033
+ props0.id = true;
3034
+ props0.type = true;
3035
+ props0.credentialSubject = true;
3036
+ props0.credentialStatus = true;
3037
+ props0.credentialSchema = true;
3038
+ props0.issuer = true;
3039
+ props0.name = true;
3040
+ props0.description = true;
3041
+ props0.evidence = true;
3042
+ props0.proof = true;
3043
+ }
3044
+ const _errs2 = errors;
3045
+ if (!(validate95(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
3046
+ vErrors = vErrors === null ? validate95.errors : vErrors.concat(validate95.errors);
3047
+ errors = vErrors.length;
3048
+ }
3049
+ var _valid0 = _errs2 === errors;
3050
+ valid0 = valid0 || _valid0;
3051
+ if (_valid0) {
3052
+ if (props0 !== true) {
3053
+ props0 = props0 || {};
3054
+ props0["@context"] = true;
3055
+ props0.validFrom = true;
3056
+ props0.validUntil = true;
3057
+ props0.id = true;
3058
+ props0.type = true;
3059
+ props0.credentialSubject = true;
3060
+ props0.credentialStatus = true;
3061
+ props0.credentialSchema = true;
3062
+ props0.issuer = true;
3063
+ props0.name = true;
3064
+ props0.description = true;
3065
+ props0.evidence = true;
3066
+ props0.proof = true;
3067
+ }
3068
+ }
3069
+ if (!valid0) {
3070
+ const err0 = createError(instancePath, "#/anyOf", "anyOf", {}, 1);
3071
+ vErrors = pushError(vErrors, err0);
3072
+ errors++;
3073
+ }
3074
+ else {
3075
+ errors = _errs0;
3076
+ if (vErrors !== null) {
3077
+ if (_errs0) {
3078
+ vErrors.length = _errs0;
3079
+ }
3080
+ else {
3081
+ vErrors = null;
3082
+ }
3083
+ }
3084
+ }
3085
+ validate76.errors = vErrors;
3086
+ evaluated0.props = props0;
3087
+ return errors === 0;
3088
+ }
3089
+ validate76.evaluated = { "dynamicProps": true, "dynamicItems": false };
3090
+ /**
3091
+ * Compiled validator for the DidVerifiableCredentialCommon schema.
3092
+ */
3093
+ export const CompiledDidVerifiableCredentialCommon = validate78;
3094
+ /**
3095
+ * Compiled validator for the DidVerifiableCredentialV1 schema.
3096
+ */
3097
+ export const CompiledDidVerifiableCredentialV1 = validate77;
3098
+ /**
3099
+ * Compiled validator for the DidVerifiableCredentialV2 schema.
3100
+ */
3101
+ export const CompiledDidVerifiableCredentialV2 = validate95;
3102
+ /**
3103
+ * Compiled validator for the DidVerifiablePresentation schema.
3104
+ */
3105
+ export const CompiledDidVerifiablePresentation = validate98;
3106
+ function validate100(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
3107
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidVerifiablePresentationCommon" */ ;
3108
+ let vErrors = null;
3109
+ let errors = 0;
3110
+ const evaluated0 = validate100.evaluated;
3111
+ if (evaluated0.dynamicProps) {
3112
+ evaluated0.props = undefined;
3113
+ }
3114
+ if (evaluated0.dynamicItems) {
3115
+ evaluated0.items = undefined;
3116
+ }
3117
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3118
+ if (data.type === undefined) {
3119
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "type" }, "must have required property '" + "type" + "'");
3120
+ vErrors = pushError(vErrors, err0);
3121
+ errors++;
3122
+ }
3123
+ if (data.id !== undefined) {
3124
+ if (typeof data.id !== "string") {
3125
+ const err1 = createError(instancePath + "/id", "#/properties/id/type", "type", { type: "string" }, 5);
3126
+ vErrors = pushError(vErrors, err1);
3127
+ errors++;
3128
+ }
3129
+ }
3130
+ if (data.type !== undefined) {
3131
+ let data1 = data.type;
3132
+ const _errs4 = errors;
3133
+ let valid1 = false;
3134
+ const _errs5 = errors;
3135
+ if (typeof data1 !== "string") {
3136
+ const err2 = createError(instancePath + "/type", "#/properties/type/anyOf/0/type", "type", { type: "string" }, 5);
3137
+ vErrors = pushError(vErrors, err2);
3138
+ errors++;
3139
+ }
3140
+ var _valid0 = _errs5 === errors;
3141
+ valid1 = valid1 || _valid0;
3142
+ const _errs7 = errors;
3143
+ if (Array.isArray(data1)) {
3144
+ const len0 = data1.length;
3145
+ for (let i0 = 0; i0 < len0; i0++) {
3146
+ if (typeof data1[i0] !== "string") {
3147
+ const err3 = createError(instancePath + "/type/" + i0, "#/properties/type/anyOf/1/items/type", "type", { type: "string" }, 5);
3148
+ vErrors = pushError(vErrors, err3);
3149
+ errors++;
3150
+ }
3151
+ }
3152
+ }
3153
+ else {
3154
+ const err4 = createError(instancePath + "/type", "#/properties/type/anyOf/1/type", "type", { type: "array" }, 4);
3155
+ vErrors = pushError(vErrors, err4);
3156
+ errors++;
3157
+ }
3158
+ var _valid0 = _errs7 === errors;
3159
+ valid1 = valid1 || _valid0;
3160
+ if (!valid1) {
3161
+ const err5 = createError(instancePath + "/type", "#/properties/type/anyOf", "anyOf", {}, 1);
3162
+ vErrors = pushError(vErrors, err5);
3163
+ errors++;
3164
+ }
3165
+ else {
3166
+ errors = _errs4;
3167
+ if (vErrors !== null) {
3168
+ if (_errs4) {
3169
+ vErrors.length = _errs4;
3170
+ }
3171
+ else {
3172
+ vErrors = null;
3173
+ }
3174
+ }
3175
+ }
3176
+ }
3177
+ if (data.holder !== undefined) {
3178
+ if (typeof data.holder !== "string") {
3179
+ const err6 = createError(instancePath + "/holder", "#/properties/holder/type", "type", { type: "string" }, 5);
3180
+ vErrors = pushError(vErrors, err6);
3181
+ errors++;
3182
+ }
3183
+ }
3184
+ if (data.proof !== undefined) {
3185
+ let data4 = data.proof;
3186
+ const _errs14 = errors;
3187
+ let valid4 = false;
3188
+ const _errs15 = errors;
3189
+ if (!(validate87(data4, { instancePath: instancePath + "/proof", parentData: data, parentDataProperty: "proof", rootData, dynamicAnchors }))) {
3190
+ vErrors = vErrors === null ? validate87.errors : vErrors.concat(validate87.errors);
3191
+ errors = vErrors.length;
3192
+ }
3193
+ var _valid1 = _errs15 === errors;
3194
+ valid4 = valid4 || _valid1;
3195
+ const _errs16 = errors;
3196
+ if (Array.isArray(data4)) {
3197
+ const len1 = data4.length;
3198
+ for (let i1 = 0; i1 < len1; i1++) {
3199
+ if (!(validate87(data4[i1], { instancePath: instancePath + "/proof/" + i1, parentData: data4, parentDataProperty: i1, rootData, dynamicAnchors }))) {
3200
+ vErrors = vErrors === null ? validate87.errors : vErrors.concat(validate87.errors);
3201
+ errors = vErrors.length;
3202
+ }
3203
+ }
3204
+ }
3205
+ else {
3206
+ const err7 = createError(instancePath + "/proof", "#/properties/proof/anyOf/1/type", "type", { type: "array" }, 4);
3207
+ vErrors = pushError(vErrors, err7);
3208
+ errors++;
3209
+ }
3210
+ var _valid1 = _errs16 === errors;
3211
+ valid4 = valid4 || _valid1;
3212
+ if (!valid4) {
3213
+ const err8 = createError(instancePath + "/proof", "#/properties/proof/anyOf", "anyOf", {}, 1);
3214
+ vErrors = pushError(vErrors, err8);
3215
+ errors++;
3216
+ }
3217
+ else {
3218
+ errors = _errs14;
3219
+ if (vErrors !== null) {
3220
+ if (_errs14) {
3221
+ vErrors.length = _errs14;
3222
+ }
3223
+ else {
3224
+ vErrors = null;
3225
+ }
3226
+ }
3227
+ }
3228
+ }
3229
+ }
3230
+ else {
3231
+ const err9 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
3232
+ vErrors = pushError(vErrors, err9);
3233
+ errors++;
3234
+ }
3235
+ validate100.errors = vErrors;
3236
+ return errors === 0;
3237
+ }
3238
+ validate100.evaluated = { "props": { "id": true, "type": true, "holder": true, "proof": true }, "dynamicProps": false, "dynamicItems": false };
3239
+ function validate99(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
3240
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidVerifiablePresentationV1" */ ;
3241
+ let vErrors = null;
3242
+ let errors = 0;
3243
+ const evaluated0 = validate99.evaluated;
3244
+ if (evaluated0.dynamicProps) {
3245
+ evaluated0.props = undefined;
3246
+ }
3247
+ if (evaluated0.dynamicItems) {
3248
+ evaluated0.items = undefined;
3249
+ }
3250
+ if (!(validate100(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
3251
+ vErrors = vErrors === null ? validate100.errors : vErrors.concat(validate100.errors);
3252
+ errors = vErrors.length;
3253
+ }
3254
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3255
+ if (data["@context"] === undefined) {
3256
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "@context" }, "must have required property '" + "@context" + "'");
3257
+ vErrors = pushError(vErrors, err0);
3258
+ errors++;
3259
+ }
3260
+ if (data["@context"] !== undefined) {
3261
+ let data0 = data["@context"];
3262
+ const _errs3 = errors;
3263
+ let valid2 = false;
3264
+ const _errs4 = errors;
3265
+ if ("https://www.w3.org/2018/credentials/v1" !== data0) {
3266
+ const err1 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/0/const", "const", { allowedValue: "https://www.w3.org/2018/credentials/v1" }, 0);
3267
+ vErrors = pushError(vErrors, err1);
3268
+ errors++;
3269
+ }
3270
+ var _valid0 = _errs4 === errors;
3271
+ valid2 = valid2 || _valid0;
3272
+ const _errs5 = errors;
3273
+ if (Array.isArray(data0)) {
3274
+ if (data0.length < 1) {
3275
+ const err2 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/minItems", "minItems", { limit: 1 }, 2);
3276
+ vErrors = pushError(vErrors, err2);
3277
+ errors++;
3278
+ }
3279
+ const len0 = data0.length;
3280
+ for (let i0 = 0; i0 < len0; i0++) {
3281
+ let data1 = data0[i0];
3282
+ const _errs8 = errors;
3283
+ let valid5 = false;
3284
+ const _errs9 = errors;
3285
+ if (!(keyword2(data1, { instancePath: instancePath + "/@context/" + i0, parentData: data0, parentDataProperty: i0, rootData, dynamicAnchors }))) {
3286
+ vErrors = vErrors === null ? keyword2.errors : vErrors.concat(keyword2.errors);
3287
+ errors = vErrors.length;
3288
+ }
3289
+ var _valid1 = _errs9 === errors;
3290
+ valid5 = valid5 || _valid1;
3291
+ const _errs10 = errors;
3292
+ if ("https://www.w3.org/2018/credentials/v1" !== data1) {
3293
+ const err3 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf/1/const", "const", { allowedValue: "https://www.w3.org/2018/credentials/v1" }, 0);
3294
+ vErrors = pushError(vErrors, err3);
3295
+ errors++;
3296
+ }
3297
+ var _valid1 = _errs10 === errors;
3298
+ valid5 = valid5 || _valid1;
3299
+ if (!valid5) {
3300
+ const err4 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf", "anyOf", {}, 1);
3301
+ vErrors = pushError(vErrors, err4);
3302
+ errors++;
3303
+ }
3304
+ else {
3305
+ errors = _errs8;
3306
+ if (vErrors !== null) {
3307
+ if (_errs8) {
3308
+ vErrors.length = _errs8;
3309
+ }
3310
+ else {
3311
+ vErrors = null;
3312
+ }
3313
+ }
3314
+ }
3315
+ }
3316
+ const _errs11 = errors;
3317
+ const len1 = data0.length;
3318
+ let valid6 = false;
3319
+ let count0 = 0;
3320
+ for (let i1 = 0; i1 < len1; i1++) {
3321
+ const _errs12 = errors;
3322
+ if ("https://www.w3.org/2018/credentials/v1" !== data0[i1]) {
3323
+ const err5 = createError(instancePath + "/@context/" + i1, "#/properties/%40context/anyOf/1/contains/const", "const", { allowedValue: "https://www.w3.org/2018/credentials/v1" }, 0);
3324
+ vErrors = pushError(vErrors, err5);
3325
+ errors++;
3326
+ }
3327
+ var _valid2 = _errs12 === errors;
3328
+ if (_valid2) {
3329
+ count0++;
3330
+ if (count0 > 1) {
3331
+ valid6 = false;
3332
+ break;
3333
+ }
3334
+ valid6 = true;
3335
+ }
3336
+ }
3337
+ if (!valid6) {
3338
+ const err6 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/contains", "contains", { minContains: 1, maxContains: 1 }, 3);
3339
+ vErrors = pushError(vErrors, err6);
3340
+ errors++;
3341
+ }
3342
+ else {
3343
+ errors = _errs11;
3344
+ if (vErrors !== null) {
3345
+ if (_errs11) {
3346
+ vErrors.length = _errs11;
3347
+ }
3348
+ else {
3349
+ vErrors = null;
3350
+ }
3351
+ }
3352
+ }
3353
+ }
3354
+ else {
3355
+ const err7 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/type", "type", { type: "array" }, 4);
3356
+ vErrors = pushError(vErrors, err7);
3357
+ errors++;
3358
+ }
3359
+ var _valid0 = _errs5 === errors;
3360
+ valid2 = valid2 || _valid0;
3361
+ if (!valid2) {
3362
+ const err8 = createError(instancePath + "/@context", "#/properties/%40context/anyOf", "anyOf", {}, 1);
3363
+ vErrors = pushError(vErrors, err8);
3364
+ errors++;
3365
+ }
3366
+ else {
3367
+ errors = _errs3;
3368
+ if (vErrors !== null) {
3369
+ if (_errs3) {
3370
+ vErrors.length = _errs3;
3371
+ }
3372
+ else {
3373
+ vErrors = null;
3374
+ }
3375
+ }
3376
+ }
3377
+ }
3378
+ if (data.verifiableCredential !== undefined) {
3379
+ let data3 = data.verifiableCredential;
3380
+ if (Array.isArray(data3)) {
3381
+ const len2 = data3.length;
3382
+ for (let i2 = 0; i2 < len2; i2++) {
3383
+ let data4 = data3[i2];
3384
+ const _errs16 = errors;
3385
+ let valid9 = false;
3386
+ const _errs17 = errors;
3387
+ if (typeof data4 !== "string") {
3388
+ const err9 = createError(instancePath + "/verifiableCredential/" + i2, "#/properties/verifiableCredential/items/anyOf/0/type", "type", { type: "string" }, 5);
3389
+ vErrors = pushError(vErrors, err9);
3390
+ errors++;
3391
+ }
3392
+ var _valid3 = _errs17 === errors;
3393
+ valid9 = valid9 || _valid3;
3394
+ const _errs19 = errors;
3395
+ if (!(validate77(data4, { instancePath: instancePath + "/verifiableCredential/" + i2, parentData: data3, parentDataProperty: i2, rootData, dynamicAnchors }))) {
3396
+ vErrors = vErrors === null ? validate77.errors : vErrors.concat(validate77.errors);
3397
+ errors = vErrors.length;
3398
+ }
3399
+ var _valid3 = _errs19 === errors;
3400
+ valid9 = valid9 || _valid3;
3401
+ if (_valid3) {
3402
+ var props1 = {};
3403
+ props1["@context"] = true;
3404
+ props1.issuanceDate = true;
3405
+ props1.expirationDate = true;
3406
+ props1.id = true;
3407
+ props1.type = true;
3408
+ props1.credentialSubject = true;
3409
+ props1.credentialStatus = true;
3410
+ props1.credentialSchema = true;
3411
+ props1.issuer = true;
3412
+ props1.name = true;
3413
+ props1.description = true;
3414
+ props1.evidence = true;
3415
+ props1.proof = true;
3416
+ }
3417
+ if (!valid9) {
3418
+ const err10 = createError(instancePath + "/verifiableCredential/" + i2, "#/properties/verifiableCredential/items/anyOf", "anyOf", {}, 1);
3419
+ vErrors = pushError(vErrors, err10);
3420
+ errors++;
3421
+ }
3422
+ else {
3423
+ errors = _errs16;
3424
+ if (vErrors !== null) {
3425
+ if (_errs16) {
3426
+ vErrors.length = _errs16;
3427
+ }
3428
+ else {
3429
+ vErrors = null;
3430
+ }
3431
+ }
3432
+ }
3433
+ }
3434
+ }
3435
+ else {
3436
+ const err11 = createError(instancePath + "/verifiableCredential", "#/properties/verifiableCredential/type", "type", { type: "array" }, 4);
3437
+ vErrors = pushError(vErrors, err11);
3438
+ errors++;
3439
+ }
3440
+ }
3441
+ }
3442
+ else {
3443
+ const err12 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
3444
+ vErrors = pushError(vErrors, err12);
3445
+ errors++;
3446
+ }
3447
+ validate99.errors = vErrors;
3448
+ return errors === 0;
3449
+ }
3450
+ validate99.evaluated = { "props": { "@context": true, "verifiableCredential": true, "id": true, "type": true, "holder": true, "proof": true }, "dynamicProps": false, "dynamicItems": false };
3451
+ function validate106(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
3452
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidVerifiablePresentationV2" */ ;
3453
+ let vErrors = null;
3454
+ let errors = 0;
3455
+ const evaluated0 = validate106.evaluated;
3456
+ if (evaluated0.dynamicProps) {
3457
+ evaluated0.props = undefined;
3458
+ }
3459
+ if (evaluated0.dynamicItems) {
3460
+ evaluated0.items = undefined;
3461
+ }
3462
+ if (!(validate100(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
3463
+ vErrors = vErrors === null ? validate100.errors : vErrors.concat(validate100.errors);
3464
+ errors = vErrors.length;
3465
+ }
3466
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3467
+ if (data["@context"] === undefined) {
3468
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "@context" }, "must have required property '" + "@context" + "'");
3469
+ vErrors = pushError(vErrors, err0);
3470
+ errors++;
3471
+ }
3472
+ if (data["@context"] !== undefined) {
3473
+ let data0 = data["@context"];
3474
+ const _errs3 = errors;
3475
+ let valid2 = false;
3476
+ const _errs4 = errors;
3477
+ if ("https://www.w3.org/ns/credentials/v2" !== data0) {
3478
+ const err1 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/0/const", "const", { allowedValue: "https://www.w3.org/ns/credentials/v2" }, 0);
3479
+ vErrors = pushError(vErrors, err1);
3480
+ errors++;
3481
+ }
3482
+ var _valid0 = _errs4 === errors;
3483
+ valid2 = valid2 || _valid0;
3484
+ const _errs5 = errors;
3485
+ if (Array.isArray(data0)) {
3486
+ if (data0.length < 1) {
3487
+ const err2 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/minItems", "minItems", { limit: 1 }, 2);
3488
+ vErrors = pushError(vErrors, err2);
3489
+ errors++;
3490
+ }
3491
+ const len0 = data0.length;
3492
+ for (let i0 = 0; i0 < len0; i0++) {
3493
+ let data1 = data0[i0];
3494
+ const _errs8 = errors;
3495
+ let valid5 = false;
3496
+ const _errs9 = errors;
3497
+ if (!(keyword2(data1, { instancePath: instancePath + "/@context/" + i0, parentData: data0, parentDataProperty: i0, rootData, dynamicAnchors }))) {
3498
+ vErrors = vErrors === null ? keyword2.errors : vErrors.concat(keyword2.errors);
3499
+ errors = vErrors.length;
3500
+ }
3501
+ var _valid1 = _errs9 === errors;
3502
+ valid5 = valid5 || _valid1;
3503
+ const _errs10 = errors;
3504
+ if ("https://www.w3.org/ns/credentials/v2" !== data1) {
3505
+ const err3 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf/1/const", "const", { allowedValue: "https://www.w3.org/ns/credentials/v2" }, 0);
3506
+ vErrors = pushError(vErrors, err3);
3507
+ errors++;
3508
+ }
3509
+ var _valid1 = _errs10 === errors;
3510
+ valid5 = valid5 || _valid1;
3511
+ if (!valid5) {
3512
+ const err4 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/1/items/anyOf", "anyOf", {}, 1);
3513
+ vErrors = pushError(vErrors, err4);
3514
+ errors++;
3515
+ }
3516
+ else {
3517
+ errors = _errs8;
3518
+ if (vErrors !== null) {
3519
+ if (_errs8) {
3520
+ vErrors.length = _errs8;
3521
+ }
3522
+ else {
3523
+ vErrors = null;
3524
+ }
3525
+ }
3526
+ }
3527
+ }
3528
+ const _errs11 = errors;
3529
+ const len1 = data0.length;
3530
+ let valid6 = false;
3531
+ let count0 = 0;
3532
+ for (let i1 = 0; i1 < len1; i1++) {
3533
+ const _errs12 = errors;
3534
+ if ("https://www.w3.org/ns/credentials/v2" !== data0[i1]) {
3535
+ const err5 = createError(instancePath + "/@context/" + i1, "#/properties/%40context/anyOf/1/contains/const", "const", { allowedValue: "https://www.w3.org/ns/credentials/v2" }, 0);
3536
+ vErrors = pushError(vErrors, err5);
3537
+ errors++;
3538
+ }
3539
+ var _valid2 = _errs12 === errors;
3540
+ if (_valid2) {
3541
+ count0++;
3542
+ if (count0 > 1) {
3543
+ valid6 = false;
3544
+ break;
3545
+ }
3546
+ valid6 = true;
3547
+ }
3548
+ }
3549
+ if (!valid6) {
3550
+ const err6 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/contains", "contains", { minContains: 1, maxContains: 1 }, 3);
3551
+ vErrors = pushError(vErrors, err6);
3552
+ errors++;
3553
+ }
3554
+ else {
3555
+ errors = _errs11;
3556
+ if (vErrors !== null) {
3557
+ if (_errs11) {
3558
+ vErrors.length = _errs11;
3559
+ }
3560
+ else {
3561
+ vErrors = null;
3562
+ }
3563
+ }
3564
+ }
3565
+ }
3566
+ else {
3567
+ const err7 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/type", "type", { type: "array" }, 4);
3568
+ vErrors = pushError(vErrors, err7);
3569
+ errors++;
3570
+ }
3571
+ var _valid0 = _errs5 === errors;
3572
+ valid2 = valid2 || _valid0;
3573
+ if (!valid2) {
3574
+ const err8 = createError(instancePath + "/@context", "#/properties/%40context/anyOf", "anyOf", {}, 1);
3575
+ vErrors = pushError(vErrors, err8);
3576
+ errors++;
3577
+ }
3578
+ else {
3579
+ errors = _errs3;
3580
+ if (vErrors !== null) {
3581
+ if (_errs3) {
3582
+ vErrors.length = _errs3;
3583
+ }
3584
+ else {
3585
+ vErrors = null;
3586
+ }
3587
+ }
3588
+ }
3589
+ }
3590
+ if (data.verifiableCredential !== undefined) {
3591
+ let data3 = data.verifiableCredential;
3592
+ if (Array.isArray(data3)) {
3593
+ const len2 = data3.length;
3594
+ for (let i2 = 0; i2 < len2; i2++) {
3595
+ let data4 = data3[i2];
3596
+ const _errs16 = errors;
3597
+ let valid9 = false;
3598
+ const _errs17 = errors;
3599
+ if (typeof data4 !== "string") {
3600
+ const err9 = createError(instancePath + "/verifiableCredential/" + i2, "#/properties/verifiableCredential/items/anyOf/0/type", "type", { type: "string" }, 5);
3601
+ vErrors = pushError(vErrors, err9);
3602
+ errors++;
3603
+ }
3604
+ var _valid3 = _errs17 === errors;
3605
+ valid9 = valid9 || _valid3;
3606
+ const _errs19 = errors;
3607
+ if (!(validate95(data4, { instancePath: instancePath + "/verifiableCredential/" + i2, parentData: data3, parentDataProperty: i2, rootData, dynamicAnchors }))) {
3608
+ vErrors = vErrors === null ? validate95.errors : vErrors.concat(validate95.errors);
3609
+ errors = vErrors.length;
3610
+ }
3611
+ var _valid3 = _errs19 === errors;
3612
+ valid9 = valid9 || _valid3;
3613
+ if (_valid3) {
3614
+ var props1 = {};
3615
+ props1["@context"] = true;
3616
+ props1.validFrom = true;
3617
+ props1.validUntil = true;
3618
+ props1.id = true;
3619
+ props1.type = true;
3620
+ props1.credentialSubject = true;
3621
+ props1.credentialStatus = true;
3622
+ props1.credentialSchema = true;
3623
+ props1.issuer = true;
3624
+ props1.name = true;
3625
+ props1.description = true;
3626
+ props1.evidence = true;
3627
+ props1.proof = true;
3628
+ }
3629
+ if (!valid9) {
3630
+ const err10 = createError(instancePath + "/verifiableCredential/" + i2, "#/properties/verifiableCredential/items/anyOf", "anyOf", {}, 1);
3631
+ vErrors = pushError(vErrors, err10);
3632
+ errors++;
3633
+ }
3634
+ else {
3635
+ errors = _errs16;
3636
+ if (vErrors !== null) {
3637
+ if (_errs16) {
3638
+ vErrors.length = _errs16;
3639
+ }
3640
+ else {
3641
+ vErrors = null;
3642
+ }
3643
+ }
3644
+ }
3645
+ }
3646
+ }
3647
+ else {
3648
+ const err11 = createError(instancePath + "/verifiableCredential", "#/properties/verifiableCredential/type", "type", { type: "array" }, 4);
3649
+ vErrors = pushError(vErrors, err11);
3650
+ errors++;
3651
+ }
3652
+ }
3653
+ }
3654
+ else {
3655
+ const err12 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
3656
+ vErrors = pushError(vErrors, err12);
3657
+ errors++;
3658
+ }
3659
+ validate106.errors = vErrors;
3660
+ return errors === 0;
3661
+ }
3662
+ validate106.evaluated = { "props": { "@context": true, "verifiableCredential": true, "id": true, "type": true, "holder": true, "proof": true }, "dynamicProps": false, "dynamicItems": false };
3663
+ function validate98(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
3664
+ /*# sourceURL="https://schema.twindev.org/w3c-did/DidVerifiablePresentation" */ ;
3665
+ let vErrors = null;
3666
+ let errors = 0;
3667
+ const evaluated0 = validate98.evaluated;
3668
+ if (evaluated0.dynamicProps) {
3669
+ evaluated0.props = undefined;
3670
+ }
3671
+ if (evaluated0.dynamicItems) {
3672
+ evaluated0.items = undefined;
3673
+ }
3674
+ const _errs0 = errors;
3675
+ let valid0 = false;
3676
+ const _errs1 = errors;
3677
+ if (!(validate99(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
3678
+ vErrors = vErrors === null ? validate99.errors : vErrors.concat(validate99.errors);
3679
+ errors = vErrors.length;
3680
+ }
3681
+ var _valid0 = _errs1 === errors;
3682
+ valid0 = valid0 || _valid0;
3683
+ if (_valid0) {
3684
+ var props0 = {};
3685
+ props0["@context"] = true;
3686
+ props0.verifiableCredential = true;
3687
+ props0.id = true;
3688
+ props0.type = true;
3689
+ props0.holder = true;
3690
+ props0.proof = true;
3691
+ }
3692
+ const _errs2 = errors;
3693
+ if (!(validate106(data, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }))) {
3694
+ vErrors = vErrors === null ? validate106.errors : vErrors.concat(validate106.errors);
3695
+ errors = vErrors.length;
3696
+ }
3697
+ var _valid0 = _errs2 === errors;
3698
+ valid0 = valid0 || _valid0;
3699
+ if (_valid0) {
3700
+ if (props0 !== true) {
3701
+ props0 = props0 || {};
3702
+ props0["@context"] = true;
3703
+ props0.verifiableCredential = true;
3704
+ props0.id = true;
3705
+ props0.type = true;
3706
+ props0.holder = true;
3707
+ props0.proof = true;
3708
+ }
3709
+ }
3710
+ if (!valid0) {
3711
+ const err0 = createError(instancePath, "#/anyOf", "anyOf", {}, 1);
3712
+ vErrors = pushError(vErrors, err0);
3713
+ errors++;
3714
+ }
3715
+ else {
3716
+ errors = _errs0;
3717
+ if (vErrors !== null) {
3718
+ if (_errs0) {
3719
+ vErrors.length = _errs0;
3720
+ }
3721
+ else {
3722
+ vErrors = null;
3723
+ }
3724
+ }
3725
+ }
3726
+ validate98.errors = vErrors;
3727
+ evaluated0.props = props0;
3728
+ return errors === 0;
3729
+ }
3730
+ validate98.evaluated = { "dynamicProps": true, "dynamicItems": false };
3731
+ /**
3732
+ * Compiled validator for the DidVerifiablePresentationCommon schema.
3733
+ */
3734
+ export const CompiledDidVerifiablePresentationCommon = validate100;
3735
+ /**
3736
+ * Compiled validator for the DidVerifiablePresentationV1 schema.
3737
+ */
3738
+ export const CompiledDidVerifiablePresentationV1 = validate99;
3739
+ /**
3740
+ * Compiled validator for the DidVerifiablePresentationV2 schema.
3741
+ */
3742
+ export const CompiledDidVerifiablePresentationV2 = validate106;
3743
+ /**
3744
+ * Compiled validator for the JsonWebSignature2020Proof schema.
3745
+ */
3746
+ export const CompiledJsonWebSignature2020Proof = validate89;
3747
+ /**
3748
+ * Compiled validator for the Multikey schema.
3749
+ */
3750
+ export const CompiledMultikey = validate110;
3751
+ function validate110(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
3752
+ /*# sourceURL="https://schema.twindev.org/w3c-did/Multikey" */ ;
3753
+ let vErrors = null;
3754
+ let errors = 0;
3755
+ const evaluated0 = validate110.evaluated;
3756
+ if (evaluated0.dynamicProps) {
3757
+ evaluated0.props = undefined;
3758
+ }
3759
+ if (evaluated0.dynamicItems) {
3760
+ evaluated0.items = undefined;
3761
+ }
3762
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3763
+ if (data.type === undefined) {
3764
+ const err0 = createError(instancePath, "#/required", "required", { missingProperty: "type" }, "must have required property '" + "type" + "'");
3765
+ vErrors = pushError(vErrors, err0);
3766
+ errors++;
3767
+ }
3768
+ if (data.publicKeyMultibase === undefined) {
3769
+ const err1 = createError(instancePath, "#/required", "required", { missingProperty: "publicKeyMultibase" }, "must have required property '" + "publicKeyMultibase" + "'");
3770
+ vErrors = pushError(vErrors, err1);
3771
+ errors++;
3772
+ }
3773
+ if (data["@context"] !== undefined) {
3774
+ let data0 = data["@context"];
3775
+ const _errs2 = errors;
3776
+ let valid1 = false;
3777
+ const _errs3 = errors;
3778
+ if ("https://www.w3.org/ns/cid/v1" !== data0) {
3779
+ const err2 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/0/const", "const", { allowedValue: "https://www.w3.org/ns/cid/v1" }, 0);
3780
+ vErrors = pushError(vErrors, err2);
3781
+ errors++;
3782
+ }
3783
+ var _valid0 = _errs3 === errors;
3784
+ valid1 = valid1 || _valid0;
3785
+ const _errs4 = errors;
3786
+ if ("https://w3id.org/security/multikey/v1" !== data0) {
3787
+ const err3 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/1/const", "const", { allowedValue: "https://w3id.org/security/multikey/v1" }, 0);
3788
+ vErrors = pushError(vErrors, err3);
3789
+ errors++;
3790
+ }
3791
+ var _valid0 = _errs4 === errors;
3792
+ valid1 = valid1 || _valid0;
3793
+ const _errs5 = errors;
3794
+ if (Array.isArray(data0)) {
3795
+ if (data0.length < 1) {
3796
+ const err4 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/2/minItems", "minItems", { limit: 1 }, 2);
3797
+ vErrors = pushError(vErrors, err4);
3798
+ errors++;
3799
+ }
3800
+ const len0 = data0.length;
3801
+ for (let i0 = 0; i0 < len0; i0++) {
3802
+ let data1 = data0[i0];
3803
+ const _errs8 = errors;
3804
+ let valid4 = false;
3805
+ const _errs9 = errors;
3806
+ if (!(keyword2(data1, { instancePath: instancePath + "/@context/" + i0, parentData: data0, parentDataProperty: i0, rootData, dynamicAnchors }))) {
3807
+ vErrors = vErrors === null ? keyword2.errors : vErrors.concat(keyword2.errors);
3808
+ errors = vErrors.length;
3809
+ }
3810
+ var _valid1 = _errs9 === errors;
3811
+ valid4 = valid4 || _valid1;
3812
+ const _errs10 = errors;
3813
+ if ("https://www.w3.org/ns/cid/v1" !== data1) {
3814
+ const err5 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/2/items/anyOf/1/const", "const", { allowedValue: "https://www.w3.org/ns/cid/v1" }, 0);
3815
+ vErrors = pushError(vErrors, err5);
3816
+ errors++;
3817
+ }
3818
+ var _valid1 = _errs10 === errors;
3819
+ valid4 = valid4 || _valid1;
3820
+ if (!valid4) {
3821
+ const err6 = createError(instancePath + "/@context/" + i0, "#/properties/%40context/anyOf/2/items/anyOf", "anyOf", {}, 1);
3822
+ vErrors = pushError(vErrors, err6);
3823
+ errors++;
3824
+ }
3825
+ else {
3826
+ errors = _errs8;
3827
+ if (vErrors !== null) {
3828
+ if (_errs8) {
3829
+ vErrors.length = _errs8;
3830
+ }
3831
+ else {
3832
+ vErrors = null;
3833
+ }
3834
+ }
3835
+ }
3836
+ }
3837
+ const _errs11 = errors;
3838
+ const len1 = data0.length;
3839
+ let valid5 = false;
3840
+ let count0 = 0;
3841
+ for (let i1 = 0; i1 < len1; i1++) {
3842
+ const _errs12 = errors;
3843
+ if ("https://www.w3.org/ns/cid/v1" !== data0[i1]) {
3844
+ const err7 = createError(instancePath + "/@context/" + i1, "#/properties/%40context/anyOf/2/contains/const", "const", { allowedValue: "https://www.w3.org/ns/cid/v1" }, 0);
3845
+ vErrors = pushError(vErrors, err7);
3846
+ errors++;
3847
+ }
3848
+ var _valid2 = _errs12 === errors;
3849
+ if (_valid2) {
3850
+ count0++;
3851
+ if (count0 > 1) {
3852
+ valid5 = false;
3853
+ break;
3854
+ }
3855
+ valid5 = true;
3856
+ }
3857
+ }
3858
+ if (!valid5) {
3859
+ const err8 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/2/contains", "contains", { minContains: 1, maxContains: 1 }, 3);
3860
+ vErrors = pushError(vErrors, err8);
3861
+ errors++;
3862
+ }
3863
+ else {
3864
+ errors = _errs11;
3865
+ if (vErrors !== null) {
3866
+ if (_errs11) {
3867
+ vErrors.length = _errs11;
3868
+ }
3869
+ else {
3870
+ vErrors = null;
3871
+ }
3872
+ }
3873
+ }
3874
+ }
3875
+ else {
3876
+ const err9 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/2/type", "type", { type: "array" }, 4);
3877
+ vErrors = pushError(vErrors, err9);
3878
+ errors++;
3879
+ }
3880
+ var _valid0 = _errs5 === errors;
3881
+ valid1 = valid1 || _valid0;
3882
+ if (_valid0) {
3883
+ var items0 = true;
3884
+ }
3885
+ const _errs13 = errors;
3886
+ if (Array.isArray(data0)) {
3887
+ if (data0.length < 1) {
3888
+ const err10 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/3/minItems", "minItems", { limit: 1 }, 2);
3889
+ vErrors = pushError(vErrors, err10);
3890
+ errors++;
3891
+ }
3892
+ const len2 = data0.length;
3893
+ for (let i2 = 0; i2 < len2; i2++) {
3894
+ let data3 = data0[i2];
3895
+ const _errs16 = errors;
3896
+ let valid8 = false;
3897
+ const _errs17 = errors;
3898
+ if (!(keyword2(data3, { instancePath: instancePath + "/@context/" + i2, parentData: data0, parentDataProperty: i2, rootData, dynamicAnchors }))) {
3899
+ vErrors = vErrors === null ? keyword2.errors : vErrors.concat(keyword2.errors);
3900
+ errors = vErrors.length;
3901
+ }
3902
+ var _valid3 = _errs17 === errors;
3903
+ valid8 = valid8 || _valid3;
3904
+ const _errs18 = errors;
3905
+ if ("https://w3id.org/security/multikey/v1" !== data3) {
3906
+ const err11 = createError(instancePath + "/@context/" + i2, "#/properties/%40context/anyOf/3/items/anyOf/1/const", "const", { allowedValue: "https://w3id.org/security/multikey/v1" }, 0);
3907
+ vErrors = pushError(vErrors, err11);
3908
+ errors++;
3909
+ }
3910
+ var _valid3 = _errs18 === errors;
3911
+ valid8 = valid8 || _valid3;
3912
+ if (!valid8) {
3913
+ const err12 = createError(instancePath + "/@context/" + i2, "#/properties/%40context/anyOf/3/items/anyOf", "anyOf", {}, 1);
3914
+ vErrors = pushError(vErrors, err12);
3915
+ errors++;
3916
+ }
3917
+ else {
3918
+ errors = _errs16;
3919
+ if (vErrors !== null) {
3920
+ if (_errs16) {
3921
+ vErrors.length = _errs16;
3922
+ }
3923
+ else {
3924
+ vErrors = null;
3925
+ }
3926
+ }
3927
+ }
3928
+ }
3929
+ const _errs19 = errors;
3930
+ const len3 = data0.length;
3931
+ let valid9 = false;
3932
+ let count1 = 0;
3933
+ for (let i3 = 0; i3 < len3; i3++) {
3934
+ const _errs20 = errors;
3935
+ if ("https://w3id.org/security/multikey/v1" !== data0[i3]) {
3936
+ const err13 = createError(instancePath + "/@context/" + i3, "#/properties/%40context/anyOf/3/contains/const", "const", { allowedValue: "https://w3id.org/security/multikey/v1" }, 0);
3937
+ vErrors = pushError(vErrors, err13);
3938
+ errors++;
3939
+ }
3940
+ var _valid4 = _errs20 === errors;
3941
+ if (_valid4) {
3942
+ count1++;
3943
+ if (count1 > 1) {
3944
+ valid9 = false;
3945
+ break;
3946
+ }
3947
+ valid9 = true;
3948
+ }
3949
+ }
3950
+ if (!valid9) {
3951
+ const err14 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/3/contains", "contains", { minContains: 1, maxContains: 1 }, 3);
3952
+ vErrors = pushError(vErrors, err14);
3953
+ errors++;
3954
+ }
3955
+ else {
3956
+ errors = _errs19;
3957
+ if (vErrors !== null) {
3958
+ if (_errs19) {
3959
+ vErrors.length = _errs19;
3960
+ }
3961
+ else {
3962
+ vErrors = null;
3963
+ }
3964
+ }
3965
+ }
3966
+ }
3967
+ else {
3968
+ const err15 = createError(instancePath + "/@context", "#/properties/%40context/anyOf/3/type", "type", { type: "array" }, 4);
3969
+ vErrors = pushError(vErrors, err15);
3970
+ errors++;
3971
+ }
3972
+ var _valid0 = _errs13 === errors;
3973
+ valid1 = valid1 || _valid0;
3974
+ if (_valid0) {
3975
+ if (items0 !== true) {
3976
+ items0 = true;
3977
+ }
3978
+ }
3979
+ if (!valid1) {
3980
+ const err16 = createError(instancePath + "/@context", "#/properties/%40context/anyOf", "anyOf", {}, 1);
3981
+ vErrors = pushError(vErrors, err16);
3982
+ errors++;
3983
+ }
3984
+ else {
3985
+ errors = _errs2;
3986
+ if (vErrors !== null) {
3987
+ if (_errs2) {
3988
+ vErrors.length = _errs2;
3989
+ }
3990
+ else {
3991
+ vErrors = null;
3992
+ }
3993
+ }
3994
+ }
3995
+ }
3996
+ if (data.id !== undefined) {
3997
+ if (typeof data.id !== "string") {
3998
+ const err17 = createError(instancePath + "/id", "#/properties/id/type", "type", { type: "string" }, 5);
3999
+ vErrors = pushError(vErrors, err17);
4000
+ errors++;
4001
+ }
4002
+ }
4003
+ if (data.type !== undefined) {
4004
+ if ("Multikey" !== data.type) {
4005
+ const err18 = createError(instancePath + "/type", "#/properties/type/const", "const", { allowedValue: "Multikey" }, 0);
4006
+ vErrors = pushError(vErrors, err18);
4007
+ errors++;
4008
+ }
4009
+ }
4010
+ if (data.controller !== undefined) {
4011
+ if (typeof data.controller !== "string") {
4012
+ const err19 = createError(instancePath + "/controller", "#/properties/controller/type", "type", { type: "string" }, 5);
4013
+ vErrors = pushError(vErrors, err19);
4014
+ errors++;
4015
+ }
4016
+ }
4017
+ if (data.publicKeyMultibase !== undefined) {
4018
+ if (typeof data.publicKeyMultibase !== "string") {
4019
+ const err20 = createError(instancePath + "/publicKeyMultibase", "#/properties/publicKeyMultibase/type", "type", { type: "string" }, 5);
4020
+ vErrors = pushError(vErrors, err20);
4021
+ errors++;
4022
+ }
4023
+ }
4024
+ if (data.secretKeyMultibase !== undefined) {
4025
+ if (typeof data.secretKeyMultibase !== "string") {
4026
+ const err21 = createError(instancePath + "/secretKeyMultibase", "#/properties/secretKeyMultibase/type", "type", { type: "string" }, 5);
4027
+ vErrors = pushError(vErrors, err21);
4028
+ errors++;
4029
+ }
4030
+ }
4031
+ if (data.expires !== undefined) {
4032
+ if (typeof data.expires !== "string") {
4033
+ const err22 = createError(instancePath + "/expires", "#/properties/expires/type", "type", { type: "string" }, 5);
4034
+ vErrors = pushError(vErrors, err22);
4035
+ errors++;
4036
+ }
4037
+ }
4038
+ if (data.revoked !== undefined) {
4039
+ if (typeof data.revoked !== "string") {
4040
+ const err23 = createError(instancePath + "/revoked", "#/properties/revoked/type", "type", { type: "string" }, 5);
4041
+ vErrors = pushError(vErrors, err23);
4042
+ errors++;
4043
+ }
4044
+ }
4045
+ }
4046
+ else {
4047
+ const err24 = createError(instancePath, "#/type", "type", { type: "object" }, 6);
4048
+ vErrors = pushError(vErrors, err24);
4049
+ errors++;
4050
+ }
4051
+ validate110.errors = vErrors;
4052
+ return errors === 0;
4053
+ }
4054
+ validate110.evaluated = { "props": { "@context": true, "id": true, "type": true, "controller": true, "publicKeyMultibase": true, "secretKeyMultibase": true, "expires": true, "revoked": true }, "dynamicProps": false, "dynamicItems": false };
4055
+ /**
4056
+ * Compiled validator for the ProofTypes schema.
4057
+ */
4058
+ export const CompiledProofTypes = validate111;
4059
+ const keyword17 = Object.values(external3["ProofTypes"]);
4060
+ function validate111(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
4061
+ /*# sourceURL="https://schema.twindev.org/w3c-did/ProofTypes" */ ;
4062
+ let vErrors = null;
4063
+ let errors = 0;
4064
+ const evaluated0 = validate111.evaluated;
4065
+ if (evaluated0.dynamicProps) {
4066
+ evaluated0.props = undefined;
4067
+ }
4068
+ if (evaluated0.dynamicItems) {
4069
+ evaluated0.items = undefined;
4070
+ }
4071
+ if (!keyword17.includes(data)) {
4072
+ for (let i0 = 0; i0 < keyword17.length; i0++) {
4073
+ vErrors = pushError(vErrors, createError(instancePath, "#/anyOf" + "/" + i0 + "/const", "const", { allowedValue: keyword17[i0] }, "must be equal to constant"));
4074
+ errors++;
4075
+ }
4076
+ vErrors = pushError(vErrors, createError(instancePath, "#/anyOf", "anyOf", {}, "must match a schema in anyOf"));
4077
+ errors++;
4078
+ }
4079
+ validate111.errors = vErrors;
4080
+ return errors === 0;
4081
+ }
4082
+ validate111.evaluated = { "dynamicProps": false, "dynamicItems": false };
4083
+ /**
4084
+ * Compiled validator for the Proof schema.
4085
+ */
4086
+ export const CompiledProof = validate87;
4087
+ //# sourceMappingURL=validators.js.map