optivise
Version:
Optivise - The Ultimate Optimizely Development Assistant with AI-powered features, zero-config setup, and comprehensive development support
88 lines • 2.36 kB
TypeScript
/**
* API Key Detection Service
* Automatically detects and securely handles API keys from various IDE configurations
* Supports Cursor, VSCode, JetBrains IDEs, and environment variables
*/
export interface APIKeySource {
source: 'cursor' | 'vscode' | 'jetbrains' | 'environment' | 'manual';
type: 'openai' | 'anthropic' | 'github-copilot' | 'other';
keyName: string;
filePath?: string;
environmentVar?: string;
isValid?: boolean;
}
export interface APIKeyDetectionResult {
found: APIKeySource[];
recommended?: APIKeySource;
hasOpenAI: boolean;
hasAnthropic: boolean;
requiresPermission: boolean;
}
export interface APIKeyPermissionRequest {
sources: APIKeySource[];
reason: string;
usage: string[];
privacy: string[];
}
export declare class APIKeyDetector {
private userHome;
private osType;
constructor();
/**
* Detect all available API keys from various sources
*/
detectAPIKeys(): Promise<APIKeyDetectionResult>;
/**
* Detect API keys from environment variables
*/
private detectEnvironmentVariables;
/**
* Detect API keys from Cursor IDE configuration
*/
private detectCursorKeys;
/**
* Detect API keys from VS Code configuration
*/
private detectVSCodeKeys;
/**
* Detect API keys from JetBrains IDEs
*/
private detectJetBrainsKeys;
/**
* Get potential Cursor IDE configuration paths
*/
private getCursorConfigPaths;
/**
* Get potential VS Code configuration paths
*/
private getVSCodeConfigPaths;
/**
* Get potential JetBrains IDE configuration paths
*/
private getJetBrainsConfigPaths;
/**
* Validate API key format
*/
private validateKeyFormat;
/**
* Select the best API key to recommend for use
*/
private selectRecommendedKey;
/**
* Create permission request for user consent
*/
createPermissionRequest(sources: APIKeySource[]): APIKeyPermissionRequest;
/**
* Test if an API key is working
*/
testAPIKey(source: APIKeySource, apiKey: string): Promise<boolean>;
/**
* Test OpenAI API key
*/
private testOpenAIKey;
/**
* Test Anthropic API key
*/
private testAnthropicKey;
}
//# sourceMappingURL=api-key-detector.d.ts.map