Zebflow Docs
crypto.signature.verify
Zebflow Docs

crypto.signature.verify

Checks an HMAC-SHA256 signature in constant time

crypto.signature.verify --text TEXT --credential TEXT [--algorithm hmac-sha256] --signature TEXT → signature

Checks an HMAC-SHA256 signature in constant time. It checks the hex --signature against the HMAC-SHA256 of --text, keyed by the secret of the hmac credential --credential, in constant time. A match answers signature: { valid: true } on the true pin, anything else { valid: false } on false; the rest of the payload is kept. An empty --text or --signature is refused.

Flags

  • --text (required): The text to sign (its UTF-8 bytes), e.g. a raw request body.
  • --credential (required): Id of the hmac credential whose secret is the key.
  • --algorithm: hmac-sha256 (default, the only one).
  • --signature (required): The signature to check, hex.

Examples

Check a webhook signature

| crypto.signature.verify --text "{{ input.body_text }}" --credential partner-hmac --signature "{{ $trigger.headers['x-signature'] }}"

Fires true or false; wire false to a 401.

It answers:

json
{  "signature": {    "valid": true  }}