Fix function placement

This commit is contained in:
Reinier Criel 2025-11-27 13:08:35 -08:00
parent a0bbe38ee7
commit 0ee5106b7a

View file

@ -8,6 +8,17 @@ const ca = loadCa();
const certCache = new Map(); const certCache = new Map();
/**
* @param {forge.pki.PublicKey} publicKey
* @returns {string}
*/
function createKeyIdentifier(publicKey) {
return forge.pki.getPublicKeyFingerprint(publicKey, {
encoding: "binary",
md: forge.md.sha1.create(),
});
}
export function getCaCertPath() { export function getCaCertPath() {
return path.join(certFolder, "ca-cert.pem"); return path.join(certFolder, "ca-cert.pem");
} }
@ -165,6 +176,7 @@ function generateCa() {
digitalSignature: true, digitalSignature: true,
keyEncipherment: true, keyEncipherment: true,
}, },
{
/* /*
Subject Key Identifier (SKI) Subject Key Identifier (SKI)
@ -174,10 +186,10 @@ function generateCa() {
System Python installations may be more lenient. System Python installations may be more lenient.
https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.2 https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.2
*/ */
{
name: "subjectKeyIdentifier", name: "subjectKeyIdentifier",
subjectKeyIdentifier: keyIdentifier, subjectKeyIdentifier: keyIdentifier,
}, },
{
/* /*
Authority Key Identifier (AKI) Authority Key Identifier (AKI)
@ -187,7 +199,6 @@ function generateCa() {
Without this, Python virtualenv certificate validation might fail Without this, Python virtualenv certificate validation might fail
https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.1 https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.1
*/ */
{
name: "authorityKeyIdentifier", name: "authorityKeyIdentifier",
keyIdentifier, keyIdentifier,
}, },
@ -199,14 +210,3 @@ function generateCa() {
certificate: cert, certificate: cert,
}; };
} }
/**
* @param {forge.pki.PublicKey} publicKey
* @returns {string}
*/
function createKeyIdentifier(publicKey) {
return forge.pki.getPublicKeyFingerprint(publicKey, {
encoding: "binary",
md: forge.md.sha1.create(),
});
}