| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.getTSATimestamp = getTSATimestamp; |
| 4 |
exports.getTLogTimestamp = getTLogTimestamp; |
| 5 |
const tsa_1 = require("./tsa"); |
| 6 |
function getTSATimestamp(timestamp, data, timestampAuthorities) { |
| 7 |
(0, tsa_1.verifyRFC3161Timestamp)(timestamp, data, timestampAuthorities); |
| 8 |
return { |
| 9 |
type: 'timestamp-authority', |
| 10 |
logID: timestamp.signerSerialNumber, |
| 11 |
timestamp: timestamp.signingTime, |
| 12 |
}; |
| 13 |
} |
| 14 |
function getTLogTimestamp(entry) { |
| 15 |
// Only entries with an inclusion promise provide a verifiable timestamp |
| 16 |
if (!entry.inclusionPromise) { |
| 17 |
return undefined; |
| 18 |
} |
| 19 |
return { |
| 20 |
type: 'transparency-log', |
| 21 |
logID: entry.logId.keyId, |
| 22 |
timestamp: new Date(Number(entry.integratedTime) * 1000), |
| 23 |
}; |
| 24 |
} |