For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/manifest/functions/cryptography/hmac_sha256.md.

hmac_sha256

Computes an HMAC-SHA256 signature for a payload using a shared secret key. Returns a lowercase hexadecimal string.

Signature

hmac_sha256(key: string, message: string) -> string

Parameters

ParameterTypeRequiredDescription
key, messagestring, stringyesShared key and message

Return value

Returns the documented result for the function signature.

Example

respond {
  condition = ctx.request.headers.x_hub_signature != hmac_sha256(env("WEBHOOK_SECRET"), json_encode(ctx.request.body))
  status = 401
  body = { error = "Invalid webhook signature" }
}