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:
parent
fa3d6bedf9
commit
50aa85dc9b
@ -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
|
when called. They have never been documented and will be removed in a future
|
||||||
release.
|
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
|
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
|
||||||
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
|
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
|
||||||
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
|
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
|
||||||
|
@ -137,7 +137,7 @@ function createVerify(algorithm, options) {
|
|||||||
|
|
||||||
module.exports = exports = {
|
module.exports = exports = {
|
||||||
// Methods
|
// Methods
|
||||||
_toBuf: toBuf,
|
_toBuf: deprecate(toBuf, 'crypto._toBuf is deprecated.', 'DEP0114'),
|
||||||
createCipheriv,
|
createCipheriv,
|
||||||
createDecipheriv,
|
createDecipheriv,
|
||||||
createDiffieHellman,
|
createDiffieHellman,
|
||||||
|
@ -25,6 +25,13 @@ const common = require('../common');
|
|||||||
if (!common.hasCrypto)
|
if (!common.hasCrypto)
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
|
|
||||||
|
common.expectWarning({
|
||||||
|
DeprecationWarning: [
|
||||||
|
['crypto.createCipher is deprecated.', 'DEP0106'],
|
||||||
|
['crypto._toBuf is deprecated.', 'DEP0114']
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const tls = require('tls');
|
const tls = require('tls');
|
||||||
@ -294,3 +301,8 @@ testEncoding({
|
|||||||
testEncoding({
|
testEncoding({
|
||||||
defaultEncoding: 'latin1'
|
defaultEncoding: 'latin1'
|
||||||
}, assertionHashLatin1);
|
}, assertionHashLatin1);
|
||||||
|
|
||||||
|
{
|
||||||
|
// Test that the exported _toBuf function is deprecated.
|
||||||
|
crypto._toBuf(Buffer.alloc(0));
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user