sofya.transcription
Version:
a JavaScript library that provides a robust and flexible solution for real-time audio transcription. It is designed to transcribe audio streams and can be easily integrated into web applications.
52 lines • 1.87 kB
TypeScript
/**
* Security validation utilities for WebSocket connections.
* Provides protection against injection attacks and ensures URL safety.
*/
/**
* WebSocket security validator class
*/
export declare class WebSocketSecurityValidator {
private rules;
constructor();
/**
* Validates a query parameter key
* @param key - The key to validate
* @throws Error if key format is invalid
*/
validateQueryParamKey(key: string): void;
/**
* Validates a query parameter value
* @param key - The parameter key (for error messages)
* @param value - The value to validate
* @throws Error if value is too long or contains malicious patterns
*/
validateQueryParamValue(key: string, value: string): void;
/**
* Warns if sensitive keys are detected in query parameters
* @param keys - Array of parameter keys to check
*/
warnSensitiveKeys(keys: string[]): void;
/**
* Checks if the final WebSocket URL exceeds maximum length
* @param url - The URL to check
* @throws Error if URL is too long
*/
checkUrlLength(url: string): void;
/**
* Detects collision between custom params and internal params
* @param customParams - Custom query parameters
* @returns Object with validated params (internal params removed) and collision warnings
*/
detectCollisions(customParams: Record<string, string>): {
validatedParams: Record<string, string>;
collisions: string[];
};
/**
* Validates all query parameters
* @param queryParams - Query parameters to validate
* @returns Validated parameters (with internal params removed)
* @throws Error if any validation fails
*/
validateQueryParams(queryParams: Record<string, string>): Record<string, string>;
}
//# sourceMappingURL=websocketSecurity.d.ts.map