aboutsummaryrefslogtreecommitdiff
path: root/src/node-fallbacks/crypto.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-14 19:15:05 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-14 19:15:05 -0700
commita31eb6a80c18a8110097e1df69ef1308b0446f53 (patch)
tree59b9bf88e9512da7d7f11f17f1a421d469ce0f77 /src/node-fallbacks/crypto.js
parentb0dd7bee5b22e49f2f2b8af92e4e1c7736f5d9a5 (diff)
downloadbun-a31eb6a80c18a8110097e1df69ef1308b0446f53.tar.gz
bun-a31eb6a80c18a8110097e1df69ef1308b0446f53.tar.zst
bun-a31eb6a80c18a8110097e1df69ef1308b0446f53.zip
Add missing `getRandomValues` to crypto polyfill
Diffstat (limited to 'src/node-fallbacks/crypto.js')
-rw-r--r--src/node-fallbacks/crypto.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/node-fallbacks/crypto.js b/src/node-fallbacks/crypto.js
index 2ab82cc89..7b72c4ea1 100644
--- a/src/node-fallbacks/crypto.js
+++ b/src/node-fallbacks/crypto.js
@@ -1,4 +1,10 @@
export * from "crypto-browserify";
-const { randomUUID } = crypto;
-export { randomUUID };
+// we deliberately reference crypto. directly here because we want to preserve the This binding
+export var getRandomValues = (array) => {
+ return crypto.getRandomValues(array);
+};
+
+export var randomUUID = () => {
+ return crypto.randomUUID();
+};