Explainer
Your AI agent can answer an API's proof challenge without holding its credential
Lantern's API asks Ada's agent for proof with x401. The agent hands the request to its A2WP wallet, which presents the credential straight to Lantern's verifier.
In How an AI agent signs in with a credential of its own, Ada’s agent signs in at Lantern Tickets through a browser. Most agents never open a browser. They call APIs. Here the same agent, with the same credential and wallet, holds two seats through Lantern’s REST API, and Lantern asks for proof with x401. Ada, Agent Registry and Lantern Tickets are made-up names.
x401 in short
x401 is a draft from Proof (version 0.2.0) for asking an HTTP caller for a credential. A route that needs proof answers 401 with a PROOF-REQUEST header. The header carries a signed OpenID4VP request, the same kind a website shows behind an Open in wallet link. The caller gets a wallet to answer it, then retries the route with a PROOF-RESPONSE header.
x401 leaves open how the caller reaches its wallet. Here the agent uses A2WP. x401 also lets the answer come back in two forms: the result itself, or a reference to a result the verifier already holds. Lantern takes the reference, so the presentation goes from the wallet to Lantern’s verifier and never through the agent. For that, its signed request uses direct_post instead of x401’s dc_api, the one place it departs from x401 0.2.0.
1. The agent and Lantern Tickets: reserve
Anyone can read the event and reserve seats on Lantern’s API; holding them needs proof. The agent reads the event and reserves two seats. Lantern keeps them for ten minutes and returns a checkout with the URL to hold it.
2. The agent and Lantern Tickets: the challenge
The agent asks to hold the seats with nothing attached, and Lantern answers with a challenge:
HTTP/1.1 401 Unauthorized
PROOF-REQUEST: eyJzY2hlbWUiOiJ4NDAxIiwidmVyc2lvbiI6IjAuMi4wIi...
Cache-Control: no-store
The header is base64url JSON. Inside is one OpenID4VP request, signed by Lantern’s verifier, asking for the agent credential. The agent doesn’t need to decode any of it.
3. The agent and its wallet
The agent submits the header value to its wallet exactly as it came, with the same submit call it uses for an openid4vp:// link on a website. As before, the answer is an operation with a status, never the credential.
4. The wallet and Lantern’s verifier: OpenID4VP
As on the website, the wallet checks that the request is signed by a certificate for Lantern’s domain, and that its policy lets this agent show these fields to Lantern. Ada’s policy for this agent doesn’t ask her each time. The wallet posts the credential with a key-binding signature to the verifier. The verifier answers with a redirect_uri: Lantern’s result URL, with a one-time response_code.
https://tickets.lantern.example/api/tickets/v1/x401/results/vrf_aMMWwUPqeppBwu3S?response_code=54f175db...
On the website, the agent opened this link in its browser. Here the wallet doesn’t follow it. It hands it to the agent as the operation’s continuation.
5. The agent and Lantern Tickets: hold
The continuation is the reference x401 asks for. The agent puts it in PROOF-RESPONSE as credential_result_uri and repeats the hold:
POST /api/tickets/v1/checkouts/chk_m4qXzaup2Nw1tslp/hold HTTP/1.1
PROOF-RESPONSE: base64url({"credential_result_uri": "<the continuation>"})
Lantern accepts the reference only if it issued it for this checkout’s current challenge, with the response_code the verifier recorded, and only once. Then it reads the verifier’s result, checks the credential’s issuer and certificate chain, and holds the seats.
The reference is bound to the checkout and the one-time response_code, not to the agent, and an API call has no browser to tie it to. An API that relays Lantern’s challenge as its own gets the continuation back and can hold the seats with it. x401’s optional agent binding, such as HTTP Message Signatures or DPoP, would stop that.