Skip to content

Commit

Permalink
tls: tweak clientCertEngine argument parsing
Browse files Browse the repository at this point in the history
PR-URL: #38900
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
codebytere committed Jun 4, 2021
1 parent fc4b9c1 commit dc25378
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/internal/tls.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,15 @@ function configSecureContext(context, options = {}, name = 'options') {
}
}

if (clientCertEngine !== undefined) {
if (typeof clientCertEngine === 'string') {
if (typeof context.setClientCertEngine !== 'function')
throw new ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED();
if (typeof clientCertEngine !== 'string') {
throw new ERR_INVALID_ARG_TYPE(`${name}.clientCertEngine`,
['string', 'null', 'undefined'],
clientCertEngine);
}
context.setClientCertEngine(clientCertEngine);
else
context.setClientCertEngine(clientCertEngine);
} else if (clientCertEngine !== undefined) {
throw new ERR_INVALID_ARG_TYPE(`${name}.clientCertEngine`,
['string', 'null', 'undefined'],
clientCertEngine);
}

if (ticketKeys !== undefined) {
Expand Down

0 comments on commit dc25378

Please sign in to comment.