fix: improve pbkdf2 type safety to match Node.js API#932
Merged
Conversation
Make digest parameter required in pbkdf2Sync to match Node.js API, which throws when digest is omitted. Remove the silent sha1 default fallback. Replace Parameters<> type extraction workaround with a direct import of BinaryLike from the package.
Remove stale commented-out test code for invalid pbkdf2 fixtures. Invalid iterations/keylen values (negative, NaN, Infinity) currently reach the native C layer and trigger assert()/abort() instead of throwing. Tests can be re-enabled once JS-side validation is added.
Contributor
🤖 End-to-End Test Results - iOSStatus: ✅ Passed 📸 Final Test ScreenshotScreenshot automatically captured from End-to-End tests and will expire in 30 days This comment is automatically updated on each test run. |
Contributor
🤖 End-to-End Test Results - AndroidStatus: ✅ Passed 📸 Final Test ScreenshotScreenshot automatically captured from End-to-End tests and will expire in 30 days This comment is automatically updated on each test run. |
boorad
added a commit
that referenced
this pull request
Feb 24, 2026
New pages: PQC (ML-DSA/ML-KEM), Argon2, KMAC, Certificate (SPKAC), and Utilities (one-shot hash, timingSafeEqual, primes, introspection). Updated 8 existing pages with missing API sections: SubtleCrypto (deriveBits, deriveKey, wrapKey/unwrapKey, encapsulation), Keys (KeyObject.from, equals, toCryptoKey), Signing (standalone sign/verify), DiffieHellman (diffieHellman function), Ed25519 (Ed448/X448), Hash (crypto.hash one-shot, SHA3), ECDH (convertKey), and reorganized the API index into Core/Key Exchange/Key Derivation/Advanced sections. Annotated 7 pages with behavioral notes from recent fix PRs (#929, #930, #932, #933, #939, #948, #949, #951, #954, #955): cipher single-use warning, generateKeys preservation, PBKDF2 validation, OAEP hash default, randomFill view correctness, RSA-* aliases, and flexible curve names. Added llms.txt index route and fixed llms-full.txt JSX stripping in source.ts to produce clean LLM-friendly output.
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.


Summary
Aligns
pbkdf2andpbkdf2Synctype signatures with Node.js@types/nodedefinitions and improves test fixture typing.Changes
digestparameter: Changed fromHashAlgorithm(narrow union) tostring, matching Node.jspbkdf2Syncdigest required: Removed optional?— digest is now required (no silentsha1default)Fixtureinto discriminatedValidFixture/InvalidFixtureinterfaces, eliminatingascasts in testsas HashAlgorithmoras numberin test codeTODO(#931)explaining why they're disabled (native layerabort()s on invalid inputs instead of throwing)Testing
bun tscpasses for both packagesRelated Issues
Closes #592
Refs #931 (created for the JS-side validation work needed to enable invalid fixture tests)