Crypto interface represents basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives.
Properties
getRandomValues()
getRandomValues: (array) => TypedArray
The Crypto.getRandomValues() method lets you get cryptographically strong
random values. The array given as the parameter is filled with random
numbers (random in its cryptographic meaning).
Parameters
array
TypedArray
An integer-based TypedArray, that is one
of: Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array,
Int32Array, Uint32Array (but not Float16Array, Float32Array nor Float64Array).
All elements in the array will be overwritten with random numbers.
Returns
TypedArray
The same array passed as input but with its
contents replaced with the newly generated random numbers. Note that
the input array is modified in-place, and no copy is made.
Throws
InvalidArgumentError If the length is invalid.Throws
QuotaExceededError If the length exceeds the allowed maximum limit.Throws
SecurityError If the random data generation fails.randomUUID()
randomUUID: () =>string
The randomUUID() method of the Crypto interface is used to generate a
v4 UUID using a cryptographically secure random number generator.
Returns
string
A string containing a randomly generated, 36 character long v4 UUID.

