Skip to main content

StatusWebhook

Trait StatusWebhook 

Source
pub trait StatusWebhook: Send + Sync {
    // Required methods
    fn kind(&self) -> &'static str;
    fn verifier(&self) -> WebhookVerifier;
    fn parse(
        &self,
        body: &[u8],
    ) -> Result<Option<StatusUpdate>, InboundStatusError>;
}
Expand description

A tracker’s inbound status webhook, implemented per vendor by adapter crates: how to verify a delivery’s signature and how to read a state change out of the verified body.

Verification is not reimplemented here: verifier returns core’s WebhookVerifier — constant-time compare, fail-closed on unreadable input and replay tolerance are inherited, never re-derived. The signature scheme a vendor signs with is expressed as one of core’s SignatureSchemes (Svix, StripeStyle, or a configured ProviderScheme); Jira Cloud, whose X-Hub-Signature: sha256=<hex> HMAC covers the raw body with no timestamp header, is ProviderScheme { signature: "X-Hub-Signature", encoding: SignatureEncoding::Hex, prefix: Some("sha256="), timestamp: None }.

Required Methods§

Source

fn kind(&self) -> &'static str

The vendor this webhook speaks for, for logs and metrics — the same name Destination::kind uses for the outbound direction.

Source

fn verifier(&self) -> WebhookVerifier

The verifier deliveries must pass before parse is ever reached. Returned per call so an adapter may hold its config without holding a verifier per tenant — the secret is a parameter of receive_status, never of the hook.

Source

fn parse(&self, body: &[u8]) -> Result<Option<StatusUpdate>, InboundStatusError>

Reads one verified body. Ok(None) for an event that carries no status change; InboundStatusError::Malformed for one that should have carried one and does not parse.

§Errors

InboundStatusError::Malformed when the verified body is not an event this vendor sends. Never InboundStatusError::Signature — that answer belongs to receive_status, before bytes are parsed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§