-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crypto documentation update #14846
Crypto documentation update #14846
Conversation
@ashanhol welcome, and thank you for your contribution 🥇 |
/cc @nodejs/documentation @nodejs/crypto @nodejs/streams |
Hi, @ashanhol. Thank you for improving the docs. |
doc/api/crypto.md
Outdated
<!-- YAML | ||
added: v0.1.94 | ||
--> | ||
- `algorithm` {string} | ||
- `password` {string | Buffer | TypedArray | DataView} | ||
- `options` {object} combined [OpenSSL options][] and [`stream.transform` options][] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be stream.Transform
since we're referencing a constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming @vsemozhetbyt's nit and this one is addressed.
doc/api/crypto.md
Outdated
@@ -2247,3 +2258,5 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. | |||
[initialization vector]: https://en.wikipedia.org/wiki/Initialization_vector | |||
[stream-writable-write]: stream.html#stream_writable_write_chunk_encoding_callback | |||
[stream]: stream.html | |||
[OpenSSL options]: #openssl-options | |||
[`stream.transform` options]: stream.html#stream_new_stream_transform_options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you sort the references ASCIIbetically? See the references that are already there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I'm going to have to renege on my LGTM earlier. Noticed some more issues with this...
doc/api/crypto.md
Outdated
<!-- YAML | ||
added: v0.1.92 | ||
--> | ||
- `algorithm` {string} | ||
- `options` {object} combined [OpenSSL options][] and [`stream.transform` options][] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually for Sign it's stream.Writable
:
Lines 285 to 292 in 0d22858
function Sign(algorithm, options) { | |
if (!(this instanceof Sign)) | |
return new Sign(algorithm, options); | |
this._handle = new binding.Sign(); | |
this._handle.init(algorithm); | |
stream.Writable.call(this, options); | |
} |
doc/api/crypto.md
Outdated
<!-- YAML | ||
added: v0.1.92 | ||
--> | ||
- `algorithm` {string} | ||
- `options` {object} combined [OpenSSL options][] and [`stream.transform` options][] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's stream.Writable for Verify too.
doc/api/crypto.md
Outdated
<!-- YAML | ||
added: v0.1.94 | ||
--> | ||
- `algorithm` {string} | ||
- `password` {string | Buffer | TypedArray | DataView} | ||
- `options` {object} combined [OpenSSL options][] and [`stream.transform` options][] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The options
object isn't actually combined, but only used for streams:
Lines 136 to 145 in 0d22858
function Cipher(cipher, password, options) { | |
if (!(this instanceof Cipher)) | |
return new Cipher(cipher, password, options); | |
this._handle = new binding.CipherBase(true); | |
this._handle.init(cipher, toBuf(password)); | |
this._decoder = null; | |
LazyTransform.call(this, options); | |
} |
The first instance of options
is used when the function is not called with new
(it's passed back into itself).
Same goes for the other classes.
It seems, there is one missing step. If we change headings in our docs, this also automatically changes anchors for href hashes. So for each changed heading we should search all the docs for previous hashes and update them. You can get the old hashes from the TOC in the https://nodejs.org/api/crypto.html For example the old one for |
@ashanhol what I forgot to mention before is that documentation changes, while easy to do are more difficult to validate. With code we can write tests and the CI can validate the change. With documentation the only way to validate is with human eyes, so don't be dismayed. |
That's a real pain, we need to figure out an automatic way to do this... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with all the nits addressed.
Thank you all for the feedback, I've made the suggested changes and grep'd the docs to make sure the old header links are updated. |
Ping @TimothyGu ... have your concerns been addressed? |
Ping @TimothyGu |
I take that as a yes. @ashanhol please rebase this as we otherwise can not land this cleanly. Currently there is a merge commit in here. |
2fe8d86
to
9a2987e
Compare
Hi @BridgeAR, seems a couple commits got duplicated somewhere. I did an interactive rebase and removed them so there's no merges. 👍 |
PR-URL: #14846 Fixes: #14804 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Landed in 4477155, thank you for your first contribution @ashanhol! 🎉 Some tips for future contributions:
|
PR-URL: #14846 Fixes: #14804 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
PR-URL: #14846 Fixes: #14804 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
PR-URL: #14846 Fixes: #14804 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
PR-URL: nodejs#14846 Fixes: nodejs#14804 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Updated crypto docs to include options argument.
Fixes: #14804
Checklist
Affected core subsystem(s)
doc