@waku/rln
Version:
RLN (Rate Limiting Nullifier) implementation for Waku
121 lines • 8.61 kB
JavaScript
/* eslint eslint-comments/no-unlimited-disable: "off" */
// This file was generated by /scripts/schema-validation-codegen.ts
// Do not modify this file by hand.
/* eslint-disable */
// @ts-ignore
;
export const Credential = validate11;
const schema12 = { "type": "object", "properties": { "crypto": { "type": "object", "properties": { "cipher": { "type": "string" }, "cipherparams": { "type": "object" }, "ciphertext": { "type": "string" }, "kdf": { "type": "string" }, "kdfparams": { "type": "object" }, "mac": { "type": "string" } }, "required": ["cipher", "cipherparams", "ciphertext", "kdf", "kdfparams", "mac"] } }, "required": ["crypto"] };
function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) {
if (data && typeof data == "object" && !Array.isArray(data)) {
let missing0;
if ((data.crypto === undefined) && (missing0 = "crypto")) {
validate11.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
return false;
}
else {
if (data.crypto !== undefined) {
let data0 = data.crypto;
const _errs1 = errors;
if (errors === _errs1) {
if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
let missing1;
if (((((((data0.cipher === undefined) && (missing1 = "cipher")) || ((data0.cipherparams === undefined) && (missing1 = "cipherparams"))) || ((data0.ciphertext === undefined) && (missing1 = "ciphertext"))) || ((data0.kdf === undefined) && (missing1 = "kdf"))) || ((data0.kdfparams === undefined) && (missing1 = "kdfparams"))) || ((data0.mac === undefined) && (missing1 = "mac"))) {
validate11.errors = [{ instancePath: instancePath + "/crypto", schemaPath: "#/properties/crypto/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
return false;
}
else {
if (data0.cipher !== undefined) {
const _errs3 = errors;
if (typeof data0.cipher !== "string") {
validate11.errors = [{ instancePath: instancePath + "/crypto/cipher", schemaPath: "#/properties/crypto/properties/cipher/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid1 = _errs3 === errors;
}
else {
var valid1 = true;
}
if (valid1) {
if (data0.cipherparams !== undefined) {
let data2 = data0.cipherparams;
const _errs5 = errors;
if (!(data2 && typeof data2 == "object" && !Array.isArray(data2))) {
validate11.errors = [{ instancePath: instancePath + "/crypto/cipherparams", schemaPath: "#/properties/crypto/properties/cipherparams/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
var valid1 = _errs5 === errors;
}
else {
var valid1 = true;
}
if (valid1) {
if (data0.ciphertext !== undefined) {
const _errs7 = errors;
if (typeof data0.ciphertext !== "string") {
validate11.errors = [{ instancePath: instancePath + "/crypto/ciphertext", schemaPath: "#/properties/crypto/properties/ciphertext/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid1 = _errs7 === errors;
}
else {
var valid1 = true;
}
if (valid1) {
if (data0.kdf !== undefined) {
const _errs9 = errors;
if (typeof data0.kdf !== "string") {
validate11.errors = [{ instancePath: instancePath + "/crypto/kdf", schemaPath: "#/properties/crypto/properties/kdf/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid1 = _errs9 === errors;
}
else {
var valid1 = true;
}
if (valid1) {
if (data0.kdfparams !== undefined) {
let data5 = data0.kdfparams;
const _errs11 = errors;
if (!(data5 && typeof data5 == "object" && !Array.isArray(data5))) {
validate11.errors = [{ instancePath: instancePath + "/crypto/kdfparams", schemaPath: "#/properties/crypto/properties/kdfparams/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
var valid1 = _errs11 === errors;
}
else {
var valid1 = true;
}
if (valid1) {
if (data0.mac !== undefined) {
const _errs13 = errors;
if (typeof data0.mac !== "string") {
validate11.errors = [{ instancePath: instancePath + "/crypto/mac", schemaPath: "#/properties/crypto/properties/mac/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
var valid1 = _errs13 === errors;
}
else {
var valid1 = true;
}
}
}
}
}
}
}
}
else {
validate11.errors = [{ instancePath: instancePath + "/crypto", schemaPath: "#/properties/crypto/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
}
}
}
}
else {
validate11.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
return false;
}
} validate11.errors = vErrors; return errors === 0; }
//# sourceMappingURL=credential_validation_generated.js.map