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>
This commit is contained in:
Tobias Nießen 2018-08-24 10:37:45 +02:00
parent fa3d6bedf9
commit 50aa85dc9b
No known key found for this signature in database
GPG Key ID: 718207F8FD156B70
3 changed files with 21 additions and 1 deletions

View File

@ -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

View File

@ -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,

View File

@ -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));
}