sdxc-webhooks

Signs and verifies Standard Webhooks deliveries using HMAC-SHA256 with typed failure results.

5|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-webhooks-sergiodxa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sdxc-webhooks
Source: https://github.com/sergiodxa/monorepo/tree/main/.agents/skills/sdxc-webhooks
Command: npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-webhooks-sergiodxa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @sdxc/result, @sdxc/crypto, @sdxc/duration.

What problem does it solve? Authenticating inbound webhook requests is easy to get wrong: signatures must be compared in constant time, timestamps bounded, replays rejected, and secrets rotated without downtime. This Skill documents how to use the @sdxc/webhooks package to verify inbound deliveries and sign outbound ones, with every failure returned as a typed value instead of a thrown exception. ## Core Features & Use Cases - Inbound Verification: verify() reads the three Standard Webhooks headers, bounds the timestamp, compares the HMAC-SHA256 signature in constant time, optionally checks a KV-backed replay store, and parses the payload only after authentication succeeds. - Outbound Signing: sign() produces the signature headers and the exact body text the signature covers, reusing one delivery id across retries. - Secret Rotation & Replay Protection: options.secrets accepts multiple secrets for zero-downtime rotation, and KVReplayStore rejects duplicate delivery ids through a Workers KV binding. - Use Case: An endpoint receives deliveries from a provider using Standard Webhooks; verify the request first, return 401 on authentication failures, answer 200 on DuplicateDeliveryError to stop retries, and branch on typed errors instead of catching exceptions. ## Quick Start Ask the agent to verify an inbound Standard Webhooks request with @sdxc/webhooks using the WEBHOOK_SECRET environment variable and return 401 on any verification failure.

Frequently Asked Questions about sdxc-webhooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify a Standard Webhooks request in a fetch handler?▼

Call Webhooks.verify(request, { secret }) from @sdxc/webhooks before anything else reads the request body. It checks the three signature headers, bounds the timestamp, compares the HMAC-SHA256 signature in constant time, and returns a Result you branch on with isFailure.

How do I sign an outbound webhook delivery?▼

Call Webhooks.sign(event, { secret, id, timestamp }) to get the signature headers and the exact body text the signature covers. Send signed.body verbatim, add your own Content-Type header, and reuse the same delivery id across retries.

Does @sdxc/webhooks support secret rotation without downtime?▼

Yes, options.secrets accepts multiple secrets so a receiver can verify deliveries signed with either the old or new secret during rotation. Every configured secret must decode successfully or the call fails, so unusable entries are never silently skipped.

Can I use @sdxc/webhooks outside Cloudflare Workers?▼

Yes, it runs on any fetch runtime and has no vendor SDK dependency. Only the KVReplayStore replay-protection feature additionally requires a Workers KV binding.

Why does webhook verification fail with UnreadableBodyError?▼

A request body stream can be read only once, so if something upstream consumes it before verify() runs, verification fails with UnreadableBodyError. Always verify before any other code reads the request; the verified text is returned as body for later use.

What are the limitations of KV-based webhook replay protection?▼

KV reads are eventually consistent, so KVReplayStore narrows the replay window rather than closing it completely. An idempotent handler is still required to make repeated deliveries harmless.