diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 84dc58cfc449df..c3121f224703fb 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2563,12 +2563,15 @@ generally useful and is being removed. See discussion here: -Type: Runtime +Type: End-of-Life Please use `Server.prototype.setSecureContext()` instead. diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index c44097a31a0a01..c92af94aee7072 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -33,7 +33,6 @@ const { const { assertCrypto, - deprecate, kEmptyObject, } = require('internal/util'); @@ -1537,53 +1536,6 @@ Server.prototype.setTicketKeys = function setTicketKeys(keys) { this._sharedCreds.context.setTicketKeys(keys); }; - -Server.prototype.setOptions = deprecate(function(options) { - this.requestCert = options.requestCert === true; - this.rejectUnauthorized = options.rejectUnauthorized !== false; - - if (options.pfx) this.pfx = options.pfx; - if (options.key) this.key = options.key; - if (options.passphrase) this.passphrase = options.passphrase; - if (options.cert) this.cert = options.cert; - if (options.clientCertEngine) - this.clientCertEngine = options.clientCertEngine; - if (options.ca) this.ca = options.ca; - if (options.minVersion) this.minVersion = options.minVersion; - if (options.maxVersion) this.maxVersion = options.maxVersion; - if (options.secureProtocol) this.secureProtocol = options.secureProtocol; - if (options.crl) this.crl = options.crl; - if (options.ciphers) this.ciphers = options.ciphers; - if (options.ecdhCurve !== undefined) - this.ecdhCurve = options.ecdhCurve; - if (options.dhparam) this.dhparam = options.dhparam; - if (options.sessionTimeout) this.sessionTimeout = options.sessionTimeout; - if (options.ticketKeys) this.ticketKeys = options.ticketKeys; - const secureOptions = options.secureOptions || 0; - if (options.honorCipherOrder !== undefined) - this.honorCipherOrder = !!options.honorCipherOrder; - else - this.honorCipherOrder = true; - if (secureOptions) this.secureOptions = secureOptions; - if (options.ALPNProtocols) - tls.convertALPNProtocols(options.ALPNProtocols, this); - if (options.sessionIdContext) { - this.sessionIdContext = options.sessionIdContext; - } else { - this.sessionIdContext = crypto.createHash('sha1') - .update(process.argv.join(' ')) - .digest('hex') - .slice(0, 32); - } - if (options.pskCallback) this[kPskCallback] = options.pskCallback; - if (options.pskIdentityHint) this[kPskIdentityHint] = options.pskIdentityHint; - if (options.sigalgs) this.sigalgs = options.sigalgs; - if (options.privateKeyIdentifier !== undefined) - this.privateKeyIdentifier = options.privateKeyIdentifier; - if (options.privateKeyEngine !== undefined) - this.privateKeyEngine = options.privateKeyEngine; -}, 'Server.prototype.setOptions() is deprecated', 'DEP0122'); - // SNI Contexts High-Level API Server.prototype.addContext = function(servername, context) { if (!servername) { diff --git a/test/parallel/test-tls-server-setoptions-clientcertengine.js b/test/parallel/test-tls-server-setoptions-clientcertengine.js deleted file mode 100644 index 56026c9b23d4ed..00000000000000 --- a/test/parallel/test-tls-server-setoptions-clientcertengine.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; -const common = require('../common'); - -if (!common.hasCrypto) - common.skip('missing crypto'); - -const assert = require('assert'); -const tls = require('tls'); - -{ - const server = tls.createServer(); - assert.strictEqual(server.clientCertEngine, undefined); - common.expectWarning('DeprecationWarning', - 'Server.prototype.setOptions() is deprecated', - 'DEP0122'); - server.setOptions({ clientCertEngine: 'Cannonmouth' }); - assert.strictEqual(server.clientCertEngine, 'Cannonmouth'); -}