Skip to content

feat: add randomUUIDv7 (RFC 9562 §5.7) and disableEntropyCache option#1033

Merged
boorad merged 2 commits into
mainfrom
feat/random-uuidv7
May 7, 2026
Merged

feat: add randomUUIDv7 (RFC 9562 §5.7) and disableEntropyCache option#1033
boorad merged 2 commits into
mainfrom
feat/random-uuidv7

Conversation

@boorad
Copy link
Copy Markdown
Collaborator

@boorad boorad commented May 6, 2026

Summary

  • Adds 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.
  • Adds options.disableEntropyCache to both randomUUID and randomUUIDv7 for Node.js API parity. RNQC pulls fresh OS entropy on every call, so the flag is documented as a no-op.
  • Refactors v4/v7 serialization into a shared serializeUUID(buffer, version) helper.
  • Catches up .docs/implementation-coverage.md and docs/data/coverage.ts with 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.tsrandomUUIDv7, RandomUUIDOptions, validation, refactored serializeUUID
  • example/src/tests/random/random_tests.ts — 9 new tests (v4 + v7)
  • docs/content/docs/api/random.mdx — documents v7 and disableEntropyCache semantics
  • .docs/implementation-coverage.md — marks crypto.randomUUIDv7() as a non-WebCrypto extension; refreshed subtle.digest table
  • docs/data/coverage.ts — adds randomUUIDv7, TurboSHAKE/KT, SLH-DSA entries

Test plan

  • bun tsc clean
  • Random suite (v4 + v7 tests) green in example app
  • Docs site builds
  • CI green

Fixes #1009

boorad added 2 commits May 6, 2026 18:58
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.
@boorad boorad self-assigned this May 6, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-quick-crypto Ready Ready Preview, Comment May 7, 2026 0:00am

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🤖 End-to-End Test Results - iOS

Status: ✅ Passed
Platform: iOS
Run: 25467949154

📸 Final Test Screenshot

Maestro Test Results - ios

Screenshot automatically captured from End-to-End tests and will expire in 30 days


This comment is automatically updated on each test run.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🤖 End-to-End Test Results - Android

Status: ✅ Passed
Platform: Android
Run: 25467949155

📸 Final Test Screenshot

Maestro Test Results - android

Screenshot automatically captured from End-to-End tests and will expire in 30 days


This comment is automatically updated on each test run.

@boorad boorad merged commit cacf92a into main May 7, 2026
9 checks passed
@boorad boorad deleted the feat/random-uuidv7 branch May 7, 2026 00:32
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.

Add crypto.randomUUIDv7() (RFC 9562) and disableEntropyCache option for randomUUID

1 participant