How it works

The Crypto interface allows access to a cryptographically strong random number generator and cryptographic primitives.

Within an Azion function, the global crypto object exposes these capabilities so you can run secure operations without pulling in external libraries. Through crypto.getRandomValues() and crypto.randomUUID() you can produce unpredictable random values and identifiers, while the crypto.subtle property unlocks the full SubtleCrypto API for hashing, signing, and verifying data. Because the work happens on Azion’s distributed architecture, sensitive computations such as token validation or request signing run close to the user and never need to round-trip to a central server, reducing latency and exposure.

Instance properties

Crypto.subtle Returns a SubtleCrypto object providing access to common cryptographic primitives, like hashing, signing, encryption, or decryption.

Instance methods

Crypto.getRandomValues() Fills the passed TypedArray with cryptographically sound random values.

Crypto.randomUUID() Returns a randomly generated, 36 character-long v4 UUID.

Use cases

  • Generating secure, collision-resistant identifiers for sessions, requests, or trace IDs with randomUUID().
  • Producing cryptographically strong random values to build nonces or tokens on Azion’s global network.
  • Hashing request payloads or computing digests to verify integrity before forwarding traffic.
  • Validating signed tokens, such as JWTs, directly in the function without contacting an origin.

For more information on Crypto visit MDN Web Docs.