From 0e2136cbb0385508f01032e1c55c46776d868b4b Mon Sep 17 00:00:00 2001 From: Jeremy Banks <_@jeremy.ca> Date: Tue, 26 Mar 2024 14:18:08 -0400 Subject: [PATCH 1/2] chore(crypto): rename an export to match style guide, deprecating original and two other obsolete imports --- crypto/_benches/bench.ts | 5 +---- crypto/crypto.ts | 29 ++++++++++++++++++++++------- crypto/crypto_test.ts | 2 +- 3 files changed, 24 insertions(+), 12 deletions(-) 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..0e6887baf649 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 0.224.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 0.224.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 0.224.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"; From e66530216f0f187ef9a5e39228300a96be57d4a6 Mon Sep 17 00:00:00 2001 From: Jeremy Banks <_@jeremy.ca> Date: Tue, 26 Mar 2024 17:16:35 -0400 Subject: [PATCH 2/2] chore(crypto): change deprecation warnings from 0.224.0 to 1.0.0 --- crypto/crypto.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/crypto.ts b/crypto/crypto.ts index 0e6887baf649..669b0d862c48 100644 --- a/crypto/crypto.ts +++ b/crypto/crypto.ts @@ -297,21 +297,21 @@ const stdCrypto: StdCrypto = ((x) => x)({ /** * A FNV (Fowler/Noll/Vo) digest algorithm name supported by std/crypto. * - * @deprecated (will be removed in 0.224.0) + * @deprecated (will be removed in 1.0.0) */ export type FNVAlgorithms = "FNV32" | "FNV32A" | "FNV64" | "FNV64A"; /** * Digest algorithm names supported by std/crypto with a Wasm implementation. * - * @deprecated (will be removed in 0.224.0) Consider using {@linkcode DIGEST_ALGORITHM_NAMES} instead. + * @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 0.224.0) Consider using {@linkcode DigestAlgorithmName} instead. + * @deprecated (will be removed in 1.0.0) Consider using {@linkcode DigestAlgorithmName} instead. */ export type WasmDigestAlgorithm = DigestAlgorithmName;