UUIDs are identifiers, not secrets. UUID v4 has 122 bits of randomness but appears in URLs and logs — it is not a secret token. UUID v7 additionally discloses creation time to the millisecond via its first 12 hex characters. For session tokens, password resets, and capability grants, use crypto.getRandomValues() (32 bytes, base64url-encoded, stored as a hash). See UUID Security.
Idempotency keys: always UUID v4. UUID validation ≠ authorisation — format checks don’t prove the ID was legitimately generated.
Read more: UUID as Idempotency Keys · v4 vs v7 · Entropy
Generate a UUID v4 · UUID Decoder · UUID Validator
Frequently asked questions
What do UUID security videos explain about UUID v7 timestamps?
UUID security videos explain that UUID v7's 48-bit timestamp is extractable by anyone who has the UUID: parseInt(uuid.replace(/-/g,"").slice(0,12), 16) gives the creation time in milliseconds. This is fine for internal primary keys but not for externally visible identifiers where creation time is sensitive. Use UUID v4 for tokens, share links, and public-facing IDs. See UUID security video walkthrough and UUID Security guide.
Can I use a UUID as a secret token?
No. A UUID is an identifier, not a credential. The 122 bits of randomness in v4 make collision unlikely, but UUIDs are often logged, included in URLs, and visible in referrer headers — any of those can expose the value. Use a purpose-built token (e.g., from crypto.getRandomValues) for secrets.
Does UUID v7 leak sensitive information?
Yes — the first 48 bits are a Unix millisecond timestamp. Anyone with a v7 UUID can read when the record was created to the millisecond. Two v7 UUIDs also reveal how many records were created between them. Use v4 for externally visible identifiers where creation time or volume is sensitive.