Packages

An Elixir framework for building LLM agent systems with skills, tools, and subagent delegation.

Current section

Files

Jump to
skill_kit lib skill_kit webhook verifier stripe.ex
Raw

lib/skill_kit/webhook/verifier/stripe.ex

defmodule SkillKit.Webhook.Verifier.Stripe do
@moduledoc """
Stripe webhook signature verifier.
Delegates to `SkillKit.Webhook.Verifier.Hmac` with Stripe's well-known
scheme baked in: HMAC-SHA256 over `"<timestamp>.<body>"`, with both the
timestamp and the signature pulled from the `Stripe-Signature` header.
## Registration config (passed through)
- `secret_key` (required) — the key name resolved via `CredentialProvider`.
- `max_skew` (optional) — timestamp tolerance in seconds. Default 300.
"""
@behaviour SkillKit.Webhook.Verifier
alias SkillKit.Webhook.Verifier.Hmac
@defaults %{
algorithm: :sha256,
signing_template: "$TIMESTAMP.$BODY",
signature_header: "stripe-signature",
signature_pattern: ~r/v1=([a-f0-9]+)/,
timestamp_header: "stripe-signature",
timestamp_pattern: ~r/t=(\d+)/,
max_skew: 300
}
@impl true
def verify(raw_body, conn, config, agent) do
Hmac.verify(raw_body, conn, Map.merge(@defaults, config), agent)
end
end