Changelog - 2026-09-18
UuidHelper - one door for every UUID
New FeatureIn one line. You can now mint a deterministic version 5 UUID, the version an idempotency key needs, and every other UUID comes from the same helper.
import { UuidHelper, UuidNamespaces } from '@venizia/ignis-helpers/core';
const uuid = UuidHelper.getInstance();
uuid.v7(); // database primary key - time-ordered
uuid.v4(); // public identifier or token - random
uuid.v5({ namespace: UuidNamespaces.URL, name: `orders/${orderId}/refund` }); // deterministicWhat changed
v5({ namespace, name })is new. The same inputs always give the same id, on every host. Derive an idempotency key from the business data instead of storing a lookup.v4()andv7()live on the same helper. Usev7()for database keys andv4()for a public identifier.inspect({ value })reads an id back: its version, and for a v7 the moment it was minted.UuidHelper.isValid(value)is the static check.UuidNamespacescarries the four RFC 9562 namespaces (DNS,URL,OID,X500). If none fit, mint your own withv4()once and pin it as a constant.- Works on
http://<lan-ip>in a browser. Nothing callscrypto.randomUUIDdirectly any more (a WebSocket client id, a WebSocket server id and the pending object name of a direct upload did), and it isundefinedoutside a secure context. The helper falls back tocrypto.getRandomValuesand gives the same shape.
Who is affected
- Existing code. No action needed.
RequestIdGeneratornow delegates toUuidHelper.v4(). - Anyone writing an idempotency key by hand. Use
v5instead of hashing a string yourself.
Details
| Use | Version |
|---|---|
| Database primary key | v7() - time-ordered |
| Idempotency key, deterministic id | v5({ namespace, name }) |
| Public identifier, random token | v4() |
WARNING
A version 5 id is reproducible, not secret. Anyone holding the same namespace and name can compute it. Never use one as a share link, a reset token or an API key.
TIP
A version 5 id gives you a stable key. What enforces idempotency is the unique index on the column, plus handling the conflict on insert.
A version 7 timestamp can sit a few milliseconds ahead of the wall clock. 4096 ids fit in one millisecond, and past that the generator borrows the next one. A creation time read from inspect() inside a burst leads the clock by roughly one millisecond per 4096 ids.