UNPKG

jsonld-signatures-merkleproof2019

Version:

A jsonld signature implementation to support MerkleProof2019 verification in Verifiable Credential context

22 lines (21 loc) 823 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ensureExplorerAPIValidity; function isPriorityValid(explorerAPI) { return explorerAPI.priority >= 0; } function isParsingFunctionValid(explorerAPI) { return typeof explorerAPI.parsingFunction === 'function'; } function ensureExplorerAPIValidity(explorerAPIs = []) { if (explorerAPIs.length === 0) { return false; } if (explorerAPIs.some(explorerAPI => !isPriorityValid(explorerAPI))) { throw new Error('One or more of your custom explorer APIs has a priority set below zero'); } if (explorerAPIs.some(explorerAPI => !isParsingFunctionValid(explorerAPI))) { throw new Error('One or more of your custom explorer APIs does not have a parsing function'); } return true; }