jsonld-signatures-merkleproof2019
Version:
A jsonld signature implementation to support MerkleProof2019 verification in Verifiable Credential context
19 lines (18 loc) • 716 B
JavaScript
function isPriorityValid(explorerAPI) {
return explorerAPI.priority >= 0;
}
function isParsingFunctionValid(explorerAPI) {
return typeof explorerAPI.parsingFunction === 'function';
}
export default 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;
}