armature-webhooks

Crates.ioarmature-webhooks
lib.rsarmature-webhooks
version0.1.1
created_at2025-12-27 02:34:05.967517+00
updated_at2025-12-29 01:36:06.546292+00
descriptionWebhook sending and receiving for Armature
homepagehttps://pegasusheavy.github.io/armature
repositoryhttps://github.com/pegasusheavy/armature
max_upload_size
id2006595
size138,525
Joseph R. Quinn (quinnjr)

documentation

README

armature-webhooks

Webhook handling for the Armature framework.

Features

  • Signature Verification - Validate webhook signatures
  • Retry Support - Automatic delivery retries
  • Event Registry - Type-safe event handling
  • Idempotency - Prevent duplicate processing
  • Provider Support - Stripe, GitHub, Slack, etc.

Installation

[dependencies]
armature-webhooks = "0.1"

Quick Start

use armature_webhooks::{WebhookHandler, WebhookConfig};

let handler = WebhookHandler::new(WebhookConfig {
    secret: "your-webhook-secret",
    signature_header: "X-Signature",
});

let app = Application::new()
    .post("/webhooks", move |req| {
        let handler = handler.clone();
        async move {
            handler.handle(req, |event| async move {
                match event.event_type.as_str() {
                    "order.created" => process_order(event.data).await,
                    _ => Ok(()),
                }
            }).await
        }
    });

Provider-Specific Handlers

Stripe

let stripe = StripeWebhook::new("whsec_...");
stripe.handle(req, |event| async move {
    match event {
        StripeEvent::PaymentSucceeded(payment) => { ... }
        StripeEvent::CustomerCreated(customer) => { ... }
        _ => Ok(()),
    }
}).await

GitHub

let github = GitHubWebhook::new("secret");
github.handle(req, |event| async move {
    match event {
        GitHubEvent::Push(push) => { ... }
        GitHubEvent::PullRequest(pr) => { ... }
        _ => Ok(()),
    }
}).await

License

MIT OR Apache-2.0

Commit count: 0

cargo fmt