summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/crypto/_randomFill.mjs
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2024-01-11 07:37:25 +0900
committerGitHub <noreply@github.com>2024-01-10 15:37:25 -0700
commit515a34b4de222e35c7ade1b92614d746e73d4c2e (patch)
tree8284201fc826a33f12597959a8a8be14e0f524bd /ext/node/polyfills/internal/crypto/_randomFill.mjs
parentd4893eb51a01c5a692d8ca74a3b8ff95c5fd1d9f (diff)
refactor: use `core.ensureFastOps()` (#21888)
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;
}