@qed-proof/sdk 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.cjs +1273 -358
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1273 -358
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -171,399 +171,1314 @@ function rootFromInclusion(index, size, leaf, path) {
|
|
|
171
171
|
return sn === 0 ? r : null;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
// src/
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"body",
|
|
187
|
-
"signature"
|
|
188
|
-
],
|
|
189
|
-
"additionalProperties": false,
|
|
190
|
-
"properties": {
|
|
191
|
-
"body": {
|
|
192
|
-
"$ref": "#/$defs/body"
|
|
193
|
-
},
|
|
194
|
-
"signature": {
|
|
195
|
-
"$ref": "#/$defs/signature"
|
|
196
|
-
},
|
|
197
|
-
"proof": {
|
|
198
|
-
"$ref": "#/$defs/proof"
|
|
174
|
+
// src/generated/receipt-validator.js
|
|
175
|
+
function ucs2length(str) {
|
|
176
|
+
const len = str.length;
|
|
177
|
+
let length = 0;
|
|
178
|
+
let pos = 0;
|
|
179
|
+
let value;
|
|
180
|
+
while (pos < len) {
|
|
181
|
+
length++;
|
|
182
|
+
value = str.charCodeAt(pos++);
|
|
183
|
+
if (value >= 55296 && value <= 56319 && pos < len) {
|
|
184
|
+
value = str.charCodeAt(pos);
|
|
185
|
+
if ((value & 64512) === 56320) pos++;
|
|
199
186
|
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
"no_connection",
|
|
238
|
-
"permission_denied",
|
|
239
|
-
"rate_limited",
|
|
240
|
-
"destination_unavailable",
|
|
241
|
-
"unsupported_action",
|
|
242
|
-
"claim_ambiguous",
|
|
243
|
-
"verifier_error"
|
|
244
|
-
]
|
|
245
|
-
},
|
|
246
|
-
"body": {
|
|
247
|
-
"type": "object",
|
|
248
|
-
"required": [
|
|
249
|
-
"spec_version",
|
|
250
|
-
"receipt_id",
|
|
251
|
-
"issued_at",
|
|
252
|
-
"issuer",
|
|
253
|
-
"agent",
|
|
254
|
-
"claim",
|
|
255
|
-
"observation",
|
|
256
|
-
"verdict",
|
|
257
|
-
"trust_level"
|
|
258
|
-
],
|
|
259
|
-
"properties": {
|
|
260
|
-
"spec_version": {
|
|
261
|
-
"const": "poaw/0.1"
|
|
262
|
-
},
|
|
263
|
-
"receipt_id": {
|
|
264
|
-
"type": "string",
|
|
265
|
-
"minLength": 1,
|
|
266
|
-
"maxLength": 128
|
|
267
|
-
},
|
|
268
|
-
"issued_at": {
|
|
269
|
-
"$ref": "#/$defs/timestamp"
|
|
270
|
-
},
|
|
271
|
-
"issuer": {
|
|
272
|
-
"type": "object",
|
|
273
|
-
"required": [
|
|
274
|
-
"key_id"
|
|
275
|
-
],
|
|
276
|
-
"properties": {
|
|
277
|
-
"key_id": {
|
|
278
|
-
"$ref": "#/$defs/keyId"
|
|
279
|
-
},
|
|
280
|
-
"name": {
|
|
281
|
-
"type": "string",
|
|
282
|
-
"maxLength": 128
|
|
283
|
-
}
|
|
187
|
+
}
|
|
188
|
+
return length;
|
|
189
|
+
}
|
|
190
|
+
var validate = validate20;
|
|
191
|
+
var schema42 = { "enum": ["verified", "late", "mismatch", "failed", "unverifiable"] };
|
|
192
|
+
var schema43 = { "enum": ["not_found", "content_mismatch", "target_mismatch", "observed_after_tolerance", "no_connection", "permission_denied", "rate_limited", "destination_unavailable", "unsupported_action", "claim_ambiguous", "verifier_error"] };
|
|
193
|
+
var func1 = ucs2length;
|
|
194
|
+
var pattern4 = new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$", "u");
|
|
195
|
+
var pattern5 = new RegExp("^ed25519:[A-Za-z0-9_-]{43}$", "u");
|
|
196
|
+
var pattern6 = new RegExp("^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$", "u");
|
|
197
|
+
var pattern7 = new RegExp("^[a-z0-9]+(\\.[a-z0-9_]+){2}$", "u");
|
|
198
|
+
var pattern9 = new RegExp("^[A-Za-z0-9_-]+$", "u");
|
|
199
|
+
var pattern11 = new RegExp("^\\d+$", "u");
|
|
200
|
+
var pattern12 = new RegExp("^sha256:[A-Za-z0-9_-]{43}$", "u");
|
|
201
|
+
function validate21(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
202
|
+
let vErrors = null;
|
|
203
|
+
let errors = 0;
|
|
204
|
+
const evaluated0 = validate21.evaluated;
|
|
205
|
+
if (evaluated0.dynamicProps) {
|
|
206
|
+
evaluated0.props = void 0;
|
|
207
|
+
}
|
|
208
|
+
if (evaluated0.dynamicItems) {
|
|
209
|
+
evaluated0.items = void 0;
|
|
210
|
+
}
|
|
211
|
+
const _errs1 = errors;
|
|
212
|
+
let valid0 = true;
|
|
213
|
+
const _errs2 = errors;
|
|
214
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
215
|
+
if (data.trust_level !== void 0) {
|
|
216
|
+
let data0 = data.trust_level;
|
|
217
|
+
if (typeof data0 == "number") {
|
|
218
|
+
if (data0 < 3 || isNaN(data0)) {
|
|
219
|
+
const err0 = {};
|
|
220
|
+
if (vErrors === null) {
|
|
221
|
+
vErrors = [err0];
|
|
222
|
+
} else {
|
|
223
|
+
vErrors.push(err0);
|
|
284
224
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
225
|
+
errors++;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
var _valid0 = _errs2 === errors;
|
|
231
|
+
errors = _errs1;
|
|
232
|
+
if (vErrors !== null) {
|
|
233
|
+
if (_errs1) {
|
|
234
|
+
vErrors.length = _errs1;
|
|
235
|
+
} else {
|
|
236
|
+
vErrors = null;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (_valid0) {
|
|
240
|
+
const _errs4 = errors;
|
|
241
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
242
|
+
let missing0;
|
|
243
|
+
if (data.attestation === void 0 && (missing0 = "attestation")) {
|
|
244
|
+
validate21.errors = [{ instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
245
|
+
return false;
|
|
246
|
+
} else {
|
|
247
|
+
if (data.observation !== void 0) {
|
|
248
|
+
let data1 = data.observation;
|
|
249
|
+
if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
|
|
250
|
+
if (data1.verifier !== void 0) {
|
|
251
|
+
let data2 = data1.verifier;
|
|
252
|
+
if (data2 && typeof data2 == "object" && !Array.isArray(data2)) {
|
|
253
|
+
let missing1;
|
|
254
|
+
if (data2.id === void 0 && (missing1 = "id") || data2.version === void 0 && (missing1 = "version") || data2.code_hash === void 0 && (missing1 = "code_hash")) {
|
|
255
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/verifier", schemaPath: "#/then/properties/observation/properties/verifier/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
256
|
+
return false;
|
|
314
257
|
}
|
|
315
258
|
}
|
|
316
259
|
}
|
|
317
260
|
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
var _valid0 = _errs4 === errors;
|
|
265
|
+
valid0 = _valid0;
|
|
266
|
+
if (valid0) {
|
|
267
|
+
var props0 = {};
|
|
268
|
+
props0.observation = true;
|
|
269
|
+
props0.trust_level = true;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (!valid0) {
|
|
273
|
+
const err1 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: "then" }, message: 'must match "then" schema' };
|
|
274
|
+
if (vErrors === null) {
|
|
275
|
+
vErrors = [err1];
|
|
276
|
+
} else {
|
|
277
|
+
vErrors.push(err1);
|
|
278
|
+
}
|
|
279
|
+
errors++;
|
|
280
|
+
validate21.errors = vErrors;
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
if (errors === 0) {
|
|
284
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
285
|
+
let missing2;
|
|
286
|
+
if (data.spec_version === void 0 && (missing2 = "spec_version") || data.receipt_id === void 0 && (missing2 = "receipt_id") || data.issued_at === void 0 && (missing2 = "issued_at") || data.issuer === void 0 && (missing2 = "issuer") || data.agent === void 0 && (missing2 = "agent") || data.claim === void 0 && (missing2 = "claim") || data.observation === void 0 && (missing2 = "observation") || data.verdict === void 0 && (missing2 = "verdict") || data.trust_level === void 0 && (missing2 = "trust_level")) {
|
|
287
|
+
validate21.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
|
|
288
|
+
return false;
|
|
289
|
+
} else {
|
|
290
|
+
if (props0 !== true) {
|
|
291
|
+
props0 = props0 || {};
|
|
292
|
+
props0.spec_version = true;
|
|
293
|
+
props0.receipt_id = true;
|
|
294
|
+
props0.issued_at = true;
|
|
295
|
+
props0.issuer = true;
|
|
296
|
+
props0.agent = true;
|
|
297
|
+
props0.operator = true;
|
|
298
|
+
props0.claim = true;
|
|
299
|
+
props0.observation = true;
|
|
300
|
+
props0.verdict = true;
|
|
301
|
+
props0.trust_level = true;
|
|
302
|
+
props0.attestation = true;
|
|
303
|
+
props0.supersedes = true;
|
|
304
|
+
}
|
|
305
|
+
if (data.spec_version !== void 0) {
|
|
306
|
+
const _errs7 = errors;
|
|
307
|
+
if ("poaw/0.1" !== data.spec_version) {
|
|
308
|
+
validate21.errors = [{ instancePath: instancePath + "/spec_version", schemaPath: "#/properties/spec_version/const", keyword: "const", params: { allowedValue: "poaw/0.1" }, message: "must be equal to constant" }];
|
|
309
|
+
return false;
|
|
354
310
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
"id": {
|
|
374
|
-
"$ref": "#/$defs/action"
|
|
375
|
-
},
|
|
376
|
-
"version": {
|
|
377
|
-
"type": "string",
|
|
378
|
-
"pattern": "^\\d+$"
|
|
379
|
-
},
|
|
380
|
-
"code_hash": {
|
|
381
|
-
"$ref": "#/$defs/fingerprint"
|
|
311
|
+
var valid4 = _errs7 === errors;
|
|
312
|
+
} else {
|
|
313
|
+
var valid4 = true;
|
|
314
|
+
}
|
|
315
|
+
if (valid4) {
|
|
316
|
+
if (data.receipt_id !== void 0) {
|
|
317
|
+
let data4 = data.receipt_id;
|
|
318
|
+
const _errs8 = errors;
|
|
319
|
+
if (errors === _errs8) {
|
|
320
|
+
if (typeof data4 === "string") {
|
|
321
|
+
if (func1(data4) > 128) {
|
|
322
|
+
validate21.errors = [{ instancePath: instancePath + "/receipt_id", schemaPath: "#/properties/receipt_id/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" }];
|
|
323
|
+
return false;
|
|
324
|
+
} else {
|
|
325
|
+
if (func1(data4) < 1) {
|
|
326
|
+
validate21.errors = [{ instancePath: instancePath + "/receipt_id", schemaPath: "#/properties/receipt_id/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
382
329
|
}
|
|
330
|
+
} else {
|
|
331
|
+
validate21.errors = [{ instancePath: instancePath + "/receipt_id", schemaPath: "#/properties/receipt_id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
332
|
+
return false;
|
|
383
333
|
}
|
|
384
|
-
},
|
|
385
|
-
"observed_at": {
|
|
386
|
-
"$ref": "#/$defs/timestamp"
|
|
387
|
-
},
|
|
388
|
-
"deadline_at": {
|
|
389
|
-
"$ref": "#/$defs/timestamp"
|
|
390
|
-
},
|
|
391
|
-
"attempts": {
|
|
392
|
-
"type": "integer",
|
|
393
|
-
"minimum": 1
|
|
394
|
-
},
|
|
395
|
-
"facts": {
|
|
396
|
-
"type": "object"
|
|
397
334
|
}
|
|
335
|
+
var valid4 = _errs8 === errors;
|
|
336
|
+
} else {
|
|
337
|
+
var valid4 = true;
|
|
398
338
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
339
|
+
if (valid4) {
|
|
340
|
+
if (data.issued_at !== void 0) {
|
|
341
|
+
let data5 = data.issued_at;
|
|
342
|
+
const _errs10 = errors;
|
|
343
|
+
const _errs11 = errors;
|
|
344
|
+
if (errors === _errs11) {
|
|
345
|
+
if (typeof data5 === "string") {
|
|
346
|
+
if (!pattern4.test(data5)) {
|
|
347
|
+
validate21.errors = [{ instancePath: instancePath + "/issued_at", schemaPath: "#/$defs/timestamp/pattern", keyword: "pattern", params: { pattern: "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$" }, message: 'must match pattern "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$"' }];
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
validate21.errors = [{ instancePath: instancePath + "/issued_at", schemaPath: "#/$defs/timestamp/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
var valid4 = _errs10 === errors;
|
|
356
|
+
} else {
|
|
357
|
+
var valid4 = true;
|
|
411
358
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
359
|
+
if (valid4) {
|
|
360
|
+
if (data.issuer !== void 0) {
|
|
361
|
+
let data6 = data.issuer;
|
|
362
|
+
const _errs13 = errors;
|
|
363
|
+
if (errors === _errs13) {
|
|
364
|
+
if (data6 && typeof data6 == "object" && !Array.isArray(data6)) {
|
|
365
|
+
let missing3;
|
|
366
|
+
if (data6.key_id === void 0 && (missing3 = "key_id")) {
|
|
367
|
+
validate21.errors = [{ instancePath: instancePath + "/issuer", schemaPath: "#/properties/issuer/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
|
|
368
|
+
return false;
|
|
369
|
+
} else {
|
|
370
|
+
if (data6.key_id !== void 0) {
|
|
371
|
+
let data7 = data6.key_id;
|
|
372
|
+
const _errs15 = errors;
|
|
373
|
+
const _errs16 = errors;
|
|
374
|
+
if (errors === _errs16) {
|
|
375
|
+
if (typeof data7 === "string") {
|
|
376
|
+
if (!pattern5.test(data7)) {
|
|
377
|
+
validate21.errors = [{ instancePath: instancePath + "/issuer/key_id", schemaPath: "#/$defs/keyId/pattern", keyword: "pattern", params: { pattern: "^ed25519:[A-Za-z0-9_-]{43}$" }, message: 'must match pattern "^ed25519:[A-Za-z0-9_-]{43}$"' }];
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
} else {
|
|
381
|
+
validate21.errors = [{ instancePath: instancePath + "/issuer/key_id", schemaPath: "#/$defs/keyId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
var valid6 = _errs15 === errors;
|
|
386
|
+
} else {
|
|
387
|
+
var valid6 = true;
|
|
388
|
+
}
|
|
389
|
+
if (valid6) {
|
|
390
|
+
if (data6.name !== void 0) {
|
|
391
|
+
let data8 = data6.name;
|
|
392
|
+
const _errs18 = errors;
|
|
393
|
+
if (errors === _errs18) {
|
|
394
|
+
if (typeof data8 === "string") {
|
|
395
|
+
if (func1(data8) > 128) {
|
|
396
|
+
validate21.errors = [{ instancePath: instancePath + "/issuer/name", schemaPath: "#/properties/issuer/properties/name/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" }];
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
} else {
|
|
400
|
+
validate21.errors = [{ instancePath: instancePath + "/issuer/name", schemaPath: "#/properties/issuer/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
var valid6 = _errs18 === errors;
|
|
405
|
+
} else {
|
|
406
|
+
var valid6 = true;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
} else {
|
|
411
|
+
validate21.errors = [{ instancePath: instancePath + "/issuer", schemaPath: "#/properties/issuer/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
var valid4 = _errs13 === errors;
|
|
416
|
+
} else {
|
|
417
|
+
var valid4 = true;
|
|
418
|
+
}
|
|
419
|
+
if (valid4) {
|
|
420
|
+
if (data.agent !== void 0) {
|
|
421
|
+
let data9 = data.agent;
|
|
422
|
+
const _errs20 = errors;
|
|
423
|
+
if (errors === _errs20) {
|
|
424
|
+
if (data9 && typeof data9 == "object" && !Array.isArray(data9)) {
|
|
425
|
+
let missing4;
|
|
426
|
+
if (data9.id === void 0 && (missing4 = "id")) {
|
|
427
|
+
validate21.errors = [{ instancePath: instancePath + "/agent", schemaPath: "#/properties/agent/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" }];
|
|
428
|
+
return false;
|
|
429
|
+
} else {
|
|
430
|
+
if (data9.id !== void 0) {
|
|
431
|
+
let data10 = data9.id;
|
|
432
|
+
const _errs22 = errors;
|
|
433
|
+
if (errors === _errs22) {
|
|
434
|
+
if (typeof data10 === "string") {
|
|
435
|
+
if (func1(data10) > 256) {
|
|
436
|
+
validate21.errors = [{ instancePath: instancePath + "/agent/id", schemaPath: "#/properties/agent/properties/id/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
|
|
437
|
+
return false;
|
|
438
|
+
} else {
|
|
439
|
+
if (func1(data10) < 1) {
|
|
440
|
+
validate21.errors = [{ instancePath: instancePath + "/agent/id", schemaPath: "#/properties/agent/properties/id/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
} else {
|
|
445
|
+
validate21.errors = [{ instancePath: instancePath + "/agent/id", schemaPath: "#/properties/agent/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
var valid8 = _errs22 === errors;
|
|
450
|
+
} else {
|
|
451
|
+
var valid8 = true;
|
|
452
|
+
}
|
|
453
|
+
if (valid8) {
|
|
454
|
+
if (data9.erc8004 !== void 0) {
|
|
455
|
+
let data11 = data9.erc8004;
|
|
456
|
+
const _errs24 = errors;
|
|
457
|
+
if (errors === _errs24) {
|
|
458
|
+
if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
|
|
459
|
+
let missing5;
|
|
460
|
+
if (data11.chain === void 0 && (missing5 = "chain") || data11.registry === void 0 && (missing5 = "registry") || data11.agent_id === void 0 && (missing5 = "agent_id")) {
|
|
461
|
+
validate21.errors = [{ instancePath: instancePath + "/agent/erc8004", schemaPath: "#/properties/agent/properties/erc8004/required", keyword: "required", params: { missingProperty: missing5 }, message: "must have required property '" + missing5 + "'" }];
|
|
462
|
+
return false;
|
|
463
|
+
} else {
|
|
464
|
+
if (data11.chain !== void 0) {
|
|
465
|
+
let data12 = data11.chain;
|
|
466
|
+
const _errs26 = errors;
|
|
467
|
+
if (errors === _errs26) {
|
|
468
|
+
if (typeof data12 === "string") {
|
|
469
|
+
if (!pattern6.test(data12)) {
|
|
470
|
+
validate21.errors = [{ instancePath: instancePath + "/agent/erc8004/chain", schemaPath: "#/properties/agent/properties/erc8004/properties/chain/pattern", keyword: "pattern", params: { pattern: "^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$" }, message: 'must match pattern "^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$"' }];
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
validate21.errors = [{ instancePath: instancePath + "/agent/erc8004/chain", schemaPath: "#/properties/agent/properties/erc8004/properties/chain/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
var valid9 = _errs26 === errors;
|
|
479
|
+
} else {
|
|
480
|
+
var valid9 = true;
|
|
481
|
+
}
|
|
482
|
+
if (valid9) {
|
|
483
|
+
if (data11.registry !== void 0) {
|
|
484
|
+
const _errs28 = errors;
|
|
485
|
+
if (typeof data11.registry !== "string") {
|
|
486
|
+
validate21.errors = [{ instancePath: instancePath + "/agent/erc8004/registry", schemaPath: "#/properties/agent/properties/erc8004/properties/registry/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
var valid9 = _errs28 === errors;
|
|
490
|
+
} else {
|
|
491
|
+
var valid9 = true;
|
|
492
|
+
}
|
|
493
|
+
if (valid9) {
|
|
494
|
+
if (data11.agent_id !== void 0) {
|
|
495
|
+
const _errs30 = errors;
|
|
496
|
+
if (typeof data11.agent_id !== "string") {
|
|
497
|
+
validate21.errors = [{ instancePath: instancePath + "/agent/erc8004/agent_id", schemaPath: "#/properties/agent/properties/erc8004/properties/agent_id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
var valid9 = _errs30 === errors;
|
|
501
|
+
} else {
|
|
502
|
+
var valid9 = true;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
} else {
|
|
508
|
+
validate21.errors = [{ instancePath: instancePath + "/agent/erc8004", schemaPath: "#/properties/agent/properties/erc8004/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
509
|
+
return false;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
var valid8 = _errs24 === errors;
|
|
513
|
+
} else {
|
|
514
|
+
var valid8 = true;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
} else {
|
|
519
|
+
validate21.errors = [{ instancePath: instancePath + "/agent", schemaPath: "#/properties/agent/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
520
|
+
return false;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
var valid4 = _errs20 === errors;
|
|
524
|
+
} else {
|
|
525
|
+
var valid4 = true;
|
|
526
|
+
}
|
|
527
|
+
if (valid4) {
|
|
528
|
+
if (data.operator !== void 0) {
|
|
529
|
+
let data15 = data.operator;
|
|
530
|
+
const _errs32 = errors;
|
|
531
|
+
if (errors === _errs32) {
|
|
532
|
+
if (typeof data15 === "string") {
|
|
533
|
+
if (func1(data15) > 256) {
|
|
534
|
+
validate21.errors = [{ instancePath: instancePath + "/operator", schemaPath: "#/properties/operator/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
} else {
|
|
538
|
+
validate21.errors = [{ instancePath: instancePath + "/operator", schemaPath: "#/properties/operator/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
539
|
+
return false;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
var valid4 = _errs32 === errors;
|
|
543
|
+
} else {
|
|
544
|
+
var valid4 = true;
|
|
545
|
+
}
|
|
546
|
+
if (valid4) {
|
|
547
|
+
if (data.claim !== void 0) {
|
|
548
|
+
let data16 = data.claim;
|
|
549
|
+
const _errs34 = errors;
|
|
550
|
+
if (errors === _errs34) {
|
|
551
|
+
if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
|
|
552
|
+
let missing6;
|
|
553
|
+
if (data16.action === void 0 && (missing6 = "action") || data16.target === void 0 && (missing6 = "target") || data16.params === void 0 && (missing6 = "params") || data16.claimed_at === void 0 && (missing6 = "claimed_at") || data16.claim_digest === void 0 && (missing6 = "claim_digest")) {
|
|
554
|
+
validate21.errors = [{ instancePath: instancePath + "/claim", schemaPath: "#/properties/claim/required", keyword: "required", params: { missingProperty: missing6 }, message: "must have required property '" + missing6 + "'" }];
|
|
555
|
+
return false;
|
|
556
|
+
} else {
|
|
557
|
+
if (data16.action !== void 0) {
|
|
558
|
+
let data17 = data16.action;
|
|
559
|
+
const _errs36 = errors;
|
|
560
|
+
const _errs37 = errors;
|
|
561
|
+
if (errors === _errs37) {
|
|
562
|
+
if (typeof data17 === "string") {
|
|
563
|
+
if (!pattern7.test(data17)) {
|
|
564
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/action", schemaPath: "#/$defs/action/pattern", keyword: "pattern", params: { pattern: "^[a-z0-9]+(\\.[a-z0-9_]+){2}$" }, message: 'must match pattern "^[a-z0-9]+(\\.[a-z0-9_]+){2}$"' }];
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
} else {
|
|
568
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/action", schemaPath: "#/$defs/action/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
569
|
+
return false;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
var valid10 = _errs36 === errors;
|
|
573
|
+
} else {
|
|
574
|
+
var valid10 = true;
|
|
575
|
+
}
|
|
576
|
+
if (valid10) {
|
|
577
|
+
if (data16.target !== void 0) {
|
|
578
|
+
let data18 = data16.target;
|
|
579
|
+
const _errs39 = errors;
|
|
580
|
+
if (errors === _errs39) {
|
|
581
|
+
if (typeof data18 === "string") {
|
|
582
|
+
if (func1(data18) > 512) {
|
|
583
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/target", schemaPath: "#/properties/claim/properties/target/maxLength", keyword: "maxLength", params: { limit: 512 }, message: "must NOT have more than 512 characters" }];
|
|
584
|
+
return false;
|
|
585
|
+
} else {
|
|
586
|
+
if (func1(data18) < 1) {
|
|
587
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/target", schemaPath: "#/properties/claim/properties/target/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
588
|
+
return false;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
} else {
|
|
592
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/target", schemaPath: "#/properties/claim/properties/target/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
593
|
+
return false;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
var valid10 = _errs39 === errors;
|
|
597
|
+
} else {
|
|
598
|
+
var valid10 = true;
|
|
599
|
+
}
|
|
600
|
+
if (valid10) {
|
|
601
|
+
if (data16.params !== void 0) {
|
|
602
|
+
let data19 = data16.params;
|
|
603
|
+
const _errs41 = errors;
|
|
604
|
+
if (!(data19 && typeof data19 == "object" && !Array.isArray(data19))) {
|
|
605
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/params", schemaPath: "#/properties/claim/properties/params/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
var valid10 = _errs41 === errors;
|
|
609
|
+
} else {
|
|
610
|
+
var valid10 = true;
|
|
611
|
+
}
|
|
612
|
+
if (valid10) {
|
|
613
|
+
if (data16.claimed_at !== void 0) {
|
|
614
|
+
let data20 = data16.claimed_at;
|
|
615
|
+
const _errs43 = errors;
|
|
616
|
+
const _errs44 = errors;
|
|
617
|
+
if (errors === _errs44) {
|
|
618
|
+
if (typeof data20 === "string") {
|
|
619
|
+
if (!pattern4.test(data20)) {
|
|
620
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/claimed_at", schemaPath: "#/$defs/timestamp/pattern", keyword: "pattern", params: { pattern: "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$" }, message: 'must match pattern "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$"' }];
|
|
621
|
+
return false;
|
|
622
|
+
}
|
|
623
|
+
} else {
|
|
624
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/claimed_at", schemaPath: "#/$defs/timestamp/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
625
|
+
return false;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
var valid10 = _errs43 === errors;
|
|
629
|
+
} else {
|
|
630
|
+
var valid10 = true;
|
|
631
|
+
}
|
|
632
|
+
if (valid10) {
|
|
633
|
+
if (data16.client_claim_id !== void 0) {
|
|
634
|
+
let data21 = data16.client_claim_id;
|
|
635
|
+
const _errs46 = errors;
|
|
636
|
+
if (errors === _errs46) {
|
|
637
|
+
if (typeof data21 === "string") {
|
|
638
|
+
if (func1(data21) > 256) {
|
|
639
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/client_claim_id", schemaPath: "#/properties/claim/properties/client_claim_id/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
} else {
|
|
643
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/client_claim_id", schemaPath: "#/properties/claim/properties/client_claim_id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
var valid10 = _errs46 === errors;
|
|
648
|
+
} else {
|
|
649
|
+
var valid10 = true;
|
|
650
|
+
}
|
|
651
|
+
if (valid10) {
|
|
652
|
+
if (data16.claim_digest !== void 0) {
|
|
653
|
+
let data22 = data16.claim_digest;
|
|
654
|
+
const _errs48 = errors;
|
|
655
|
+
const _errs49 = errors;
|
|
656
|
+
if (errors === _errs49) {
|
|
657
|
+
if (typeof data22 === "string") {
|
|
658
|
+
if (!pattern9.test(data22)) {
|
|
659
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/claim_digest", schemaPath: "#/$defs/b64url/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: 'must match pattern "^[A-Za-z0-9_-]+$"' }];
|
|
660
|
+
return false;
|
|
661
|
+
}
|
|
662
|
+
} else {
|
|
663
|
+
validate21.errors = [{ instancePath: instancePath + "/claim/claim_digest", schemaPath: "#/$defs/b64url/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
664
|
+
return false;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
var valid10 = _errs48 === errors;
|
|
668
|
+
} else {
|
|
669
|
+
var valid10 = true;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
} else {
|
|
678
|
+
validate21.errors = [{ instancePath: instancePath + "/claim", schemaPath: "#/properties/claim/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
679
|
+
return false;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
var valid4 = _errs34 === errors;
|
|
683
|
+
} else {
|
|
684
|
+
var valid4 = true;
|
|
685
|
+
}
|
|
686
|
+
if (valid4) {
|
|
687
|
+
if (data.observation !== void 0) {
|
|
688
|
+
let data23 = data.observation;
|
|
689
|
+
const _errs51 = errors;
|
|
690
|
+
if (errors === _errs51) {
|
|
691
|
+
if (data23 && typeof data23 == "object" && !Array.isArray(data23)) {
|
|
692
|
+
let missing7;
|
|
693
|
+
if (data23.verifier === void 0 && (missing7 = "verifier") || data23.observed_at === void 0 && (missing7 = "observed_at") || data23.deadline_at === void 0 && (missing7 = "deadline_at") || data23.attempts === void 0 && (missing7 = "attempts") || data23.facts === void 0 && (missing7 = "facts")) {
|
|
694
|
+
validate21.errors = [{ instancePath: instancePath + "/observation", schemaPath: "#/properties/observation/required", keyword: "required", params: { missingProperty: missing7 }, message: "must have required property '" + missing7 + "'" }];
|
|
695
|
+
return false;
|
|
696
|
+
} else {
|
|
697
|
+
if (data23.verifier !== void 0) {
|
|
698
|
+
let data24 = data23.verifier;
|
|
699
|
+
const _errs53 = errors;
|
|
700
|
+
if (errors === _errs53) {
|
|
701
|
+
if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
|
|
702
|
+
let missing8;
|
|
703
|
+
if (data24.id === void 0 && (missing8 = "id") || data24.version === void 0 && (missing8 = "version")) {
|
|
704
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/verifier", schemaPath: "#/properties/observation/properties/verifier/required", keyword: "required", params: { missingProperty: missing8 }, message: "must have required property '" + missing8 + "'" }];
|
|
705
|
+
return false;
|
|
706
|
+
} else {
|
|
707
|
+
if (data24.id !== void 0) {
|
|
708
|
+
let data25 = data24.id;
|
|
709
|
+
const _errs55 = errors;
|
|
710
|
+
const _errs56 = errors;
|
|
711
|
+
if (errors === _errs56) {
|
|
712
|
+
if (typeof data25 === "string") {
|
|
713
|
+
if (!pattern7.test(data25)) {
|
|
714
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/verifier/id", schemaPath: "#/$defs/action/pattern", keyword: "pattern", params: { pattern: "^[a-z0-9]+(\\.[a-z0-9_]+){2}$" }, message: 'must match pattern "^[a-z0-9]+(\\.[a-z0-9_]+){2}$"' }];
|
|
715
|
+
return false;
|
|
716
|
+
}
|
|
717
|
+
} else {
|
|
718
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/verifier/id", schemaPath: "#/$defs/action/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
719
|
+
return false;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
var valid15 = _errs55 === errors;
|
|
723
|
+
} else {
|
|
724
|
+
var valid15 = true;
|
|
725
|
+
}
|
|
726
|
+
if (valid15) {
|
|
727
|
+
if (data24.version !== void 0) {
|
|
728
|
+
let data26 = data24.version;
|
|
729
|
+
const _errs58 = errors;
|
|
730
|
+
if (errors === _errs58) {
|
|
731
|
+
if (typeof data26 === "string") {
|
|
732
|
+
if (!pattern11.test(data26)) {
|
|
733
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/verifier/version", schemaPath: "#/properties/observation/properties/verifier/properties/version/pattern", keyword: "pattern", params: { pattern: "^\\d+$" }, message: 'must match pattern "^\\d+$"' }];
|
|
734
|
+
return false;
|
|
735
|
+
}
|
|
736
|
+
} else {
|
|
737
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/verifier/version", schemaPath: "#/properties/observation/properties/verifier/properties/version/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
738
|
+
return false;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
var valid15 = _errs58 === errors;
|
|
742
|
+
} else {
|
|
743
|
+
var valid15 = true;
|
|
744
|
+
}
|
|
745
|
+
if (valid15) {
|
|
746
|
+
if (data24.code_hash !== void 0) {
|
|
747
|
+
let data27 = data24.code_hash;
|
|
748
|
+
const _errs60 = errors;
|
|
749
|
+
const _errs61 = errors;
|
|
750
|
+
if (errors === _errs61) {
|
|
751
|
+
if (typeof data27 === "string") {
|
|
752
|
+
if (!pattern12.test(data27)) {
|
|
753
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/verifier/code_hash", schemaPath: "#/$defs/fingerprint/pattern", keyword: "pattern", params: { pattern: "^sha256:[A-Za-z0-9_-]{43}$" }, message: 'must match pattern "^sha256:[A-Za-z0-9_-]{43}$"' }];
|
|
754
|
+
return false;
|
|
755
|
+
}
|
|
756
|
+
} else {
|
|
757
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/verifier/code_hash", schemaPath: "#/$defs/fingerprint/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
758
|
+
return false;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
var valid15 = _errs60 === errors;
|
|
762
|
+
} else {
|
|
763
|
+
var valid15 = true;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
} else {
|
|
769
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/verifier", schemaPath: "#/properties/observation/properties/verifier/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
770
|
+
return false;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
var valid14 = _errs53 === errors;
|
|
774
|
+
} else {
|
|
775
|
+
var valid14 = true;
|
|
776
|
+
}
|
|
777
|
+
if (valid14) {
|
|
778
|
+
if (data23.observed_at !== void 0) {
|
|
779
|
+
let data28 = data23.observed_at;
|
|
780
|
+
const _errs63 = errors;
|
|
781
|
+
const _errs64 = errors;
|
|
782
|
+
if (errors === _errs64) {
|
|
783
|
+
if (typeof data28 === "string") {
|
|
784
|
+
if (!pattern4.test(data28)) {
|
|
785
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/observed_at", schemaPath: "#/$defs/timestamp/pattern", keyword: "pattern", params: { pattern: "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$" }, message: 'must match pattern "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$"' }];
|
|
786
|
+
return false;
|
|
787
|
+
}
|
|
788
|
+
} else {
|
|
789
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/observed_at", schemaPath: "#/$defs/timestamp/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
790
|
+
return false;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
var valid14 = _errs63 === errors;
|
|
794
|
+
} else {
|
|
795
|
+
var valid14 = true;
|
|
796
|
+
}
|
|
797
|
+
if (valid14) {
|
|
798
|
+
if (data23.deadline_at !== void 0) {
|
|
799
|
+
let data29 = data23.deadline_at;
|
|
800
|
+
const _errs66 = errors;
|
|
801
|
+
const _errs67 = errors;
|
|
802
|
+
if (errors === _errs67) {
|
|
803
|
+
if (typeof data29 === "string") {
|
|
804
|
+
if (!pattern4.test(data29)) {
|
|
805
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/deadline_at", schemaPath: "#/$defs/timestamp/pattern", keyword: "pattern", params: { pattern: "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$" }, message: 'must match pattern "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$"' }];
|
|
806
|
+
return false;
|
|
807
|
+
}
|
|
808
|
+
} else {
|
|
809
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/deadline_at", schemaPath: "#/$defs/timestamp/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
810
|
+
return false;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
var valid14 = _errs66 === errors;
|
|
814
|
+
} else {
|
|
815
|
+
var valid14 = true;
|
|
816
|
+
}
|
|
817
|
+
if (valid14) {
|
|
818
|
+
if (data23.attempts !== void 0) {
|
|
819
|
+
let data30 = data23.attempts;
|
|
820
|
+
const _errs69 = errors;
|
|
821
|
+
if (!(typeof data30 == "number" && (!(data30 % 1) && !isNaN(data30)))) {
|
|
822
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/attempts", schemaPath: "#/properties/observation/properties/attempts/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
823
|
+
return false;
|
|
824
|
+
}
|
|
825
|
+
if (errors === _errs69) {
|
|
826
|
+
if (typeof data30 == "number") {
|
|
827
|
+
if (data30 < 1 || isNaN(data30)) {
|
|
828
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/attempts", schemaPath: "#/properties/observation/properties/attempts/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" }];
|
|
829
|
+
return false;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
var valid14 = _errs69 === errors;
|
|
834
|
+
} else {
|
|
835
|
+
var valid14 = true;
|
|
836
|
+
}
|
|
837
|
+
if (valid14) {
|
|
838
|
+
if (data23.facts !== void 0) {
|
|
839
|
+
let data31 = data23.facts;
|
|
840
|
+
const _errs71 = errors;
|
|
841
|
+
if (!(data31 && typeof data31 == "object" && !Array.isArray(data31))) {
|
|
842
|
+
validate21.errors = [{ instancePath: instancePath + "/observation/facts", schemaPath: "#/properties/observation/properties/facts/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
843
|
+
return false;
|
|
844
|
+
}
|
|
845
|
+
var valid14 = _errs71 === errors;
|
|
846
|
+
} else {
|
|
847
|
+
var valid14 = true;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
} else {
|
|
855
|
+
validate21.errors = [{ instancePath: instancePath + "/observation", schemaPath: "#/properties/observation/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
856
|
+
return false;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
var valid4 = _errs51 === errors;
|
|
860
|
+
} else {
|
|
861
|
+
var valid4 = true;
|
|
862
|
+
}
|
|
863
|
+
if (valid4) {
|
|
864
|
+
if (data.verdict !== void 0) {
|
|
865
|
+
let data32 = data.verdict;
|
|
866
|
+
const _errs73 = errors;
|
|
867
|
+
const _errs75 = errors;
|
|
868
|
+
let valid20 = true;
|
|
869
|
+
const _errs76 = errors;
|
|
870
|
+
if (data32 && typeof data32 == "object" && !Array.isArray(data32)) {
|
|
871
|
+
if (data32.value !== void 0) {
|
|
872
|
+
if ("unverifiable" !== data32.value) {
|
|
873
|
+
const err2 = {};
|
|
874
|
+
if (vErrors === null) {
|
|
875
|
+
vErrors = [err2];
|
|
876
|
+
} else {
|
|
877
|
+
vErrors.push(err2);
|
|
878
|
+
}
|
|
879
|
+
errors++;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
var _valid1 = _errs76 === errors;
|
|
884
|
+
errors = _errs75;
|
|
885
|
+
if (vErrors !== null) {
|
|
886
|
+
if (_errs75) {
|
|
887
|
+
vErrors.length = _errs75;
|
|
888
|
+
} else {
|
|
889
|
+
vErrors = null;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
if (_valid1) {
|
|
893
|
+
const _errs78 = errors;
|
|
894
|
+
if (data32 && typeof data32 == "object" && !Array.isArray(data32)) {
|
|
895
|
+
let missing9;
|
|
896
|
+
if (data32.value === void 0 && (missing9 = "value") || data32.reason_code === void 0 && (missing9 = "reason_code")) {
|
|
897
|
+
validate21.errors = [{ instancePath: instancePath + "/verdict", schemaPath: "#/properties/verdict/then/required", keyword: "required", params: { missingProperty: missing9 }, message: "must have required property '" + missing9 + "'" }];
|
|
898
|
+
return false;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
var _valid1 = _errs78 === errors;
|
|
902
|
+
valid20 = _valid1;
|
|
903
|
+
}
|
|
904
|
+
if (!valid20) {
|
|
905
|
+
const err3 = { instancePath: instancePath + "/verdict", schemaPath: "#/properties/verdict/if", keyword: "if", params: { failingKeyword: "then" }, message: 'must match "then" schema' };
|
|
906
|
+
if (vErrors === null) {
|
|
907
|
+
vErrors = [err3];
|
|
908
|
+
} else {
|
|
909
|
+
vErrors.push(err3);
|
|
910
|
+
}
|
|
911
|
+
errors++;
|
|
912
|
+
validate21.errors = vErrors;
|
|
913
|
+
return false;
|
|
914
|
+
}
|
|
915
|
+
if (errors === _errs73) {
|
|
916
|
+
if (data32 && typeof data32 == "object" && !Array.isArray(data32)) {
|
|
917
|
+
let missing10;
|
|
918
|
+
if (data32.value === void 0 && (missing10 = "value")) {
|
|
919
|
+
validate21.errors = [{ instancePath: instancePath + "/verdict", schemaPath: "#/properties/verdict/required", keyword: "required", params: { missingProperty: missing10 }, message: "must have required property '" + missing10 + "'" }];
|
|
920
|
+
return false;
|
|
921
|
+
} else {
|
|
922
|
+
if (data32.value !== void 0) {
|
|
923
|
+
let data34 = data32.value;
|
|
924
|
+
const _errs79 = errors;
|
|
925
|
+
if (!(data34 === "verified" || data34 === "late" || data34 === "mismatch" || data34 === "failed" || data34 === "unverifiable")) {
|
|
926
|
+
validate21.errors = [{ instancePath: instancePath + "/verdict/value", schemaPath: "#/$defs/verdictValue/enum", keyword: "enum", params: { allowedValues: schema42.enum }, message: "must be equal to one of the allowed values" }];
|
|
927
|
+
return false;
|
|
928
|
+
}
|
|
929
|
+
var valid22 = _errs79 === errors;
|
|
930
|
+
} else {
|
|
931
|
+
var valid22 = true;
|
|
932
|
+
}
|
|
933
|
+
if (valid22) {
|
|
934
|
+
if (data32.reason_code !== void 0) {
|
|
935
|
+
let data35 = data32.reason_code;
|
|
936
|
+
const _errs81 = errors;
|
|
937
|
+
if (!(data35 === "not_found" || data35 === "content_mismatch" || data35 === "target_mismatch" || data35 === "observed_after_tolerance" || data35 === "no_connection" || data35 === "permission_denied" || data35 === "rate_limited" || data35 === "destination_unavailable" || data35 === "unsupported_action" || data35 === "claim_ambiguous" || data35 === "verifier_error")) {
|
|
938
|
+
validate21.errors = [{ instancePath: instancePath + "/verdict/reason_code", schemaPath: "#/$defs/reasonCode/enum", keyword: "enum", params: { allowedValues: schema43.enum }, message: "must be equal to one of the allowed values" }];
|
|
939
|
+
return false;
|
|
940
|
+
}
|
|
941
|
+
var valid22 = _errs81 === errors;
|
|
942
|
+
} else {
|
|
943
|
+
var valid22 = true;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
} else {
|
|
948
|
+
validate21.errors = [{ instancePath: instancePath + "/verdict", schemaPath: "#/properties/verdict/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
var valid4 = _errs73 === errors;
|
|
953
|
+
} else {
|
|
954
|
+
var valid4 = true;
|
|
955
|
+
}
|
|
956
|
+
if (valid4) {
|
|
957
|
+
if (data.trust_level !== void 0) {
|
|
958
|
+
let data36 = data.trust_level;
|
|
959
|
+
const _errs83 = errors;
|
|
960
|
+
if (!(typeof data36 == "number" && (!(data36 % 1) && !isNaN(data36)))) {
|
|
961
|
+
validate21.errors = [{ instancePath: instancePath + "/trust_level", schemaPath: "#/properties/trust_level/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
962
|
+
return false;
|
|
963
|
+
}
|
|
964
|
+
if (errors === _errs83) {
|
|
965
|
+
if (typeof data36 == "number") {
|
|
966
|
+
if (data36 > 4 || isNaN(data36)) {
|
|
967
|
+
validate21.errors = [{ instancePath: instancePath + "/trust_level", schemaPath: "#/properties/trust_level/maximum", keyword: "maximum", params: { comparison: "<=", limit: 4 }, message: "must be <= 4" }];
|
|
968
|
+
return false;
|
|
969
|
+
} else {
|
|
970
|
+
if (data36 < 1 || isNaN(data36)) {
|
|
971
|
+
validate21.errors = [{ instancePath: instancePath + "/trust_level", schemaPath: "#/properties/trust_level/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" }];
|
|
972
|
+
return false;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
var valid4 = _errs83 === errors;
|
|
978
|
+
} else {
|
|
979
|
+
var valid4 = true;
|
|
980
|
+
}
|
|
981
|
+
if (valid4) {
|
|
982
|
+
if (data.attestation !== void 0) {
|
|
983
|
+
let data37 = data.attestation;
|
|
984
|
+
const _errs85 = errors;
|
|
985
|
+
if (errors === _errs85) {
|
|
986
|
+
if (data37 && typeof data37 == "object" && !Array.isArray(data37)) {
|
|
987
|
+
let missing11;
|
|
988
|
+
if (data37.type === void 0 && (missing11 = "type") || data37.document === void 0 && (missing11 = "document")) {
|
|
989
|
+
validate21.errors = [{ instancePath: instancePath + "/attestation", schemaPath: "#/properties/attestation/required", keyword: "required", params: { missingProperty: missing11 }, message: "must have required property '" + missing11 + "'" }];
|
|
990
|
+
return false;
|
|
991
|
+
} else {
|
|
992
|
+
if (data37.type !== void 0) {
|
|
993
|
+
const _errs87 = errors;
|
|
994
|
+
if (typeof data37.type !== "string") {
|
|
995
|
+
validate21.errors = [{ instancePath: instancePath + "/attestation/type", schemaPath: "#/properties/attestation/properties/type/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
996
|
+
return false;
|
|
997
|
+
}
|
|
998
|
+
var valid25 = _errs87 === errors;
|
|
999
|
+
} else {
|
|
1000
|
+
var valid25 = true;
|
|
1001
|
+
}
|
|
1002
|
+
if (valid25) {
|
|
1003
|
+
if (data37.document !== void 0) {
|
|
1004
|
+
let data39 = data37.document;
|
|
1005
|
+
const _errs89 = errors;
|
|
1006
|
+
const _errs90 = errors;
|
|
1007
|
+
if (errors === _errs90) {
|
|
1008
|
+
if (typeof data39 === "string") {
|
|
1009
|
+
if (!pattern9.test(data39)) {
|
|
1010
|
+
validate21.errors = [{ instancePath: instancePath + "/attestation/document", schemaPath: "#/$defs/b64url/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: 'must match pattern "^[A-Za-z0-9_-]+$"' }];
|
|
1011
|
+
return false;
|
|
1012
|
+
}
|
|
1013
|
+
} else {
|
|
1014
|
+
validate21.errors = [{ instancePath: instancePath + "/attestation/document", schemaPath: "#/$defs/b64url/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1015
|
+
return false;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
var valid25 = _errs89 === errors;
|
|
1019
|
+
} else {
|
|
1020
|
+
var valid25 = true;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
} else {
|
|
1025
|
+
validate21.errors = [{ instancePath: instancePath + "/attestation", schemaPath: "#/properties/attestation/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1026
|
+
return false;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
var valid4 = _errs85 === errors;
|
|
1030
|
+
} else {
|
|
1031
|
+
var valid4 = true;
|
|
1032
|
+
}
|
|
1033
|
+
if (valid4) {
|
|
1034
|
+
if (data.supersedes !== void 0) {
|
|
1035
|
+
const _errs92 = errors;
|
|
1036
|
+
if (typeof data.supersedes !== "string") {
|
|
1037
|
+
validate21.errors = [{ instancePath: instancePath + "/supersedes", schemaPath: "#/properties/supersedes/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1038
|
+
return false;
|
|
1039
|
+
}
|
|
1040
|
+
var valid4 = _errs92 === errors;
|
|
1041
|
+
} else {
|
|
1042
|
+
var valid4 = true;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
417
1051
|
}
|
|
418
1052
|
}
|
|
419
|
-
},
|
|
420
|
-
"then": {
|
|
421
|
-
"required": [
|
|
422
|
-
"value",
|
|
423
|
-
"reason_code"
|
|
424
|
-
]
|
|
425
1053
|
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
} else {
|
|
1057
|
+
validate21.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1058
|
+
return false;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
validate21.errors = vErrors;
|
|
1062
|
+
evaluated0.props = props0;
|
|
1063
|
+
return errors === 0;
|
|
1064
|
+
}
|
|
1065
|
+
validate21.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
1066
|
+
var pattern17 = new RegExp("^[A-Za-z0-9_-]{86}$", "u");
|
|
1067
|
+
function validate23(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
1068
|
+
let vErrors = null;
|
|
1069
|
+
let errors = 0;
|
|
1070
|
+
const evaluated0 = validate23.evaluated;
|
|
1071
|
+
if (evaluated0.dynamicProps) {
|
|
1072
|
+
evaluated0.props = void 0;
|
|
1073
|
+
}
|
|
1074
|
+
if (evaluated0.dynamicItems) {
|
|
1075
|
+
evaluated0.items = void 0;
|
|
1076
|
+
}
|
|
1077
|
+
if (errors === 0) {
|
|
1078
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1079
|
+
let missing0;
|
|
1080
|
+
if (data.alg === void 0 && (missing0 = "alg") || data.key_id === void 0 && (missing0 = "key_id") || data.value === void 0 && (missing0 = "value")) {
|
|
1081
|
+
validate23.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
1082
|
+
return false;
|
|
1083
|
+
} else {
|
|
1084
|
+
const _errs1 = errors;
|
|
1085
|
+
for (const key0 in data) {
|
|
1086
|
+
if (!(key0 === "alg" || key0 === "key_id" || key0 === "value")) {
|
|
1087
|
+
validate23.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
|
|
1088
|
+
return false;
|
|
1089
|
+
break;
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
if (_errs1 === errors) {
|
|
1093
|
+
if (data.alg !== void 0) {
|
|
1094
|
+
const _errs2 = errors;
|
|
1095
|
+
if ("Ed25519" !== data.alg) {
|
|
1096
|
+
validate23.errors = [{ instancePath: instancePath + "/alg", schemaPath: "#/properties/alg/const", keyword: "const", params: { allowedValue: "Ed25519" }, message: "must be equal to constant" }];
|
|
1097
|
+
return false;
|
|
1098
|
+
}
|
|
1099
|
+
var valid0 = _errs2 === errors;
|
|
1100
|
+
} else {
|
|
1101
|
+
var valid0 = true;
|
|
1102
|
+
}
|
|
1103
|
+
if (valid0) {
|
|
1104
|
+
if (data.key_id !== void 0) {
|
|
1105
|
+
let data1 = data.key_id;
|
|
1106
|
+
const _errs3 = errors;
|
|
1107
|
+
const _errs4 = errors;
|
|
1108
|
+
if (errors === _errs4) {
|
|
1109
|
+
if (typeof data1 === "string") {
|
|
1110
|
+
if (!pattern5.test(data1)) {
|
|
1111
|
+
validate23.errors = [{ instancePath: instancePath + "/key_id", schemaPath: "#/$defs/keyId/pattern", keyword: "pattern", params: { pattern: "^ed25519:[A-Za-z0-9_-]{43}$" }, message: 'must match pattern "^ed25519:[A-Za-z0-9_-]{43}$"' }];
|
|
1112
|
+
return false;
|
|
1113
|
+
}
|
|
1114
|
+
} else {
|
|
1115
|
+
validate23.errors = [{ instancePath: instancePath + "/key_id", schemaPath: "#/$defs/keyId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1116
|
+
return false;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
var valid0 = _errs3 === errors;
|
|
1120
|
+
} else {
|
|
1121
|
+
var valid0 = true;
|
|
1122
|
+
}
|
|
1123
|
+
if (valid0) {
|
|
1124
|
+
if (data.value !== void 0) {
|
|
1125
|
+
let data2 = data.value;
|
|
1126
|
+
const _errs6 = errors;
|
|
1127
|
+
if (errors === _errs6) {
|
|
1128
|
+
if (typeof data2 === "string") {
|
|
1129
|
+
if (!pattern17.test(data2)) {
|
|
1130
|
+
validate23.errors = [{ instancePath: instancePath + "/value", schemaPath: "#/properties/value/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]{86}$" }, message: 'must match pattern "^[A-Za-z0-9_-]{86}$"' }];
|
|
1131
|
+
return false;
|
|
1132
|
+
}
|
|
1133
|
+
} else {
|
|
1134
|
+
validate23.errors = [{ instancePath: instancePath + "/value", schemaPath: "#/properties/value/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1135
|
+
return false;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
var valid0 = _errs6 === errors;
|
|
1139
|
+
} else {
|
|
1140
|
+
var valid0 = true;
|
|
1141
|
+
}
|
|
444
1142
|
}
|
|
445
1143
|
}
|
|
446
|
-
},
|
|
447
|
-
"supersedes": {
|
|
448
|
-
"type": "string"
|
|
449
1144
|
}
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
1145
|
+
}
|
|
1146
|
+
} else {
|
|
1147
|
+
validate23.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1148
|
+
return false;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
validate23.errors = vErrors;
|
|
1152
|
+
return errors === 0;
|
|
1153
|
+
}
|
|
1154
|
+
validate23.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
1155
|
+
var pattern21 = new RegExp("^0x[0-9a-fA-F]{64}$", "u");
|
|
1156
|
+
function validate25(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
1157
|
+
let vErrors = null;
|
|
1158
|
+
let errors = 0;
|
|
1159
|
+
const evaluated0 = validate25.evaluated;
|
|
1160
|
+
if (evaluated0.dynamicProps) {
|
|
1161
|
+
evaluated0.props = void 0;
|
|
1162
|
+
}
|
|
1163
|
+
if (evaluated0.dynamicItems) {
|
|
1164
|
+
evaluated0.items = void 0;
|
|
1165
|
+
}
|
|
1166
|
+
if (errors === 0) {
|
|
1167
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1168
|
+
let missing0;
|
|
1169
|
+
if (data.log_id === void 0 && (missing0 = "log_id") || data.leaf_index === void 0 && (missing0 = "leaf_index") || data.tree_size === void 0 && (missing0 = "tree_size") || data.root_hash === void 0 && (missing0 = "root_hash") || data.inclusion === void 0 && (missing0 = "inclusion")) {
|
|
1170
|
+
validate25.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
1171
|
+
return false;
|
|
1172
|
+
} else {
|
|
1173
|
+
if (data.log_id !== void 0) {
|
|
1174
|
+
let data0 = data.log_id;
|
|
1175
|
+
const _errs1 = errors;
|
|
1176
|
+
const _errs2 = errors;
|
|
1177
|
+
if (errors === _errs2) {
|
|
1178
|
+
if (typeof data0 === "string") {
|
|
1179
|
+
if (!pattern9.test(data0)) {
|
|
1180
|
+
validate25.errors = [{ instancePath: instancePath + "/log_id", schemaPath: "#/$defs/b64url/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: 'must match pattern "^[A-Za-z0-9_-]+$"' }];
|
|
1181
|
+
return false;
|
|
1182
|
+
}
|
|
1183
|
+
} else {
|
|
1184
|
+
validate25.errors = [{ instancePath: instancePath + "/log_id", schemaPath: "#/$defs/b64url/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1185
|
+
return false;
|
|
1186
|
+
}
|
|
455
1187
|
}
|
|
1188
|
+
var valid0 = _errs1 === errors;
|
|
1189
|
+
} else {
|
|
1190
|
+
var valid0 = true;
|
|
456
1191
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
"
|
|
469
|
-
|
|
470
|
-
|
|
1192
|
+
if (valid0) {
|
|
1193
|
+
if (data.leaf_index !== void 0) {
|
|
1194
|
+
let data1 = data.leaf_index;
|
|
1195
|
+
const _errs4 = errors;
|
|
1196
|
+
if (!(typeof data1 == "number" && (!(data1 % 1) && !isNaN(data1)))) {
|
|
1197
|
+
validate25.errors = [{ instancePath: instancePath + "/leaf_index", schemaPath: "#/properties/leaf_index/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
1198
|
+
return false;
|
|
1199
|
+
}
|
|
1200
|
+
if (errors === _errs4) {
|
|
1201
|
+
if (typeof data1 == "number") {
|
|
1202
|
+
if (data1 < 0 || isNaN(data1)) {
|
|
1203
|
+
validate25.errors = [{ instancePath: instancePath + "/leaf_index", schemaPath: "#/properties/leaf_index/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
1204
|
+
return false;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
var valid0 = _errs4 === errors;
|
|
1209
|
+
} else {
|
|
1210
|
+
var valid0 = true;
|
|
1211
|
+
}
|
|
1212
|
+
if (valid0) {
|
|
1213
|
+
if (data.tree_size !== void 0) {
|
|
1214
|
+
let data2 = data.tree_size;
|
|
1215
|
+
const _errs6 = errors;
|
|
1216
|
+
if (!(typeof data2 == "number" && (!(data2 % 1) && !isNaN(data2)))) {
|
|
1217
|
+
validate25.errors = [{ instancePath: instancePath + "/tree_size", schemaPath: "#/properties/tree_size/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
1218
|
+
return false;
|
|
1219
|
+
}
|
|
1220
|
+
if (errors === _errs6) {
|
|
1221
|
+
if (typeof data2 == "number") {
|
|
1222
|
+
if (data2 < 1 || isNaN(data2)) {
|
|
1223
|
+
validate25.errors = [{ instancePath: instancePath + "/tree_size", schemaPath: "#/properties/tree_size/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" }];
|
|
1224
|
+
return false;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
var valid0 = _errs6 === errors;
|
|
1229
|
+
} else {
|
|
1230
|
+
var valid0 = true;
|
|
1231
|
+
}
|
|
1232
|
+
if (valid0) {
|
|
1233
|
+
if (data.root_hash !== void 0) {
|
|
1234
|
+
let data3 = data.root_hash;
|
|
1235
|
+
const _errs8 = errors;
|
|
1236
|
+
const _errs9 = errors;
|
|
1237
|
+
if (errors === _errs9) {
|
|
1238
|
+
if (typeof data3 === "string") {
|
|
1239
|
+
if (!pattern9.test(data3)) {
|
|
1240
|
+
validate25.errors = [{ instancePath: instancePath + "/root_hash", schemaPath: "#/$defs/b64url/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: 'must match pattern "^[A-Za-z0-9_-]+$"' }];
|
|
1241
|
+
return false;
|
|
1242
|
+
}
|
|
1243
|
+
} else {
|
|
1244
|
+
validate25.errors = [{ instancePath: instancePath + "/root_hash", schemaPath: "#/$defs/b64url/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1245
|
+
return false;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
var valid0 = _errs8 === errors;
|
|
1249
|
+
} else {
|
|
1250
|
+
var valid0 = true;
|
|
1251
|
+
}
|
|
1252
|
+
if (valid0) {
|
|
1253
|
+
if (data.inclusion !== void 0) {
|
|
1254
|
+
let data4 = data.inclusion;
|
|
1255
|
+
const _errs11 = errors;
|
|
1256
|
+
if (errors === _errs11) {
|
|
1257
|
+
if (Array.isArray(data4)) {
|
|
1258
|
+
var valid3 = true;
|
|
1259
|
+
const len0 = data4.length;
|
|
1260
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
1261
|
+
let data5 = data4[i0];
|
|
1262
|
+
const _errs13 = errors;
|
|
1263
|
+
const _errs14 = errors;
|
|
1264
|
+
if (errors === _errs14) {
|
|
1265
|
+
if (typeof data5 === "string") {
|
|
1266
|
+
if (!pattern9.test(data5)) {
|
|
1267
|
+
validate25.errors = [{ instancePath: instancePath + "/inclusion/" + i0, schemaPath: "#/$defs/b64url/pattern", keyword: "pattern", params: { pattern: "^[A-Za-z0-9_-]+$" }, message: 'must match pattern "^[A-Za-z0-9_-]+$"' }];
|
|
1268
|
+
return false;
|
|
1269
|
+
}
|
|
1270
|
+
} else {
|
|
1271
|
+
validate25.errors = [{ instancePath: instancePath + "/inclusion/" + i0, schemaPath: "#/$defs/b64url/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1272
|
+
return false;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
var valid3 = _errs13 === errors;
|
|
1276
|
+
if (!valid3) {
|
|
1277
|
+
break;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
} else {
|
|
1281
|
+
validate25.errors = [{ instancePath: instancePath + "/inclusion", schemaPath: "#/properties/inclusion/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
1282
|
+
return false;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
var valid0 = _errs11 === errors;
|
|
1286
|
+
} else {
|
|
1287
|
+
var valid0 = true;
|
|
1288
|
+
}
|
|
1289
|
+
if (valid0) {
|
|
1290
|
+
if (data.anchor !== void 0) {
|
|
1291
|
+
let data6 = data.anchor;
|
|
1292
|
+
const _errs16 = errors;
|
|
1293
|
+
if (errors === _errs16) {
|
|
1294
|
+
if (data6 && typeof data6 == "object" && !Array.isArray(data6)) {
|
|
1295
|
+
let missing1;
|
|
1296
|
+
if (data6.chain === void 0 && (missing1 = "chain") || data6.scheme === void 0 && (missing1 = "scheme") || data6.uid === void 0 && (missing1 = "uid") || data6.tx_hash === void 0 && (missing1 = "tx_hash") || data6.tree_size === void 0 && (missing1 = "tree_size")) {
|
|
1297
|
+
validate25.errors = [{ instancePath: instancePath + "/anchor", schemaPath: "#/properties/anchor/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
1298
|
+
return false;
|
|
1299
|
+
} else {
|
|
1300
|
+
if (data6.chain !== void 0) {
|
|
1301
|
+
const _errs18 = errors;
|
|
1302
|
+
if (typeof data6.chain !== "string") {
|
|
1303
|
+
validate25.errors = [{ instancePath: instancePath + "/anchor/chain", schemaPath: "#/properties/anchor/properties/chain/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1304
|
+
return false;
|
|
1305
|
+
}
|
|
1306
|
+
var valid5 = _errs18 === errors;
|
|
1307
|
+
} else {
|
|
1308
|
+
var valid5 = true;
|
|
1309
|
+
}
|
|
1310
|
+
if (valid5) {
|
|
1311
|
+
if (data6.scheme !== void 0) {
|
|
1312
|
+
const _errs20 = errors;
|
|
1313
|
+
if ("eas" !== data6.scheme) {
|
|
1314
|
+
validate25.errors = [{ instancePath: instancePath + "/anchor/scheme", schemaPath: "#/properties/anchor/properties/scheme/const", keyword: "const", params: { allowedValue: "eas" }, message: "must be equal to constant" }];
|
|
1315
|
+
return false;
|
|
1316
|
+
}
|
|
1317
|
+
var valid5 = _errs20 === errors;
|
|
1318
|
+
} else {
|
|
1319
|
+
var valid5 = true;
|
|
1320
|
+
}
|
|
1321
|
+
if (valid5) {
|
|
1322
|
+
if (data6.uid !== void 0) {
|
|
1323
|
+
let data9 = data6.uid;
|
|
1324
|
+
const _errs21 = errors;
|
|
1325
|
+
if (errors === _errs21) {
|
|
1326
|
+
if (typeof data9 === "string") {
|
|
1327
|
+
if (!pattern21.test(data9)) {
|
|
1328
|
+
validate25.errors = [{ instancePath: instancePath + "/anchor/uid", schemaPath: "#/properties/anchor/properties/uid/pattern", keyword: "pattern", params: { pattern: "^0x[0-9a-fA-F]{64}$" }, message: 'must match pattern "^0x[0-9a-fA-F]{64}$"' }];
|
|
1329
|
+
return false;
|
|
1330
|
+
}
|
|
1331
|
+
} else {
|
|
1332
|
+
validate25.errors = [{ instancePath: instancePath + "/anchor/uid", schemaPath: "#/properties/anchor/properties/uid/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1333
|
+
return false;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
var valid5 = _errs21 === errors;
|
|
1337
|
+
} else {
|
|
1338
|
+
var valid5 = true;
|
|
1339
|
+
}
|
|
1340
|
+
if (valid5) {
|
|
1341
|
+
if (data6.tx_hash !== void 0) {
|
|
1342
|
+
let data10 = data6.tx_hash;
|
|
1343
|
+
const _errs23 = errors;
|
|
1344
|
+
if (errors === _errs23) {
|
|
1345
|
+
if (typeof data10 === "string") {
|
|
1346
|
+
if (!pattern21.test(data10)) {
|
|
1347
|
+
validate25.errors = [{ instancePath: instancePath + "/anchor/tx_hash", schemaPath: "#/properties/anchor/properties/tx_hash/pattern", keyword: "pattern", params: { pattern: "^0x[0-9a-fA-F]{64}$" }, message: 'must match pattern "^0x[0-9a-fA-F]{64}$"' }];
|
|
1348
|
+
return false;
|
|
1349
|
+
}
|
|
1350
|
+
} else {
|
|
1351
|
+
validate25.errors = [{ instancePath: instancePath + "/anchor/tx_hash", schemaPath: "#/properties/anchor/properties/tx_hash/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1352
|
+
return false;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
var valid5 = _errs23 === errors;
|
|
1356
|
+
} else {
|
|
1357
|
+
var valid5 = true;
|
|
1358
|
+
}
|
|
1359
|
+
if (valid5) {
|
|
1360
|
+
if (data6.tree_size !== void 0) {
|
|
1361
|
+
let data11 = data6.tree_size;
|
|
1362
|
+
const _errs25 = errors;
|
|
1363
|
+
if (!(typeof data11 == "number" && (!(data11 % 1) && !isNaN(data11)))) {
|
|
1364
|
+
validate25.errors = [{ instancePath: instancePath + "/anchor/tree_size", schemaPath: "#/properties/anchor/properties/tree_size/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
1365
|
+
return false;
|
|
1366
|
+
}
|
|
1367
|
+
if (errors === _errs25) {
|
|
1368
|
+
if (typeof data11 == "number") {
|
|
1369
|
+
if (data11 < 1 || isNaN(data11)) {
|
|
1370
|
+
validate25.errors = [{ instancePath: instancePath + "/anchor/tree_size", schemaPath: "#/properties/anchor/properties/tree_size/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" }];
|
|
1371
|
+
return false;
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
var valid5 = _errs25 === errors;
|
|
1376
|
+
} else {
|
|
1377
|
+
var valid5 = true;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
} else {
|
|
1385
|
+
validate25.errors = [{ instancePath: instancePath + "/anchor", schemaPath: "#/properties/anchor/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1386
|
+
return false;
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
var valid0 = _errs16 === errors;
|
|
1390
|
+
} else {
|
|
1391
|
+
var valid0 = true;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
471
1394
|
}
|
|
472
1395
|
}
|
|
473
1396
|
}
|
|
474
1397
|
}
|
|
475
1398
|
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
1399
|
+
} else {
|
|
1400
|
+
validate25.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1401
|
+
return false;
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
validate25.errors = vErrors;
|
|
1405
|
+
return errors === 0;
|
|
1406
|
+
}
|
|
1407
|
+
validate25.evaluated = { "props": { "log_id": true, "leaf_index": true, "tree_size": true, "root_hash": true, "inclusion": true, "anchor": true }, "dynamicProps": false, "dynamicItems": false };
|
|
1408
|
+
function validate20(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
1409
|
+
;
|
|
1410
|
+
let vErrors = null;
|
|
1411
|
+
let errors = 0;
|
|
1412
|
+
const evaluated0 = validate20.evaluated;
|
|
1413
|
+
if (evaluated0.dynamicProps) {
|
|
1414
|
+
evaluated0.props = void 0;
|
|
1415
|
+
}
|
|
1416
|
+
if (evaluated0.dynamicItems) {
|
|
1417
|
+
evaluated0.items = void 0;
|
|
1418
|
+
}
|
|
1419
|
+
if (errors === 0) {
|
|
1420
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1421
|
+
let missing0;
|
|
1422
|
+
if (data.body === void 0 && (missing0 = "body") || data.signature === void 0 && (missing0 = "signature")) {
|
|
1423
|
+
validate20.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
1424
|
+
return false;
|
|
1425
|
+
} else {
|
|
1426
|
+
const _errs1 = errors;
|
|
1427
|
+
for (const key0 in data) {
|
|
1428
|
+
if (!(key0 === "body" || key0 === "signature" || key0 === "proof")) {
|
|
1429
|
+
validate20.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
|
|
1430
|
+
return false;
|
|
1431
|
+
break;
|
|
1432
|
+
}
|
|
495
1433
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
],
|
|
507
|
-
"properties": {
|
|
508
|
-
"log_id": {
|
|
509
|
-
"$ref": "#/$defs/b64url"
|
|
510
|
-
},
|
|
511
|
-
"leaf_index": {
|
|
512
|
-
"type": "integer",
|
|
513
|
-
"minimum": 0
|
|
514
|
-
},
|
|
515
|
-
"tree_size": {
|
|
516
|
-
"type": "integer",
|
|
517
|
-
"minimum": 1
|
|
518
|
-
},
|
|
519
|
-
"root_hash": {
|
|
520
|
-
"$ref": "#/$defs/b64url"
|
|
521
|
-
},
|
|
522
|
-
"inclusion": {
|
|
523
|
-
"type": "array",
|
|
524
|
-
"items": {
|
|
525
|
-
"$ref": "#/$defs/b64url"
|
|
1434
|
+
if (_errs1 === errors) {
|
|
1435
|
+
if (data.body !== void 0) {
|
|
1436
|
+
const _errs2 = errors;
|
|
1437
|
+
if (!validate21(data.body, { instancePath: instancePath + "/body", parentData: data, parentDataProperty: "body", rootData, dynamicAnchors })) {
|
|
1438
|
+
vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);
|
|
1439
|
+
errors = vErrors.length;
|
|
1440
|
+
}
|
|
1441
|
+
var valid0 = _errs2 === errors;
|
|
1442
|
+
} else {
|
|
1443
|
+
var valid0 = true;
|
|
526
1444
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
"type": "string",
|
|
550
|
-
"pattern": "^0x[0-9a-fA-F]{64}$"
|
|
551
|
-
},
|
|
552
|
-
"tree_size": {
|
|
553
|
-
"type": "integer",
|
|
554
|
-
"minimum": 1
|
|
1445
|
+
if (valid0) {
|
|
1446
|
+
if (data.signature !== void 0) {
|
|
1447
|
+
const _errs3 = errors;
|
|
1448
|
+
if (!validate23(data.signature, { instancePath: instancePath + "/signature", parentData: data, parentDataProperty: "signature", rootData, dynamicAnchors })) {
|
|
1449
|
+
vErrors = vErrors === null ? validate23.errors : vErrors.concat(validate23.errors);
|
|
1450
|
+
errors = vErrors.length;
|
|
1451
|
+
}
|
|
1452
|
+
var valid0 = _errs3 === errors;
|
|
1453
|
+
} else {
|
|
1454
|
+
var valid0 = true;
|
|
1455
|
+
}
|
|
1456
|
+
if (valid0) {
|
|
1457
|
+
if (data.proof !== void 0) {
|
|
1458
|
+
const _errs4 = errors;
|
|
1459
|
+
if (!validate25(data.proof, { instancePath: instancePath + "/proof", parentData: data, parentDataProperty: "proof", rootData, dynamicAnchors })) {
|
|
1460
|
+
vErrors = vErrors === null ? validate25.errors : vErrors.concat(validate25.errors);
|
|
1461
|
+
errors = vErrors.length;
|
|
1462
|
+
}
|
|
1463
|
+
var valid0 = _errs4 === errors;
|
|
1464
|
+
} else {
|
|
1465
|
+
var valid0 = true;
|
|
1466
|
+
}
|
|
555
1467
|
}
|
|
556
1468
|
}
|
|
557
1469
|
}
|
|
558
1470
|
}
|
|
1471
|
+
} else {
|
|
1472
|
+
validate20.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1473
|
+
return false;
|
|
559
1474
|
}
|
|
560
1475
|
}
|
|
561
|
-
|
|
1476
|
+
validate20.errors = vErrors;
|
|
1477
|
+
return errors === 0;
|
|
1478
|
+
}
|
|
1479
|
+
validate20.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
562
1480
|
|
|
563
1481
|
// src/schema.ts
|
|
564
|
-
var ajv = new Ajv2020({ allErrors: false, strict: false });
|
|
565
|
-
addFormats(ajv);
|
|
566
|
-
var validate = ajv.compile(receiptSchema);
|
|
567
1482
|
function schemaValid(receipt) {
|
|
568
1483
|
return Boolean(validate(receipt));
|
|
569
1484
|
}
|