Operator-authorized payment middleware for x402 flows.
Untch Guard
Package: @untch/x402-guard
Mode B middleware for buyer agents. On each 402 challenge it:
- Parses the challenge
- Runs Challenge Binding Check (expected vs presented fields)
- Calls Untch preflight (or your preflight adapter)
- Invokes your
signAndPayonly if checks pass
Install
npm install @untch/x402-guard
Mental model
You keep the key. The guard keeps the agent from signing a challenge that was swapped, replayed, or never preflighted.
Binding failures map to BLOCKED_REPLAY or REJECTED_BINDING semantics. They never reach the signer.