Skip to main content
The crypto module provides cryptographic helpers built on Node’s crypto, with no external dependencies. Typical uses: OAuth PKCE, webhook signature verification (HMAC), and content fingerprints.

sha256 / sha512 / md5

Compute a cryptographic digest of a string.
Returns the digest as a string. sha512 and md5 take the same parameters (md5 for legacy/etag use only).

hmac

Compute a keyed HMAC signature — used to sign or verify webhooks.
Returns the signature as a string.

base64Encode / base64Decode

Encode or decode base64, with an optional URL-safe variant.
base64Encode returns the encoded string; base64Decode returns the decoded UTF-8 string.

randomBytes

Generate cryptographically-secure random bytes — e.g. a PKCE code_verifier or a token.
Returns the random value as a string.

randomUUID

Generate a canonical random UUID v4 (with dashes).
Takes no parameters. For a dash-free UUID inline in an expression, the uuid() helper is also available.

OAuth PKCE example

The two crypto primitives PKCE needs, end to end: