diff options
author | Tobias Nießen <tniessen@tnie.de> | 2018-08-24 10:37:45 +0200 |
---|---|---|
committer | Tobias Nießen <tniessen@tnie.de> | 2018-08-27 13:37:20 +0200 |
commit | 50aa85dc9bf47c7fad280aba40401a14c81a1aac (patch) | |
tree | 1c051316005baf8a87c6c9dcaa49d8f527b7c5b3 | |
parent | fa3d6bedf9b1507bc17265eb9fad70b623247d85 (diff) | |
download | android-node-v8-50aa85dc9bf47c7fad280aba40401a14c81a1aac.tar.gz android-node-v8-50aa85dc9bf47c7fad280aba40401a14c81a1aac.tar.bz2 android-node-v8-50aa85dc9bf47c7fad280aba40401a14c81a1aac.zip |
crypto: deprecate _toBuf
PR-URL: https://github.com/nodejs/node/pull/22501
Fixes: https://github.com/nodejs/node/issues/22425
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
-rw-r--r-- | doc/api/deprecations.md | 8 | ||||
-rw-r--r-- | lib/crypto.js | 2 | ||||
-rw-r--r-- | test/parallel/test-crypto.js | 12 |
3 files changed, 21 insertions, 1 deletions
diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 56935574e6..7aa8ac01ba 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1031,6 +1031,14 @@ With the current crypto API, having `Cipher.setAuthTag()` and when called. They have never been documented and will be removed in a future release. +<a id="DEP0114"></a> +### DEP0114: crypto._toBuf() + +Type: Runtime + +The `crypto._toBuf()` function was not designed to be used by modules outside +of Node.js core and will be removed in the future. + [`--pending-deprecation`]: cli.html#cli_pending_deprecation [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array diff --git a/lib/crypto.js b/lib/crypto.js index bced9f040a..c2d3eb38cf 100644 --- a/lib/crypto.js +++ b/lib/crypto.js @@ -137,7 +137,7 @@ function createVerify(algorithm, options) { module.exports = exports = { // Methods - _toBuf: toBuf, + _toBuf: deprecate(toBuf, 'crypto._toBuf is deprecated.', 'DEP0114'), createCipheriv, createDecipheriv, createDiffieHellman, diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index 88d4916710..1f02c07b02 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -25,6 +25,13 @@ const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); +common.expectWarning({ + DeprecationWarning: [ + ['crypto.createCipher is deprecated.', 'DEP0106'], + ['crypto._toBuf is deprecated.', 'DEP0114'] + ] +}); + const assert = require('assert'); const crypto = require('crypto'); const tls = require('tls'); @@ -294,3 +301,8 @@ testEncoding({ testEncoding({ defaultEncoding: 'latin1' }, assertionHashLatin1); + +{ + // Test that the exported _toBuf function is deprecated. + crypto._toBuf(Buffer.alloc(0)); +} |