diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-01-29 22:02:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-29 22:02:26 +0100 |
commit | 345423cf7697326258ce8b32f681910f4a2f77de (patch) | |
tree | 484dd157be01e3dc0d4f34f28526dac1804d0250 /ext/node/polyfills/internal/crypto | |
parent | 909986fa6ed3404e76590438b387391a6c213e46 (diff) |
refactor: Use virtul ops module (#22175)
Follow up to #22157.
This leaves us with 4 usages of `ensureFastOps()` in `deno` itself.
There's also about 150 usages of `Deno.core.ops.<op_name>` left as well.
Diffstat (limited to 'ext/node/polyfills/internal/crypto')
4 files changed, 7 insertions, 16 deletions
diff --git a/ext/node/polyfills/internal/crypto/_randomFill.mjs b/ext/node/polyfills/internal/crypto/_randomFill.mjs index cb61e27ef..5de756536 100644 --- a/ext/node/polyfills/internal/crypto/_randomFill.mjs +++ b/ext/node/polyfills/internal/crypto/_randomFill.mjs @@ -3,11 +3,10 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; -const { +import { op_node_generate_secret, op_node_generate_secret_async, -} = core.ensureFastOps(true); +} from "ext:core/ops"; import { MAX_SIZE as kMaxUint32, diff --git a/ext/node/polyfills/internal/crypto/diffiehellman.ts b/ext/node/polyfills/internal/crypto/diffiehellman.ts index bba01e2c4..4b105e575 100644 --- a/ext/node/polyfills/internal/crypto/diffiehellman.ts +++ b/ext/node/polyfills/internal/crypto/diffiehellman.ts @@ -4,17 +4,14 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core } from "ext:core/mod.js"; import { op_node_dh_compute_secret, op_node_dh_generate2, op_node_ecdh_compute_public_key, op_node_ecdh_compute_secret, op_node_ecdh_generate_keys, -} from "ext:core/ops"; -const { op_node_gen_prime, -} = core.ensureFastOps(true); +} from "ext:core/ops"; import { notImplemented } from "ext:deno_node/_utils.ts"; import { diff --git a/ext/node/polyfills/internal/crypto/keygen.ts b/ext/node/polyfills/internal/crypto/keygen.ts index cdb94d222..f3263aecf 100644 --- a/ext/node/polyfills/internal/crypto/keygen.ts +++ b/ext/node/polyfills/internal/crypto/keygen.ts @@ -29,7 +29,6 @@ import { import { Buffer } from "node:buffer"; import { KeyFormat, KeyType } from "ext:deno_node/internal/crypto/types.ts"; -import { core } from "ext:core/mod.js"; import { op_node_dh_generate, op_node_dh_generate_async, @@ -43,13 +42,11 @@ import { op_node_ed25519_generate_async, op_node_generate_rsa, op_node_generate_rsa_async, + op_node_generate_secret, + op_node_generate_secret_async, op_node_x25519_generate, op_node_x25519_generate_async, } from "ext:core/ops"; -const { - op_node_generate_secret, - op_node_generate_secret_async, -} = core.ensureFastOps(true); function validateGenerateKey( type: "hmac" | "aes", diff --git a/ext/node/polyfills/internal/crypto/random.ts b/ext/node/polyfills/internal/crypto/random.ts index 0c8273bdf..4219414dc 100644 --- a/ext/node/polyfills/internal/crypto/random.ts +++ b/ext/node/polyfills/internal/crypto/random.ts @@ -4,18 +4,16 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -import { core, primordials } from "ext:core/mod.js"; +import { primordials } from "ext:core/mod.js"; import { op_node_check_prime, op_node_check_prime_async, op_node_check_prime_bytes, op_node_check_prime_bytes_async, + op_node_gen_prime, op_node_gen_prime_async, } from "ext:core/ops"; const { - op_node_gen_prime, -} = core.ensureFastOps(true); -const { StringPrototypePadStart, StringPrototypeToString, } = primordials; |