mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-26 14:15:52 +00:00
use node:tls library for ca certs (#5552)
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
"axios": "^1.9.0",
|
||||
"grpc-reflection-js": "^0.3.0",
|
||||
"is-ip": "^5.0.1",
|
||||
"system-ca": "^2.0.1",
|
||||
"tough-cookie": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -39,6 +39,6 @@ module.exports = [
|
||||
typescript({ tsconfig: './tsconfig.json' }),
|
||||
terser(),
|
||||
],
|
||||
external: ['axios', 'qs', 'system-ca']
|
||||
external: ['axios', 'qs']
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { systemCertsAsync, Options as SystemCAOptions } from 'system-ca';
|
||||
import { rootCertificates } from 'node:tls';
|
||||
import * as tls from 'node:tls';
|
||||
import * as fs from 'node:fs';
|
||||
|
||||
type T_CACertificatesOptions = {
|
||||
@@ -19,11 +18,11 @@ type T_CACertificatesResult = {
|
||||
|
||||
let systemCertsCache: string[] | undefined;
|
||||
|
||||
async function getSystemCerts(systemCAOpts: SystemCAOptions = {}): Promise<string[]> {
|
||||
async function getSystemCerts(): Promise<string[]> {
|
||||
if (systemCertsCache) return systemCertsCache;
|
||||
|
||||
try {
|
||||
systemCertsCache = await systemCertsAsync(systemCAOpts);
|
||||
systemCertsCache = tls.getCACertificates('system');
|
||||
|
||||
return systemCertsCache;
|
||||
} catch (error) {
|
||||
@@ -131,7 +130,7 @@ const getCACertificates = async ({ caCertFilePath, shouldKeepDefaultCerts = true
|
||||
caCertificatesCount.system = systemCerts.length;
|
||||
|
||||
// get root certs
|
||||
rootCerts = [...rootCertificates];
|
||||
rootCerts = [...tls.rootCertificates];
|
||||
caCertificatesCount.root = rootCerts.length;
|
||||
}
|
||||
} else {
|
||||
@@ -140,7 +139,7 @@ const getCACertificates = async ({ caCertFilePath, shouldKeepDefaultCerts = true
|
||||
caCertificatesCount.system = systemCerts.length;
|
||||
|
||||
// get root certs
|
||||
rootCerts = [...rootCertificates];
|
||||
rootCerts = [...tls.rootCertificates];
|
||||
caCertificatesCount.root = rootCerts.length;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user