Crypto
Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives.
See
https://developer.mozilla.org/docs/Web/API/Crypto
Implements
Accessors
subtle
get
subtle(): SubtleCrypto
A SubtleCrypto
which can be
used to perform low-level cryptographic operations.
See
https://developer.mozilla.org/docs/Web/API/Crypto/subtle
Returns
Implementation of
globalThis.Crypto.subtle
Methods
getRandomValues()
getRandomValues<T
>(array
): T
Fills the provided TypedArray
with cryptographically strong random values.
Type Parameters
Type Parameter |
---|
T extends null | ArrayBufferView |
Parameters
Parameter | Type | Description |
---|---|---|
array | T | The TypedArray to fill with random values. |
Returns
T
The same TypedArray
filled with random values.
Implementation of
globalThis.Crypto.getRandomValues
Example
See
https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues
randomUUID()
randomUUID(): `${string}-${string}-${string}-${string}-${string}`
Generates a cryptographically strong random unique identifier (UUID).
Returns
`${string}-${string}-${string}-${string}-${string}`
A string representation of a UUID.
Implementation of
globalThis.Crypto.randomUUID
Example
See
https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID