summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/crypto/_randomFill.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/internal/crypto/_randomFill.mjs')
-rw-r--r--ext/node/polyfills/internal/crypto/_randomFill.mjs13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/node/polyfills/internal/crypto/_randomFill.mjs b/ext/node/polyfills/internal/crypto/_randomFill.mjs
index 7f66cfb4b..cb61e27ef 100644
--- a/ext/node/polyfills/internal/crypto/_randomFill.mjs
+++ b/ext/node/polyfills/internal/crypto/_randomFill.mjs
@@ -3,17 +3,18 @@
// TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials
+import { core } from "ext:core/mod.js";
+const {
+ op_node_generate_secret,
+ op_node_generate_secret_async,
+} = core.ensureFastOps(true);
+
import {
MAX_SIZE as kMaxUint32,
} from "ext:deno_node/internal/crypto/_randomBytes.ts";
import { Buffer } from "node:buffer";
import { isAnyArrayBuffer, isArrayBufferView } from "node:util/types";
import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts";
-const { core } = globalThis.__bootstrap;
-const { ops } = core;
-const {
- op_node_generate_secret_async,
-} = core.ensureFastOps();
const kBufferMaxLength = 0x7fffffff;
@@ -87,7 +88,7 @@ export function randomFillSync(buf, offset = 0, size) {
}
const bytes = new Uint8Array(buf.buffer ? buf.buffer : buf, offset, size);
- ops.op_node_generate_secret(bytes);
+ op_node_generate_secret(bytes);
return buf;
}