CLI docs

Trusted Agent ProtocolTest your verifier

Trusted Agent ProtocolVisa CLI's profile

Test your verifier

Published vectors for any verifier of signed agent requests, most of them cases it has to refuse.

Markdownllms.txt
On this page

A verifier that accepts good requests can still be wrong: what matters is what it refuses, and whether it can tell a refusal from an outage. These are 94 test cases in one JSON file, which you can run against a verifier in any language. Most of them are cases it has to refuse.

Run them:

Shell
DOCS="${DOCS:-https://app.visacli.sh}"
curl -fsSO "$DOCS/examples/verify-agent.mjs"
curl -fsSO "$DOCS/examples/run-vectors.mjs"
curl -fsSO "$DOCS/conformance/tap-http-request-v1.json"
less verify-agent.mjs run-vectors.mjs
node run-vectors.mjs

The docs serve these files themselves, so you can also download verify-agent.mjs, run-vectors.mjs and the test vectors from this page. DOCS defaults to https://app.visacli.sh; if you're reading these docs at another address, run export DOCS=<that address> first. While the docs are private, add -H "Authorization: Bearer <your docs key>" to each curl.

There's no published checksum or signature, so read the code before you run it: the less line opens what you saved. verify-agent.mjs is the same file as the one printed in full on Verifier code, and run-vectors.mjs the same as the one printed below, because the downloads are served from that printed code, byte for byte. The JSON file is data, and What's in the file describes every field.

Last line of the output
94 of 94 passed: 18 accepted, 52 refused, 24 could not check

That's the example verifier from Verify a signed request, checked on every build of these docs.

Does your verifier pass?

VerifierResultHow we know
The example on Verify a signed request94 of 94run-vectors.mjs, on every docs build

This table lists the verifiers we maintain. To add yours, ask your Visa CLI partner contact, as Before you start explains.

What's in the file

FieldWhat it holds
profiletap-http-request-v1, the profile being tested
keyThe public test key. It's RFC 8032 test vector 1, so anyone can sign with it, and it's listed nowhere
originThe public origin to pin, unless a case sets its own
listingWhat the registry returns for the test key
listingsOther listings some cases use, named by their registry value
cases[].nameWhat the case tests
cases[].nowThe time to use, in Unix seconds, so the cases don't expire
cases[].registryHow the stand-in registry should answer. See below
cases[].requesturl, method, headers as pairs, and body. url is what the agent signed for. When a case also has target, send that as the request target in place of the path and query of url
cases[].repeatWhen true, send the request twice and judge the second
cases[].expectok, or code, reason and judged
cases[].modedirectory when the case reads the Visa Agent Directory instead of Visa CLI's registry. Create the verifier with directory.origin, and answer with the entry under directory.answers named by registry
directoryorigin, which Visa Agent Directory the verifier reads, sandbox or production, and answers, each a status and body for GET {origin}/.well-known/jwks/keys/{keyid}
registry valueThe stand-in registry answers
listed200 with listing
not_listed404
paused200 with isActive: false. Visa CLI's registry never sends this: it answers 404 for a paused agent. The case is for verifiers that also read other sources
key_revoked200 with the key's status set to revoked
down_503503 with Retry-After: 7
redirect_302302 to another origin. A verifier must not follow it: with fetch, pass redirect: 'error'
malformed200 with a body that isn't a listing
status_missing, algorithm_missing200 with listing, its key missing that field. Both are under listings
simulated200 with simulated: true
Any other value200 with the listing under that name in listings, such as one holding an Ed448 or DSA key

In words: listed answers 200 with the test listing and not_listed answers 404. A verifier must treat down_503 and redirect_302 as couldn't check with tap_trust_unavailable, and a malformed listing, a revoked key or a key missing its status or algorithm as couldn't check with tap_trust_invalid.

