import 'reflect-metadata'; /** * API Key Module Configuration */ export interface ApiKeyModuleConfig { /** Array of valid API keys (or env var names to read from) */ keys?: string[]; /** Environment variable prefix to read keys from (e.g., 'API_KEY' reads API_KEY_1, API_KEY_2, etc.) */ keysEnvPrefix?: string; /** If true, keys are stored as SHA-256 hashes */ hashed?: boolean; /** Header name to extract API key from (default: 'x-api-key') */ headerName?: string; /** Metadata field name in MCP requests (default: 'apiKey') */ metadataField?: string; /** Custom validation function */ customValidation?: (key: string) => Promise | boolean; } /** * API Key Module - Enable API key authentication in your MCP server * * Import this module to indicate your server uses API key authentication. * Then use @UseGuards(ApiKeyGuard) on your tools to protect them. * * @example * ```typescript * import { McpApplicationFactory, ApiKeyModule } from 'nitrostack'; * import { AppModule } from './app.module.js'; * * async function bootstrap() { * const app = await McpApplicationFactory.create(AppModule, { * // Enable API key authentication * apiKey: ApiKeyModule.forRoot({ * keysEnvPrefix: 'API_KEY', // Reads API_KEY_1, API_KEY_2, etc. * headerName: 'x-api-key', * }), * }); * await app.start(); * } * ``` */ export declare class ApiKeyModule { private static config; /** * Configure API Key module for the application */ static forRoot(config: ApiKeyModuleConfig): ApiKeyModuleConfig; /** * Get current API Key configuration */ static getConfig(): ApiKeyModuleConfig; /** * Get valid API keys from config or environment */ static getKeys(): string[]; /** * Validate an API key */ static validate(key: string): Promise; /** * Hash an API key (SHA-256) */ static hashKey(key: string): string; /** * Generate a secure API key */ static generateKey(prefix?: string): string; } //# sourceMappingURL=apikey-module.d.ts.map