Skip to content
VaelJS Blog

vael:uuid/v7

RFC 9562 version 7 (Unix-time-ordered + random) UUID generator.

Available in both vjs (vaeljs) and vjs-lite (vaeljs-lite) runtimes. Exports the same synchronous CSPRNG-backed v7 function as "vael:uuid".

import ... from "vael:uuid/v7"
Since v0.0.0-alpha.0 vjs (V8) vjs-lite (QuickJS)
Cargo feature: Always enabled in vaeljs-core; vael-uuid (default) in vaeljs-lite-core
import v7 from "vael:uuid/v7";
console.log(v7());
functionSince v0.0.0-alpha.0vjs & vjs-lite
export function v7(): string;

Generate a canonical lowercase RFC 9562 version 7 (Unix-time-ordered + random) UUID string (36 characters) using the OS CSPRNG.

Identical function object to v7 from "vael:uuid".

Returns
string — Canonical 36-character lowercase RFC 9562 UUIDv7 string.
Exceptions
  • TypeError — when any argument is supplied.
  • Error — with code "VAEL_UUID_CLOCK" or "VAEL_UUID_RANDOM".
import { v7 } from "vael:uuid/v7";
console.log(v7().length); // 36
defaultSince v0.0.0-alpha.0vjs & vjs-lite
export default v7;

Default export: identical to v7.