Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
The 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.

Throws

SecurityError If the random values generation fails due to a security issue.

Throws

InternalNativeOperationError If an internal error occurs during the generation process.

See

RFC 4122 for the UUID specification.
Last modified on October 2, 2025