-
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: adjust types for getRandomValues #41481
Conversation
Review requested:
|
@LiviaMedeiros If this is ready (it seems so) please remove the draft status, otherwise CI does not run. Thank you. |
c3076ab
to
e074f4b
Compare
Sure, now it's ready. Also I should explicitly mention that this is a potentially breaking change, if someone actually uses this method with |
The Web Crypto API is experimental so I do not think we should label this as "semver-major". Can you please also update the doc to remove the no longer supported types? |
That's great. Raw crypto.getRandomValues(new ArrayBuffer(8)); // DOMException [TypeMismatchError] |
6b067ef
to
c108ea1
Compare
Rebased to make linter happy, updated list of |
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.
@LiviaMedeiros, thank you so much for this PR!
Did a light review, so pre-approving for now, but hope that we can get a more thorough review on this by other collaborators more involved in these parts — would like to see if further improvements can be made here. :)
c108ea1
to
1ee830b
Compare
81a5a97
to
1dc73af
Compare
prevents Web Crypto API's getRandomValues from accepting DataView - Fixes: nodejs#41480 - Refs: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues
Co-authored-by: Luigi Pinca <luigipinca@gmail.com>
1dc73af
to
213ea91
Compare
This reverts commit 5f1c397.
Thanks @LiviaMedeiros :) |
Landed in b8de7aa |
prevents Web Crypto API's getRandomValues from accepting DataView Fixes: #41480 Refs: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues PR-URL: #41481 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
prevents Web Crypto API's getRandomValues from accepting DataView Fixes: #41480 Refs: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues PR-URL: #41481 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
prevents Web Crypto API's getRandomValues from accepting DataView Fixes: nodejs#41480 Refs: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues PR-URL: nodejs#41481 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This was previously a `DataView`, not an integer-type TypedArray, throwing in Node 17.5.0: nodejs/node#41481
prevents Web Crypto API's getRandomValues from accepting DataView Fixes: #41480 Refs: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues PR-URL: #41481 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
prevents Web Crypto API's getRandomValues from accepting DataView Fixes: #41480 Refs: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues PR-URL: #41481 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
prevents Web Crypto API's getRandomValues from accepting DataView Fixes: #41480 Refs: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues PR-URL: #41481 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
prevents Web Crypto API's getRandomValues from accepting DataView Fixes: #41480 Refs: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues PR-URL: #41481 Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
Fixes: #41480
Prevents Web Crypto API's getRandomValues from accepting DataView
WIP/draft at this moment.
I'm not sure if
new DataView(buf.buffer)
in this test was intentional:node/test/parallel/test-webcrypto-random.js
Lines 47 to 53 in 6b7b0b7