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