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

@prudra/webhooks

v0.2.2

Published

Prudra webhooks SDK — subscribe and verify

Readme

@prudra/webhooks

Prudra webhook SDK — two things: HMAC signature verification for incoming webhooks, and a programmatic client for managing webhook subscriptions.

Installation

npm install @prudra/webhooks

1. Verifying Incoming Webhooks

The most important feature. Use verifyWebhook() to validate that incoming payloads are authentic and haven't been tampered with.

Use express.raw(), not express.json(), on the webhook route. JSON parsing before verification will break signature checking because the raw bytes must match the HMAC.

import express from 'express';
import { verifyWebhook } from '@prudra/webhooks';

const app = express();

app.post(
  '/prudra/events',
  express.raw({ type: 'application/json' }),
  (req, res) => {
    const result = verifyWebhook({
      payload:   req.body,
      signature: req.headers['x-prudra-signature'] as string,
      timestamp: req.headers['x-prudra-timestamp'] as string,
      secret:    process.env.PRUDRA_WEBHOOK_SECRET!,
    });

    if (!result.valid) {
      console.error('Webhook verification failed:', result.error);
      return res.status(401).end();
    }

    const event = result.event!;
    console.log(`Received ${event.type}:`, event.data);

    switch (event.type) {
      case 'vault.sealed':
        // Handle sealed vault
        break;
      case 'payment.received':
        // Handle payment
        break;
    }

    res.status(200).end();
  },
);

verifyWebhook() never throws. All errors return { valid: false, error: '...' }.

2. Registering Webhooks Programmatically

Requires initialise() from @prudra/core.

import { initialise } from '@prudra/core';
import { registerWebhook, listWebhooks, updateWebhook, deleteWebhook } from '@prudra/webhooks';

initialise({ apiKey: process.env.PRUDRA_API_KEY! });

// Register
const webhook = await registerWebhook({
  url: 'https://yourapp.com/prudra/events',
  events: ['vault.sealed', 'payment.received'],
});

// List all
const webhooks = await listWebhooks();

// Update
await updateWebhook(webhook.id, {
  events: ['*'], // Subscribe to all events
});

// Delete
await deleteWebhook(webhook.id);

3. Inspecting Deliveries

Debug failed webhook deliveries and replay them after fixing your endpoint.

import { listDeliveries, replayDelivery } from '@prudra/webhooks';

// List recent failures
const result = await listDeliveries(webhookId, {
  status: 'failed',
  limit: 10,
});

for (const delivery of result.data) {
  console.log(`${delivery.eventType} — ${delivery.attempts} attempts`);
}

// Replay a failed delivery
await replayDelivery(webhookId, deliveryId);

4. Available Event Types

| Event | Description | |-------|-------------| | vault.created | A new vault was created | | vault.file.added | A file was uploaded to a vault | | vault.document.added | A document was added to a vault | | vault.event | A custom event was emitted via vault.emit() | | vault.sealed | A vault was sealed (read-only) | | vault.expiring | A vault is approaching its TTL expiry | | vault.expired | A vault has expired | | payment.received | A payment was verified and recorded |

Use ['*'] when registering to subscribe to all event types.

Documentation

Full documentation: docs.prudra.dev/docs/webhooks