A verifier passes a case when it gives the same code and judged. reason is finer, and a verifier can use its own, so the runner prints a different reason as a note rather than a failure. What a verifier mustn't do is turn a judged: false case into a refusal: an outage says nothing about the agent.

Run the vectors against your verifier

Save this beside verify-agent.mjs and the JSON file. To test your own verifier, swap createVerifier for an adapter around yours. The Python tab runs the same cases against verify_agent.py, the Python port, with python3 run_vectors.py, and prints the same last line.

import { readFileSync } from 'node:fs'
import { createVerifier, memoryNonceStore } from './verify-agent.mjs'

const file = JSON.parse(readFileSync('tap-http-request-v1.json', 'utf8'))
const json = (doc, status = 200, headers = {}) => new Response(JSON.stringify(doc), { status, headers })
const answers = {
  listed: () => json(file.listing),
  not_listed: () => json({ code: 'not_found' }, 404),
  paused: () => json({ ...file.listing, isActive: false }),
  key_revoked: () => json({ ...file.listing, keys: file.listing.keys.map((key) => ({ ...key, status: 'revoked' })) }),
  down_503: () => json({ code: 'unavailable' }, 503, { 'retry-after': '7' }),
  redirect_302: () => new Response(null, { status: 302, headers: { location: 'https://elsewhere.example/' } }),
  malformed: () => json({ nope: true }),
  simulated: () => json({ ...file.listing, simulated: true }),
}
const answer = (vector) => {
  if (vector.mode !== 'directory') return (answers[vector.registry] ?? (() => json(file.listings[vector.registry])))()
  const { status, body } = file.directory.answers[vector.registry]
  return json(body, status)
}

let passed = 0
const notes = []
const kinds = { accepted: 0, refused: 0, 'could not check': 0 }
for (const vector of file.cases) {
  const verifyRequest = createVerifier({
    ...(vector.mode === 'directory' ? { directoryOrigin: file.directory.origin } : { registryOrigin: 'https://registry.invalid' }),
    reserveNonce: memoryNonceStore(() => vector.now),
    now: () => vector.now,
    fetchImpl: async () => answer(vector),
  })
  const request = {
    method: vector.request.method,
    publicOrigin: vector.origin ?? file.origin,
    target: vector.request.target ?? vector.request.url.replace(/^https:\/\/[^/]+/, ''),
    headers: Object.fromEntries(vector.request.headers.map(([name, value]) => [name.toLowerCase(), value])),
    rawBody: Buffer.from(vector.request.body ?? ''),
  }
  if (vector.repeat) await verifyRequest(request)
  const result = await verifyRequest(request)
  const pass = vector.expect.ok ? result.ok === true : result.code === vector.expect.code && result.judged === vector.expect.judged
  if (pass) passed += 1
  if (pass && !vector.expect.ok && result.reason !== vector.expect.reason) notes.push(`${vector.name}: reason ${result.reason}, the file says ${vector.expect.reason}`)
  kinds[vector.expect.ok ? 'accepted' : vector.expect.judged ? 'refused' : 'could not check'] += 1
  console.log(`${pass ? 'PASS' : 'FAIL'}  ${vector.name}${pass ? '' : `: got ${result.code}, judged ${result.judged}`}`)
}
for (const note of notes) console.log(`NOTE  ${note}`)
console.log(`${passed} of ${file.cases.length} passed: ${kinds.accepted} accepted, ${kinds.refused} refused, ${kinds['could not check']} could not check`)
process.exit(passed === file.cases.length ? 0 : 1)
import json
import sys

from verify_agent import create_verifier, memory_nonce_store

with open('tap-http-request-v1.json') as handle:
    file = json.load(handle)


