Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

zerohash-webhooks

FreeRuns bundled scriptsNot checked

Receive and verify zerohash (Zero Hash) webhooks. Use when setting up zerohash webhook handlers, debugging x-zh-hook-rsa-signature or x-zh-hook-signature…

hookdeckby hookdeck★ 104 GitHub stars

About this skill

zerohash Webhooks

When to Use This Skill

  • How do I receive zerohash webhooks?
  • How do I verify zerohash webhook signatures (x-zh-hook-rsa-signature or x-zh-hook-signature)?
  • How do I handle trade.status_changed and payment_status_changed?
  • Why is my zerohash webhook signature verification failing?
  • How do I guard zerohash webhooks against replay with x-zh-hook-timestamp?

Verification (core)

zerohash sets one security method per platform:

Method Headers on each webhook
RSA (the default, and zerohash's recommendation) x-zh-hook-rsa-signature, x-zh-hook-timestamp (plus legacy x-zh-hook-rsa-signature-256)
Shared Secret (HMAC, on request) x-zh-hook-signature, x-zh-hook-timestamp (plus legacy x-zh-hook-signature-256)
OAuth 2.0 Client Credentials Authorization: Bearer <token> only, no payload signature
OAuth 2.0 Client Credentials with RSA the bearer token plus the RSA headers

Both signing methods sign the raw request body with the x-zh-hook-timestamp value appended (no delimiter), and send a hex signature. The timestamp is UNIX time in milliseconds; zerohash suggests rejecting anything outside ±5 minutes. There is no webhook SDK.

const crypto = require('crypto');

function verifyZeroHash(rawBody, headers, { rsaPublicKey, secret }) {
  const timestamp = headers['x-zh-hook-timestamp'];
  if (!timestamp || !/^\d+$/.test(timestamp)) return false;
  if (Math.abs(Date.now() - Number(timestamp)) > 5 * 60 * 1000) return false; // milliseconds

  const signed = Buffer.concat([rawBody, Buffer.from(timestamp, 'utf8')]); // payload + timestamp

  const rsaSig = headers['x-zh-hook-rsa-signature'];
  if (rsaSig && rsaPublicKey) {
    // RSA-PSS with SHA-256 and MGF1-SHA256, as in zerohash's signature recipe.
    return crypto.verify('sha256', signed, {
      key: rsaPublicKey,
      padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
      saltLength: crypto.constants.RSA_PSS_SALTLEN_AUTO,
    }, Buffer.from(rsaSig, 'hex'));
  }

  const hmacSig = headers['x-zh-hook-signature'];
  if (hmacSig && secret) {
    const expected = crypto.createHmac('sha256', secret).update(signed).digest('hex');
    try {
      return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(hmacSig));
    } catch {
      return false; // length mismatch => invalid
    }
  }
  return false;
}

Legacy headers: x-zh-hook-signature-256 and x-zh-hook-rsa-signature-256 sign the payload alone, with no timestamp. zerohash sends them alongside the new headers during a grace period and will phase them out, so verify the new headers. See references/verification.md.

For complete handlers with route wiring, event dispatch, and tests, see:

Common Payload Types

The payload type is in the x-zh-hook-payload-type header, not the body.

x-zh-hook-payload-type Sent when
participant_status_changed A participant is submitted, approved, rejected, locked, disabled, divested or closed
payment_status_changed A fiat or blockchain payment changes status
trade.status_changed A trade is accepted, active or terminated (settled)
account_balance.changed An available or collateral balance changes
deposit.status_changed / withdrawal.status_changed A deposit or withdrawal changes status

Names mix underscores and dots, so copy them exactly. There is no trade_status_changed. The asset price alert is spelled asset_mover_updated on its own page and asset_mover_update in the overview, so accept both. See references/overview.md for the full list.

Important Headers

Header Description
x-zh-hook-notification-id Notification ID for idempotency checks; the same on every copy when you have several endpoints
x-zh-hook-payload-type Payload type, e.g. trade.status_changed
x-zh-hook-timestamp UNIX milliseconds, signed with the body
x-zh-hook-rsa-signature Hex RSA-PSS of payload + timestamp (RSA method)
x-zh-hook-signature Hex HMAC-SHA256 of payload + timestamp (Shared Secret method)
x-zh-hook-rsa-signature-256 / x-zh-hook-signature-256 Legacy, payload only

Environment Variables

# RSA method (default): the PEM zh-public-key, one per environment
ZEROHASH_RSA_PUBLIC_KEY="-----BEGIN RSA PUBLIC KEY-----..."
# Shared Secret method
ZEROHASH_WEBHOOK_SECRET=your_zerohash_shared_secret

Webhooks aren't self-service: you give your zerohash representative a URL for CERT and PROD and the payload types you want, and zerohash configures them. See references/setup.md.

Local Development

# Start tunnel (no account needed)
npx
Full SKILL.md on GitHub

Install zerohash-webhooks in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

examples/express/.env.exampleexamples/express/README.mdexamples/express/package.jsonexamples/express/src/index.jsexamples/fastapi/.env.exampleexamples/fastapi/README.mdexamples/fastapi/main.pyexamples/fastapi/requirements.txtexamples/fastapi/test_webhook.pyexamples/nextjs/.env.exampleexamples/nextjs/README.mdexamples/nextjs/app/webhooks/zerohash/route.tsexamples/nextjs/package.jsonexamples/nextjs/vitest.config.tsreferences/overview.mdreferences/setup.mdreferences/verification.md

FAQ

What does the zerohash-webhooks skill do?

Receive and verify zerohash (Zero Hash) webhooks. Use when setting up zerohash webhook handlers, debugging x-zh-hook-rsa-signature or x-zh-hook-signature verification, or handling payload types like trade.status_changed, payment_status_changed and participant_status_changed.

How do I install the zerohash-webhooks skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the zerohash-webhooks skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare zerohash-webhooks with