/** * Input Validation Utilities * Input validation and sanitization utilities. * * Provides: * - validateBoardId: Board identifier syntax checking. * - validateProjectPath: Project context path validation. * - checkDirectoryWritable: IO permissions validation. * - checkDirectoryExists: Directory presence checking. * - sanitizeInput: Input safety checker. * - validateSerialPort: COM/tty port analyzer. * - validateLibraryName: Registry package syntax checker. * - validateFramework: Framework string validator. * - validateEnvironmentName: Compilation target validator. * - validateVersion: Semantic version string validator. * - validateBaudRate: Standardized baud-rate checker. * - isTextSafe: Text payload scanner. * - sanitizeObject: Object value sanitization pass. */ /** * Validates a board ID to prevent command injection and ensure valid format. * Board IDs should contain only alphanumeric characters, hyphens, and underscores. * * @param boardId - The raw board identifier string to validate. * @returns True if the board ID is syntactically safe, false otherwise. */ export declare function validateBoardId(boardId: string): boolean; /** * Validates and normalizes a project path. * Returns the absolute path if valid. * Throws an error if the path is invalid or potentially unsafe. * * @param projectPath - The local relative or absolute project path. * @returns The resolved absolute path. */ export declare function validateProjectPath(projectPath: string): string; /** * Checks if a directory exists and is writable. * * @param dirPath - The absolute directory path to verify. * @returns Resolves true if RW access is permitted. */ export declare function checkDirectoryWritable(dirPath: string): Promise; /** * Checks if a directory exists. * * @param dirPath - The absolute directory path to verify. * @returns Resolves true if the standard directory footprint exists. */ export declare function checkDirectoryExists(dirPath: string): Promise; /** * Sanitizes general string input to prevent command injection. * Removes or escapes potentially dangerous characters. * * @param input - The raw incoming untrusted string. * @returns The escaped and trimmed output string. */ export declare function sanitizeInput(input: string): string; /** * Validates a serial port path. * Different formats for different operating systems. * * @param port - The string representation of the serial COM port. * @returns True if the port string matches known OS COM patterns. */ export declare function validateSerialPort(port: string): boolean; /** * Validates a library name. * Library names can contain alphanumeric, spaces, hyphens, and underscores. * * @param name - The string representation of the library name to evaluate. * @returns True if the library name adheres to PlatformIO registry constraints. */ export declare function validateLibraryName(name: string): boolean; /** * Validates a framework name. * * @param framework - The target system framework string (e.g. arduino). * @returns True if the framework name follows valid alphanumeric constraints. */ export declare function validateFramework(framework: string): boolean; /** * Validates an environment name from platformio.ini. * * @param env - The specified runtime environment string. * @returns True if the environment label is valid. */ export declare function validateEnvironmentName(env: string): boolean; /** * Validates a version string. * Can be semantic version (1.2.3) or ranges (^1.0.0, ~2.1.0). * * @param version - The input semver dependency string. * @returns True if the string acts as a valid version identifier. */ export declare function validateVersion(version: string): boolean; /** * Validates a baud rate. * Common baud rates: 9600, 19200, 38400, 57600, 115200, etc. * * @param baud - The numerical baud rate to authenticate. * @returns True if the baud rate corresponds to standard UART steps. */ export declare function validateBaudRate(baud: number): boolean; /** * Validates that a string doesn't contain null bytes or other dangerous content. * * @param text - The raw text payload input. * @returns True if the text does not manifest potential overflow or escape attacks. */ export declare function isTextSafe(text: string): boolean; /** * Sanitizes an object's string values to prevent injection attacks. * * @param obj - The input dictionary containing mixed values. * @returns A structurally identical object with safe string properties. */ export declare function sanitizeObject(obj: Record): Record; //# sourceMappingURL=validation.d.ts.map