pub trait WebhookPlugin: Send + Sync {
// Required methods
fn provider(&self) -> &str;
fn scheme(&self) -> WebhookSchemeKind;
fn verify(&self, req: &WebhookRequest) -> Result<(), WebhookError>;
// Provided method
fn is_healthy(&self) -> bool { ... }
}Expand description
A plugin that verifies webhook requests from one third-party provider.
All methods are synchronous and return Result values to match
the rest of bext-plugin-api (WASM guests cannot express async
traits today). Verifiers that need network I/O bridge with a
block_on the same way SesMailerPlugin does.
Host functions webhook.verify call through to the currently
registered implementation keyed on provider().
Required Methods§
Sourcefn provider(&self) -> &str
fn provider(&self) -> &str
Vendor name used for plugin registration, e.g. "stripe",
"github", "shopify", "slack", "twilio". Lower-case,
no whitespace.
Sourcefn scheme(&self) -> WebhookSchemeKind
fn scheme(&self) -> WebhookSchemeKind
Which signature scheme this plugin implements. Surfaced in admin UI; verifiers that compose two schemes pick the dominant one.
Sourcefn verify(&self, req: &WebhookRequest) -> Result<(), WebhookError>
fn verify(&self, req: &WebhookRequest) -> Result<(), WebhookError>
Verify that req really came from the configured third
party. Returns Ok(()) on success; the caller then proceeds
to its own handler. Middleware MUST treat any Err as a
hard stop and use WebhookError::http_status (or its own
override) to build the response.
Provided Methods§
Sourcefn is_healthy(&self) -> bool
fn is_healthy(&self) -> bool
Optional health check. Default: always healthy. Plugins that cache signing secrets from an external secret store override this to probe the cache.