hyperlane-plugin-webhook 23.2.0

A production inbound HTTP webhook verification plugin for the Hyperlane framework featuring zero-allocation precomputed-midstate pure-Rust HMAC-SHA256 (Hex, Base64, and Stripe-style timestamped schemes), per-route secret rotation, timestamp skew enforcement, 64-shard bounded TTL replay-nonce caching, and verified WebhookEvent Context injection.
Documentation
/// Signature header encoding and payload-framing scheme for an inbound [`WebhookEndpoint`](crate::WebhookEndpoint).
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum WebhookScheme {
    /// Hex-encoded 32-byte HMAC-SHA256 digest with an optional prefix (for example `Some("sha256=")` for GitHub).
    Hex {
        /// Optional literal prefix stripped before decoding 64 hex characters.
        prefix: Option<String>,
    },
    /// Base64-encoded 32-byte HMAC-SHA256 digest with an optional prefix (for example Shopify or `Some("v1,")`).
    Base64 {
        /// Optional literal prefix stripped before decoding RFC 4648 base64.
        prefix: Option<String>,
    },
    /// Stripe-style `t=<unix_secs>,<version>=<hex>[,<version>=<hex>...]` header signing `b"<t>.<body>"`.
    StripeTimestamped {
        /// Signature scheme version key (typically `"v1"`).
        version: String,
    },
}

/// Specific reason an inbound webhook request was rejected by [`WebhookVerifier`](crate::WebhookVerifier).
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum WebhookRejectReason {
    /// Request body exceeded the configured `max_body_bytes` cap (`413 Payload Too Large`).
    BodyTooLarge,
    /// Required signature header was absent (`401 Unauthorized`).
    MissingSignature,
    /// Signature header could not be parsed or decoded (`401 Unauthorized`).
    MalformedSignature,
    /// Required timestamp header or `t=` parameter was absent or invalid (`401 Unauthorized`).
    MissingTimestamp,
    /// Timestamp fell outside the configured `±tolerance_secs` skew window (`401 Unauthorized`).
    TimestampOutOfRange,
    /// Constant-time HMAC-SHA256 comparison failed across all configured secrets (`401 Unauthorized`).
    InvalidSignature,
    /// Nonce/signature was already processed within `replay_ttl_secs` (`409 Conflict`).
    ReplayDetected,
}