Skip to content

Type Alias: UUIDVersion1Options ​

UUIDVersion1Options = object

The options of a version 1 (time-based) UUID. Without options, the UUIDs of the process share a state: the timestamp is the current time, a counter keeps the UUIDs created in the same millisecond unique and ordered, and the node and clock sequence are random, drawn once. Given any option, the UUID is built from the options alone: the missing time is the current one, the missing node and clock sequence come from the random bytes, and two UUIDs created with the same options in the same millisecond may be equal.

Properties ​

_v6? ​

optional _v6?: boolean

Internal: set by the version 6 generation, to draw a new node and clock sequence for each UUID. Do not set it.


clockseq? ​

optional clockseq?: number

The clock sequence, an integer from 0 to 0x3fff (14 bits); a greater value overwrites the variant bits.

Default ​

ts
random

msecs? ​

optional msecs?: number

The time of the UUID, in milliseconds since the Unix epoch.

Default ​

ts
Date.now()

node? ​

optional node?: Uint8Array

The node ID, its first 6 bytes (traditionally a MAC address).

Default ​

ts
6 random bytes

nsecs? ​

optional nsecs?: number

The 100-nanosecond intervals added to msecs, an integer from 0 to 9999.

Default ​

ts
0

random? ​

optional random?: Uint8Array

16 random bytes (or more, fewer make the generation throw an Error), used for the node and the clock sequence when they are not given; it takes precedence over rng.

Default ​

ts
bytes from the cryptographic random generator of Node.js

rng? ​

optional rng?: () => Uint8Array

A function returning 16 random bytes (or more), called when random is not given.

Returns ​

Uint8Array

Default ​

ts
the cryptographic random generator of Node.js

Released under the MIT License.