feat: add randomUUIDv7 (RFC 9562 §5.7) and disableEntropyCache option#1033
Merged
Conversation
Implements #1009. Adds RFC 9562 §5.7 v7 UUIDs (48-bit unix-ms timestamp prefix making them lexicographically time-sortable). Both randomUUID and randomUUIDv7 now accept an optional `disableEntropyCache` parameter for Node.js API parity; RNQC pulls fresh OS entropy on every call so the flag is a no-op. Also catches up `.docs/implementation-coverage.md` and `docs/data/coverage.ts` with TurboSHAKE128/256 + KangarooTwelve (KT128/KT256) digests from #1032 and SLH-DSA sign/verify/generateKeyPair entries from #1030, which were missed in their respective PRs.
- Add explicit return types to randomUUID, randomUUIDv7, serializeUUID, validateRandomUUIDOptions per project TS rules. - serializeUUID now takes a small int version (4 or 7) and shifts internally; drops the variant parameter since RFC 9562 v4 and v7 share the 10xx variant. Call sites read as serializeUUID(buffer, 7) instead of serializeUUID(buffer, 0x70, 0x80). - Fix RFC 9562 section reference §4.4 → §5.4 (v4 lives at §5.4 in 9562; §4.4 was the v4 section in the obsolete RFC 4122). - Mark crypto.randomUUIDv7() as a non-WebCrypto extension in the coverage doc.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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. |
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
crypto.randomUUIDv7()per RFC 9562 §5.7 — 48-bit big-endian Unix-ms timestamp prefix making the UUIDs lexicographically time-sortable, with 74 bits of CSPRNG output.options.disableEntropyCacheto bothrandomUUIDandrandomUUIDv7for Node.js API parity. RNQC pulls fresh OS entropy on every call, so the flag is documented as a no-op.serializeUUID(buffer, version)helper..docs/implementation-coverage.mdanddocs/data/coverage.tswith TurboSHAKE128/256, KangarooTwelve (KT128/KT256), and SLH-DSA entries that were missed in feat: add SLH-DSA sign and verify support #1030 / feat: add TurboSHAKE and KangarooTwelve digests #1032.Changes
packages/react-native-quick-crypto/src/random.ts—randomUUIDv7,RandomUUIDOptions, validation, refactoredserializeUUIDexample/src/tests/random/random_tests.ts— 9 new tests (v4 + v7)docs/content/docs/api/random.mdx— documents v7 anddisableEntropyCachesemantics.docs/implementation-coverage.md— markscrypto.randomUUIDv7()as a non-WebCrypto extension; refreshedsubtle.digesttabledocs/data/coverage.ts— adds randomUUIDv7, TurboSHAKE/KT, SLH-DSA entriesTest plan
bun tsccleanFixes #1009