• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.filterTLogAuthorities = exports.filterCertAuthorities = void 0;
4function filterCertAuthorities(certAuthorities, criteria) {
5    return certAuthorities.filter((ca) => {
6        return (ca.validFor.start <= criteria.start && ca.validFor.end >= criteria.end);
7    });
8}
9exports.filterCertAuthorities = filterCertAuthorities;
10// Filter the list of tlog instances to only those which match the given log
11// ID and have public keys which are valid for the given integrated time.
12function filterTLogAuthorities(tlogAuthorities, criteria) {
13    return tlogAuthorities.filter((tlog) => {
14        // If we're filtering by log ID and the log IDs don't match, we can't use
15        // this tlog
16        if (criteria.logID && !tlog.logID.equals(criteria.logID)) {
17            return false;
18        }
19        // Check that the integrated time is within the validFor range
20        return (tlog.validFor.start <= criteria.targetDate &&
21            criteria.targetDate <= tlog.validFor.end);
22    });
23}
24exports.filterTLogAuthorities = filterTLogAuthorities;
25