data tier

data-webhooks

Webhooks for Rust applications

Webhooks for Rust applications

Tierdata
Roleunclassified (baselined)
Pathcrates/data/webhooks
Edition2021
Targetsdata_webhooks
Public items51 across 0 modules
Tests37

What it is for

Webhook library crates for Rust applications.

Provides inbound and outbound webhook handling with signature verification and retry logic.

Capabilities

DeliveryStatus

Webhook library crates for Rust applications.

Item
pub enum DeliveryStatus
DeliveryStatus :: fn is_terminal(& self) -> bool

EventType

Webhook library crates for Rust applications.

Item
pub struct EventType
EventType :: fn new(name : impl Into <String>) -> Self
EventType :: fn wildcard() -> Self
EventType :: fn matches(& self, other : & EventType) -> bool
EventType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

InboundWebhook

Webhook library crates for Rust applications.

Item
pub struct InboundWebhook
InboundWebhook :: fn new(source : impl Into <String>, path : impl Into <String>) -> Self
InboundWebhook :: fn with_secret(mut self, secret : impl Into <String>) -> Self
InboundWebhook :: fn with_metadata(mut self, key : impl Into <String>, value : impl Into <String>) -> Self

Result

Webhook library crates for Rust applications.

Item
pub type Result<T>: std::result::Result <T, WebhookError>

SignatureAlgorithm

Webhook library crates for Rust applications.

Item
pub enum SignatureAlgorithm
SignatureAlgorithm :: fn header_name(& self) -> & 'static str

WebhookConfig

Webhook library crates for Rust applications.

Item
pub struct WebhookConfig
WebhookConfig :: fn default() -> Self

WebhookDelivery

Webhook library crates for Rust applications.

Item
pub struct WebhookDelivery
WebhookDelivery :: fn new(endpoint_id : Uuid, event : WebhookEvent) -> Self
WebhookDelivery :: fn with_max_attempts(mut self, max : u32) -> Self
WebhookDelivery :: fn mark_delivered(& mut self, status : u16, body : Option <String>)
WebhookDelivery :: fn mark_failed(& mut self, error : impl Into <String>, status : Option <u16>)
WebhookDelivery :: fn should_retry(& self) -> bool
WebhookDelivery :: fn retries_exhausted(& self) -> bool

WebhookDirection

Webhook library crates for Rust applications.

Item
pub enum WebhookDirection

WebhookEndpoint

Webhook library crates for Rust applications.

Item
pub struct WebhookEndpoint
WebhookEndpoint :: fn new(url : impl Into <String>, secret : impl Into <String>) -> Self
WebhookEndpoint :: fn with_events(mut self, events : Vec <EventType>) -> Self
WebhookEndpoint :: fn with_event(mut self, event : EventType) -> Self
WebhookEndpoint :: fn with_description(mut self, description : impl Into <String>) -> Self
WebhookEndpoint :: fn with_metadata(mut self, key : impl Into <String>, value : impl Into <String>) -> Self
WebhookEndpoint :: fn set_enabled(& mut self, enabled : bool)
WebhookEndpoint :: fn should_receive(& self, event_type : & EventType) -> bool
WebhookEndpoint :: fn rotate_secret(& mut self, new_secret : impl Into <String>)

WebhookError

Webhook library crates for Rust applications.

Item
pub enum WebhookError

WebhookEvent

Webhook library crates for Rust applications.

Item
pub struct WebhookEvent
WebhookEvent :: fn new <T : Serialize>(event_type : impl Into <String>, payload : & T) -> Result <Self>
WebhookEvent :: fn from_value(event_type : impl Into <String>, payload : serde_json::Value) -> Self

WebhookHandler

Webhook library crates for Rust applications.

Item
pub trait WebhookHandler

WebhookLog

Webhook library crates for Rust applications.

