/** * Attestation Service * * Manages the lifecycle of attestations: * - Key generation and persistence * - Attestation creation and storage * - Key registry serving * * This service is the main integration point for the attestation protocol. */ import { Attestation, VerificationResult } from './signing.js'; import { KeyRegistry } from './key-management.js'; /** * Configuration for the attestation service */ export interface AttestationServiceConfig { /** Directory to store keys and config. Defaults to ~/.recourse */ configDir?: string; /** Instance ID for this RecourseOS instance */ instanceId?: string; /** Base URL for attestation URIs */ instanceBaseUrl?: string; /** Evaluator version string */ evaluatorVersion?: string; } /** * Attestation Service * * Singleton service that manages attestation operations. */ export declare class AttestationService { private configDir; private instanceId; private instanceBaseUrl; private evaluatorVersion; private privateKey; private publicKeyBase64url; private keyMetadata; private registry; /** * In-memory attestation cache (for fast access) * Attestations are also persisted to disk for cross-process sharing. */ private attestations; /** Directory for persisted attestations */ private attestationsDir; constructor(config?: AttestationServiceConfig); /** * Initialize the service: load or generate keys */ initialize(): Promise; /** * Load existing key from disk */ private loadKey; /** * Generate new key and save to disk */ private generateAndSaveKey; /** * Check if service is initialized */ isInitialized(): boolean; /** * Get the key registry (for /.well-known/recourse-keys.json) */ getKeyRegistry(): KeyRegistry & { instance_id: string; }; /** * Create an attestation for an evaluation */ createAttestation(input: unknown, output: unknown): Attestation; /** * Persist an attestation to disk */ private persistAttestation; /** * Load an attestation from disk */ private loadAttestation; /** * Get an attestation by ID (for /.well-known/attestations/{id}.json) * Checks memory cache first, then tries to load from disk. */ getAttestation(id: string): Attestation | null; /** * Verify an attestation */ verifyAttestation(attestation: Attestation): VerificationResult; /** * Get instance base URL */ getInstanceBaseUrl(): string; /** * Get current key ID */ getCurrentKeyId(): string | null; } /** * Get or create the global attestation service instance */ export declare function getAttestationService(config?: AttestationServiceConfig): AttestationService; /** * Reset the global instance (for testing) */ export declare function resetAttestationService(): void; //# sourceMappingURL=service.d.ts.map