UNPKG

@sphereon/pex

Version:

A Typescript implementation of the v1 and v2 DIF Presentation Exchange specification

672 lines (671 loc) 305 kB
"use strict"; module.exports = validate42; module.exports.default = validate42; const schema12 = { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Presentation Definition", "definitions": { "schema": { "type": "object", "properties": { "uri": { "type": "string" }, "required": { "type": "boolean" } }, "required": ["uri"], "additionalProperties": false }, "issuance": { "type": "object", "properties": { "manifest": { "type": "string" } }, "additionalProperties": true }, "filter": { "type": "object", "properties": { "type": { "type": "string" }, "format": { "type": "string" }, "pattern": { "type": "string" }, "minimum": { "type": ["number", "string"] }, "minLength": { "type": "integer" }, "maxLength": { "type": "integer" }, "exclusiveMinimum": { "type": ["number", "string"] }, "exclusiveMaximum": { "type": ["number", "string"] }, "maximum": { "type": ["number", "string"] }, "const": { "type": ["number", "string"] }, "enum": { "type": "array", "items": { "type": ["number", "string"] } }, "not": { "type": "object", "minProperties": 1 } }, "required": ["type"], "additionalProperties": false }, "format": { "type": "object", "properties": { "vc+sd-jwt": { "type": "object", "properties": { "sd-jwt_alg_values": { "type": "array", "description": "A JSON array containing identifiers of cryptographic algorithms the verifier supports for protection of a SD-JWT. If present, the alg JOSE header (as defined in [RFC7515]) of the presented SD-JWT MUST match one of the array values.", "minItems": 1, "items": { "type": "string" } }, "kb-jwt_alg_values": { "type": "array", "description": "A JSON array containing identifiers of cryptographic algorithms the verifier supports for protection of a KB-JWT. If present, the alg JOSE header (as defined in [RFC7515]) of the presented KB-JWT MUST match one of the array values.", "minItems": 1, "items": { "type": "string" } } }, "required": [], "additionalProperties": false } }, "patternProperties": { "^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$": { "type": "object", "properties": { "alg": { "type": "array", "minItems": 1, "items": { "type": "string" } } }, "required": ["alg"], "additionalProperties": false }, "^ldp_vc$|^ldp_vp$|^ldp$": { "type": "object", "properties": { "proof_type": { "type": "array", "minItems": 1, "items": { "type": "string" } } }, "required": ["proof_type"], "additionalProperties": false }, "^di_vc$|^di_vp$|^di$": { "type": "object", "properties": { "proof_type": { "type": "array", "minItems": 1, "items": { "type": "string" } }, "cryptosuite": { "type": "array", "minItems": 1, "items": { "type": "string" } } }, "required": ["proof_type", "cryptosuite"], "additionalProperties": false }, "additionalProperties": false }, "additionalProperties": false }, "submission_requirements": { "type": "object", "oneOf": [{ "properties": { "name": { "type": "string" }, "purpose": { "type": "string" }, "rule": { "type": "string", "enum": ["all", "pick"] }, "count": { "type": "integer", "minimum": 1 }, "min": { "type": "integer", "minimum": 0 }, "max": { "type": "integer", "minimum": 0 }, "from": { "type": "string" } }, "required": ["rule", "from"], "additionalProperties": false }, { "properties": { "name": { "type": "string" }, "purpose": { "type": "string" }, "rule": { "type": "string", "enum": ["all", "pick"] }, "count": { "type": "integer", "minimum": 1 }, "min": { "type": "integer", "minimum": 0 }, "max": { "type": "integer", "minimum": 0 }, "from_nested": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/submission_requirements" } } }, "required": ["rule", "from_nested"], "additionalProperties": false }] }, "input_descriptors": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "purpose": { "type": "string" }, "group": { "type": "array", "items": { "type": "string" } }, "schema": { "type": "array", "items": { "$ref": "#/definitions/schema" } }, "issuance": { "type": "array", "items": { "$ref": "#/definitions/issuance" } }, "constraints": { "type": "object", "properties": { "limit_disclosure": { "type": "string", "enum": ["required", "preferred"] }, "statuses": { "type": "object", "properties": { "active": { "type": "object", "properties": { "directive": { "type": "string", "enum": ["required", "allowed", "disallowed"] } } }, "suspended": { "type": "object", "properties": { "directive": { "type": "string", "enum": ["required", "allowed", "disallowed"] } } }, "revoked": { "type": "object", "properties": { "directive": { "type": "string", "enum": ["required", "allowed", "disallowed"] } } } } }, "fields": { "type": "array", "items": { "$ref": "#/definitions/field" } }, "subject_is_issuer": { "type": "string", "enum": ["required", "preferred"] }, "is_holder": { "type": "array", "items": { "type": "object", "properties": { "field_id": { "type": "array", "items": { "type": "string" } }, "directive": { "type": "string", "enum": ["required", "preferred"] } }, "required": ["field_id", "directive"], "additionalProperties": false } }, "same_subject": { "type": "array", "items": { "type": "object", "properties": { "field_id": { "type": "array", "items": { "type": "string" } }, "directive": { "type": "string", "enum": ["required", "preferred"] } }, "required": ["field_id", "directive"], "additionalProperties": false } } }, "additionalProperties": false } }, "required": ["id", "schema"], "additionalProperties": false }, "field": { "type": "object", "oneOf": [{ "properties": { "id": { "type": "string" }, "path": { "type": "array", "items": { "type": "string" } }, "purpose": { "type": "string" }, "filter": { "$ref": "#/definitions/filter" } }, "required": ["path"], "additionalProperties": false }, { "properties": { "id": { "type": "string" }, "path": { "type": "array", "items": { "type": "string" } }, "purpose": { "type": "string" }, "filter": { "$ref": "#/definitions/filter" }, "predicate": { "type": "string", "enum": ["required", "preferred"] } }, "required": ["path", "filter", "predicate"], "additionalProperties": false }] } }, "type": "object", "properties": { "presentation_definition": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "purpose": { "type": "string" }, "format": { "$ref": "#/definitions/format" }, "submission_requirements": { "type": "array", "items": { "$ref": "#/definitions/submission_requirements" } }, "input_descriptors": { "type": "array", "items": { "$ref": "#/definitions/input_descriptors" } } }, "required": ["id", "input_descriptors"], "additionalProperties": false } } }; const schema13 = { "type": "object", "properties": { "vc+sd-jwt": { "type": "object", "properties": { "sd-jwt_alg_values": { "type": "array", "description": "A JSON array containing identifiers of cryptographic algorithms the verifier supports for protection of a SD-JWT. If present, the alg JOSE header (as defined in [RFC7515]) of the presented SD-JWT MUST match one of the array values.", "minItems": 1, "items": { "type": "string" } }, "kb-jwt_alg_values": { "type": "array", "description": "A JSON array containing identifiers of cryptographic algorithms the verifier supports for protection of a KB-JWT. If present, the alg JOSE header (as defined in [RFC7515]) of the presented KB-JWT MUST match one of the array values.", "minItems": 1, "items": { "type": "string" } } }, "required": [], "additionalProperties": false } }, "patternProperties": { "^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$": { "type": "object", "properties": { "alg": { "type": "array", "minItems": 1, "items": { "type": "string" } } }, "required": ["alg"], "additionalProperties": false }, "^ldp_vc$|^ldp_vp$|^ldp$": { "type": "object", "properties": { "proof_type": { "type": "array", "minItems": 1, "items": { "type": "string" } } }, "required": ["proof_type"], "additionalProperties": false }, "^di_vc$|^di_vp$|^di$": { "type": "object", "properties": { "proof_type": { "type": "array", "minItems": 1, "items": { "type": "string" } }, "cryptosuite": { "type": "array", "minItems": 1, "items": { "type": "string" } } }, "required": ["proof_type", "cryptosuite"], "additionalProperties": false }, "additionalProperties": false }, "additionalProperties": false }; const pattern0 = new RegExp("^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$", "u"); const pattern1 = new RegExp("^ldp_vc$|^ldp_vp$|^ldp$", "u"); const pattern2 = new RegExp("^di_vc$|^di_vp$|^di$", "u"); const pattern3 = new RegExp("additionalProperties", "u"); function validate43(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { for (const key0 in data) { if (!(((((key0 === "vc+sd-jwt") || (pattern0.test(key0))) || (pattern1.test(key0))) || (pattern2.test(key0))) || (pattern3.test(key0)))) { const err0 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties", schema: false, parentSchema: schema13, data }; if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } errors++; } } if (data["vc+sd-jwt"] !== undefined) { let data0 = data["vc+sd-jwt"]; if (data0 && typeof data0 == "object" && !Array.isArray(data0)) { for (const key1 in data0) { if (!((key1 === "sd-jwt_alg_values") || (key1 === "kb-jwt_alg_values"))) { const err1 = { instancePath: instancePath + "/vc+sd-jwt", schemaPath: "#/properties/vc%2Bsd-jwt/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties", schema: false, parentSchema: schema13.properties["vc+sd-jwt"], data: data0 }; if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } errors++; } } if (data0["sd-jwt_alg_values"] !== undefined) { let data1 = data0["sd-jwt_alg_values"]; if (Array.isArray(data1)) { if (data1.length < 1) { const err2 = { instancePath: instancePath + "/vc+sd-jwt/sd-jwt_alg_values", schemaPath: "#/properties/vc%2Bsd-jwt/properties/sd-jwt_alg_values/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items", schema: 1, parentSchema: schema13.properties["vc+sd-jwt"].properties["sd-jwt_alg_values"], data: data1 }; if (vErrors === null) { vErrors = [err2]; } else { vErrors.push(err2); } errors++; } const len0 = data1.length; for (let i0 = 0; i0 < len0; i0++) { let data2 = data1[i0]; if (typeof data2 !== "string") { const err3 = { instancePath: instancePath + "/vc+sd-jwt/sd-jwt_alg_values/" + i0, schemaPath: "#/properties/vc%2Bsd-jwt/properties/sd-jwt_alg_values/items/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema13.properties["vc+sd-jwt"].properties["sd-jwt_alg_values"].items.type, parentSchema: schema13.properties["vc+sd-jwt"].properties["sd-jwt_alg_values"].items, data: data2 }; if (vErrors === null) { vErrors = [err3]; } else { vErrors.push(err3); } errors++; } } } else { const err4 = { instancePath: instancePath + "/vc+sd-jwt/sd-jwt_alg_values", schemaPath: "#/properties/vc%2Bsd-jwt/properties/sd-jwt_alg_values/type", keyword: "type", params: { type: "array" }, message: "must be array", schema: schema13.properties["vc+sd-jwt"].properties["sd-jwt_alg_values"].type, parentSchema: schema13.properties["vc+sd-jwt"].properties["sd-jwt_alg_values"], data: data1 }; if (vErrors === null) { vErrors = [err4]; } else { vErrors.push(err4); } errors++; } } if (data0["kb-jwt_alg_values"] !== undefined) { let data3 = data0["kb-jwt_alg_values"]; if (Array.isArray(data3)) { if (data3.length < 1) { const err5 = { instancePath: instancePath + "/vc+sd-jwt/kb-jwt_alg_values", schemaPath: "#/properties/vc%2Bsd-jwt/properties/kb-jwt_alg_values/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items", schema: 1, parentSchema: schema13.properties["vc+sd-jwt"].properties["kb-jwt_alg_values"], data: data3 }; if (vErrors === null) { vErrors = [err5]; } else { vErrors.push(err5); } errors++; } const len1 = data3.length; for (let i1 = 0; i1 < len1; i1++) { let data4 = data3[i1]; if (typeof data4 !== "string") { const err6 = { instancePath: instancePath + "/vc+sd-jwt/kb-jwt_alg_values/" + i1, schemaPath: "#/properties/vc%2Bsd-jwt/properties/kb-jwt_alg_values/items/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema13.properties["vc+sd-jwt"].properties["kb-jwt_alg_values"].items.type, parentSchema: schema13.properties["vc+sd-jwt"].properties["kb-jwt_alg_values"].items, data: data4 }; if (vErrors === null) { vErrors = [err6]; } else { vErrors.push(err6); } errors++; } } } else { const err7 = { instancePath: instancePath + "/vc+sd-jwt/kb-jwt_alg_values", schemaPath: "#/properties/vc%2Bsd-jwt/properties/kb-jwt_alg_values/type", keyword: "type", params: { type: "array" }, message: "must be array", schema: schema13.properties["vc+sd-jwt"].properties["kb-jwt_alg_values"].type, parentSchema: schema13.properties["vc+sd-jwt"].properties["kb-jwt_alg_values"], data: data3 }; if (vErrors === null) { vErrors = [err7]; } else { vErrors.push(err7); } errors++; } } } else { const err8 = { instancePath: instancePath + "/vc+sd-jwt", schemaPath: "#/properties/vc%2Bsd-jwt/type", keyword: "type", params: { type: "object" }, message: "must be object", schema: schema13.properties["vc+sd-jwt"].type, parentSchema: schema13.properties["vc+sd-jwt"], data: data0 }; if (vErrors === null) { vErrors = [err8]; } else { vErrors.push(err8); } errors++; } } for (const key2 in data) { if (pattern0.test(key2)) { let data5 = data[key2]; if (data5 && typeof data5 == "object" && !Array.isArray(data5)) { if (data5.alg === undefined) { const err9 = { instancePath: instancePath + "/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/%5Ejwt%24%7C%5Ejwt_vc%24%7C%5Ejwt_vc_json%24%7C%5Ejwt_vp%24%7C%5Ejwt_vp_json%24/required", keyword: "required", params: { missingProperty: "alg" }, message: "must have required property '" + "alg" + "'", schema: schema13.patternProperties["^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$"].required, parentSchema: schema13.patternProperties["^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$"], data: data5 }; if (vErrors === null) { vErrors = [err9]; } else { vErrors.push(err9); } errors++; } for (const key3 in data5) { if (!(key3 === "alg")) { const err10 = { instancePath: instancePath + "/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/%5Ejwt%24%7C%5Ejwt_vc%24%7C%5Ejwt_vc_json%24%7C%5Ejwt_vp%24%7C%5Ejwt_vp_json%24/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties", schema: false, parentSchema: schema13.patternProperties["^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$"], data: data5 }; if (vErrors === null) { vErrors = [err10]; } else { vErrors.push(err10); } errors++; } } if (data5.alg !== undefined) { let data6 = data5.alg; if (Array.isArray(data6)) { if (data6.length < 1) { const err11 = { instancePath: instancePath + "/" + key2.replace(/~/g, "~0").replace(/\//g, "~1") + "/alg", schemaPath: "#/patternProperties/%5Ejwt%24%7C%5Ejwt_vc%24%7C%5Ejwt_vc_json%24%7C%5Ejwt_vp%24%7C%5Ejwt_vp_json%24/properties/alg/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items", schema: 1, parentSchema: schema13.patternProperties["^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$"].properties.alg, data: data6 }; if (vErrors === null) { vErrors = [err11]; } else { vErrors.push(err11); } errors++; } const len2 = data6.length; for (let i2 = 0; i2 < len2; i2++) { let data7 = data6[i2]; if (typeof data7 !== "string") { const err12 = { instancePath: instancePath + "/" + key2.replace(/~/g, "~0").replace(/\//g, "~1") + "/alg/" + i2, schemaPath: "#/patternProperties/%5Ejwt%24%7C%5Ejwt_vc%24%7C%5Ejwt_vc_json%24%7C%5Ejwt_vp%24%7C%5Ejwt_vp_json%24/properties/alg/items/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema13.patternProperties["^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$"].properties.alg.items.type, parentSchema: schema13.patternProperties["^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$"].properties.alg.items, data: data7 }; if (vErrors === null) { vErrors = [err12]; } else { vErrors.push(err12); } errors++; } } } else { const err13 = { instancePath: instancePath + "/" + key2.replace(/~/g, "~0").replace(/\//g, "~1") + "/alg", schemaPath: "#/patternProperties/%5Ejwt%24%7C%5Ejwt_vc%24%7C%5Ejwt_vc_json%24%7C%5Ejwt_vp%24%7C%5Ejwt_vp_json%24/properties/alg/type", keyword: "type", params: { type: "array" }, message: "must be array", schema: schema13.patternProperties["^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$"].properties.alg.type, parentSchema: schema13.patternProperties["^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$"].properties.alg, data: data6 }; if (vErrors === null) { vErrors = [err13]; } else { vErrors.push(err13); } errors++; } } } else { const err14 = { instancePath: instancePath + "/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/%5Ejwt%24%7C%5Ejwt_vc%24%7C%5Ejwt_vc_json%24%7C%5Ejwt_vp%24%7C%5Ejwt_vp_json%24/type", keyword: "type", params: { type: "object" }, message: "must be object", schema: schema13.patternProperties["^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$"].type, parentSchema: schema13.patternProperties["^jwt$|^jwt_vc$|^jwt_vc_json$|^jwt_vp$|^jwt_vp_json$"], data: data5 }; if (vErrors === null) { vErrors = [err14]; } else { vErrors.push(err14); } errors++; } } } for (const key4 in data) { if (pattern1.test(key4)) { let data8 = data[key4]; if (data8 && typeof data8 == "object" && !Array.isArray(data8)) { if (data8.proof_type === undefined) { const err15 = { instancePath: instancePath + "/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/%5Eldp_vc%24%7C%5Eldp_vp%24%7C%5Eldp%24/required", keyword: "required", params: { missingProperty: "proof_type" }, message: "must have required property '" + "proof_type" + "'", schema: schema13.patternProperties["^ldp_vc$|^ldp_vp$|^ldp$"].required, parentSchema: schema13.patternProperties["^ldp_vc$|^ldp_vp$|^ldp$"], data: data8 }; if (vErrors === null) { vErrors = [err15]; } else { vErrors.push(err15); } errors++; } for (const key5 in data8) { if (!(key5 === "proof_type")) { const err16 = { instancePath: instancePath + "/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/%5Eldp_vc%24%7C%5Eldp_vp%24%7C%5Eldp%24/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties", schema: false, parentSchema: schema13.patternProperties["^ldp_vc$|^ldp_vp$|^ldp$"], data: data8 }; if (vErrors === null) { vErrors = [err16]; } else { vErrors.push(err16); } errors++; } } if (data8.proof_type !== undefined) { let data9 = data8.proof_type; if (Array.isArray(data9)) { if (data9.length < 1) { const err17 = { instancePath: instancePath + "/" + key4.replace(/~/g, "~0").replace(/\//g, "~1") + "/proof_type", schemaPath: "#/patternProperties/%5Eldp_vc%24%7C%5Eldp_vp%24%7C%5Eldp%24/properties/proof_type/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items", schema: 1, parentSchema: schema13.patternProperties["^ldp_vc$|^ldp_vp$|^ldp$"].properties.proof_type, data: data9 }; if (vErrors === null) { vErrors = [err17]; } else { vErrors.push(err17); } errors++; } const len3 = data9.length; for (let i3 = 0; i3 < len3; i3++) { let data10 = data9[i3]; if (typeof data10 !== "string") { const err18 = { instancePath: instancePath + "/" + key4.replace(/~/g, "~0").replace(/\//g, "~1") + "/proof_type/" + i3, schemaPath: "#/patternProperties/%5Eldp_vc%24%7C%5Eldp_vp%24%7C%5Eldp%24/properties/proof_type/items/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema13.patternProperties["^ldp_vc$|^ldp_vp$|^ldp$"].properties.proof_type.items.type, parentSchema: schema13.patternProperties["^ldp_vc$|^ldp_vp$|^ldp$"].properties.proof_type.items, data: data10 }; if (vErrors === null) { vErrors = [err18]; } else { vErrors.push(err18); } errors++; } } } else { const err19 = { instancePath: instancePath + "/" + key4.replace(/~/g, "~0").replace(/\//g, "~1") + "/proof_type", schemaPath: "#/patternProperties/%5Eldp_vc%24%7C%5Eldp_vp%24%7C%5Eldp%24/properties/proof_type/type", keyword: "type", params: { type: "array" }, message: "must be array", schema: schema13.patternProperties["^ldp_vc$|^ldp_vp$|^ldp$"].properties.proof_type.type, parentSchema: schema13.patternProperties["^ldp_vc$|^ldp_vp$|^ldp$"].properties.proof_type, data: data9 }; if (vErrors === null) { vErrors = [err19]; } else { vErrors.push(err19); } errors++; } } } else { const err20 = { instancePath: instancePath + "/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/%5Eldp_vc%24%7C%5Eldp_vp%24%7C%5Eldp%24/type", keyword: "type", params: { type: "object" }, message: "must be object", schema: schema13.patternProperties["^ldp_vc$|^ldp_vp$|^ldp$"].type, parentSchema: schema13.patternProperties["^ldp_vc$|^ldp_vp$|^ldp$"], data: data8 }; if (vErrors === null) { vErrors = [err20]; } else { vErrors.push(err20); } errors++; } } } for (const key6 in data) { if (pattern2.test(key6)) { let data11 = data[key6]; if (data11 && typeof data11 == "object" && !Array.isArray(data11)) { if (data11.proof_type === undefined) { const err21 = { instancePath: instancePath + "/" + key6.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/%5Edi_vc%24%7C%5Edi_vp%24%7C%5Edi%24/required", keyword: "required", params: { missingProperty: "proof_type" }, message: "must have required property '" + "proof_type" + "'", schema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].required, parentSchema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"], data: data11 }; if (vErrors === null) { vErrors = [err21]; } else { vErrors.push(err21); } errors++; } if (data11.cryptosuite === undefined) { const err22 = { instancePath: instancePath + "/" + key6.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/%5Edi_vc%24%7C%5Edi_vp%24%7C%5Edi%24/required", keyword: "required", params: { missingProperty: "cryptosuite" }, message: "must have required property '" + "cryptosuite" + "'", schema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].required, parentSchema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"], data: data11 }; if (vErrors === null) { vErrors = [err22]; } else { vErrors.push(err22); } errors++; } for (const key7 in data11) { if (!((key7 === "proof_type") || (key7 === "cryptosuite"))) { const err23 = { instancePath: instancePath + "/" + key6.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/%5Edi_vc%24%7C%5Edi_vp%24%7C%5Edi%24/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key7 }, message: "must NOT have additional properties", schema: false, parentSchema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"], data: data11 }; if (vErrors === null) { vErrors = [err23]; } else { vErrors.push(err23); } errors++; } } if (data11.proof_type !== undefined) { let data12 = data11.proof_type; if (Array.isArray(data12)) { if (data12.length < 1) { const err24 = { instancePath: instancePath + "/" + key6.replace(/~/g, "~0").replace(/\//g, "~1") + "/proof_type", schemaPath: "#/patternProperties/%5Edi_vc%24%7C%5Edi_vp%24%7C%5Edi%24/properties/proof_type/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items", schema: 1, parentSchema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].properties.proof_type, data: data12 }; if (vErrors === null) { vErrors = [err24]; } else { vErrors.push(err24); } errors++; } const len4 = data12.length; for (let i4 = 0; i4 < len4; i4++) { let data13 = data12[i4]; if (typeof data13 !== "string") { const err25 = { instancePath: instancePath + "/" + key6.replace(/~/g, "~0").replace(/\//g, "~1") + "/proof_type/" + i4, schemaPath: "#/patternProperties/%5Edi_vc%24%7C%5Edi_vp%24%7C%5Edi%24/properties/proof_type/items/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].properties.proof_type.items.type, parentSchema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].properties.proof_type.items, data: data13 }; if (vErrors === null) { vErrors = [err25]; } else { vErrors.push(err25); } errors++; } } } else { const err26 = { instancePath: instancePath + "/" + key6.replace(/~/g, "~0").replace(/\//g, "~1") + "/proof_type", schemaPath: "#/patternProperties/%5Edi_vc%24%7C%5Edi_vp%24%7C%5Edi%24/properties/proof_type/type", keyword: "type", params: { type: "array" }, message: "must be array", schema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].properties.proof_type.type, parentSchema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].properties.proof_type, data: data12 }; if (vErrors === null) { vErrors = [err26]; } else { vErrors.push(err26); } errors++; } } if (data11.cryptosuite !== undefined) { let data14 = data11.cryptosuite; if (Array.isArray(data14)) { if (data14.length < 1) { const err27 = { instancePath: instancePath + "/" + key6.replace(/~/g, "~0").replace(/\//g, "~1") + "/cryptosuite", schemaPath: "#/patternProperties/%5Edi_vc%24%7C%5Edi_vp%24%7C%5Edi%24/properties/cryptosuite/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items", schema: 1, parentSchema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].properties.cryptosuite, data: data14 }; if (vErrors === null) { vErrors = [err27]; } else { vErrors.push(err27); } errors++; } const len5 = data14.length; for (let i5 = 0; i5 < len5; i5++) { let data15 = data14[i5]; if (typeof data15 !== "string") { const err28 = { instancePath: instancePath + "/" + key6.replace(/~/g, "~0").replace(/\//g, "~1") + "/cryptosuite/" + i5, schemaPath: "#/patternProperties/%5Edi_vc%24%7C%5Edi_vp%24%7C%5Edi%24/properties/cryptosuite/items/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].properties.cryptosuite.items.type, parentSchema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].properties.cryptosuite.items, data: data15 }; if (vErrors === null) { vErrors = [err28]; } else { vErrors.push(err28); } errors++; } } } else { const err29 = { instancePath: instancePath + "/" + key6.replace(/~/g, "~0").replace(/\//g, "~1") + "/cryptosuite", schemaPath: "#/patternProperties/%5Edi_vc%24%7C%5Edi_vp%24%7C%5Edi%24/properties/cryptosuite/type", keyword: "type", params: { type: "array" }, message: "must be array", schema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].properties.cryptosuite.type, parentSchema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].properties.cryptosuite, data: data14 }; if (vErrors === null) { vErrors = [err29]; } else { vErrors.push(err29); } errors++; } } } else { const err30 = { instancePath: instancePath + "/" + key6.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/%5Edi_vc%24%7C%5Edi_vp%24%7C%5Edi%24/type", keyword: "type", params: { type: "object" }, message: "must be object", schema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"].type, parentSchema: schema13.patternProperties["^di_vc$|^di_vp$|^di$"], data: data11 }; if (vErrors === null) { vErrors = [err30]; } else { vErrors.push(err30); } errors++; } } } for (const key8 in data) { if (pattern3.test(key8)) { const err31 = { instancePath: instancePath + "/" + key8.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/patternProperties/additionalProperties/false schema", keyword: "false schema", params: {}, message: "boolean schema is false", schema: false, parentSchema: schema13.patternProperties.additionalProperties, data: data[key8] }; if (vErrors === null) { vErrors = [err31]; } else { vErrors.push(err31); } errors++; } } } else { const err32 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object", schema: schema13.type, parentSchema: schema13, data }; if (vErrors === null) { vErrors = [err32]; } else { vErrors.push(err32); } errors++; } validate43.errors = vErrors; return errors === 0; } const schema14 = { "type": "object", "oneOf": [{ "properties": { "name": { "type": "string" }, "purpose": { "type": "string" }, "rule": { "type": "string", "enum": ["all", "pick"] }, "count": { "type": "integer", "minimum": 1 }, "min": { "type": "integer", "minimum": 0 }, "max": { "type": "integer", "minimum": 0 }, "from": { "type": "string" } }, "required": ["rule", "from"], "additionalProperties": false }, { "properties": { "name": { "type": "string" }, "purpose": { "type": "string" }, "rule": { "type": "string", "enum": ["all", "pick"] }, "count": { "type": "integer", "minimum": 1 }, "min": { "type": "integer", "minimum": 0 }, "max": { "type": "integer", "minimum": 0 }, "from_nested": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/submission_requirements" } } }, "required": ["rule", "from_nested"], "additionalProperties": false }] }; const wrapper0 = { validate: validate45 }; function validate45(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (!(data && typeof data == "object" && !Array.isArray(data))) { const err0 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object", schema: schema14.type, parentSchema: schema14, data }; if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } errors++; } const _errs1 = errors; let valid0 = false; let passing0 = null; const _errs2 = errors; if (data && typeof data == "object" && !Array.isArray(data)) { if (data.rule === undefined) { const err1 = { instancePath, schemaPath: "#/oneOf/0/required", keyword: "required", params: { missingProperty: "rule" }, message: "must have required property '" + "rule" + "'", schema: schema14.oneOf[0].required, parentSchema: schema14.oneOf[0], data }; if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } errors++; } if (data.from === undefined) { const err2 = { instancePath, schemaPath: "#/oneOf/0/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property '" + "from" + "'", schema: schema14.oneOf[0].required, parentSchema: schema14.oneOf[0], data }; if (vErrors === null) { vErrors = [err2]; } else { vErrors.push(err2); } errors++; } for (const key0 in data) { if (!(((((((key0 === "name") || (key0 === "purpose")) || (key0 === "rule")) || (key0 === "count")) || (key0 === "min")) || (key0 === "max")) || (key0 === "from"))) { const err3 = { instancePath, schemaPath: "#/oneOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties", schema: false, parentSchema: schema14.oneOf[0], data }; if (vErrors === null) { vErrors = [err3]; } else { vErrors.push(err3); } errors++; } } if (data.name !== undefined) { let data0 = data.name; if (typeof data0 !== "string") { const err4 = { instancePath: instancePath + "/name", schemaPath: "#/oneOf/0/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema14.oneOf[0].properties.name.type, parentSchema: schema14.oneOf[0].properties.name, data: data0 }; if (vErrors === null) { vErrors = [err4]; } else { vErrors.push(err4); } errors++; } } if (data.purpose !== undefined) { let data1 = data.purpose; if (typeof data1 !== "string") { const err5 = { instancePath: instancePath + "/purpose", schemaPath: "#/oneOf/0/properties/purpose/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema14.oneOf[0].properties.purpose.type, parentSchema: schema14.oneOf[0].properties.purpose, data: data1 }; if (vErrors === null) { vErrors = [err5]; } else { vErrors.push(err5); } errors++; } } if (data.rule !== undefined) { let data2 = data.rule; if (typeof data2 !== "string") { const err6 = { instancePath: instancePath + "/rule", schemaPath: "#/oneOf/0/properties/rule/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema14.oneOf[0].properties.rule.type, parentSchema: schema14.oneOf[0].properties.rule, data: data2 }; if (vErrors === null) { vErrors = [err6]; } else { vErrors.push(err6); } errors++; } if (!((data2 === "all") || (data2 === "pick"))) { const err7 = { instancePath: instancePath + "/rule", schemaPath: "#/oneOf/0/properties/rule/enum", keyword: "enum", params: { allowedValues: schema14.oneOf[0].properties.rule.enum }, message: "must be equal to one of the allowed values", schema: schema14.oneOf[0].properties.rule.enum, parentSchema: schema14.oneOf[0].properties.rule, data: data2 }; if (vErrors === null) { vErrors = [err7]; } else { vErrors.push(err7); } errors++; } } if (data.count !== undefined) { let data3 = data.count; if (!((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3)))) { const err8 = { instancePath: instancePath + "/count", schemaPath: "#/oneOf/0/properties/count/type", keyword: "type", params: { type: "integer" }, message: "must be integer", schema: schema14.oneOf[0].properties.count.type, parentSchema: schema14.oneOf[0].properties.count, data: data3 }; if (vErrors === null) { vErrors = [err8]; } else { vErrors.push(err8); } errors++; } if (typeof data3 == "number") { if (data3 < 1 || isNaN(data3)) { const err9 = { instancePath: instancePath + "/count", schemaPath: "#/oneOf/0/properties/count/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1", schema: 1, parentSchema: schema14.oneOf[0].properties.count, data: data3 }; if (vErrors === null) { vErrors = [err9]; } else { vErrors.push(err9); } errors++; } } } if (data.min !== undefined) { let data4 = data.min; if (!((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4)))) { const err10 = { instancePath: instancePath + "/min", schemaPath: "#/oneOf/0/properties/min/type", keyword: "type", params: { type: "integer" }, message: "must be integer", schema: schema14.oneOf[0].properties.min.type, parentSchema: schema14.oneOf[0].properties.min, data: data4 }; if (vErrors === null) { vErrors = [err10]; } else { vErrors.push(err10); } errors++; } if (typeof data4 == "number") { if (data4 < 0 || isNaN(data4)) { const err11 = { instancePath: instancePath + "/min", schemaPath: "#/oneOf/0/properties/min/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0", schema: 0, parentSchema: schema14.oneOf[0].properties.min, data: data4 }; if (vErrors === null) { vErrors = [err11]; } else { vErrors.push(err11); } errors++; } } } if (data.max !== undefined) { let data5 = data.max; if (!((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5)))) { const err12 = { instancePath: instancePath + "/max", schemaPath: "#/oneOf/0/properties/max/type", keyword: "type", params: { type: "integer" }, message: "must be integer", schema: schema14.oneOf[0].properties.max.type, parentSchema: schema14.oneOf[0].properties.max, data: data5 }; if (vErrors === null) { vErrors = [err12]; } else { vErrors.push(err12); } errors++; } if (typeof data5 == "number") { if (data5 < 0 || isNaN(data5)) { const err13 = { instancePath: instancePath + "/max", schemaPath: "#/oneOf/0/properties/max/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0", schema: 0, parentSchema: schema14.oneOf[0].properties.max, data: data5 }; if (vErrors === null) { vErrors = [err13]; } else { vErrors.push(err13); } errors++; } } } if (data.from !== undefined) { let data6 = data.from; if (typeof data6 !== "string") { const err14 = { instancePath: instancePath + "/from", schemaPath: "#/oneOf/0/properties/from/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema14.oneOf[0].properties.from.type, parentSchema: schema14.oneOf[0].properties.from, data: data6 }; if (vErrors === null) { vErrors = [err14]; } else { vErrors.push(err14); } errors++; } } } var _valid0 = _errs2 === errors; if (_valid0) { valid0 = true; passing0 = 0; } const _errs18 = errors; if (data && typeof data == "object" && !Array.isArray(data)) { if (data.rule === undefined) { const err15 = { instancePath, schemaPath: "#/oneOf/1/required", keyword: "required", params: { missingProperty: "rule" }, message: "must have required property '" + "rule" + "'", schema: schema14.oneOf[1].required, parentSchema: schema14.oneOf[1], data }; if (vErrors === null) { vErrors = [err15]; } else { vErrors.push(err15); } errors++; } if (data.from_nested === undefined) { const err16 = { instancePath, schemaPath: "#/oneOf/1/required", keyword: "required", params: { missingProperty: "from_nested" }, message: "must have required property '" + "from_nested" + "'", schema: schema14.oneOf[1].required, parentSchema: schema14.oneOf[1], data }; if (vErrors === null) { vErrors = [err16]; } else { vErrors.push(err16); } errors++; } for (const key1 in data) { if (!(((((((key1 === "name") || (key1 === "purpose")) || (key1 === "rule")) || (key1 === "count")) || (key1 === "min")) || (key1 === "max")) || (key1 === "from_nested"))) { const err17 = { instancePath, schemaPath: "#/oneOf/1/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties", schema: false, parentSchema: schema14.oneOf[1], data }; if (vErrors === null) { vErrors = [err17]; } else { vErrors.push(err17); } errors++; } } if (data.name !== undefined) { let data7 = data.name; if (typeof data7 !== "string") { const err18 = { instancePath: instancePath + "/name", schemaPath: "#/oneOf/1/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema14.oneOf[1].properties.name.type, parentSchema: schema14.oneOf[1].properties.name, data: data7 }; if (vErrors === null) { vErrors = [err18]; } else { vErrors.push(err18); } errors++; } } if (data.purpose !== undefined) { let data8 = data.purpose; if (typeof data8 !== "string") { const err19 = { instancePath: instancePath + "/purpose", schemaPath: "#/oneOf/1/properties/purpose/type", keyword: "type", params: { type: "string" }, message: "must be string", schema: schema14.oneOf[1].properties.purpose.type, parentSchema: schema14.oneOf[1].properties.purpose, data: data8 }; if (vErrors === null) { vErrors = [err19]; } else {