Item
pub struct WebhookLog
WebhookLog :: fn outbound(webhook_id : Uuid, event_type : EventType, url : impl Into <String>, body : impl Into <String>,) -> Self
WebhookLog :: fn inbound(webhook_id : Uuid, event_type : EventType, url : impl Into <String>, body : impl Into <String>,) -> Self
WebhookLog :: fn record_success(mut self, status : u16, headers : HashMap <String, String>, body : String, duration_ms : u64,) -> Self
WebhookLog :: fn record_failure(mut self, error : impl Into <String>, duration_ms : Option <u64>) -> Self
WebhookLog :: fn with_request_headers(mut self, headers : HashMap <String, String>) -> Self

WebhookSignature

Webhook library crates for Rust applications.

Item
pub struct WebhookSignature
WebhookSignature :: fn new(timestamp : i64, signature : impl Into <String>, algorithm : SignatureAlgorithm,) -> Self
WebhookSignature :: fn from_header(header : & str) -> Option <Self>
WebhookSignature :: fn sign(secret : & u8, timestamp : i64, body : & u8, algorithm : SignatureAlgorithm) -> Self
WebhookSignature :: fn verify(& self, secret : & u8, body : & u8, tolerance_seconds : i64) -> Result <()>
WebhookSignature :: fn is_expired(& self, tolerance_seconds : i64) -> bool
WebhookSignature :: fn to_header(& self) -> String

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
pub enum WebhookErrorWebhook errors.
pub type Result<T>: std::result::Result <T, WebhookError>Result type for webhook operations.
pub struct EventTypeWebhook event types.
EventType :: fn new(name : impl Into <String>) -> SelfCreate a new event type.
EventType :: fn wildcard() -> SelfCreate a wildcard event type that matches all events.
EventType :: fn matches(& self, other : & EventType) -> boolCheck if this event type matches another.
EventType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub enum DeliveryStatusWebhook delivery status.
DeliveryStatus :: fn is_terminal(& self) -> boolCheck if this is a terminal status.
pub struct WebhookEndpointWebhook endpoint configuration.
WebhookEndpoint :: fn new(url : impl Into <String>, secret : impl Into <String>) -> SelfCreate a new webhook endpoint.
WebhookEndpoint :: fn with_events(mut self, events : Vec <EventType>) -> SelfSubscribe to specific events.
WebhookEndpoint :: fn with_event(mut self, event : EventType) -> SelfAdd a single event subscription.
WebhookEndpoint :: fn with_description(mut self, description : impl Into <String>) -> SelfSet description.
WebhookEndpoint :: fn with_metadata(mut self, key : impl Into <String>, value : impl Into <String>) -> SelfAdd metadata.
WebhookEndpoint :: fn set_enabled(& mut self, enabled : bool)Enable or disable the endpoint.
WebhookEndpoint :: fn should_receive(& self, event_type : & EventType) -> boolCheck if the endpoint should receive an event.
WebhookEndpoint :: fn rotate_secret(& mut self, new_secret : impl Into <String>)Update the secret.
pub struct WebhookEventWebhook event payload.
WebhookEvent :: fn new <T : Serialize>(event_type : impl Into <String>, payload : & T) -> Result <Self>Create a new webhook event.
WebhookEvent :: fn from_value(event_type : impl Into <String>, payload : serde_json::Value) -> SelfCreate from a JSON value directly.
pub struct WebhookDeliveryWebhook delivery attempt.
WebhookDelivery :: fn new(endpoint_id : Uuid, event : WebhookEvent) -> SelfCreate a new delivery.
WebhookDelivery :: fn with_max_attempts(mut self, max : u32) -> SelfSet maximum attempts.
WebhookDelivery :: fn mark_delivered(& mut self, status : u16, body : Option <String>)Record a successful delivery.
WebhookDelivery :: fn mark_failed(& mut self, error : impl Into <String>, status : Option <u16>)Record a failed delivery attempt.
WebhookDelivery :: fn should_retry(& self) -> boolCheck if the delivery should be retried.
WebhookDelivery :: fn retries_exhausted(& self) -> boolCheck if all retries are exhausted.
pub enum SignatureAlgorithmSignature algorithm for webhook verification.
SignatureAlgorithm :: fn header_name(& self) -> & 'static strGet the header name for this algorithm.
pub struct WebhookSignatureWebhook signature for verification.
WebhookSignature :: fn new(timestamp : i64, signature : impl Into <String>, algorithm : SignatureAlgorithm,) -> SelfCreate a new signature.
WebhookSignature :: fn from_header(header : & str) -> Option <Self>Parse a signature from a header value.
WebhookSignature :: fn sign(secret : & u8, timestamp : i64, body : & u8, algorithm : SignatureAlgorithm) -> SelfCompute an HMAC signature over the raw body bytes, scoped to timestamp
WebhookSignature :: fn verify(& self, secret : & u8, body : & u8, tolerance_seconds : i64) -> Result <()>Verify this signature against secret and the raw inbound body bytes
WebhookSignature :: fn is_expired(& self, tolerance_seconds : i64) -> boolCheck if the signature has expired.
WebhookSignature :: fn to_header(& self) -> StringFormat as a header value.
pub struct WebhookConfigConfiguration for webhook delivery.
WebhookConfig :: fn default() -> Self
pub trait WebhookHandlerTrait for webhook handlers.
pub struct InboundWebhookInbound webhook for receiving webhooks from external services.
InboundWebhook :: fn new(source : impl Into <String>, path : impl Into <String>) -> SelfCreate a new inbound webhook.
InboundWebhook :: fn with_secret(mut self, secret : impl Into <String>) -> SelfSet the secret for signature verification.
InboundWebhook :: fn with_metadata(mut self, key : impl Into <String>, value : impl Into <String>) -> SelfAdd metadata.
pub struct WebhookLogWebhook delivery log entry.
pub enum WebhookDirectionDirection of webhook (inbound or outbound).
WebhookLog :: fn outbound(webhook_id : Uuid, event_type : EventType, url : impl Into <String>, body : impl Into <String>,) -> SelfCreate a new outbound webhook log.
WebhookLog :: fn inbound(webhook_id : Uuid, event_type : EventType, url : impl Into <String>, body : impl Into <String>,) -> SelfCreate a new inbound webhook log.
WebhookLog :: fn record_success(mut self, status : u16, headers : HashMap <String, String>, body : String, duration_ms : u64,) -> SelfRecord a successful response.
WebhookLog :: fn record_failure(mut self, error : impl Into <String>, duration_ms : Option <u64>) -> SelfRecord a failed response.
WebhookLog :: fn with_request_headers(mut self, headers : HashMap <String, String>) -> SelfAdd request headers.

