unbound-claude-code
Version:
Claude Code with Unbound integration - Drop-in replacement for Claude Code with multi-provider routing and cost optimization
112 lines • 2.83 kB
TypeScript
/**
* Unbound Code Storage - API Key and Config Management
*
* Stores API key securely in system keychain when available,
* falls back to file-based storage for cross-platform compatibility
*/
export interface UnboundConfig {
model?: string;
baseUrl?: string;
logLevel?: string;
lastUsed?: string;
apiKey?: string;
useVertex?: boolean;
vertexPrimaryModel?: string;
vertexSmallModel?: string;
isConfigured?: boolean;
}
export declare class UnboundStorage {
private readonly SERVICE_NAME;
private readonly ACCOUNT_NAME;
private readonly CONFIG_DIR;
private readonly CONFIG_FILE;
constructor();
/**
* Generate machine-specific encryption key
*/
private getMachineKey;
/**
* Encrypt sensitive data
*/
private encrypt;
/**
* Decrypt sensitive data
*/
private decrypt;
private ensureConfigDir;
private readConfig;
private writeConfig;
/**
* Store API key securely (keychain preferred, file fallback)
*/
setApiKey(apiKey: string, silent?: boolean): Promise<void>;
/**
* Get stored API key (keychain preferred, file fallback)
*/
getApiKey(): Promise<string | null>;
/**
* Get stored model
*/
getModel(): Promise<string>;
/**
* Store model preference
*/
setModel(model: string): Promise<void>;
/**
* Get full configuration
*/
getFullConfig(): Promise<UnboundConfig>;
/**
* Update configuration
*/
updateConfig(updates: Partial<UnboundConfig>): Promise<void>;
/**
* Clear all stored data including keychain and config file
*/
clearConfig(): Promise<void>;
clearConfigDueToInvalidKey(): Promise<void>;
/**
* Check if API key is stored
*/
hasApiKey(): Promise<boolean>;
/**
* Check if API key is stored (sync version for backward compatibility)
*/
hasApiKeySync(): boolean;
/**
* Get vertex configuration
*/
getVertexConfig(): Promise<{
useVertex: boolean;
model?: string;
smallModel?: string;
}>;
/**
* Store vertex configuration
*/
setVertexConfig(vertexConfig: {
useVertex: boolean;
model?: string;
smallModel?: string;
}): Promise<void>;
/**
* Check if user has completed initial configuration
*/
isConfigured(): Promise<boolean>;
/**
* Mark configuration as complete
*/
markAsConfigured(): Promise<void>;
/**
* Get startup display configuration
*/
getStartupConfig(): Promise<{
hasApiKey: boolean;
model: string;
useVertex: boolean;
vertexPrimaryModel?: string;
vertexSmallModel?: string;
baseUrl: string;
}>;
}
//# sourceMappingURL=storage.d.ts.map