def answer(vector):
    registry = vector['registry']

    def respond(doc, status=200, headers=None):
        return status, headers or {}, json.dumps(doc).encode()

    if vector.get('mode') == 'directory':
        entry = file['directory']['answers'][registry]
        return respond(entry['body'], entry['status'])

    answers = {
        'listed': lambda: respond(file['listing']),
        'not_listed': lambda: respond({'code': 'not_found'}, 404),
        'paused': lambda: respond({**file['listing'], 'isActive': False}),
        'key_revoked': lambda: respond({**file['listing'], 'keys': [{**key, 'status': 'revoked'} for key in file['listing']['keys']]}),
        'down_503': lambda: respond({'code': 'unavailable'}, 503, {'retry-after': '7'}),
        'redirect_302': lambda: (302, {'location': 'https://elsewhere.example/'}, b''),
        'malformed': lambda: respond({'nope': True}),
        'simulated': lambda: respond({**file['listing'], 'simulated': True}),
    }
    return answers.get(registry, lambda: respond(file['listings'][registry]))()


passed = 0
notes = []
kinds = {'accepted': 0, 'refused': 0, 'could not check': 0}
for vector in file['cases']:
    source = {'directory_origin': file['directory']['origin']} if vector.get('mode') == 'directory' else {'registry_origin': 'https://registry.invalid'}
    verify_request = create_verifier(
        **source,
        reserve_nonce=memory_nonce_store(lambda: vector['now']),
        now=lambda: vector['now'],
        fetch=lambda url: answer(vector),
    )
    request = {
        'method': vector['request']['method'],
        'public_origin': vector.get('origin', file['origin']),
        'target': vector['request'].get('target', '/' + vector['request']['url'].split('/', 3)[3]),
        'headers': {name.lower(): value for name, value in vector['request']['headers']},
        'raw_body': (vector['request'].get('body') or '').encode(),
    }
    if vector.get('repeat'):
        verify_request(**request)
    result = verify_request(**request)
    expect = vector['expect']
    ok = result['ok'] if expect['ok'] else result.get('code') == expect['code'] and result.get('judged') == expect['judged']
    passed += ok
    if ok and not expect['ok'] and result['reason'] != expect['reason']:
        notes.append(f"{vector['name']}: reason {result['reason']}, the file says {expect['reason']}")
    kinds['accepted' if expect['ok'] else 'refused' if expect['judged'] else 'could not check'] += 1
    print(f"{'PASS' if ok else 'FAIL'}  {vector['name']}" + ('' if ok else f": got {result.get('code')}, judged {result.get('judged')}"))
for note in notes:
    print(f'NOTE  {note}')
print(f"{passed} of {len(file['cases'])} passed: {kinds['accepted']} accepted, {kinds['refused']} refused, {kinds['could not check']} could not check")
sys.exit(0 if passed == len(file['cases']) else 1)

Every case

Key named by a UUID, with Signature-Agent and an application header

Result: Accepted

Key named by thumbprint

Result: Accepted

The registered lowercase ed25519 label

Result: Accepted

GET with no body or query

Result: Accepted

No signature

Result: Refused

code: tap_missing

reason: no_signature_headers

Body changed

Result: Refused

code: tap_signature_invalid

reason: body_digest_mismatch

Path changed

Result: Refused

code: tap_signature_invalid

reason: signature_mismatch

Query changed

Result: Refused

code: tap_signature_invalid

reason: signature_mismatch

Signed for another site

Result: Refused

code: tap_signature_invalid

reason: signature_mismatch

Signature bytes changed

Result: Refused

code: tap_signature_invalid

reason: signature_mismatch

Another key claims this keyid

Result: Refused

code: tap_signature_invalid

reason: signature_mismatch

A listing pairs the victim's thumbprint keyid with the attacker's key

Result: Refused

code: tap_key_inactive

reason: key_not_live

Expired

Result: Refused

code: tap_expired

reason: expired

Created in the future

Result: Refused

code: tap_expired

reason: not_yet_valid

Lifetime over 60 seconds

Result: Refused

code: tap_expired

reason: lifetime_too_long

Label sig1

Result: Refused

code: tap_malformed

reason: signature_input_format

