clientCertificate: remove unsafe casts

This commit is contained in:
Reto Brunner 2024-04-14 02:59:41 +02:00
parent a4afa08add
commit b8a9fe08ab

View file

@ -31,7 +31,7 @@ function get(uuid: string): ClientCertificateType | null {
return {
private_key: fs.readFileSync(paths.privateKeyPath, "utf-8"),
certificate: fs.readFileSync(paths.certificatePath, "utf-8"),
} as ClientCertificateType;
};
} catch (e: any) {
log.error("Unable to get certificate", e);
}
@ -122,10 +122,10 @@ function generate() {
// Sign this certificate with a SHA256 signature
cert.sign(keys.privateKey, md.sha256.create());
const pem = {
const pem: ClientCertificateType = {
private_key: pki.privateKeyToPem(keys.privateKey),
certificate: pki.certificateToPem(cert),
} as ClientCertificateType;
};
return pem;
}