/** * Input validation utilities for the captcha-canvas library. * * This module provides comprehensive validation functions for all CAPTCHA * configuration parameters, ensuring that inputs meet security and usability * requirements before processing. */ export declare const VALIDATION_CONSTRAINTS: { readonly MIN_WIDTH: 50; readonly MAX_WIDTH: 2000; readonly MIN_HEIGHT: 30; readonly MAX_HEIGHT: 1000; readonly MIN_ASPECT_RATIO: 0.2; readonly MAX_ASPECT_RATIO: 5; readonly MIN_CHARACTERS: 4; readonly MAX_CHARACTERS: 20; readonly MIN_FONT_SIZE: 8; readonly MAX_FONT_SIZE: 200; readonly MIN_OPACITY: 0; readonly MAX_OPACITY: 1; readonly MAX_DECOYS: 1000; readonly MAX_TRACE_SIZE: 20; readonly MAX_ROTATION: 90; }; /** * Validates canvas dimensions and throws CaptchaValidationError if invalid. * * @param width - Canvas width in pixels * @param height - Canvas height in pixels * @throws {CaptchaValidationError} When dimensions are invalid */ export declare function validateDimensions(width: number, height: number): void; /** * Validates color strings and throws CaptchaValidationError if invalid. * * Supports hex colors (#RGB, #RRGGBB), RGB colors (rgb(r,g,b)), * RGBA colors (rgba(r,g,b,a)), and named colors. * * @param color - Color string to validate * @param fieldName - Field name for error reporting * @throws {CaptchaValidationError} When color is invalid */ export declare function validateColor(color: string, fieldName?: string): void; /** * Validates font names and throws CaptchaValidationError if invalid. * * @param font - Font name to validate * @throws {CaptchaValidationError} When font is invalid */ export declare function validateFont(font: string): void; /** * Validates font size and throws CaptchaValidationError if invalid. * * @param size - Font size in pixels * @throws {CaptchaValidationError} When font size is invalid */ export declare function validateFontSize(size: number | string): void; /** * Validates opacity values and throws CaptchaValidationError if invalid. * * @param opacity - Opacity value (0.0 to 1.0) * @throws {CaptchaValidationError} When opacity is invalid */ export declare function validateOpacity(opacity: number): void; /** * Validates character count and throws CaptchaValidationError if invalid. * * @param characters - Number of characters * @throws {CaptchaValidationError} When character count is invalid * @throws {CaptchaSecurityError} When character count is insufficient for security */ export declare function validateCharacterCount(characters: number): void; /** * Validates text content and throws CaptchaValidationError if invalid. * * @param text - Text content to validate * @param expectedLength - Expected length of text (optional) * @throws {CaptchaValidationError} When text is invalid */ export declare function validateText(text: string, expectedLength?: number): void; /** * Validates background image path/URL and throws CaptchaValidationError if invalid. * * @param background - Background image source (path, URL, or Buffer) * @throws {CaptchaValidationError} When background is invalid */ export declare function validateBackground(background: string | Buffer): void; /** * Validates rotation angle and throws CaptchaValidationError if invalid. * * @param rotation - Maximum rotation angle in degrees * @throws {CaptchaValidationError} When rotation is invalid */ export declare function validateRotation(rotation: number): void; /** * Validates decoy configuration and throws CaptchaValidationError if invalid. * * @param total - Number of decoy characters * @throws {CaptchaValidationError} When decoy count is invalid */ export declare function validateDecoyCount(total: number): void; /** * Validates trace line configuration and throws CaptchaValidationError if invalid. * * @param size - Trace line width in pixels * @throws {CaptchaValidationError} When trace size is invalid */ export declare function validateTraceSize(size: number): void; /** * Validates complete captcha configuration object. * * @param config - Configuration object to validate * @throws {CaptchaValidationError} When any configuration is invalid * @throws {CaptchaSecurityError} When security-related configuration is insufficient */ export declare function validateCaptchaConfig(config: any): void;