Skip to content

Commit

Permalink
tls: rename validateKeyCert in _tls_common.js
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
danbev authored and BridgeAR committed Jun 17, 2019
1 parent 303a9a3 commit 6b9d477
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/_tls_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function SecureContext(secureProtocol, secureOptions, minVersion, maxVersion) {
if (secureOptions) this.context.setOptions(secureOptions);
}

function validateKeyCert(name, value) {
function validateKeyOrCertOption(name, value) {
if (typeof value !== 'string' && !isArrayBufferView(value)) {
throw new ERR_INVALID_ARG_TYPE(
`options.${name}`,
Expand Down Expand Up @@ -107,11 +107,11 @@ exports.createSecureContext = function createSecureContext(options) {
if (Array.isArray(ca)) {
for (i = 0; i < ca.length; ++i) {
val = ca[i];
validateKeyCert('ca', val);
validateKeyOrCertOption('ca', val);
c.context.addCACert(val);
}
} else {
validateKeyCert('ca', ca);
validateKeyOrCertOption('ca', ca);
c.context.addCACert(ca);
}
} else {
Expand All @@ -123,11 +123,11 @@ exports.createSecureContext = function createSecureContext(options) {
if (Array.isArray(cert)) {
for (i = 0; i < cert.length; ++i) {
val = cert[i];
validateKeyCert('cert', val);
validateKeyOrCertOption('cert', val);
c.context.setCert(val);
}
} else {
validateKeyCert('cert', cert);
validateKeyOrCertOption('cert', cert);
c.context.setCert(cert);
}
}
Expand All @@ -144,11 +144,11 @@ exports.createSecureContext = function createSecureContext(options) {
val = key[i];
// eslint-disable-next-line eqeqeq
const pem = (val != undefined && val.pem !== undefined ? val.pem : val);
validateKeyCert('key', pem);
validateKeyOrCertOption('key', pem);
c.context.setKey(pem, val.passphrase || passphrase);
}
} else {
validateKeyCert('key', key);
validateKeyOrCertOption('key', key);
c.context.setKey(key, passphrase);
}
}
Expand Down

0 comments on commit 6b9d477

Please sign in to comment.