Skip to content

getRandomBytes

getRandomBytes(length): Uint8Array<ArrayBuffer>

Defined in: get-random-bytes.ts:24

Fills and returns a new Uint8Array of length cryptographically random bytes, via crypto.getRandomValues.

Chunks internally at MAX_BYTES_PER_CALL: the Web Crypto API spec caps a single getRandomValues call at 65,536 bytes and throws QuotaExceededError beyond it — a limit callers should not have to know about.

number

Uint8Array<ArrayBuffer>

When length is not a non-negative integer.