-
Notifications
You must be signed in to change notification settings - Fork 57
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
getRandomValues() and BigInt #255
Comments
They aren't supported anywhere I tested - so I'll make the change you suggested. I believe, as the linked comment does, that the intent was to exclude Float32Array and Float64Array (the issue with those is that the caller might expect some uniform distribution that you don't get if you interpret random bytes as floats). I don't see any issues with BigInt64Array and BigUint64Array, so I agree it would make sense to add support for those, if browsers are interested in implementing this. |
The check for "integer arrays" is to prevent people from using getRandomValues with floating-point arrays, which doesn't work as people might expect. However, the check was not updated when Chrome gained support for BigInt64Array and BigUint64Array, which do work as expected. This allows code fragments such as const b = new BigInt64Array(10); crypto.getRandomValues(b); See w3c/webcrypto#255 for the spec issue. Bug: 1225765 Change-Id: I338ecc5594492e6f329580f4e8f04d367f866361
Filed issues:
Tests are in web-platform-tests/wpt#29565. I'm working on implementing this change in Chrome right now, and I will get around to implementing it in Firefox soon. I think this would likely satisfy the implementor interest requirement. |
@TimothyGu Thanks! I've opened #266 to fix this issue, let me know if you have any comments there as well. |
The check for "integer arrays" is to prevent people from using getRandomValues with floating-point arrays, which doesn't work as people might expect. However, the check was not updated when Chrome gained support for BigInt64Array and BigUint64Array, which do work as expected. This allows code fragments such as const b = new BigInt64Array(10); crypto.getRandomValues(b); See w3c/webcrypto#255 for the spec issue. Bug: 1225765 Change-Id: I338ecc5594492e6f329580f4e8f04d367f866361
The check for "integer arrays" is to prevent people from using getRandomValues with floating-point arrays, which doesn't work as people might expect. However, the check was not updated when Chrome gained support for BigInt64Array and BigUint64Array, which do work as expected. This allows code fragments such as const b = new BigInt64Array(10); crypto.getRandomValues(b); See w3c/webcrypto#255 for the spec issue. Bug: 1225765 Change-Id: I338ecc5594492e6f329580f4e8f04d367f866361 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3002049 Reviewed-by: Mike West <[email protected]> Commit-Queue: Timothy Gu <[email protected]> Cr-Commit-Position: refs/heads/master@{#898924}
The check for "integer arrays" is to prevent people from using getRandomValues with floating-point arrays, which doesn't work as people might expect. However, the check was not updated when Chrome gained support for BigInt64Array and BigUint64Array, which do work as expected. This allows code fragments such as const b = new BigInt64Array(10); crypto.getRandomValues(b); See w3c/webcrypto#255 for the spec issue. Bug: 1225765 Change-Id: I338ecc5594492e6f329580f4e8f04d367f866361 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3002049 Reviewed-by: Mike West <[email protected]> Commit-Queue: Timothy Gu <[email protected]> Cr-Commit-Position: refs/heads/master@{#898924}
The check for "integer arrays" is to prevent people from using getRandomValues with floating-point arrays, which doesn't work as people might expect. However, the check was not updated when Chrome gained support for BigInt64Array and BigUint64Array, which do work as expected. This allows code fragments such as const b = new BigInt64Array(10); crypto.getRandomValues(b); See w3c/webcrypto#255 for the spec issue. Bug: 1225765 Change-Id: I338ecc5594492e6f329580f4e8f04d367f866361 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3002049 Reviewed-by: Mike West <[email protected]> Commit-Queue: Timothy Gu <[email protected]> Cr-Commit-Position: refs/heads/master@{#898924}
Tracking issue for Deno: denoland/deno#11445 |
Refs: w3c/webcrypto#255 Fixes: #39442 PR-URL: #39443 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
Refs: w3c/webcrypto#255 Fixes: #39442 PR-URL: #39443 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
Refs: w3c/webcrypto#255 Fixes: #39442 PR-URL: #39443 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
Refs: w3c/webcrypto#255 Fixes: #39442 PR-URL: #39443 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
The check for "integer arrays" is to prevent people from using getRandomValues with floating-point arrays, which doesn't work as people might expect. However, the check was not updated when Chrome gained support for BigInt64Array and BigUint64Array, which do work as expected. This allows code fragments such as const b = new BigInt64Array(10); crypto.getRandomValues(b); See w3c/webcrypto#255 for the spec issue. Bug: 1225765 Change-Id: I338ecc5594492e6f329580f4e8f04d367f866361 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3002049 Reviewed-by: Mike West <[email protected]> Commit-Queue: Timothy Gu <[email protected]> Cr-Commit-Position: refs/heads/master@{#898924} NOKEYCHECK=True GitOrigin-RevId: 88825b38ea9859ca06f31aa60bc8e8ea6563f57d
As per web-platform-tests/wpt#27920 (comment) this should be clarified whether BigInt64Array and BigUint64Array are to be supported. It should probably also not speak of an "integer type" and instead replace that with the text between parenthesis.
If they are not supported, please turn this into a feature request as it would make sense for them to work here.
cc @bathos
The text was updated successfully, but these errors were encountered: