Skip to content

Webhooks

Send us an HTTPS endpoint and we POST to it the first time a session crosses each threshold. You get a signing secret; verify every request before trusting it. Delivery is best effort with a 5 s timeout and no retries during the alpha: the risk endpoint stays the source of truth.

Request we send
POST https://your-app.example.com/hooks/behavlabs
Content-Type: application/json
X-BehavLabs-Signature: sha256=5f1c...   (HMAC-SHA256 of the raw body with your webhook secret)

{ "type": "session.takeover_alarm", "operating_point": "sensitive",
  "risk": { ...the risk object, with device and network... } }

Verify the signature

Compute the HMAC over the raw request body, before any JSON parsing, and compare in constant time.

import hmac, hashlib

def valid(raw_body: bytes, header: str, secret: str) -> bool:
    expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, header)
import crypto from "node:crypto";

export function valid(rawBody, header, secret) {
  const expected = "sha256=" + crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
  return header.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(header), Buffer.from(expected));
}