|
1 | 1 | # Crypto
|
2 | 2 |
|
3 |
| - Stability: 3 - Stable |
| 3 | + Stability: 2 - Unstable; API changes are being discussed for |
| 4 | + future versions. Breaking changes will be minimized. See below. |
4 | 5 |
|
5 | 6 | Use `require('crypto')` to access this module.
|
6 | 7 |
|
@@ -366,6 +367,37 @@ Generates cryptographically strong pseudo-random data. Usage:
|
366 | 367 | // handle error
|
367 | 368 | }
|
368 | 369 |
|
| 370 | +## Proposed API Changes in Future Versions of Node |
| 371 | + |
| 372 | +The Crypto module was added to Node before there was the concept of a |
| 373 | +unified Stream API, and before there were Buffer objects for handling |
| 374 | +binary data. |
| 375 | + |
| 376 | +As such, the streaming classes don't have the typical methods found on |
| 377 | +other Node classes, and many methods accept and return Binary-encoded |
| 378 | +strings by default rather than Buffers. |
| 379 | + |
| 380 | +A future version of node will make Buffers the default data type. |
| 381 | +This will be a breaking change for some use cases, but not all. |
| 382 | + |
| 383 | +For example, if you currently use the default arguments to the Sign |
| 384 | +class, and then pass the results to the Verify class, without ever |
| 385 | +inspecting the data, then it will continue to work as before. Where |
| 386 | +you now get a binary string and then present the binary string to the |
| 387 | +Verify object, you'll get a Buffer, and present the Buffer to the |
| 388 | +Verify object. |
| 389 | + |
| 390 | +However, if you are doing things with the string data that will not |
| 391 | +work properly on Buffers (such as, concatenating them, storing in |
| 392 | +databases, etc.), or you are passing binary strings to the crypto |
| 393 | +functions without an encoding arguemnt, then you will need to start |
| 394 | +providing encoding arguments to specify which encoding you'd like to |
| 395 | +use. |
| 396 | + |
| 397 | +Also, a Streaming API will be provided, but this will be done in such |
| 398 | +a way as to preserve the legacy API surface. |
| 399 | + |
| 400 | + |
369 | 401 | [createCipher()]: #crypto_crypto_createcipher_algorithm_password
|
370 | 402 | [createCipheriv()]: #crypto_crypto_createcipheriv_algorithm_key_iv
|
371 | 403 | [crypto.createDiffieHellman()]: #crypto_crypto_creatediffiehellman_prime_encoding
|
|
0 commit comments