No pub use re-exports: every item above is declared in this crate.

Boundary

Depends on no other workspace tier.

Shares tier data with 2 other crates: data-export, data-import.

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)data
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/data/webhooks
Vocabulary in force (lexicon)current

Dependencies

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
async-trait^0.1noalways
chrono^0.4serdenoalways
hex^0.4noalways
hmac^0.12noalways
serde^1derivenoalways
serde_json^1noalways
sha2^0.10noalways
subtle^2noalways
thiserror^2noalways
uuid^1v4, v7, serde, jsnoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tokio^1fullnoalways

Build. None.

Depended on by. 1 workspace crate.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_webhooks["application-webhooks"] -->|uses| SELF
  SELF["data-webhooks"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
libdata_webhooks`src/lib.rs`

Error model

Error typeNamed by
WebhookErrorResult

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

1 workspace crate depends on this one: application-webhooks.

Verification

KindCount
Unit tests37
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root1401

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc4951
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 49
    "No rustdoc detected" : 2

Metrics

MetricValue
Rust source files1
Source lines1043
Code lines823
Public API items51
Public modules0
Tests37
Examples0
Cargo features0
Direct runtime dependencies10
Workspace reverse dependencies1
pie showData
    title Public API by kind
    "enum" : 4
    "method" : 37
    "struct" : 8
    "trait" : 1
    "type alias" : 1
pie showData
    title Rust source composition
    "Code" : 823
    "Blank or comment" : 220

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

All data · Manual