Repository navigation
ash_hooks 3.0.0
Inbound verification becomes generic: describe any sender's signature scheme in
configuration, or write one callback with public primitives. The package no
longer ships vendor-specific verifiers. Two breaking changes, listed below with
their replacements; UPGRADING.md gives the configuration for
each removed module. No schema or dependency changes.
Breaking
- Removed the vendor verifier modules
AshHooks.Provider.ComplyCube(and
ComplyCube.Event),AshHooks.Provider.HubSpotV3(andHubSpotV3.Eventand
decode_request_uri/1),AshHooks.Provider.Twilio,AshHooks.Provider.Stripe,
AshHooks.Provider.Shopify,AshHooks.Provider.WooCommerce,
AshHooks.Provider.Shippo,AshHooks.Provider.EasyPost,
AshHooks.Provider.Magento2,AshHooks.Provider.BigCommerce,
AshHooks.Provider.Ecwid,AshHooks.Provider.Squarespace, and
AshHooks.Provider.Wix. Replacement: a provider module in your application,
usuallyuse AshHooks.Provider, verify: [...]with the options UPGRADING lists
for each one. - Removed the name-to-module convention. An inbound declaration without
providerno longer resolvesAshHooks.Provider.<CamelizedName>; it fails to
compile with a message naming the fix. Replacement: setprovideron every
inbound declaration, keeping the inbound name unchanged so existing
deduplication identities still match.
Added
use AshHooks.Provider, verify: [...]generates a provider from configuration:
HMAC with SHA-1, SHA-256, SHA-384 or SHA-512; RSA PKCS#1 v1.5 and RSA-PSS with
SHA-256, SHA-384 or SHA-512; ECDSA P-256 and P-384 with DER or rawr || s
signatures; Ed25519; and compact JWS bodies with the algorithm pinned by the
host. Signatures come from a named header (optionally prefixed), a structured
header of key/value pairs carrying up to 16 signatures, or the body. Hex,
base64 and base64url encodings; raw, hex or base64 secrets with an optional
prefix; PEM public keys, X.509 certificates or raw Ed25519 keys; a signed input
built from the body, timestamp, method, URL, path, headers and literals, or by a
host function; timestamps in seconds or milliseconds from a header, a signature
field or a host function, with a symmetric tolerance. Options are checked at
compile time and every generated callback can be overridden.AshHooks.Provider.Schemedocuments those options.new!/1validates them,
verify/4verifies with them directly, andpayload_identity/1,
decode_payload/2,timestamp_header/1andsignature_source/1back the
generated callbacks.- A provider configured with
signature: :jws_bodyalso getsdecode_payload/1,
which stores the verified JWS payload, andevent_identity/1, which
deduplicates on the SHA-256 of that payload as canonical JSON
(AshHooks.Provider.Scheme.payload_identity/1) instead of the raw-body digest.
Two encodings of the same signed content share one ledger row. AshHooks.Provider.Signature.jws/3and:jws_bodyaccept only unpadded
base64url segments, as RFC 7515 requires. A token that contains=fails with
:invalid_signature.AshHooks.Provider.Signatureis public:hmac/4,rsa/4,ecdsa/4,
ed25519/4,jws/3,compare/2,header/2andcheck_timestamp/3, for
providers that implementverify_signature/3themselves.- The optional
signature_source/0callback accepts:request, for providers
that read their own signature from the request headers; ingress then needs no
ctx.signature. AshHooks.Ingress.ingest/4accepts the request headers as an ordered list of
{name, value}pairs, such asconn.req_headers, as well as a map. Providers
receive every line in arrival order in the newctx.header_list, and repeated
lines are joined with", "inctx.headers. A map the host passes is
delivered unchanged, as before.AshHooks.Provider.Hmacaccepts:sha384and:sha512algorithms.- A "Verify any sender" guide with recipes for common signature shapes.
Changed
AshHooks.Ingress.ingest/4fails verification whenheadersis neither a map
nor a list of binary{name, value}pairs. A list reaches providers as a map in
ctx.headersand in full inctx.header_list.
See UPGRADING.md for the replacement configuration of each removed module, and the Verify any sender guide.