Ankusa.Sink.Http.Signer (ankusa v0.7.0)

Copy Markdown View Source

Standard Webhooks signatures for Ankusa.Sink.Http's :secret option, so a worker can tell a delivery from this node apart from anything else that can reach its URL.

Three headers: webhook-id (the hook id), webhook-timestamp (unix seconds at send time) and webhook-signature, a space-separated list with one v1,<base64> entry per secret — HMAC-SHA256 over "<webhook-id>.<webhook-timestamp>.<body>". Several secrets sign with each, so a receiver can rotate keys without a gap.

A secret is whsec_ + the base64 key (the Standard Webhooks form, decoded with Ankusa.Verifier.Hmac.raw_key/2), or any other non-empty string, used as its own bytes — the same rule every SDK's verify_signature applies (conformance/cases/signature.json).

Summary

Functions

The signature headers for one delivery, or :error when a secret is empty or its whsec_ base64 does not decode.

Functions

headers(id, body, secrets, now_s)

@spec headers(String.t(), iodata(), String.t() | [String.t()], integer()) ::
  {:ok, [{String.t(), String.t()}]} | :error

The signature headers for one delivery, or :error when a secret is empty or its whsec_ base64 does not decode.