summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/crypto
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-01-29 14:58:08 +0100
committerGitHub <noreply@github.com>2024-01-29 14:58:08 +0100
commit909986fa6ed3404e76590438b387391a6c213e46 (patch)
tree30eec861847dccadd83fcc65b91dc44c96af6d9e /ext/node/polyfills/internal/crypto
parentaed5e4997df26c99a186fb9a5b18da3bbc594ed3 (diff)
refactor: migrate 'ext/node' extension to virtual ops module (#22157)
Follow up to https://github.com/denoland/deno/pull/22135
Diffstat (limited to 'ext/node/polyfills/internal/crypto')
-rw-r--r--ext/node/polyfills/internal/crypto/_randomInt.ts5
-rw-r--r--ext/node/polyfills/internal/crypto/cipher.ts4
-rw-r--r--ext/node/polyfills/internal/crypto/diffiehellman.ts6
-rw-r--r--ext/node/polyfills/internal/crypto/hash.ts9
-rw-r--r--ext/node/polyfills/internal/crypto/hkdf.ts6
-rw-r--r--ext/node/polyfills/internal/crypto/keygen.ts4
-rw-r--r--ext/node/polyfills/internal/crypto/keys.ts5
-rw-r--r--ext/node/polyfills/internal/crypto/pbkdf2.ts6
-rw-r--r--ext/node/polyfills/internal/crypto/random.ts4
-rw-r--r--ext/node/polyfills/internal/crypto/scrypt.ts7
-rw-r--r--ext/node/polyfills/internal/crypto/sig.ts6
-rw-r--r--ext/node/polyfills/internal/crypto/x509.ts5
12 files changed, 21 insertions, 46 deletions
diff --git a/ext/node/polyfills/internal/crypto/_randomInt.ts b/ext/node/polyfills/internal/crypto/_randomInt.ts
index 072d74c11..7f4d703ad 100644
--- a/ext/node/polyfills/internal/crypto/_randomInt.ts
+++ b/ext/node/polyfills/internal/crypto/_randomInt.ts
@@ -3,10 +3,7 @@
// TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials
-import { core } from "ext:core/mod.js";
-const {
- op_node_random_int,
-} = core.ensureFastOps();
+import { op_node_random_int } from "ext:core/ops";
export default function randomInt(max: number): number;
export default function randomInt(min: number, max: number): number;
diff --git a/ext/node/polyfills/internal/crypto/cipher.ts b/ext/node/polyfills/internal/crypto/cipher.ts
index fdbdb6fd4..20971a8c7 100644
--- a/ext/node/polyfills/internal/crypto/cipher.ts
+++ b/ext/node/polyfills/internal/crypto/cipher.ts
@@ -8,7 +8,7 @@ import { core } from "ext:core/mod.js";
const {
encode,
} = core;
-const {
+import {
op_node_cipheriv_encrypt,
op_node_cipheriv_final,
op_node_cipheriv_set_aad,
@@ -20,7 +20,7 @@ const {
op_node_private_decrypt,
op_node_private_encrypt,
op_node_public_encrypt,
-} = core.ensureFastOps();
+} from "ext:core/ops";
import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts";
import {
diff --git a/ext/node/polyfills/internal/crypto/diffiehellman.ts b/ext/node/polyfills/internal/crypto/diffiehellman.ts
index fbcdab185..bba01e2c4 100644
--- a/ext/node/polyfills/internal/crypto/diffiehellman.ts
+++ b/ext/node/polyfills/internal/crypto/diffiehellman.ts
@@ -5,13 +5,13 @@
// deno-lint-ignore-file prefer-primordials
import { core } from "ext:core/mod.js";
-const {
+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,
- op_node_ecdh_compute_public_key,
-} = core.ensureFastOps();
+} from "ext:core/ops";
const {
op_node_gen_prime,
} = core.ensureFastOps(true);
diff --git a/ext/node/polyfills/internal/crypto/hash.ts b/ext/node/polyfills/internal/crypto/hash.ts
index 8d56f601e..a1d61f953 100644
--- a/ext/node/polyfills/internal/crypto/hash.ts
+++ b/ext/node/polyfills/internal/crypto/hash.ts
@@ -4,16 +4,15 @@
// 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_create_hash,
op_node_get_hashes,
op_node_hash_clone,
- op_node_hash_digest_hex,
op_node_hash_digest,
- op_node_hash_update_str,
+ op_node_hash_digest_hex,
op_node_hash_update,
-} = core.ensureFastOps();
+ op_node_hash_update_str,
+} from "ext:core/ops";
import { TextEncoder } from "ext:deno_web/08_text_encoding.js";
import { Buffer } from "node:buffer";
diff --git a/ext/node/polyfills/internal/crypto/hkdf.ts b/ext/node/polyfills/internal/crypto/hkdf.ts
index 8e09f6388..0a8dcbb2e 100644
--- a/ext/node/polyfills/internal/crypto/hkdf.ts
+++ b/ext/node/polyfills/internal/crypto/hkdf.ts
@@ -4,11 +4,7 @@
// TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials
-import { core } from "ext:core/mod.js";
-const {
- op_node_hkdf,
- op_node_hkdf_async,
-} = core.ensureFastOps();
+import { op_node_hkdf, op_node_hkdf_async } from "ext:core/ops";
import {
validateFunction,
diff --git a/ext/node/polyfills/internal/crypto/keygen.ts b/ext/node/polyfills/internal/crypto/keygen.ts
index 7b6c58d59..cdb94d222 100644
--- a/ext/node/polyfills/internal/crypto/keygen.ts
+++ b/ext/node/polyfills/internal/crypto/keygen.ts
@@ -30,7 +30,7 @@ import { Buffer } from "node:buffer";
import { KeyFormat, KeyType } from "ext:deno_node/internal/crypto/types.ts";
import { core } from "ext:core/mod.js";
-const {
+import {
op_node_dh_generate,
op_node_dh_generate_async,
op_node_dh_generate_group,
@@ -45,7 +45,7 @@ const {
op_node_generate_rsa_async,
op_node_x25519_generate,
op_node_x25519_generate_async,
-} = core.ensureFastOps();
+} from "ext:core/ops";
const {
op_node_generate_secret,
op_node_generate_secret_async,
diff --git a/ext/node/polyfills/internal/crypto/keys.ts b/ext/node/polyfills/internal/crypto/keys.ts
index f1da42daf..ab753582f 100644
--- a/ext/node/polyfills/internal/crypto/keys.ts
+++ b/ext/node/polyfills/internal/crypto/keys.ts
@@ -4,10 +4,7 @@
// TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials
-import { core } from "ext:core/mod.js";
-const {
- op_node_create_private_key,
-} = core.ensureFastOps();
+import { op_node_create_private_key } from "ext:core/ops";
import {
kHandle,
diff --git a/ext/node/polyfills/internal/crypto/pbkdf2.ts b/ext/node/polyfills/internal/crypto/pbkdf2.ts
index 47c66043c..5cf102fa9 100644
--- a/ext/node/polyfills/internal/crypto/pbkdf2.ts
+++ b/ext/node/polyfills/internal/crypto/pbkdf2.ts
@@ -3,11 +3,7 @@
// TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials
-import { core } from "ext:core/mod.js";
-const {
- op_node_pbkdf2,
- op_node_pbkdf2_async,
-} = core.ensureFastOps();
+import { op_node_pbkdf2, op_node_pbkdf2_async } from "ext:core/ops";
import { Buffer } from "node:buffer";
import { HASH_DATA } from "ext:deno_node/internal/crypto/types.ts";
diff --git a/ext/node/polyfills/internal/crypto/random.ts b/ext/node/polyfills/internal/crypto/random.ts
index 52f6db272..0c8273bdf 100644
--- a/ext/node/polyfills/internal/crypto/random.ts
+++ b/ext/node/polyfills/internal/crypto/random.ts
@@ -5,13 +5,13 @@
// deno-lint-ignore-file prefer-primordials
import { core, primordials } from "ext:core/mod.js";
-const {
+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_async,
-} = core.ensureFastOps();
+} from "ext:core/ops";
const {
op_node_gen_prime,
} = core.ensureFastOps(true);
diff --git a/ext/node/polyfills/internal/crypto/scrypt.ts b/ext/node/polyfills/internal/crypto/scrypt.ts
index 7de5a3ab8..ce8649bbe 100644
--- a/ext/node/polyfills/internal/crypto/scrypt.ts
+++ b/ext/node/polyfills/internal/crypto/scrypt.ts
@@ -28,12 +28,7 @@ SOFTWARE.
import { Buffer } from "node:buffer";
import { HASH_DATA } from "ext:deno_node/internal/crypto/types.ts";
-
-import { core } from "ext:core/mod.js";
-const {
- op_node_scrypt_sync,
- op_node_scrypt_async,
-} = core.ensureFastOps();
+import { op_node_scrypt_async, op_node_scrypt_sync } from "ext:core/ops";
type Opts = Partial<{
N: number;
diff --git a/ext/node/polyfills/internal/crypto/sig.ts b/ext/node/polyfills/internal/crypto/sig.ts
index fb303e4e2..5a9611780 100644
--- a/ext/node/polyfills/internal/crypto/sig.ts
+++ b/ext/node/polyfills/internal/crypto/sig.ts
@@ -4,11 +4,7 @@
// TODO(petamoriken): enable prefer-primordials for node polyfills
// deno-lint-ignore-file prefer-primordials
-import { core } from "ext:core/mod.js";
-const {
- op_node_sign,
- op_node_verify,
-} = core.ensureFastOps();
+import { op_node_sign, op_node_verify } from "ext:core/ops";
import { notImplemented } from "ext:deno_node/_utils.ts";
import {
diff --git a/ext/node/polyfills/internal/crypto/x509.ts b/ext/node/polyfills/internal/crypto/x509.ts
index 380deefc3..50a7ab48d 100644
--- a/ext/node/polyfills/internal/crypto/x509.ts
+++ b/ext/node/polyfills/internal/crypto/x509.ts
@@ -4,8 +4,7 @@
// 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_x509_ca,
op_node_x509_check_email,
op_node_x509_fingerprint,
@@ -18,7 +17,7 @@ const {
op_node_x509_get_valid_to,
op_node_x509_key_usage,
op_node_x509_parse,
-} = core.ensureFastOps();
+} from "ext:core/ops";
import { KeyObject } from "ext:deno_node/internal/crypto/keys.ts";
import { Buffer } from "node:buffer";