| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/nodejs/node_modules/npm/node_modules/@sigstore/verify/dist/bundle/ |
Upload File : |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toSignedEntity = toSignedEntity;
exports.signatureContent = signatureContent;
const core_1 = require("@sigstore/core");
const dsse_1 = require("./dsse");
const message_1 = require("./message");
function toSignedEntity(bundle, artifact) {
const { tlogEntries, timestampVerificationData } = bundle.verificationMaterial;
const timestamps = [];
for (const entry of tlogEntries) {
if (entry.integratedTime && entry.integratedTime !== '0') {
timestamps.push({
$case: 'transparency-log',
tlogEntry: entry,
});
}
}
for (const ts of timestampVerificationData?.rfc3161Timestamps ?? []) {
timestamps.push({
$case: 'timestamp-authority',
timestamp: core_1.RFC3161Timestamp.parse(Buffer.from(ts.signedTimestamp)),
});
}
return {
signature: signatureContent(bundle, artifact),
key: key(bundle),
tlogEntries,
timestamps,
};
}
function signatureContent(bundle, artifact) {
switch (bundle.content.$case) {
case 'dsseEnvelope':
return new dsse_1.DSSESignatureContent(bundle.content.dsseEnvelope);
case 'messageSignature':
return new message_1.MessageSignatureContent(bundle.content.messageSignature, artifact);
}
}
function key(bundle) {
switch (bundle.verificationMaterial.content.$case) {
case 'publicKey':
return {
$case: 'public-key',
hint: bundle.verificationMaterial.content.publicKey.hint,
};
case 'x509CertificateChain':
return {
$case: 'certificate',
certificate: core_1.X509Certificate.parse(Buffer.from(bundle.verificationMaterial.content.x509CertificateChain
.certificates[0].rawBytes)),
};
case 'certificate':
return {
$case: 'certificate',
certificate: core_1.X509Certificate.parse(Buffer.from(bundle.verificationMaterial.content.certificate.rawBytes)),
};
}
}