Skip to content

Commit 99b2368

Browse files
committed
doc: Reduce crypto stability to 2-Unstable
1 parent 6a128e0 commit 99b2368

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

doc/api/crypto.markdown

+33-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Crypto
22

3-
Stability: 3 - Stable
3+
Stability: 2 - Unstable; API changes are being discussed for
4+
future versions. Breaking changes will be minimized. See below.
45

56
Use `require('crypto')` to access this module.
67

@@ -366,6 +367,37 @@ Generates cryptographically strong pseudo-random data. Usage:
366367
// handle error
367368
}
368369

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+
369401
[createCipher()]: #crypto_crypto_createcipher_algorithm_password
370402
[createCipheriv()]: #crypto_crypto_createcipheriv_algorithm_key_iv
371403
[crypto.createDiffieHellman()]: #crypto_crypto_creatediffiehellman_prime_encoding

0 commit comments

Comments
 (0)