x402_verify_settlement_webhook
Verifies x402/facilitator settlement webhooks with HMAC-SHA256 or Ed25519 signatures, enforcing timestamp skew and idempotency-key deduplication to reject replayed or duplicate payment settlements.
Instructions
Verify x402 / facilitator settlement webhooks via constant-time hmac.compare_digest (HMAC-SHA256) or pure-Python RFC 8032 Ed25519, enforcing timestamp skew limits, mandatory idempotency_key deduplication (SPEC_CLASS_14), integer settlement math (SPEC_CLASS_09), and automatic redaction of accidental API keys, secrets, and payment card digits.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"raw_body": "<raw_body>",
"signature_header": "<signature_header>"
},
"name": "x402_verify_settlement_webhook"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scheme | No | Webhook cryptographic verification scheme. | hmac-sha256 |
| raw_body | Yes | Exact unmutated raw HTTP request JSON body string. | |
| ledger_db_path | No | Optional SQLite WAL database path for persistent `idempotency_key` deduplication. | |
| webhook_secret | No | Shared HMAC secret when `scheme='hmac-sha256'`. | |
| max_skew_seconds | No | Allowed clock skew / replay window in seconds (default `300`). | |
| signature_header | Yes | Signature header value (hex or base64/base64url, with optional `sha256=`/`v1=`/`ed25519=` prefix). | |
| timestamp_header | No | Optional Unix timestamp header (`<timestamp>.<raw_body>` signing bind + replay window check). | |
| reference_unix_ts | No | Optional deterministic Unix timestamp override. | |
| seen_idempotency_keys | No | Optional stateless list of already processed `idempotency_key` values. | |
| ed25519_public_key_str | No | 32-byte Ed25519 public key (hex or base64/base64url) when `scheme='ed25519'`. |