import type { AgentToken } from '../protocol.js'; /** * Result of looking up a presented token. The `expired` reason is * returned by the verify path when the token's record exists but its * hard-expiry has passed; `unknown` covers both "no record" and * "wrong hash" so a probe-by-hash leak surface is uniform. */ export type VerifyResult = { kind: 'ok'; tid: string; } | { kind: 'invalid'; reason: 'malformed' | 'unknown' | 'expired'; }; /** * Mint an opaque random bearer token + the SHA-256 hash the server * stores as a lookup key. Tokens are 32 bytes of CSPRNG entropy (256 * bits) base64url-encoded with the `agt_` prefix — total ~48 chars. * The prefix is intentionally generic so LLM clients don't mistake the * token format for a hint about which MCP tool namespace to use. * * The token itself never persists; only the hash does. A leaked store * therefore does not compromise live tokens, since the bearer secret * isn't recoverable from the hash. This matches the standard "session * cookie / API key" pattern. * * The opaque form is the only token format the server understands as * of 0.0.35. The previous HMAC-signed JWT format is gone; clients * carrying old tokens will fail with `unknown` on first call and need * to remint. See CHANGELOG. */ export declare function mintToken(): Promise<{ token: AgentToken; tokenHash: string; }>; /** * Compute the SHA-256 hash of a presented bearer token. Returns `null` * when the prefix is missing — the verify path uses that to fail-fast * on garbage-shaped Authorization headers without a crypto round-trip. * Hash is hex-encoded for portability across stores (Postgres `text`, * KV string, etc.). */ export declare function tokenHashOf(token: string): Promise; //# sourceMappingURL=token.d.ts.map