mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-10 01:32:17 +02:00
clientCertificate: remove unsafe casts
This commit is contained in:
parent
a4afa08add
commit
b8a9fe08ab
|
@ -31,7 +31,7 @@ function get(uuid: string): ClientCertificateType | null {
|
||||||
return {
|
return {
|
||||||
private_key: fs.readFileSync(paths.privateKeyPath, "utf-8"),
|
private_key: fs.readFileSync(paths.privateKeyPath, "utf-8"),
|
||||||
certificate: fs.readFileSync(paths.certificatePath, "utf-8"),
|
certificate: fs.readFileSync(paths.certificatePath, "utf-8"),
|
||||||
} as ClientCertificateType;
|
};
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
log.error("Unable to get certificate", e);
|
log.error("Unable to get certificate", e);
|
||||||
}
|
}
|
||||||
|
@ -122,10 +122,10 @@ function generate() {
|
||||||
// Sign this certificate with a SHA256 signature
|
// Sign this certificate with a SHA256 signature
|
||||||
cert.sign(keys.privateKey, md.sha256.create());
|
cert.sign(keys.privateKey, md.sha256.create());
|
||||||
|
|
||||||
const pem = {
|
const pem: ClientCertificateType = {
|
||||||
private_key: pki.privateKeyToPem(keys.privateKey),
|
private_key: pki.privateKeyToPem(keys.privateKey),
|
||||||
certificate: pki.certificateToPem(cert),
|
certificate: pki.certificateToPem(cert),
|
||||||
} as ClientCertificateType;
|
};
|
||||||
|
|
||||||
return pem;
|
return pem;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue