@@ -2308,21 +2308,25 @@ const additionalCerts = ['-----BEGIN CERTIFICATE-----\n...'];
23082308tls .setDefaultCACertificates ([... currentCerts, ... additionalCerts]);
23092309```
23102310
2311- ## ` tls.getCACertificates([type ]) `
2311+ ## ` tls.getCACertificates([options ]) `
23122312
23132313<!-- YAML
23142314added:
23152315 - v23.10.0
23162316 - v22.15.0
23172317-->
23182318
2319- * ` type ` {string|undefined} The type of CA certificates that will be returned. Valid values
2320- are ` "default" ` , ` "system" ` , ` "bundled" ` and ` "extra" ` .
2321- ** Default:** ` "default" ` .
2322- * Returns: {string\[ ] } An array of PEM-encoded certificates. The array may contain duplicates
2323- if the same certificate is repeatedly stored in multiple sources.
2319+ * ` options ` {string|Object|undefined}\
2320+ Optional. If a string, it is treated as the ` type ` of certificates to return.\
2321+ If an object, it may contain:
2322+ * ` type ` {string} The type of CA certificates to return. One of ` "default" ` , ` "system" ` , ` "bundled" ` , or ` "extra" ` .\
2323+ ** Default:** ` "default" ` .
2324+ * ` as ` {string} The format of returned certificates. One of:
2325+ * ` "buffer" ` (default): Returns an array of certificate data as ` Buffer ` objects.
2326+ * ` "x509" ` : Returns an array of \[ ` X509Certificate ` ] \[ ] instances.
23242327
2325- Returns an array containing the CA certificates from various sources, depending on ` type ` :
2328+ * Returns: {Array.\< Buffer|X509Certificate>}\
2329+ An array of certificates in the specified format.
23262330
23272331* ` "default" ` : return the CA certificates that will be used by the Node.js TLS clients by default.
23282332 * When [ ` --use-bundled-ca ` ] [ ] is enabled (default), or [ ` --use-openssl-ca ` ] [ ] is not enabled,
@@ -2331,11 +2335,14 @@ Returns an array containing the CA certificates from various sources, depending
23312335 trusted store.
23322336 * When [ ` NODE_EXTRA_CA_CERTS ` ] [ ] is used, this would also include certificates loaded from the specified
23332337 file.
2338+
23342339* ` "system" ` : return the CA certificates that are loaded from the system's trusted store, according
23352340 to rules set by [ ` --use-system-ca ` ] [ ] . This can be used to get the certificates from the system
23362341 when [ ` --use-system-ca ` ] [ ] is not enabled.
2342+
23372343* ` "bundled" ` : return the CA certificates from the bundled Mozilla CA store. This would be the same
23382344 as [ ` tls.rootCertificates ` ] [ ] .
2345+
23392346* ` "extra" ` : return the CA certificates loaded from [ ` NODE_EXTRA_CA_CERTS ` ] [ ] . It's an empty array if
23402347 [ ` NODE_EXTRA_CA_CERTS ` ] [ ] is not set.
23412348
0 commit comments