Skip to main content

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 (or signature)
  • Signature-Input (or signature-input)
  • Signature-Agent (or signature-agent)
Header names are case-insensitive.

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


How It Works

  1. Extract Signature Headers: The method reads Signature, Signature-Input, and Signature-Agent from the request headers
  2. Parse Agent Identity: Extracts the agent UID from the Signature-Agent header (e.g., agent-609a4fd2ebf4e6347108c517)
  3. Fetch Public Key: Makes a request to the agent’s .well-known discovery endpoint to retrieve the public key:
  4. Verify Signature: Uses the public key to cryptographically verify the request signature matches the HTTP method and URI
  5. Check Expiration: Validates that the signature hasn’t expired based on the expires timestamp
  6. 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_REGEX environment variable
.env
Never set TOOL_FQDN_REGEX to .* as this would allow fetching from any domain, exposing your server to SSRF attacks.

Signature Expiration

Signatures include an expires 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