Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
crypto: deprecate _toBuf
Fixes: #22425
  • Loading branch information
tniessen committed Aug 24, 2018
commit 8c7551bbf5011836a40f51721cdfdda3260a83bf
8 changes: 8 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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="DEP00XX"></a>
### DEP00XX: crypto._toBuf()

Type: Runtime

The `crypto._toBuf()` function was not designed to be used by modules outside
of Node.js core and will become unavailable in the future.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change "will become unavailable" with "will be removed"?


[`--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
Expand Down
2 changes: 1 addition & 1 deletion lib/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function createVerify(algorithm, options) {

module.exports = exports = {
// Methods
_toBuf: toBuf,
_toBuf: deprecate(toBuf, 'crypto._toBuf is deprecated.', 'DEP00XX'),
createCipheriv,
createDecipheriv,
createDiffieHellman,
Expand Down
12 changes: 12 additions & 0 deletions test/parallel/test-crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.', 'DEP00XX']
]
});

const assert = require('assert');
const crypto = require('crypto');
const tls = require('tls');
Expand Down Expand Up @@ -294,3 +301,8 @@ testEncoding({
testEncoding({
defaultEncoding: 'latin1'
}, assertionHashLatin1);

{
// Test that the exported _toBuf function is deprecated.
crypto._toBuf(Buffer.alloc(0));
}