fix: add defensive check for isEncryptionAvailable method
The isEncryptionAvailable() function was throwing "Cannot read properties of undefined" when safeStorage exists but doesn't have the isEncryptionAvailable method (can occur on some Electron versions). This was causing the entire settings UI to fail rendering after the Authentication heading, hiding all API key management controls. Fix: Add typeof check before calling safeStorage.isEncryptionAvailable() to ensure the method exists before attempting to call it.
This commit is contained in:
@@ -70,5 +70,7 @@ export function decryptApiKey(stored: string): string {
|
||||
* @returns true if safeStorage encryption is available
|
||||
*/
|
||||
export function isEncryptionAvailable(): boolean {
|
||||
return safeStorage !== null && safeStorage.isEncryptionAvailable();
|
||||
return safeStorage !== null &&
|
||||
typeof safeStorage.isEncryptionAvailable === 'function' &&
|
||||
safeStorage.isEncryptionAvailable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user