Generate a UUID v4 for a host identifier that must be unguessable.
Uses native crypto.randomUUID() (called on its Crypto receiver) when the
browser exposes it. Browsers omit it outside secure contexts, including
non-localhost plain HTTP, so the fallback builds a UUID v4 from 16
crypto.getRandomValues() bytes. There is no weak-randomness fallback.
Returns string
A lowercase RFC 9562 UUID v4 string.
Throws
If neither crypto.randomUUID nor crypto.getRandomValues exists.
Generate a UUID v4 for a host identifier that must be unguessable.
Uses native
crypto.randomUUID()(called on itsCryptoreceiver) when the browser exposes it. Browsers omit it outside secure contexts, including non-localhost plain HTTP, so the fallback builds a UUID v4 from 16crypto.getRandomValues()bytes. There is no weak-randomness fallback.