/** * Service Authentication Validators * * Core validation logic for service keys, permissions, and endpoint access. * Provides utilities for validating service-to-service authentication. */ import { ValidatedServiceApiKey, ServiceKeyValidationResult, AuthenticatedRequest } from './types'; /** * Extract API key from request headers or query parameters */ export declare function extractApiKey(req: AuthenticatedRequest): string | null; /** * Validate if an API key belongs to a service key */ export declare function validateServiceKey(apiKey: ValidatedServiceApiKey, endpoint: string): ServiceKeyValidationResult; /** * Validate API key format and basic structure */ export declare function validateApiKeyFormat(apiKey: string): boolean; /** * Check if request is accessing a service key protected endpoint */ export declare function isServiceKeyProtectedEndpoint(endpoint: string): boolean; /** * Validate request context for service authentication */ export declare function validateRequestContext(req: AuthenticatedRequest): { hasApiKey: boolean; apiKey: string | null; endpoint: string; method: string; }; /** * Create standardized error response for authentication failures */ export declare function createAuthErrorResponse(error: string, statusCode?: number): { status: number; error: string; message: string; }; /** * Log authentication events for audit purposes */ export declare function logAuthEvent(event: 'success' | 'failure', details: { endpoint: string; authType: 'standalone' | 'service-key' | 'none'; serviceKeyEmail?: string; error?: string; clientIp?: string; userAgent?: string; }): void;