Repository navigation
Conversation
The RSA, EC, CFRG, ML-DSA, and ML-KEM importKey implementations each duplicated the handling of the 'KeyObjectHandle', 'spki', and 'pkcs8' formats. Move it into a shared importAsymmetricKeyHandle() helper in webcrypto_util, with an optional hook that ML-DSA and ML-KEM use to reject PKCS#8 keys without a seed. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com>
exportKeySpki() and exportKeyPkcs8() contained identical switch statements mapping the algorithm name to its export function. Move the lookup into a shared getAsymmetricKeyExporter() helper. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com>
ClientRequest and Server duplicated the validation of the insecureHTTPParser and httpValidation options, including the check that they are mutually exclusive. Move it into a shared setHttpParserOptions() helper in internal/http. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com>
util.debounce() and util.throttle() duplicated the construction of the AbortError used for cancel()/abort, and the property definitions for the returned function's control methods, state getters, length, and name. Move both into internal/util/wrapped_function. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com>
The Writable and Duplex adapters created from web streams duplicated the logic that encodes string chunks as a Uint8Array before writing them to the WritableStream. Move it into a shared encodeStringChunk() helper. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com>
SQLTagStore::Run(), Iterate(), Get(), and All() each duplicated the database state checks, statement preparation, and parameter binding. Move them into a shared PrepareForExecution() helper. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com>
URLPattern::Exec() and URLPattern::Test() duplicated the parsing of the input and baseURL arguments. Move it into a shared ParseURLPatternMatchArgs() helper. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com>
IndexOfString() and IndexOfBuffer() duplicated the computation of the search range and the early returns for empty needles, empty haystacks, and out-of-range offsets. Move it into a shared GetIndexOfSearchRange() helper. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com>
The two Hash::HashInit() overloads duplicated the logic that determines the digest length and validates the requested XOF output length after the digest context is initialized. Move it into a shared FinishHashInit() helper. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com>
The SecureContext ticket key callback signatures repeated the same backend-specific preprocessor block to select between EVP_MAC_CTX and HMAC_CTX. Define the type once as TicketHmacCtx and use it instead. Assisted-by: Claude Signed-off-by: James M Snell <jasnell@gmail.com>
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #67495 +/- ##
==========================================
+ Coverage 90.67% 90.68% +0.01%
==========================================
Files 799 800 +1
Lines 280245 280134 -111
Branches 54125 54079 -46
==========================================
- Hits 254100 254037 -63
+ Misses 16280 16252 -28
+ Partials 9865 9845 -20
🚀 New features to boost your workflow:
|
Collaborator
panva
approved these changes
Nov 16, 2026
panva
left a comment
Member
There was a problem hiding this comment.
node:crypto and Web Cryptography LGTM
ronag
approved these changes
Nov 16, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overall simplification. Deduplicate a number of JS and C++ bits.
See each individual commit.