How do I check that a call to my web address came from Bluerithm?

When a notification rule posts to a web address, it signs the call with your account's key. The tool that receives it can check the signature to be sure the call came from Bluerithm and wasn't changed on the way.

Get your account's key

Account Admins: open Home, then the Account tab. Under Web address signing key, click the eye (1) to show the key or the copy button (2) to copy it, and paste it into the other tool's signature check. Keep it private.

The Web address signing key card on the Account tab, with the key hidden

If the key may have been seen by someone it shouldn't have, click Regenerate the key (3). Calls signed with the old key then fail their checks, so paste the new key into every tool that checks them.

What each call carries

Each call is an HTTPS POST of a JSON body with two headers:

  • X-Bluerithm-Signature: t=<time>,v1=<signature> : t  is when it was sent (seconds since 1970, UTC) and v1  is the HMAC-SHA256 of <t>.<body>  under your key, in hexadecimal.
  • X-Bluerithm-Delivery : the call's id, also the body's id . A call that's tried again keeps its id.

The body has event  (workflow.rule.fired , or workflow.rule.test  for Send test), text  (one sentence saying what happened), rule , project , trigger , itemCount , up to 50 items  (each with its type, id, label and a link), and firedAt .

Check a call

  1. Join the t  value, a dot and the body exactly as received (before any JSON parsing), and compute its HMAC-SHA256 with your key.
  2. Compare the result with v1  using a constant-time comparison.
  3. Reject the call if t  is more than a few minutes old, so a copied call can't be replayed later.
  4. If you act on each call, skip an id you've already handled: a call that's tried again is the same event.

For example, in Node.js:

const crypto = require('crypto');
// header: the X-Bluerithm-Signature value; body: the raw request body; key: your account's key
const { t, v1 } = Object.fromEntries(header.split(',').map(p => p.split('=')));
const expected = crypto.createHmac('sha256', key).update(`${t}.${body}`).digest('hex');
const genuine = expected.length === v1.length
  && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1))
  && Math.abs(Date.now() / 1000 - Number(t)) < 300;

Good to know

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us