Overview
The Tool API provides a single method for verifying cryptographically signed agent requests. Use this API when building tools that need to authenticate agents.tool.verify()
Verifies a signed HTTP request by validating the signature and fetching the agent’s public key from the discovery endpoint.Signature
Parameters
string
required
The HTTP method of the request being verified (e.g.,
GET, POST, PUT, DELETE)string
required
The full request URI including scheme, host, and path (e.g.,
https://api.example.com/data)HeaderBag
The request headers object containing:
Signature(orsignature)Signature-Input(orsignature-input)Signature-Agent(orsignature-agent)
Returns
string
The agent’s unique identifier (e.g.,
agent-4b94ccd425e939fac5016b6b)string
The key ID used to sign the request
PublicJwk
The agent’s public key in JWK format
string
The URL where the agent’s public keys were discovered (e.g.,
https://agent-609a4fd2ebf4e6347108c517.api.vestauth.com/.well-known/http-message-signatures-directory)Example
- Express
- Fastify
- Next.js API Route
How It Works
-
Extract Signature Headers: The method reads
Signature,Signature-Input, andSignature-Agentfrom the request headers -
Parse Agent Identity: Extracts the agent UID from the
Signature-Agentheader (e.g.,agent-609a4fd2ebf4e6347108c517) -
Fetch Public Key: Makes a request to the agent’s
.well-knowndiscovery endpoint to retrieve the public key: - Verify Signature: Uses the public key to cryptographically verify the request signature matches the HTTP method and URI
-
Check Expiration: Validates that the signature hasn’t expired based on the
expirestimestamp - Return Agent Info: Returns the verified agent’s UID, key ID, and public key
Security Features
SSRF Protection
Vestauth prevents Server-Side Request Forgery (SSRF) attacks by only fetching public keys from trusted domains:- Default trusted domain:
*.api.vestauth.com - Custom domains via
TOOL_FQDN_REGEXenvironment variable
.env
Signature Expiration
Signatures include anexpires timestamp. Expired signatures are automatically rejected:
Nonce Support
Each signature includes a unique nonce to prevent replay attacks. While Vestauth validates signature freshness via timestamps, you can optionally track nonces for additional protection:Error Handling
tool.verify() throws errors for various failure cases:
Common Error Messages
Middleware Pattern
Create reusable authentication middleware:Type Definitions
Complete Example: Building a Tool
Here’s a complete example of a simple file storage tool:Deprecated Alias
vestauth.provider is a deprecated alias for vestauth.tool. Both provide the same verify() method. Use vestauth.tool in new code.See Also
- Agent API - Create agents and sign requests
- Primitives API - Low-level verification
- Building Tools Guide - Complete guide to tool development