Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tls: rename validateKeyCert in _tls_common.js #28116

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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