-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deprecation(crypto): rename an export to match style guide, deprecating original and two other obsolete imports #4525
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
/** | ||
* 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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
/* | ||
* The largest digest length the current Wasm implementation can support. This | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of this export is minimal. A removal version of v1 instead of sooner is overkill and would be non-impactful to remove sooner. See https://github.com/search?q=%22FNVAlgorithms%22&type=code and notice they're almost entirely forks of std. WDYT, @kt3k?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no benefit of removing them earlier in my view.
Breaking at 1.0 is more obvious and less confusing. That is better than breaking at random 0.x version in my view