Skip to content

Commit 6b9d477

Browse files
danbevBridgeAR
authored andcommitted
tls: rename validateKeyCert in _tls_common.js
This commit renames validateKeyCert to validateKeyCertArg to avoid confusing this with something that would validate the actual key or certificate. PR-URL: #28116 Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 303a9a3 commit 6b9d477

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/_tls_common.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function SecureContext(secureProtocol, secureOptions, minVersion, maxVersion) {
7575
if (secureOptions) this.context.setOptions(secureOptions);
7676
}
7777

78-
function validateKeyCert(name, value) {
78+
function validateKeyOrCertOption(name, value) {
7979
if (typeof value !== 'string' && !isArrayBufferView(value)) {
8080
throw new ERR_INVALID_ARG_TYPE(
8181
`options.${name}`,
@@ -107,11 +107,11 @@ exports.createSecureContext = function createSecureContext(options) {
107107
if (Array.isArray(ca)) {
108108
for (i = 0; i < ca.length; ++i) {
109109
val = ca[i];
110-
validateKeyCert('ca', val);
110+
validateKeyOrCertOption('ca', val);
111111
c.context.addCACert(val);
112112
}
113113
} else {
114-
validateKeyCert('ca', ca);
114+
validateKeyOrCertOption('ca', ca);
115115
c.context.addCACert(ca);
116116
}
117117
} else {
@@ -123,11 +123,11 @@ exports.createSecureContext = function createSecureContext(options) {
123123
if (Array.isArray(cert)) {
124124
for (i = 0; i < cert.length; ++i) {
125125
val = cert[i];
126-
validateKeyCert('cert', val);
126+
validateKeyOrCertOption('cert', val);
127127
c.context.setCert(val);
128128
}
129129
} else {
130-
validateKeyCert('cert', cert);
130+
validateKeyOrCertOption('cert', cert);
131131
c.context.setCert(cert);
132132
}
133133
}
@@ -144,11 +144,11 @@ exports.createSecureContext = function createSecureContext(options) {
144144
val = key[i];
145145
// eslint-disable-next-line eqeqeq
146146
const pem = (val != undefined && val.pem !== undefined ? val.pem : val);
147-
validateKeyCert('key', pem);
147+
validateKeyOrCertOption('key', pem);
148148
c.context.setKey(pem, val.passphrase || passphrase);
149149
}
150150
} else {
151-
validateKeyCert('key', key);
151+
validateKeyOrCertOption('key', key);
152152
c.context.setKey(key, passphrase);
153153
}
154154
}

0 commit comments

Comments
 (0)