import type { ServerDigest } from './BehaviorDigest.js'; /** * Configuration for zero-trust attestation. * * Passed to `AttachOptions.zeroTrust` in ServerAttachment. */ export interface ZeroTrustConfig { /** * The signing strategy to use. * - `'hmac'` — HMAC-SHA256 with a shared secret (built-in) * - A custom `AttestationSigner` for external KMS integration */ readonly signer: 'hmac' | AttestationSigner; /** * For `'hmac'` mode: the shared secret. * Read from environment in production (never hardcode). */ readonly secret?: string; /** * Expected server digest hash from a known-good build. * When set, runtime verification will fail-fast if the * re-computed digest doesn't match. */ readonly expectedDigest?: string; /** * Whether to fail-fast on attestation failure. * Default: `true` in production, `false` in development. */ readonly failOnMismatch?: boolean; /** * Whether to expose the attestation in MCP capabilities. * Default: `true`. */ readonly exposeCapability?: boolean; } /** * Pluggable signer interface for external KMS integration. * * Implementations should be stateless and async-safe. * The `sign()` method receives the canonical digest string * and returns a signature (hex-encoded or base64). */ export interface AttestationSigner { /** Human-readable name (e.g., 'sigstore', 'aws-kms') */ readonly name: string; /** Sign a digest string */ sign(digest: string): Promise; /** Verify a digest against a signature */ verify(digest: string, signature: string): Promise; } /** * Result of an attestation operation. */ export interface AttestationResult { /** Whether the attestation was successful */ readonly valid: boolean; /** The computed digest */ readonly computedDigest: string; /** The expected digest (if configured) */ readonly expectedDigest: string | null; /** The signature (if signing was performed) */ readonly signature: string | null; /** Signer identity */ readonly signerName: string; /** ISO-8601 timestamp of attestation */ readonly attestedAt: string; /** Human-readable error message, if invalid */ readonly error: string | null; } /** * Capability structure exposed via MCP `server.capabilities`. * * Clients can inspect this to verify the server's behavioral * identity before trusting tool responses. */ export interface FusionTrustCapability { /** Current server behavioral digest */ readonly serverDigest: string; /** Attestation signature (if signed) */ readonly signature: string | null; /** Signer identity */ readonly signerName: string; /** ISO-8601 timestamp of last attestation */ readonly attestedAt: string; /** Number of tools covered by the attestation */ readonly toolCount: number; /** Whether the attestation passed verification */ readonly verified: boolean; } /** * Create an HMAC-SHA256 signer from a shared secret. * * @param secret - The shared secret (should be ≥32 bytes) * @returns An `AttestationSigner` using HMAC-SHA256 */ export declare function createHmacSigner(secret: string): AttestationSigner; /** * Sign a server digest and produce an attestation result. * * @param serverDigest - The server's behavioral digest * @param config - Zero-trust configuration * @returns Attestation result with signature */ export declare function attestServerDigest(serverDigest: ServerDigest, config: ZeroTrustConfig): Promise; /** * Verify a previously signed attestation. * * @param serverDigest - The current server digest * @param signature - The signature to verify * @param config - Zero-trust configuration * @returns Attestation result with verification status */ export declare function verifyAttestation(serverDigest: ServerDigest, signature: string, config: ZeroTrustConfig): Promise; /** * Runtime capability pinning — check that the current digest * matches what was attested at build time. * * Designed to be called once at server startup in the `attach()` flow. * * @param currentDigest - Re-computed server digest * @param config - Zero-trust configuration * @returns Attestation result * @throws If `failOnMismatch` is true and the digest doesn't match */ export declare function verifyCapabilityPin(currentDigest: ServerDigest, config: ZeroTrustConfig): Promise; /** * Build the `fusionTrust` capability object for MCP exposure. * * @param attestation - A completed attestation result * @param toolCount - Number of tools in the registry * @returns Capability structure for `server.capabilities` */ export declare function buildTrustCapability(attestation: AttestationResult, toolCount: number): FusionTrustCapability; /** * Error thrown when zero-trust attestation fails with failOnMismatch. * * Carries the full `AttestationResult` for programmatic inspection. */ export declare class AttestationError extends Error { readonly attestation: AttestationResult; constructor(message: string, attestation: AttestationResult); } //# sourceMappingURL=CryptoAttestation.d.ts.map