Add crypto RNG/KDF/FIPS helpers - #205
Merged
kevinresol merged 2 commits intoJul 13, 2026
Merged
Conversation
These externs were missing from Crypto.hx, so Haxe code could not call randomFill/randomInt/UUID, scrypt/hkdf, timingSafeEqual, or FIPS/prime/cipher-info APIs without untyped workarounds. Co-authored-by: Cursor <cursoragent@cursor.com>
Fix hkdf/hkdfSync to return ArrayBuffer, add scrypt cost/blockSize/parallelization options, deprecate fips, accept ArrayBuffer on timingSafeEqual/checkPrime, and expose randomUUIDv7. Co-authored-by: Cursor <cursoragent@cursor.com>
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
cryptosimple APIs toCrypto.hx:randomFill/randomFillSync,randomInt,randomUUID,timingSafeEqual,scrypt/scryptSync,hkdf/hkdfSync,getFips/setFips,checkPrime/checkPrimeSync, andgetCipherInfo.ScryptOptions,RandomUUIDOptions,CheckPrimeOptions,CipherInfo/CipherInfoOptions) in the same file, matching existing pbkdf2-style overloads and EitherType usage.generateKeyPair(out of scope for this PR).Test plan
haxe build.hxml(Haxe 4.3.7) succeeds with only pre-existing warningssrc/js/node/Crypto.hxMade with Cursor