getRandomBytes
Returns an ArrayBuffer containing length cryptographically secure random bytes
import { getRandomBytes } from "@roku-sdk/runtime/crypto";getRandomBytes(length: number): ArrayBufferDescription
Returns an ArrayBuffer containing length cryptographically secure random bytes.
Backed by the Roku runtime's global crypto.getRandomBytes() host function, which uses OpenSSL's RAND_bytes() (HW-backed CSPRNG via /dev/urandom).
Parameters
| Name | Type | Description |
|---|---|---|
length | number | Number of bytes to generate. Must be a non-negative integer no greater than 65536. |
Return values
An ArrayBuffer of length random bytes.
Updated about 3 hours ago
What’s Next
Did this page help you?