summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/crypto.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-04 22:31:38 -0400
committerGitHub <noreply@github.com>2023-03-05 02:31:38 +0000
commitb40086fd7da3729d1d59b312c89ee57747fc66a9 (patch)
tree991583010635feab13fae77e7c8a35fef0a09095 /ext/node/polyfills/crypto.ts
parent01028fcdf4f379a7285cc15079306e3ac31edcc1 (diff)
refactor(core): include_js_files! 'dir' option doesn't change specifiers (#18019)
This commit changes "include_js_files!" macro from "deno_core" in a way that "dir" option doesn't cause specifiers to be rewritten to include it. Example: ``` include_js_files! { dir "js", "hello.js", } ``` The above definition required embedders to use: `import ... from "internal:<ext_name>/js/hello.js"`. But with this change, the "js" directory in which the files are stored is an implementation detail, which for embedders results in: `import ... from "internal:<ext_name>/hello.js"`. The directory the files are stored in, is an implementation detail and in some cases might result in a significant size difference for the snapshot. As an example, in "deno_node" extension, we store the source code in "polyfills" directory; which resulted in each specifier to look like "internal:deno_node/polyfills/<module_name>", but with this change it's "internal:deno_node/<module_name>". Given that "deno_node" has over 100 files, many of them having several import specifiers to the same extension, this change removes 10 characters from each import specifier.
Diffstat (limited to 'ext/node/polyfills/crypto.ts')
-rw-r--r--ext/node/polyfills/crypto.ts57
1 files changed, 27 insertions, 30 deletions
diff --git a/ext/node/polyfills/crypto.ts b/ext/node/polyfills/crypto.ts
index 8c179e916..c30b2dcdf 100644
--- a/ext/node/polyfills/crypto.ts
+++ b/ext/node/polyfills/crypto.ts
@@ -1,14 +1,14 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
-import { ERR_CRYPTO_FIPS_FORCED } from "internal:deno_node/polyfills/internal/errors.ts";
-import { crypto as constants } from "internal:deno_node/polyfills/internal_binding/constants.ts";
-import { getOptionValue } from "internal:deno_node/polyfills/internal/options.ts";
+import { ERR_CRYPTO_FIPS_FORCED } from "internal:deno_node/internal/errors.ts";
+import { crypto as constants } from "internal:deno_node/internal_binding/constants.ts";
+import { getOptionValue } from "internal:deno_node/internal/options.ts";
import {
getFipsCrypto,
setFipsCrypto,
timingSafeEqual,
-} from "internal:deno_node/polyfills/internal_binding/crypto.ts";
+} from "internal:deno_node/internal_binding/crypto.ts";
import {
checkPrime,
checkPrimeSync,
@@ -19,36 +19,33 @@ import {
randomFillSync,
randomInt,
randomUUID,
-} from "internal:deno_node/polyfills/internal/crypto/random.ts";
+} from "internal:deno_node/internal/crypto/random.ts";
import type {
CheckPrimeOptions,
GeneratePrimeOptions,
GeneratePrimeOptionsArrayBuffer,
GeneratePrimeOptionsBigInt,
LargeNumberLike,
-} from "internal:deno_node/polyfills/internal/crypto/random.ts";
+} from "internal:deno_node/internal/crypto/random.ts";
import {
pbkdf2,
pbkdf2Sync,
-} from "internal:deno_node/polyfills/internal/crypto/pbkdf2.ts";
+} from "internal:deno_node/internal/crypto/pbkdf2.ts";
import type {
Algorithms,
NormalizedAlgorithms,
-} from "internal:deno_node/polyfills/internal/crypto/pbkdf2.ts";
+} from "internal:deno_node/internal/crypto/pbkdf2.ts";
import {
scrypt,
scryptSync,
-} from "internal:deno_node/polyfills/internal/crypto/scrypt.ts";
-import {
- hkdf,
- hkdfSync,
-} from "internal:deno_node/polyfills/internal/crypto/hkdf.ts";
+} from "internal:deno_node/internal/crypto/scrypt.ts";
+import { hkdf, hkdfSync } from "internal:deno_node/internal/crypto/hkdf.ts";
import {
generateKey,
generateKeyPair,
generateKeyPairSync,
generateKeySync,
-} from "internal:deno_node/polyfills/internal/crypto/keygen.ts";
+} from "internal:deno_node/internal/crypto/keygen.ts";
import type {
BasePrivateKeyEncodingOptions,
DSAKeyPairKeyObjectOptions,
@@ -69,26 +66,26 @@ import type {
X25519KeyPairOptions,
X448KeyPairKeyObjectOptions,
X448KeyPairOptions,
-} from "internal:deno_node/polyfills/internal/crypto/keygen.ts";
+} from "internal:deno_node/internal/crypto/keygen.ts";
import {
createPrivateKey,
createPublicKey,
createSecretKey,
KeyObject,
-} from "internal:deno_node/polyfills/internal/crypto/keys.ts";
+} from "internal:deno_node/internal/crypto/keys.ts";
import type {
AsymmetricKeyDetails,
JsonWebKeyInput,
JwkKeyExportOptions,
KeyExportOptions,
KeyObjectType,
-} from "internal:deno_node/polyfills/internal/crypto/keys.ts";
+} from "internal:deno_node/internal/crypto/keys.ts";
import {
DiffieHellman,
diffieHellman,
DiffieHellmanGroup,
ECDH,
-} from "internal:deno_node/polyfills/internal/crypto/diffiehellman.ts";
+} from "internal:deno_node/internal/crypto/diffiehellman.ts";
import {
Cipheriv,
Decipheriv,
@@ -97,7 +94,7 @@ import {
privateEncrypt,
publicDecrypt,
publicEncrypt,
-} from "internal:deno_node/polyfills/internal/crypto/cipher.ts";
+} from "internal:deno_node/internal/crypto/cipher.ts";
import type {
Cipher,
CipherCCM,
@@ -114,7 +111,7 @@ import type {
DecipherCCM,
DecipherGCM,
DecipherOCB,
-} from "internal:deno_node/polyfills/internal/crypto/cipher.ts";
+} from "internal:deno_node/internal/crypto/cipher.ts";
import type {
BinaryLike,
BinaryToTextEncoding,
@@ -127,13 +124,13 @@ import type {
LegacyCharacterEncoding,
PrivateKeyInput,
PublicKeyInput,
-} from "internal:deno_node/polyfills/internal/crypto/types.ts";
+} from "internal:deno_node/internal/crypto/types.ts";
import {
Sign,
signOneShot,
Verify,
verifyOneShot,
-} from "internal:deno_node/polyfills/internal/crypto/sig.ts";
+} from "internal:deno_node/internal/crypto/sig.ts";
import type {
DSAEncoding,
KeyLike,
@@ -142,30 +139,30 @@ import type {
SignPrivateKeyInput,
VerifyKeyObjectInput,
VerifyPublicKeyInput,
-} from "internal:deno_node/polyfills/internal/crypto/sig.ts";
+} from "internal:deno_node/internal/crypto/sig.ts";
import {
createHash,
Hash,
Hmac,
-} from "internal:deno_node/polyfills/internal/crypto/hash.ts";
-import { X509Certificate } from "internal:deno_node/polyfills/internal/crypto/x509.ts";
+} from "internal:deno_node/internal/crypto/hash.ts";
+import { X509Certificate } from "internal:deno_node/internal/crypto/x509.ts";
import type {
PeerCertificate,
X509CheckOptions,
-} from "internal:deno_node/polyfills/internal/crypto/x509.ts";
+} from "internal:deno_node/internal/crypto/x509.ts";
import {
getCiphers,
getCurves,
getHashes,
secureHeapUsed,
setEngine,
-} from "internal:deno_node/polyfills/internal/crypto/util.ts";
-import type { SecureHeapUsage } from "internal:deno_node/polyfills/internal/crypto/util.ts";
-import Certificate from "internal:deno_node/polyfills/internal/crypto/certificate.ts";
+} from "internal:deno_node/internal/crypto/util.ts";
+import type { SecureHeapUsage } from "internal:deno_node/internal/crypto/util.ts";
+import Certificate from "internal:deno_node/internal/crypto/certificate.ts";
import type {
TransformOptions,
WritableOptions,
-} from "internal:deno_node/polyfills/_stream.d.ts";
+} from "internal:deno_node/_stream.d.ts";
import { crypto as webcrypto } from "internal:deno_crypto/00_crypto.js";
const fipsForced = getOptionValue("--force-fips");