Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 41x 9x 10x 22x 20x 8x | import VerifierError from '../models/verifierError';
import { SUB_STEPS } from '../domain/verifier/entities/verificationSteps';
import domain from '../domain';
import { intersect } from '../helpers/array';
import type { RevokedAssertion } from '../models/RevokedAssertions';
export default function ensureNotRevoked (revokedAddresses?: RevokedAssertion[], keys?: string | string[]): void {
if (!revokedAddresses || !keys) {
// nothing to do
return;
}
if (!Array.isArray(keys)) {
keys = [keys];
}
keys = keys.filter(key => key != null);
const matches = intersect(keys, revokedAddresses.map(assertion => assertion.id));
if (matches.length > 0) {
const indexOfMatch = revokedAddresses.findIndex(address => address.id === matches[0]);
if (indexOfMatch > -1) {
throw new VerifierError(
SUB_STEPS.checkRevokedStatus,
domain.certificates.generateRevocationReason(
revokedAddresses[indexOfMatch].revocationReason
)
);
}
}
}
|