Skip to content

Commit

Permalink
crypto: remove deprecated legacy API
Browse files Browse the repository at this point in the history
The `crypto.Credentials` legacy API has been Runtime deprecated since
v0.11.13 and users had been adviced to use `tls.SecureContext` instead.

PR-URL: #21153
Fixes: #20793
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
aduh95 authored and vsemozhetbyt committed Jul 13, 2018
1 parent 3950a3e commit d2ee7d6
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 66 deletions.
20 changes: 0 additions & 20 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -1415,25 +1415,6 @@ something has to be unpredictable and unique, but does not have to be secret;
it is important to remember that an attacker must not be able to predict ahead
of time what a given IV will be.

### crypto.createCredentials(details)
<!-- YAML
added: v0.1.92
deprecated: v0.11.13
-->

> Stability: 0 - Deprecated: Use [`tls.createSecureContext()`][] instead.
- `details` {Object} Identical to [`tls.createSecureContext()`][].
- Returns: {tls.SecureContext}

The `crypto.createCredentials()` method is a deprecated function for creating
and returning a `tls.SecureContext`. It should not be used. Replace it with
[`tls.createSecureContext()`][] which has the exact same arguments and return
value.

Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`][] had been
called.

### crypto.createDecipher(algorithm, password[, options])
<!-- YAML
added: v0.1.94
Expand Down Expand Up @@ -2750,7 +2731,6 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
[`sign.update()`]: #crypto_sign_update_data_inputencoding
[`stream.transform` options]: stream.html#stream_new_stream_transform_options
[`stream.Writable` options]: stream.html#stream_constructor_new_stream_writable_options
[`tls.createSecureContext()`]: tls.html#tls_tls_createsecurecontext_options
[`verify.update()`]: #crypto_verify_update_data_inputencoding
[`verify.verify()`]: #crypto_verify_verify_object_signature_signatureformat
[AEAD algorithms]: https://en.wikipedia.org/wiki/Authenticated_encryption
Expand Down
9 changes: 4 additions & 5 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@ undefined `digest` will throw a `TypeError`.
<a id="DEP0010"></a>
### DEP0010: crypto.createCredentials

Type: Runtime
Type: End-of-Life

The [`crypto.createCredentials()`][] API is deprecated. Please use
The `crypto.createCredentials()` API was removed. Please use
[`tls.createSecureContext()`][] instead.

<a id="DEP0011"></a>
### DEP0011: crypto.Credentials

Type: Runtime
Type: End-of-Life

The `crypto.Credentials` class is deprecated. Please use [`tls.SecureContext`][]
The `crypto.Credentials` class was removed. Please use [`tls.SecureContext`][]
instead.

<a id="DEP0012"></a>
Expand Down Expand Up @@ -1020,7 +1020,6 @@ The option `produceCachedData` has been deprecated. Use
[`console.log()`]: console.html#console_console_log_data_args
[`crypto.createCipher()`]: crypto.html#crypto_crypto_createcipher_algorithm_password_options
[`crypto.createCipheriv()`]: crypto.html#crypto_crypto_createcipheriv_algorithm_key_iv_options
[`crypto.createCredentials()`]: crypto.html#crypto_crypto_createcredentials_details
[`crypto.createDecipher()`]: crypto.html#crypto_crypto_createdecipher_algorithm_password_options
[`crypto.createDecipheriv()`]: crypto.html#crypto_crypto_createdecipheriv_algorithm_key_iv_options
[`crypto.DEFAULT_ENCODING`]: crypto.html#crypto_crypto_default_encoding
Expand Down
18 changes: 0 additions & 18 deletions lib/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,5 @@ Object.defineProperties(exports, {
configurable: false,
enumerable: true,
value: constants
},

// Legacy API
createCredentials: {
configurable: true,
enumerable: true,
get: deprecate(() => {
return require('tls').createSecureContext;
}, 'crypto.createCredentials is deprecated. ' +
'Use tls.createSecureContext instead.', 'DEP0010')
},
Credentials: {
configurable: true,
enumerable: true,
get: deprecate(function() {
return require('tls').SecureContext;
}, 'crypto.Credentials is deprecated. ' +
'Use tls.SecureContext instead.', 'DEP0011')
}
});
1 change: 0 additions & 1 deletion test/parallel/test-crypto-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const TEST_CASES = {
'DiffieHellman': [1024],
'DiffieHellmanGroup': ['modp5'],
'ECDH': ['prime256v1'],
'Credentials': []
};

if (!common.hasFipsCrypto) {
Expand Down
22 changes: 0 additions & 22 deletions test/parallel/test-crypto-deprecated.js

This file was deleted.

0 comments on commit d2ee7d6

Please sign in to comment.