-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: clarify require("crypto").getRandomValues
is Node.js specific
#41782
Conversation
Review requested:
|
@jasnell could you help us here? It seems there is a confusion on what is the plan for exposing a
If it's the latter, then I guess we should land this PR, as well as #41760, but this would need your input to move forward. |
My preference is exposing |
This is going to create all sort of compatibility problems (I've been myself affected by #41760), I'm -1 on this idea. Adding it to the TSC agenda so we can discuss this further. |
I suggested this when talking to @jasnell earlier, except that I'd maybe add the aliases to |
One possible approach we can take here is to modify Node.js'
|
It wouldn't help folks doing Could you maybe explain why we wouldn't expose |
Yes, I think that was the motivation behind #41266 (see #41266 (comment)). |
FYI, I've opened #41938 to suggest exposing the Web Crypto on the global scope instead of the Node.js one. |
PR-URL: #41938 Refs: https://developer.mozilla.org/en-US/docs/Web/API/crypto_property Refs: #41782 Refs: https://w3c.github.io/webcrypto Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
I don't think we get much value from having
Whatever we decide to do we the alias, I think we should land this ASAP: all this PR is doing is documenting that the shortcut is not exactly the same as the web version, and it unblocks #41760. Currently our docs for Web crypto are "broken", for example here we tell the user to use object destructuring to get a reference to Lines 128 to 159 in b8de7aa
If the user tries to use this code in a browser or Deno, it will throw an arguably quite surprising error (e.g. Chromium throws TypeError: Illegal invocation ).
|
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
@jasnell have you got any concerns in landing this as-is? |
…Node.js specific
PR-URL: nodejs#41938 Refs: https://developer.mozilla.org/en-US/docs/Web/API/crypto_property Refs: nodejs#41782 Refs: https://w3c.github.io/webcrypto Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
PR-URL: #41938 Refs: https://developer.mozilla.org/en-US/docs/Web/API/crypto_property Refs: #41782 Refs: https://w3c.github.io/webcrypto Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
PR-URL: #41938 Refs: https://developer.mozilla.org/en-US/docs/Web/API/crypto_property Refs: #41782 Refs: https://w3c.github.io/webcrypto Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
Landed in 470c284 |
Refs: nodejs#41779 Refs: nodejs#41760 PR-URL: nodejs#41782 Reviewed-By: Matteo Collina <[email protected]>
@aduh95 this doesn't land cleanly on v16.x-staging. Can you make a backport for this? Thank you |
PR-URL: nodejs#41938 Refs: https://developer.mozilla.org/en-US/docs/Web/API/crypto_property Refs: nodejs#41782 Refs: https://w3c.github.io/webcrypto Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
PR-URL: #41938 Refs: https://developer.mozilla.org/en-US/docs/Web/API/crypto_property Refs: #41782 Refs: https://w3c.github.io/webcrypto Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Filip Skokan <[email protected]>
Refs: #41779
Refs: #41760