Remove certificate validation check
Breaks compatibility with Node 12 and it's not really necessary anyway.
This commit is contained in:
1 parent
c6fe696300
commit
cdbfb172c7
1 file changed
-15
@@ -3,7 +3,6 @@ import * as http from "node:http";
|
|||||||
import * as https from "node:https";
|
import * as https from "node:https";
|
||||||
import { Socket } from "node:net";
|
import { Socket } from "node:net";
|
||||||
import * as path from "node:path";
|
import * as path from "node:path";
|
||||||
import { X509Certificate, createPrivateKey } from "node:crypto";
|
|
||||||
import { ROOT_DIR } from "./config.ts";
|
import { ROOT_DIR } from "./config.ts";
|
||||||
|
|
||||||
let server: http.Server | https.Server;
|
let server: http.Server | https.Server;
|
||||||
@@ -67,13 +66,6 @@ function getValidPrivKeys(value: string): Buffer[] {
|
|||||||
const buf = str.startsWith("-----BEGIN ")
|
const buf = str.startsWith("-----BEGIN ")
|
||||||
? Buffer.from(str)
|
? Buffer.from(str)
|
||||||
: readFileSync(path.resolve(ROOT_DIR, str));
|
: readFileSync(path.resolve(ROOT_DIR, str));
|
||||||
|
|
||||||
try {
|
|
||||||
createPrivateKey(buf);
|
|
||||||
} catch (err) {
|
|
||||||
throw new Error(`Invalid private key: ${err.message}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -84,13 +76,6 @@ function getValidCerts(value: string): Buffer[] {
|
|||||||
const buf = str.startsWith("-----BEGIN ")
|
const buf = str.startsWith("-----BEGIN ")
|
||||||
? Buffer.from(str)
|
? Buffer.from(str)
|
||||||
: readFileSync(path.resolve(ROOT_DIR, str));
|
: readFileSync(path.resolve(ROOT_DIR, str));
|
||||||
|
|
||||||
try {
|
|
||||||
new X509Certificate(buf);
|
|
||||||
} catch (err) {
|
|
||||||
throw new Error(`Invalid certificate: ${err.message}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user