The paid tag

Result: Refused

code: tap_malformed

reason: signature_input_format

16-byte nonce

Result: Refused

code: tap_malformed

reason: signature_input_format

Required component left out

Result: Refused

code: tap_malformed

reason: required_components_missing

Authorization present, even unsigned

Result: Refused

code: tap_malformed

reason: credential_header_present

A header the signature does not cover

Result: Refused

code: tap_malformed

reason: uncovered_header

Replayed

Result: Refused

code: tap_replayed

reason: nonce_reused

Key not listed

Result: Refused

code: tap_key_unknown

reason: key_not_listed

A listing that says the agent is paused

Result: Refused

code: tap_key_inactive

reason: agent_not_live

Listing reports a revoked key

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

Registry answered something unusable

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

Registry down, saying when to ask again

Result: Couldn't check

code: tap_trust_unavailable

reason: registry_unavailable

The registry answers with a redirect

Result: Couldn't check

code: tap_trust_unavailable

reason: registry_unavailable

Signature-Agent isn't on the allowlist

Result: Refused

code: tap_signature_agent_not_accepted

reason: signature_agent_not_accepted

A simulated listing, by a verifier not told to accept one

Result: Refused

code: tap_simulated_not_accepted

reason: simulated_listing

Dot segments in the path

Result: Refused

code: tap_malformed

reason: request_target_invalid

Dot segments after a segment that starts with a dot

Result: Refused

code: tap_malformed

reason: request_target_invalid

Encoded dots in the path

Result: Refused

code: tap_malformed

reason: request_target_invalid

Backslashes in the path

Result: Refused

code: tap_malformed

reason: request_target_invalid

A fragment in the target

Result: Refused

code: tap_malformed

reason: request_target_invalid

Proxy, tracing and CDN headers left unsigned

Result: Accepted

Every request header Cloudflare documents, left unsigned

Result: Accepted

Every request header Vercel documents, left unsigned

Result: Accepted

Every request header Fly.io documents, left unsigned

Result: Accepted

Every request header Google Cloud documents, left unsigned

Result: Accepted

An identity header left unsigned

Result: Refused

code: tap_malformed

reason: uncovered_header

Alg spelled ED25519

Result: Refused

code: tap_malformed

reason: signature_input_format

Body changed and Signature-Agent off the allowlist, so the body is checked first

Result: Refused

code: tap_signature_invalid

reason: body_digest_mismatch

The listing holds an Ed448 key, and the request is signed with it

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listing holds a DSA key

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

Brackets and a pipe in the path, which a URL parser leaves as they are

Result: Accepted

A caret in the path, which newer URL parsers encode

Result: Refused

code: tap_malformed

reason: request_target_invalid

A percent sign not followed by two hex digits, left as it is

Result: Accepted

Brackets, braces, a pipe, a caret and a backtick in the query

Result: Accepted

A brace in the path, which a URL parser would encode

Result: Refused

code: tap_malformed

reason: request_target_invalid

A target that runs on into another host, signed for that host

Result: Refused

code: tap_malformed

reason: request_target_invalid

A target that adds a port, signed for that port

Result: Refused

code: tap_malformed

reason: request_target_invalid

A target that turns the host into a user name, signed for the host after it

Result: Refused

code: tap_malformed

reason: request_target_invalid

An absolute-form target

Result: Refused

code: tap_malformed

reason: request_target_invalid

The listed key has no status

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listed key has no algorithm

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

A Signature header that is not whole base64

Result: Refused

code: tap_malformed

reason: signature_header_format

Origin covered by the signature

Result: Refused

code: tap_malformed

reason: signed_header_invalid

X-Forwarded-For covered by the signature

Result: Refused

code: tap_malformed

reason: signed_header_invalid

A covered header over 4096 characters

Result: Refused

code: tap_malformed

reason: signed_header_invalid

A Content-Digest that is not sha-256 base64

