Overview
Thetool.verify() method verifies RFC 9421 signed HTTP requests with additional security checks. It validates that the request signature is valid and that the signing agent’s domain is trusted.
tool.verify() is a wrapper around primitives.verify() that adds FQDN (Fully Qualified Domain Name) trust validation. Use this method when building tools that need to verify requests from trusted agents only.Signature
Parameters
HttpMethod
required
The HTTP method of the request being verified.Valid values:
'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD', or any custom string.string
required
The full URI of the request being verified (e.g.,
https://tool.example.com/api/action).HeaderBag
default:"{}"
The HTTP headers from the incoming request. Must include
Signature, Signature-Input, and Signature-Agent headers.Return Value
Returns a Promise that resolves to aVerifyResult object:
string
The unique identifier of the agent that signed the request.
string
The key ID (thumbprint) of the public key used to sign the request.
PublicJwk
The public JWK that was used to verify the signature.
string
The well-known URL where the public key was discovered (if applicable).
Trust Validation
Thetool.verify() method validates that the signing agent’s domain matches one of these trusted patterns:
- Vestauth API:
*.api.vestauth.com - Server Hostname: Matches the configured server hostname (if using Vestauth server)
- Custom Pattern: Matches the
TOOL_FQDN_REGEXenvironment variable (if set)
untrustedSignatureAgent error.
Example
Example with Next.js API Route
Example Output
Custom Trust Pattern
You can configure custom trusted domains using theTOOL_FQDN_REGEX environment variable:
Error Handling
Common Errors
- Missing HTTP Method:
httpMethodparameter is required - Missing URI:
uriparameter is required - Missing Signature-Agent: The
Signature-Agentheader is not present in the request - Invalid Signature-Agent: The
Signature-Agentheader is malformed - Untrusted Signature-Agent: The agent’s domain is not in the trusted list
- Invalid Signature: The signature verification failed (wrong key or tampered request)
- Expired Signature: The signature has expired (based on the
expiresparameter)
Verification Flow
- Validate Headers: Ensures
Signature-Agentheader is present and valid - Extract FQDN: Parses the agent’s domain from the
Signature-Agentheader - Trust Check: Validates the domain against trusted patterns
- Signature Verification: Calls
primitives.verify()to verify the cryptographic signature - Return Result: Returns the verified agent information
Related Methods
- primitives.verify() - Lower-level verification without FQDN trust check
- agent.headers() - Generate signature headers for outbound requests