tools402-authorize
v1.0.0
Published
Generate an EIP-3009 session token to authorize tools402 to pull USDC on Base. Used once per session by AI agents calling tools402.dev APIs.
Maintainers
Readme
tools402-authorize
Generate a session token for tools402.dev — an EIP-3009 TransferWithAuthorization signed offline that authorizes tools402 to pull up to N USDC from your wallet on Base mainnet.
Usage
npx tools402-authorize --amount 10 --days 30 --private-key 0xYOUR_KEYOr via env vars:
PRIVATE_KEY=0xYOUR_KEY TOOLS402_AMOUNT=10 TOOLS402_DAYS=30 npx tools402-authorizeThe CLI prints a TOOLS402_SESSION_TOKEN=... value. Add it to your agent config (e.g. claude_desktop_config.json for Claude Code, or your env vars).
How it works
- You sign an EIP-3009 TransferWithAuthorization offline. Your private key never leaves your machine.
- The signed authorization is encoded as a base64url session token.
- Your AI agent sends this token in the
X-Session-TokenHTTP header on each tools402 API call. - tools402's facilitator submits the authorization on-chain to pull USDC up to the cap, then deducts atomic amounts off-chain until exhausted.
- When the cap is consumed or the deadline expires, sign a fresh token.
Worst-case attack
If tools402 is fully compromised between now and the expiry, an attacker can pull at most --amount USDC from your wallet. Choose a cap appropriate to your risk tolerance.
Source
Part of tools402. Documentation: https://tools402.dev/docs/integrations.
License: MIT.
