Skip to content

Add crypto RNG/KDF/FIPS helpers - #205

Merged
kevinresol merged 2 commits into
HaxeFoundation:masterfrom
kevinresol:feat/crypto-rng-kdf
Jul 13, 2026
Merged

Add crypto RNG/KDF/FIPS helpers#205
kevinresol merged 2 commits into
HaxeFoundation:masterfrom
kevinresol:feat/crypto-rng-kdf

Conversation

@kevinresol

Copy link
Copy Markdown
Contributor

Summary

  • Add missing Node.js crypto simple APIs to Crypto.hx: randomFill/randomFillSync, randomInt, randomUUID, timingSafeEqual, scrypt/scryptSync, hkdf/hkdfSync, getFips/setFips, checkPrime/checkPrimeSync, and getCipherInfo.
  • Include small supporting typedefs (ScryptOptions, RandomUUIDOptions, CheckPrimeOptions, CipherInfo/CipherInfoOptions) in the same file, matching existing pbkdf2-style overloads and EitherType usage.
  • Skips KeyObject, webcrypto, and generateKeyPair (out of scope for this PR).

Test plan

  • haxe build.hxml (Haxe 4.3.7) succeeds with only pre-existing warnings
  • Spot-check typings against Node.js docs for each added API
  • Confirm no unintended files beyond src/js/node/Crypto.hx

Made with Cursor

kevinresol and others added 2 commits July 13, 2026 22:22
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>
@kevinresol
kevinresol merged commit 061469b into HaxeFoundation:master Jul 13, 2026
@kevinresol
kevinresol deleted the feat/crypto-rng-kdf branch July 15, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant