diff --git a/crypto/_benches/bench.ts b/crypto/_benches/bench.ts index 8017284e518a..3efd05532411 100644 --- a/crypto/_benches/bench.ts +++ b/crypto/_benches/bench.ts @@ -1,9 +1,6 @@ #!/usr/bin/env -S deno bench // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { - crypto as stdCrypto, - wasmDigestAlgorithms as DIGEST_ALGORITHM_NAMES, -} from "../mod.ts"; +import { crypto as stdCrypto, DIGEST_ALGORITHM_NAMES } from "../mod.ts"; import nodeCrypto from "node:crypto"; diff --git a/crypto/crypto.ts b/crypto/crypto.ts index 7af8bff2777c..669b0d862c48 100644 --- a/crypto/crypto.ts +++ b/crypto/crypto.ts @@ -107,12 +107,12 @@ * @module */ import { - DIGEST_ALGORITHM_NAMES as wasmDigestAlgorithms, - type DigestAlgorithmName as WasmDigestAlgorithm, + DIGEST_ALGORITHM_NAMES, + type DigestAlgorithmName, instantiateWasm, } from "./_wasm/mod.ts"; -export { type WasmDigestAlgorithm, wasmDigestAlgorithms }; +export { DIGEST_ALGORITHM_NAMES, type DigestAlgorithmName }; /** Digest algorithms supported by WebCrypto. */ const WEB_CRYPTO_DIGEST_ALGORITHM_NAMES = [ @@ -219,7 +219,7 @@ const stdCrypto: StdCrypto = ((x) => x)({ bytes ) { return webCrypto.subtle.digest(algorithm, bytes); - } else if (wasmDigestAlgorithms.includes(name as WasmDigestAlgorithm)) { + } else if (DIGEST_ALGORITHM_NAMES.includes(name as DigestAlgorithmName)) { if (bytes) { // Otherwise, we use our bundled Wasm implementation via digestSync // if it supports the algorithm. @@ -294,11 +294,26 @@ const stdCrypto: StdCrypto = ((x) => x)({ }, }); -/** FNV (Fowler/Noll/Vo) algorithms names. */ +/** + * A FNV (Fowler/Noll/Vo) digest algorithm name supported by std/crypto. + * + * @deprecated (will be removed in 1.0.0) + */ export type FNVAlgorithms = "FNV32" | "FNV32A" | "FNV64" | "FNV64A"; -/** Extended digest algorithm names. */ -export type DigestAlgorithmName = WasmDigestAlgorithm | FNVAlgorithms; +/** + * Digest algorithm names supported by std/crypto with a Wasm implementation. + * + * @deprecated (will be removed in 1.0.0) Consider using {@linkcode DIGEST_ALGORITHM_NAMES} instead. + */ +export const wasmDigestAlgorithms = DIGEST_ALGORITHM_NAMES; + +/** + * A digest algorithm name supported by std/crypto with a Wasm implementation. + * + * @deprecated (will be removed in 1.0.0) Consider using {@linkcode DigestAlgorithmName} instead. + */ +export type WasmDigestAlgorithm = DigestAlgorithmName; /* * The largest digest length the current Wasm implementation can support. This diff --git a/crypto/crypto_test.ts b/crypto/crypto_test.ts index 7f9db84422de..d09fb73e4e62 100644 --- a/crypto/crypto_test.ts +++ b/crypto/crypto_test.ts @@ -2,8 +2,8 @@ import { assert, assertEquals, assertInstanceOf, fail } from "../assert/mod.ts"; import { crypto as stdCrypto, + DIGEST_ALGORITHM_NAMES, type DigestAlgorithmName, - wasmDigestAlgorithms as DIGEST_ALGORITHM_NAMES, } from "./mod.ts"; import { repeat } from "../bytes/repeat.ts"; import { encodeHex } from "../encoding/hex.ts";