import { AttestationError, thumbprintFromPeerCert, thumbprintFromForwardedClientCert, type VerifyOptions, type AttestationClaims } from '@adastracomputing/aer-resource-node'; export { AttestationError, thumbprintFromPeerCert, thumbprintFromForwardedClientCert }; export type { AttestationClaims, VerifyOptions }; /** JSON-RPC error code for "attestation required" (implementation-defined range). */ export declare const MCP_ATTESTATION_ERROR_CODE = -32001; export type JsonRpcId = string | number | null; export interface JsonRpcError { jsonrpc: '2.0'; id: JsonRpcId; error: { code: number; message: string; data: { reason: string; }; }; } export interface GuardOptions extends Omit { /** Also accept `Authorization: Bearer`. Default false (X-AER-Attestation only). */ allowBearer?: boolean; /** Clock injection for tests (ms). */ now?: () => number; /** * Resolve the presented client-cert thumbprint per request (when `requireMtls`). * Receives the header getter - use it to read a forwarded client-cert header * (`thumbprintFromForwardedClientCert`) behind a TRUSTED proxy. For DIRECT mTLS, * resolve from the socket in your handler and pass `mtlsThumbprint` instead. * ⚠️ Only read a forwarded cert header behind a proxy you control. */ resolveMtlsThumbprint?: (getHeader: (name: string) => string | null | undefined) => string | null | Promise; } export type GuardResult = { ok: true; claims: AttestationClaims; } | { ok: false; status: number; jsonRpcError: JsonRpcError; }; type HeaderGetter = (name: string) => string | null | undefined; /** * HTTP status for a denial reason: * - 403 token is authentic but lacks authority: revoked / introspection says * inactive / insufficient_scope (RFC 6750 maps insufficient_scope → 403) * - 503 introspection unreachable + fail-closed, or the JWKS unreachable * (jwks_unavailable): the guard could not decide (liveness unknown - not the * client's fault, and the token may well be valid) * - 401 everything else: missing / malformed / bad signature / expired / * wrong audience / wrong issuer / DPoP proof failures (RFC 9449 uses 401 * with a DPoP challenge - dpop_required / dpop_invalid / dpop_replay) */ export declare function statusForReason(reason: string): number; /** * Framework-neutral guard. Reads the attestation header, verifies it (offline + * optional introspection), and returns either the claims or a ready-to-send * JSON-RPC denial + HTTP status. Never reads the request body - pass `rpcId` * only if the body was already parsed by your framework (else leave it null so * streaming/SSE bodies are untouched). */ export declare function guardMcpRequest(getHeader: HeaderGetter, opts: GuardOptions, rpcId?: JsonRpcId): Promise; //# sourceMappingURL=index.d.ts.map