UNPKG

@agentman/chat-widget

Version:

Agentman Chat Widget for easy integration with web applications

62 lines (61 loc) 1.68 kB
import type { AgentMetadata, ClientMetadata } from '../types/types'; /** * Validation utilities for data integrity */ export declare class ValidationUtils { /** * Validate AgentMetadata structure */ static validateAgentMetadata(data: any): AgentMetadata | null; /** * Validate ClientMetadata structure */ static validateClientMetadata(data: any): ClientMetadata | null; /** * Basic email validation */ private static isValidEmail; /** * Sanitize custom tags object */ private static sanitizeCustomTags; /** * Validate localStorage quota before saving */ static checkStorageQuota(data: string): boolean; /** * Get safe localStorage usage stats */ static getStorageStats(): { used: number; available: boolean; }; /** * Sanitize user input text to prevent XSS and ensure safe processing */ static sanitizeUserInput(input: string, maxLength?: number): string; /** * Validate and sanitize file upload data */ static sanitizeFileData(file: File): { valid: boolean; errors: string[]; }; /** * Validate URL for safety */ static isValidUrl(url: string): boolean; /** * Sanitize JSON payloads and prevent prototype pollution */ static parseAndValidatePayload(jsonString: string): any; /** * Deep sanitize objects to prevent prototype pollution */ private static sanitizeObject; /** * Rate limiting for API calls */ private static rateLimitMap; static checkRateLimit(key: string, maxRequests?: number, windowMs?: number): boolean; }