crypto: adjust types for getRandomValues#41481
crypto: adjust types for getRandomValues#41481LiviaMedeiros wants to merge 6 commits intonodejs:masterfrom
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 |
DerekNonGeneric
left a comment
There was a problem hiding this comment.
@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