Skip to main content

Module webhooks

Module webhooks 

Source
Expand description

Webhooks, as the PHP package sends them: endpoints subscribe to event types (with patterns such as order.*) and are pinned to a version, events are recorded as one delivery per subscribed endpoint, and a queued job posts each delivery, signed with the endpoint’s secret, in the endpoint’s version. Failed deliveries are retried after the configured delays, and an endpoint whose deliveries fail too many times in a row is disabled.

Receivers check Webhook-Signature with Signer::verify; it is t=<unix time>,v1=<hex>, where the hex is an HMAC-SHA256 of <unix time>.<body> with the endpoint’s secret.

An endpoint’s URL may come from a user, so a delivery is only sent to an address on the public internet (is_public) and redirects are not followed, unless Config::webhook_private_addresses allows it.

Structs§

Signer
Signs and checks webhook bodies.

Functions§

is_public
Whether an IP address is on the public internet: globally reachable, as RFC 6890 lists them, which leaves out loopback, private networks and link-local addresses such as a cloud metadata service’s. A NAT64 address counts as the IPv4 address it carries, which is where it connects. The same addresses as the PHP package’s PublicAddressHandler::isPublic.