@waku/rln
Version:
RLN (Rate Limiting Nullifier) implementation for Waku
865 lines (864 loc) • 71.4 kB
JavaScript
import { __exports as schemaValidationGenerated } from '../../../../_virtual/schema-validation-generated.js';
Object.defineProperty(schemaValidationGenerated, "__esModule", { value: true });
schemaValidationGenerated.Keystore = void 0;
schemaValidationGenerated.Keystore = validate19;
const pattern0 = new RegExp("^pbkdf2$", "u");
const pattern1 = new RegExp("^hmac-sha256$", "u");
const pattern2 = new RegExp("^$", "u");
const pattern3 = new RegExp("^scrypt$", "u");
const pattern4 = new RegExp("^([A-Fa-f0-9]{2}){32}$", "u");
function validate12(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; const _errs0 = errors; const _errs1 = errors; if (errors === _errs1) {
if (data && typeof data == "object" && !Array.isArray(data)) {
let missing0;
if ((((data.function === undefined) && (missing0 = "function")) || ((data.message === undefined) && (missing0 = "message"))) || ((data.params === undefined) && (missing0 = "params"))) {
validate12.errors = [{ instancePath, schemaPath: "#/definitions/Module/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
return false;
}
else {
if (data.function !== undefined) {
const _errs3 = errors;
if (typeof data.function !== "string") {
validate12.errors = [{ instancePath: instancePath + "/function", schemaPath: "#/definitions/Module/properties/function/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid2 = _errs3 === errors;
}
else {
var valid2 = true;
}
if (valid2) {
if (data.params !== undefined) {
let data1 = data.params;
const _errs5 = errors;
if (!(data1 && typeof data1 == "object" && !Array.isArray(data1))) {
validate12.errors = [{ instancePath: instancePath + "/params", schemaPath: "#/definitions/Module/properties/params/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
var valid2 = _errs5 === errors;
}
else {
var valid2 = true;
}
if (valid2) {
if (data.message !== undefined) {
const _errs7 = errors;
if (typeof data.message !== "string") {
validate12.errors = [{ instancePath: instancePath + "/message", schemaPath: "#/definitions/Module/properties/message/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid2 = _errs7 === errors;
}
else {
var valid2 = true;
}
}
}
}
}
else {
validate12.errors = [{ instancePath, schemaPath: "#/definitions/Module/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
} var valid0 = _errs0 === errors; if (valid0) {
const _errs9 = errors;
const _errs10 = errors;
let valid3 = false;
let passing0 = null;
const _errs11 = errors;
const _errs12 = errors;
if (errors === _errs12) {
if (data && typeof data == "object" && !Array.isArray(data)) {
if (data.function !== undefined) {
let data3 = data.function;
const _errs14 = errors;
if (errors === _errs14) {
if (typeof data3 === "string") {
if (!pattern0.test(data3)) {
const err0 = { instancePath: instancePath + "/function", schemaPath: "#/definitions/Pbkdf2Module/properties/function/pattern", keyword: "pattern", params: { pattern: "^pbkdf2$" }, message: "must match pattern \"" + "^pbkdf2$" + "\"" };
if (vErrors === null) {
vErrors = [err0];
}
else {
vErrors.push(err0);
}
errors++;
}
}
else {
const err1 = { instancePath: instancePath + "/function", schemaPath: "#/definitions/Pbkdf2Module/properties/function/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err1];
}
else {
vErrors.push(err1);
}
errors++;
}
}
var valid5 = _errs14 === errors;
}
else {
var valid5 = true;
}
if (valid5) {
if (data.params !== undefined) {
let data4 = data.params;
const _errs16 = errors;
if (errors === _errs16) {
if (data4 && typeof data4 == "object" && !Array.isArray(data4)) {
let missing1;
if (((((data4.dklen === undefined) && (missing1 = "dklen")) || ((data4.c === undefined) && (missing1 = "c"))) || ((data4.prf === undefined) && (missing1 = "prf"))) || ((data4.salt === undefined) && (missing1 = "salt"))) {
const err2 = { instancePath: instancePath + "/params", schemaPath: "#/definitions/Pbkdf2Module/properties/params/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" };
if (vErrors === null) {
vErrors = [err2];
}
else {
vErrors.push(err2);
}
errors++;
}
else {
if (data4.dklen !== undefined) {
let data5 = data4.dklen;
const _errs18 = errors;
if (!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) {
const err3 = { instancePath: instancePath + "/params/dklen", schemaPath: "#/definitions/Pbkdf2Module/properties/params/properties/dklen/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
if (vErrors === null) {
vErrors = [err3];
}
else {
vErrors.push(err3);
}
errors++;
}
if (errors === _errs18) {
if ((typeof data5 == "number") && (isFinite(data5))) {
if (data5 < 0 || isNaN(data5)) {
const err4 = { instancePath: instancePath + "/params/dklen", schemaPath: "#/definitions/Pbkdf2Module/properties/params/properties/dklen/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
if (vErrors === null) {
vErrors = [err4];
}
else {
vErrors.push(err4);
}
errors++;
}
}
}
var valid6 = _errs18 === errors;
}
else {
var valid6 = true;
}
if (valid6) {
if (data4.c !== undefined) {
let data6 = data4.c;
const _errs20 = errors;
if (!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) {
const err5 = { instancePath: instancePath + "/params/c", schemaPath: "#/definitions/Pbkdf2Module/properties/params/properties/c/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
if (vErrors === null) {
vErrors = [err5];
}
else {
vErrors.push(err5);
}
errors++;
}
if (errors === _errs20) {
if ((typeof data6 == "number") && (isFinite(data6))) {
if (data6 < 0 || isNaN(data6)) {
const err6 = { instancePath: instancePath + "/params/c", schemaPath: "#/definitions/Pbkdf2Module/properties/params/properties/c/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
if (vErrors === null) {
vErrors = [err6];
}
else {
vErrors.push(err6);
}
errors++;
}
}
}
var valid6 = _errs20 === errors;
}
else {
var valid6 = true;
}
if (valid6) {
if (data4.prf !== undefined) {
let data7 = data4.prf;
const _errs22 = errors;
if (errors === _errs22) {
if (typeof data7 === "string") {
if (!pattern1.test(data7)) {
const err7 = { instancePath: instancePath + "/params/prf", schemaPath: "#/definitions/Pbkdf2Module/properties/params/properties/prf/pattern", keyword: "pattern", params: { pattern: "^hmac-sha256$" }, message: "must match pattern \"" + "^hmac-sha256$" + "\"" };
if (vErrors === null) {
vErrors = [err7];
}
else {
vErrors.push(err7);
}
errors++;
}
}
else {
const err8 = { instancePath: instancePath + "/params/prf", schemaPath: "#/definitions/Pbkdf2Module/properties/params/properties/prf/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err8];
}
else {
vErrors.push(err8);
}
errors++;
}
}
var valid6 = _errs22 === errors;
}
else {
var valid6 = true;
}
if (valid6) {
if (data4.salt !== undefined) {
const _errs24 = errors;
if (typeof data4.salt !== "string") {
const err9 = { instancePath: instancePath + "/params/salt", schemaPath: "#/definitions/Pbkdf2Module/properties/params/properties/salt/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err9];
}
else {
vErrors.push(err9);
}
errors++;
}
var valid6 = _errs24 === errors;
}
else {
var valid6 = true;
}
}
}
}
}
}
else {
const err10 = { instancePath: instancePath + "/params", schemaPath: "#/definitions/Pbkdf2Module/properties/params/type", keyword: "type", params: { type: "object" }, message: "must be object" };
if (vErrors === null) {
vErrors = [err10];
}
else {
vErrors.push(err10);
}
errors++;
}
}
var valid5 = _errs16 === errors;
}
else {
var valid5 = true;
}
if (valid5) {
if (data.message !== undefined) {
let data9 = data.message;
const _errs26 = errors;
if (errors === _errs26) {
if (typeof data9 === "string") {
if (!pattern2.test(data9)) {
const err11 = { instancePath: instancePath + "/message", schemaPath: "#/definitions/Pbkdf2Module/properties/message/pattern", keyword: "pattern", params: { pattern: "^$" }, message: "must match pattern \"" + "^$" + "\"" };
if (vErrors === null) {
vErrors = [err11];
}
else {
vErrors.push(err11);
}
errors++;
}
}
else {
const err12 = { instancePath: instancePath + "/message", schemaPath: "#/definitions/Pbkdf2Module/properties/message/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err12];
}
else {
vErrors.push(err12);
}
errors++;
}
}
var valid5 = _errs26 === errors;
}
else {
var valid5 = true;
}
}
}
}
else {
const err13 = { instancePath, schemaPath: "#/definitions/Pbkdf2Module/type", keyword: "type", params: { type: "object" }, message: "must be object" };
if (vErrors === null) {
vErrors = [err13];
}
else {
vErrors.push(err13);
}
errors++;
}
}
var _valid0 = _errs11 === errors;
if (_valid0) {
valid3 = true;
passing0 = 0;
}
const _errs28 = errors;
const _errs29 = errors;
if (errors === _errs29) {
if (data && typeof data == "object" && !Array.isArray(data)) {
if (data.function !== undefined) {
let data10 = data.function;
const _errs31 = errors;
if (errors === _errs31) {
if (typeof data10 === "string") {
if (!pattern3.test(data10)) {
const err14 = { instancePath: instancePath + "/function", schemaPath: "#/definitions/ScryptModule/properties/function/pattern", keyword: "pattern", params: { pattern: "^scrypt$" }, message: "must match pattern \"" + "^scrypt$" + "\"" };
if (vErrors === null) {
vErrors = [err14];
}
else {
vErrors.push(err14);
}
errors++;
}
}
else {
const err15 = { instancePath: instancePath + "/function", schemaPath: "#/definitions/ScryptModule/properties/function/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err15];
}
else {
vErrors.push(err15);
}
errors++;
}
}
var valid8 = _errs31 === errors;
}
else {
var valid8 = true;
}
if (valid8) {
if (data.params !== undefined) {
let data11 = data.params;
const _errs33 = errors;
if (errors === _errs33) {
if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
let missing2;
if ((((((data11.dklen === undefined) && (missing2 = "dklen")) || ((data11.n === undefined) && (missing2 = "n"))) || ((data11.p === undefined) && (missing2 = "p"))) || ((data11.r === undefined) && (missing2 = "r"))) || ((data11.salt === undefined) && (missing2 = "salt"))) {
const err16 = { instancePath: instancePath + "/params", schemaPath: "#/definitions/ScryptModule/properties/params/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" };
if (vErrors === null) {
vErrors = [err16];
}
else {
vErrors.push(err16);
}
errors++;
}
else {
if (data11.dklen !== undefined) {
let data12 = data11.dklen;
const _errs35 = errors;
if (!(((typeof data12 == "number") && (!(data12 % 1) && !isNaN(data12))) && (isFinite(data12)))) {
const err17 = { instancePath: instancePath + "/params/dklen", schemaPath: "#/definitions/ScryptModule/properties/params/properties/dklen/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
if (vErrors === null) {
vErrors = [err17];
}
else {
vErrors.push(err17);
}
errors++;
}
if (errors === _errs35) {
if ((typeof data12 == "number") && (isFinite(data12))) {
if (data12 < 0 || isNaN(data12)) {
const err18 = { instancePath: instancePath + "/params/dklen", schemaPath: "#/definitions/ScryptModule/properties/params/properties/dklen/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
if (vErrors === null) {
vErrors = [err18];
}
else {
vErrors.push(err18);
}
errors++;
}
}
}
var valid9 = _errs35 === errors;
}
else {
var valid9 = true;
}
if (valid9) {
if (data11.n !== undefined) {
let data13 = data11.n;
const _errs37 = errors;
if (!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))) {
const err19 = { instancePath: instancePath + "/params/n", schemaPath: "#/definitions/ScryptModule/properties/params/properties/n/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
if (vErrors === null) {
vErrors = [err19];
}
else {
vErrors.push(err19);
}
errors++;
}
if (errors === _errs37) {
if ((typeof data13 == "number") && (isFinite(data13))) {
if (data13 < 0 || isNaN(data13)) {
const err20 = { instancePath: instancePath + "/params/n", schemaPath: "#/definitions/ScryptModule/properties/params/properties/n/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
if (vErrors === null) {
vErrors = [err20];
}
else {
vErrors.push(err20);
}
errors++;
}
}
}
var valid9 = _errs37 === errors;
}
else {
var valid9 = true;
}
if (valid9) {
if (data11.p !== undefined) {
let data14 = data11.p;
const _errs39 = errors;
if (!(((typeof data14 == "number") && (!(data14 % 1) && !isNaN(data14))) && (isFinite(data14)))) {
const err21 = { instancePath: instancePath + "/params/p", schemaPath: "#/definitions/ScryptModule/properties/params/properties/p/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
if (vErrors === null) {
vErrors = [err21];
}
else {
vErrors.push(err21);
}
errors++;
}
if (errors === _errs39) {
if ((typeof data14 == "number") && (isFinite(data14))) {
if (data14 < 0 || isNaN(data14)) {
const err22 = { instancePath: instancePath + "/params/p", schemaPath: "#/definitions/ScryptModule/properties/params/properties/p/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
if (vErrors === null) {
vErrors = [err22];
}
else {
vErrors.push(err22);
}
errors++;
}
}
}
var valid9 = _errs39 === errors;
}
else {
var valid9 = true;
}
if (valid9) {
if (data11.r !== undefined) {
let data15 = data11.r;
const _errs41 = errors;
if (!(((typeof data15 == "number") && (!(data15 % 1) && !isNaN(data15))) && (isFinite(data15)))) {
const err23 = { instancePath: instancePath + "/params/r", schemaPath: "#/definitions/ScryptModule/properties/params/properties/r/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
if (vErrors === null) {
vErrors = [err23];
}
else {
vErrors.push(err23);
}
errors++;
}
if (errors === _errs41) {
if ((typeof data15 == "number") && (isFinite(data15))) {
if (data15 < 0 || isNaN(data15)) {
const err24 = { instancePath: instancePath + "/params/r", schemaPath: "#/definitions/ScryptModule/properties/params/properties/r/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
if (vErrors === null) {
vErrors = [err24];
}
else {
vErrors.push(err24);
}
errors++;
}
}
}
var valid9 = _errs41 === errors;
}
else {
var valid9 = true;
}
if (valid9) {
if (data11.salt !== undefined) {
let data16 = data11.salt;
const _errs43 = errors;
if (errors === _errs43) {
if (typeof data16 === "string") {
if (!pattern4.test(data16)) {
const err25 = { instancePath: instancePath + "/params/salt", schemaPath: "#/definitions/ScryptModule/properties/params/properties/salt/pattern", keyword: "pattern", params: { pattern: "^([A-Fa-f0-9]{2}){32}$" }, message: "must match pattern \"" + "^([A-Fa-f0-9]{2}){32}$" + "\"" };
if (vErrors === null) {
vErrors = [err25];
}
else {
vErrors.push(err25);
}
errors++;
}
}
else {
const err26 = { instancePath: instancePath + "/params/salt", schemaPath: "#/definitions/ScryptModule/properties/params/properties/salt/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err26];
}
else {
vErrors.push(err26);
}
errors++;
}
}
var valid9 = _errs43 === errors;
}
else {
var valid9 = true;
}
}
}
}
}
}
}
else {
const err27 = { instancePath: instancePath + "/params", schemaPath: "#/definitions/ScryptModule/properties/params/type", keyword: "type", params: { type: "object" }, message: "must be object" };
if (vErrors === null) {
vErrors = [err27];
}
else {
vErrors.push(err27);
}
errors++;
}
}
var valid8 = _errs33 === errors;
}
else {
var valid8 = true;
}
if (valid8) {
if (data.message !== undefined) {
let data17 = data.message;
const _errs45 = errors;
if (errors === _errs45) {
if (typeof data17 === "string") {
if (!pattern2.test(data17)) {
const err28 = { instancePath: instancePath + "/message", schemaPath: "#/definitions/ScryptModule/properties/message/pattern", keyword: "pattern", params: { pattern: "^$" }, message: "must match pattern \"" + "^$" + "\"" };
if (vErrors === null) {
vErrors = [err28];
}
else {
vErrors.push(err28);
}
errors++;
}
}
else {
const err29 = { instancePath: instancePath + "/message", schemaPath: "#/definitions/ScryptModule/properties/message/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err29];
}
else {
vErrors.push(err29);
}
errors++;
}
}
var valid8 = _errs45 === errors;
}
else {
var valid8 = true;
}
}
}
}
else {
const err30 = { instancePath, schemaPath: "#/definitions/ScryptModule/type", keyword: "type", params: { type: "object" }, message: "must be object" };
if (vErrors === null) {
vErrors = [err30];
}
else {
vErrors.push(err30);
}
errors++;
}
}
var _valid0 = _errs28 === errors;
if (_valid0 && valid3) {
valid3 = false;
passing0 = [passing0, 1];
}
else {
if (_valid0) {
valid3 = true;
passing0 = 1;
}
}
if (!valid3) {
const err31 = { instancePath, schemaPath: "#/allOf/1/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" };
if (vErrors === null) {
vErrors = [err31];
}
else {
vErrors.push(err31);
}
errors++;
validate12.errors = vErrors;
return false;
}
else {
errors = _errs10;
if (vErrors !== null) {
if (_errs10) {
vErrors.length = _errs10;
}
else {
vErrors = null;
}
}
}
var valid0 = _errs9 === errors;
} validate12.errors = vErrors; return errors === 0; }
const pattern6 = new RegExp("^sha256$", "u");
function validate14(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; const _errs0 = errors; const _errs1 = errors; if (errors === _errs1) {
if (data && typeof data == "object" && !Array.isArray(data)) {
let missing0;
if ((((data.function === undefined) && (missing0 = "function")) || ((data.message === undefined) && (missing0 = "message"))) || ((data.params === undefined) && (missing0 = "params"))) {
validate14.errors = [{ instancePath, schemaPath: "#/definitions/Module/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
return false;
}
else {
if (data.function !== undefined) {
const _errs3 = errors;
if (typeof data.function !== "string") {
validate14.errors = [{ instancePath: instancePath + "/function", schemaPath: "#/definitions/Module/properties/function/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid2 = _errs3 === errors;
}
else {
var valid2 = true;
}
if (valid2) {
if (data.params !== undefined) {
let data1 = data.params;
const _errs5 = errors;
if (!(data1 && typeof data1 == "object" && !Array.isArray(data1))) {
validate14.errors = [{ instancePath: instancePath + "/params", schemaPath: "#/definitions/Module/properties/params/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
var valid2 = _errs5 === errors;
}
else {
var valid2 = true;
}
if (valid2) {
if (data.message !== undefined) {
const _errs7 = errors;
if (typeof data.message !== "string") {
validate14.errors = [{ instancePath: instancePath + "/message", schemaPath: "#/definitions/Module/properties/message/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid2 = _errs7 === errors;
}
else {
var valid2 = true;
}
}
}
}
}
else {
validate14.errors = [{ instancePath, schemaPath: "#/definitions/Module/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
} var valid0 = _errs0 === errors; if (valid0) {
const _errs9 = errors;
const _errs10 = errors;
let valid3 = false;
let passing0 = null;
const _errs11 = errors;
const _errs12 = errors;
if (errors === _errs12) {
if (data && typeof data == "object" && !Array.isArray(data)) {
if (data.function !== undefined) {
let data3 = data.function;
const _errs14 = errors;
if (errors === _errs14) {
if (typeof data3 === "string") {
if (!pattern6.test(data3)) {
const err0 = { instancePath: instancePath + "/function", schemaPath: "#/definitions/Sha2Module/properties/function/pattern", keyword: "pattern", params: { pattern: "^sha256$" }, message: "must match pattern \"" + "^sha256$" + "\"" };
if (vErrors === null) {
vErrors = [err0];
}
else {
vErrors.push(err0);
}
errors++;
}
}
else {
const err1 = { instancePath: instancePath + "/function", schemaPath: "#/definitions/Sha2Module/properties/function/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err1];
}
else {
vErrors.push(err1);
}
errors++;
}
}
var valid5 = _errs14 === errors;
}
else {
var valid5 = true;
}
if (valid5) {
if (data.params !== undefined) {
let data4 = data.params;
const _errs16 = errors;
if (errors === _errs16) {
if (data4 && typeof data4 == "object" && !Array.isArray(data4)) {
for (const key0 in data4) {
const err2 = { instancePath: instancePath + "/params", schemaPath: "#/definitions/Sha2Module/properties/params/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
if (vErrors === null) {
vErrors = [err2];
}
else {
vErrors.push(err2);
}
errors++;
break;
}
}
else {
const err3 = { instancePath: instancePath + "/params", schemaPath: "#/definitions/Sha2Module/properties/params/type", keyword: "type", params: { type: "object" }, message: "must be object" };
if (vErrors === null) {
vErrors = [err3];
}
else {
vErrors.push(err3);
}
errors++;
}
}
var valid5 = _errs16 === errors;
}
else {
var valid5 = true;
}
if (valid5) {
if (data.message !== undefined) {
let data5 = data.message;
const _errs19 = errors;
if (errors === _errs19) {
if (typeof data5 === "string") {
if (!pattern4.test(data5)) {
const err4 = { instancePath: instancePath + "/message", schemaPath: "#/definitions/Sha2Module/properties/message/pattern", keyword: "pattern", params: { pattern: "^([A-Fa-f0-9]{2}){32}$" }, message: "must match pattern \"" + "^([A-Fa-f0-9]{2}){32}$" + "\"" };
if (vErrors === null) {
vErrors = [err4];
}
else {
vErrors.push(err4);
}
errors++;
}
}
else {
const err5 = { instancePath: instancePath + "/message", schemaPath: "#/definitions/Sha2Module/properties/message/type", keyword: "type", params: { type: "string" }, message: "must be string" };
if (vErrors === null) {
vErrors = [err5];
}
else {
vErrors.push(err5);
}
errors++;
}
}
var valid5 = _errs19 === errors;
}
else {
var valid5 = true;
}
}
}
}
else {
const err6 = { instancePath, schemaPath: "#/definitions/Sha2Module/type", keyword: "type", params: { type: "object" }, message: "must be object" };
if (vErrors === null) {
vErrors = [err6];
}
else {
vErrors.push(err6);
}
errors++;
}
}
var _valid0 = _errs11 === errors;
if (_valid0) {
valid3 = true;
passing0 = 0;
}
if (!valid3) {
const err7 = { instancePath, schemaPath: "#/allOf/1/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" };
if (vErrors === null) {
vErrors = [err7];
}
else {
vErrors.push(err7);
}
errors++;
validate14.errors = vErrors;
return false;
}
else {
errors = _errs10;
if (vErrors !== null) {
if (_errs10) {
vErrors.length = _errs10;
}
else {
vErrors = null;
}
}
}
var valid0 = _errs9 === errors;
} validate14.errors = vErrors; return errors === 0; }
const pattern8 = new RegExp("^aes-128-ctr$", "u");
const pattern9 = new RegExp("^([A-Fa-f0-9]{2}){16}$", "u");
function validate16(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; const _errs0 = errors; const _errs1 = errors; if (errors === _errs1) {
if (data && typeof data == "object" && !Array.isArray(data)) {
let missing0;
if ((((data.function === undefined) && (missing0 = "function")) || ((data.message === undefined) && (missing0 = "message"))) || ((data.params === undefined) && (missing0 = "params"))) {
validate16.errors = [{ instancePath, schemaPath: "#/definitions/Module/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
return false;
}
else {
if (data.function !== undefined) {
const _errs3 = errors;
if (typeof data.function !== "string") {
validate16.errors = [{ instancePath: instancePath + "/function", schemaPath: "#/definitions/Module/properties/function/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid2 = _errs3 === errors;
}
else {
var valid2 = true;
}
if (valid2) {
if (data.params !== undefined) {
let data1 = data.params;
const _errs5 = errors;
if (!(data1 && typeof data1 == "object" && !Array.isArray(data1))) {
validate16.errors = [{ instancePath: instancePath + "/params", schemaPath: "#/definitions/Module/properties/p