npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zanii/webhooks

v0.1.0

Published

Zanii webhook receiver: verify the X-Zanii-Signature (HMAC-SHA256) and dispatch typed events. The safe, boilerplate-free way to react to agent activity.

Readme

@zanii/webhooks

Verify and dispatch Zanii webhook deliveries — the safe, boilerplate-free way to react to your agents' activity. Zanii POSTs a signed JSON event for each receipt.recorded (an agent acted) and receipt.rejected (out-of-scope, revoked, or invalid). This package verifies the X-Zanii-Signature header (HMAC-SHA256 of the raw body, timing-safe) and routes the typed event to your handlers, so an unverified delivery never reaches your code.

Zero dependencies (Node's built-in crypto). Node 18+.

npm install @zanii/webhooks

Use it

Give the receiver the raw request body (exactly the bytes Zanii signed — don't re-serialize) and the signature header.

Express:

import express from 'express';
import { createWebhookReceiver } from '@zanii/webhooks';

const receive = createWebhookReceiver({
  secret: process.env.ZANII_WEBHOOK_SECRET!,   // the whsec_… shown once at registration
  on: {
    'receipt.recorded': (e) => save(e.data),
    'receipt.rejected': (e) => alertTeam(e.data),
  },
});

const app = express();
app.post('/zanii', express.raw({ type: 'application/json' }), async (req, res) => {
  const { status } = await receive(req.body, req.header('x-zanii-signature'));
  res.status(status).end();                     // 401 bad sig · 400 bad body · 500 handler error · 200 ok
});

Next.js (App Router):

import { createWebhookReceiver } from '@zanii/webhooks';
const receive = createWebhookReceiver({ secret: process.env.ZANII_WEBHOOK_SECRET!, on: { /* … */ } });

export async function POST(req: Request) {
  const raw = await req.text();                 // raw body — required for the signature
  const { status } = await receive(raw, req.headers.get('x-zanii-signature'));
  return new Response(null, { status });
}

API

  • createWebhookReceiver({ secret, on?, onAny? })(rawBody, signature) => Promise<{ ok, status, event, error }>
  • verifySignature(rawBody, signature, secret)boolean (constant-time)
  • sign(rawBody, secret)'sha256=<hex>' (for tests / symmetry)
  • Events: receipt.recorded, receipt.rejected. ZaniiEvent = { event, ts, data:{ hash, index, agent_id, action, target, ts, error } }.

The receiver never dispatches on a bad signature. Always send back the returned status. Get your whsec_… secret from POST /v1/account/webhooks (see the Zanii docs).

Changelog

  • 0.1.0 — initial release: verifySignature, sign, createWebhookReceiver.

License

Apache-2.0.