Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(desktop): stop unnecessary macOS Keychain prompts on first launch (#821)

Gabriel Stein96169a318f80
diff --git a/src/helpers/environment.js b/src/helpers/environment.js
index 0629cab1b..99e95a5d2 100644
--- a/src/helpers/environment.js
+++ b/src/helpers/environment.js
@@ -87,17 +87,11 @@ class EnvironmentManager {
}
}
- // Encryption init runs after construction; safeStorage fallback needs app.whenReady().
+ // Encryption initializes lazily. Probing it eagerly would touch the macOS
+ // Keychain before any window is visible. Migration and _loadAllSecrets are
+ // both no-ops on fresh installs, so neither path triggers Keychain until
+ // the user actually saves their first secret.
async init() {
- if (!this._encryptionAvailable()) {
- debugLogger.warn(
- "Secret encryption unavailable — secrets remain in plaintext .env",
- { platform: process.platform },
- "environment"
- );
- return;
- }
-
if (!fs.existsSync(this._getMigrationSentinelPath())) {
await this._migrateToSecureStorage();
}
diff --git a/src/helpers/secretCrypto.js b/src/helpers/secretCrypto.js
index f9f882949..9026e1e08 100644
--- a/src/helpers/secretCrypto.js
+++ b/src/helpers/secretCrypto.js
@@ -69,8 +69,10 @@ function _initKeychain() {
} else {
masterKey = crypto.randomBytes(KEY_LEN);
entry.setPassword(masterKey.toString("base64"));
+ // Write the safeStorage backup only when the key is first generated.
+ // Re-writing on every launch invokes a second Keychain backend on macOS.
+ _saveMasterKeyBackup();
}
- _saveMasterKeyBackup();
return true;
} catch (error) {
debugLogger.warn(