Result: Refused

code: tap_malformed

reason: digest_format

The listed key's expirationDate has passed

Result: Refused

code: tap_key_inactive

reason: key_not_live

The listed key's expirationDate is still ahead

Result: Accepted

The listed key's expirationDate is not a date

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

A pinned origin written with a trailing dot

Result: Refused

code: tap_malformed

reason: origin_not_normal

A pinned origin with an underscore in the host

Result: Refused

code: tap_malformed

reason: origin_not_normal

A method sent in lowercase, though the agent signed POST

Result: Refused

code: tap_malformed

reason: method_not_allowed

The listed key's expirationDate is still ahead, written with a zone offset

Result: Accepted

The listed key's expirationDate is a date alone, with no time or zone

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listed key's expirationDate is a word and a number

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listed key's expirationDate is a word and a year

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listed key's expirationDate has hour 24

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listed key's expirationDate has a zone offset with 99 minutes

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listed key's expirationDate has no zone

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listed key's expirationDate has one-digit month and day

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listed key's expirationDate has a six-digit year

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listed key's expirationDate is a day that doesn't exist

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The listed key's expirationDate is in year 0000

Result: Refused

code: tap_key_inactive

reason: key_not_live

The listed key's expirationDate is a leap day, in lowercase, with a fraction

Result: Accepted

Reading the Visa Agent Directory, the key resolves

Result: Accepted

The Visa Agent Directory spells the algorithm Ed25519

Result: Accepted

Reading the Visa Agent Directory, agentType trusted passes the same as known

Result: Accepted

The Visa Agent Directory answers 404

Result: Refused

code: tap_key_unknown

reason: key_not_listed

The Visa Agent Directory answers 503

Result: Couldn't check

code: tap_trust_unavailable

reason: registry_unavailable

Reading the Visa Agent Directory, the key's status isn't active

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

Reading the Visa Agent Directory, the key's expirationDate has passed

Result: Refused

code: tap_key_inactive

reason: key_not_live

Reading the Visa Agent Directory, the key's expirationDate isn't RFC 3339

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

Reading the Visa Agent Directory, the answer is for another key ID

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

Reading the Visa Agent Directory, the key is neither Ed25519 nor P-256

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

Reading the Visa Agent Directory, the answer has no key

Result: Couldn't check

code: tap_trust_invalid

reason: listing_unusable

The Visa Agent Directory holds another public key for this key ID

Result: Refused

code: tap_signature_invalid

reason: signature_mismatch

Reading the Visa Agent Directory, a thumbprint keyid

Result: Refused

code: tap_key_unknown

reason: key_not_in_directory

Reading the Visa Agent Directory sandbox, Signature-Agent names the Visa Agent Directory

Result: Refused

code: tap_signature_agent_not_accepted

reason: signature_agent_other_directory

P-256 keys in the Visa Agent Directory

Agents registered through Basis Theory may sign with P-256 (ECDSA) keys, as Basis Theory documents, and the example verifier accepts them when it reads the Visa Agent Directory. These cases aren't in the JSON file yet. The example verifier's own tests run them on every build of these docs: fixture.mjs in Node, with a P-256 key it generates, and test_server.py in Python, with a recorded signature. Verifier code prints both, with their output.

Reading the Visa Agent Directory, a P-256 key and a valid ecdsa-p256-sha256 signature

Result: Accepted

Reading the Visa Agent Directory, a P-256 key, and the signature says alg="Ed25519"

Result: Refused

code: tap_signature_invalid

reason: algorithm_mismatch

Reading the Visa Agent Directory, a P-256 key, and the signature bytes changed

Result: Refused

code: tap_signature_invalid

reason: signature_mismatch

Reading Visa CLI's registry, an Ed25519 key, and the signature says alg="ecdsa-p256-sha256"

Result: Refused

code: tap_signature_invalid

reason: algorithm_mismatch

Updated 18 Nov 2026