@dharshansr/gitgenius
Version:
AI-powered commit message generator with enhanced features
75 lines • 2.23 kB
TypeScript
/**
* Security utilities for input validation, sanitization, and encryption
*/
export declare class SecurityUtils {
private static readonly ALGORITHM;
private static readonly SALT_LENGTH;
private static readonly IV_LENGTH;
private static readonly TAG_LENGTH;
private static readonly KEY_LENGTH;
/**
* Validate and enforce HTTPS URLs
*/
static validateSecureUrl(urlString: string): boolean;
/**
* Enforce HTTPS for API endpoints
*/
static enforceHttps(urlString: string): string;
/**
* Sanitize input to prevent injection attacks
*/
static sanitizeInput(input: string): string;
/**
* Validate API key format
*/
static validateApiKey(apiKey: string): boolean;
/**
* Encrypt sensitive data
*/
static encrypt(text: string, masterPassword: string): string;
/**
* Decrypt sensitive data
*/
static decrypt(encryptedData: string, masterPassword: string): string;
/**
* Generate a secure random token for API key rotation
*/
static generateRotationToken(): string;
/**
* Hash sensitive data for comparison (one-way)
*/
static hash(data: string): string;
/**
* Validate commit message to prevent injection
*/
static validateCommitMessage(message: string): boolean;
/**
* Rate limiting helper - track requests
*/
private static requestCounts;
/**
* Check rate limit for a given key
*/
static checkRateLimit(key: string, maxRequests: number, windowMs: number): boolean;
/**
* Clean up old rate limit records
*/
static cleanupRateLimits(): void;
/**
* Generate secure headers for API requests
*/
static getSecureHeaders(apiKey?: string): Record<string, string>;
/**
* Validate environment variable name to prevent injection
*/
static validateEnvVarName(name: string): boolean;
/**
* Sanitize file path to prevent directory traversal
*/
static sanitizePath(path: string): string;
/**
* Mask sensitive data for logging
*/
static maskSensitiveData(data: string, visibleChars?: number): string;
}
//# sourceMappingURL=SecurityUtils.d.ts.map