Skip to content

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

fix(enterprise): persist non-secret config fields to .env

Gabriel Steined3e1c9cb4ad
diff --git a/preload.js b/preload.js
index 206ff9490..fd19dfff7 100644
--- a/preload.js
+++ b/preload.js
@@ -360,14 +360,28 @@ contextBridge.exposeInMainWorld("electronAPI", {
saveCustomReasoningKey: (key) => ipcRenderer.invoke("save-custom-reasoning-key", key),
// Enterprise provider key management
+ getBedrockRegion: () => ipcRenderer.invoke("get-bedrock-region"),
+ saveBedrockRegion: (value) => ipcRenderer.invoke("save-bedrock-region", value),
+ getBedrockProfile: () => ipcRenderer.invoke("get-bedrock-profile"),
+ saveBedrockProfile: (value) => ipcRenderer.invoke("save-bedrock-profile", value),
getBedrockAccessKeyId: () => ipcRenderer.invoke("get-bedrock-access-key-id"),
saveBedrockAccessKeyId: (key) => ipcRenderer.invoke("save-bedrock-access-key-id", key),
getBedrockSecretAccessKey: () => ipcRenderer.invoke("get-bedrock-secret-access-key"),
saveBedrockSecretAccessKey: (key) => ipcRenderer.invoke("save-bedrock-secret-access-key", key),
getBedrockSessionToken: () => ipcRenderer.invoke("get-bedrock-session-token"),
saveBedrockSessionToken: (key) => ipcRenderer.invoke("save-bedrock-session-token", key),
+ getAzureEndpoint: () => ipcRenderer.invoke("get-azure-endpoint"),
+ saveAzureEndpoint: (value) => ipcRenderer.invoke("save-azure-endpoint", value),
getAzureApiKey: () => ipcRenderer.invoke("get-azure-api-key"),
saveAzureApiKey: (key) => ipcRenderer.invoke("save-azure-api-key", key),
+ getAzureDeployment: () => ipcRenderer.invoke("get-azure-deployment"),
+ saveAzureDeployment: (value) => ipcRenderer.invoke("save-azure-deployment", value),
+ getAzureApiVersion: () => ipcRenderer.invoke("get-azure-api-version"),
+ saveAzureApiVersion: (value) => ipcRenderer.invoke("save-azure-api-version", value),
+ getVertexProject: () => ipcRenderer.invoke("get-vertex-project"),
+ saveVertexProject: (value) => ipcRenderer.invoke("save-vertex-project", value),
+ getVertexLocation: () => ipcRenderer.invoke("get-vertex-location"),
+ saveVertexLocation: (value) => ipcRenderer.invoke("save-vertex-location", value),
getVertexApiKey: () => ipcRenderer.invoke("get-vertex-api-key"),
saveVertexApiKey: (key) => ipcRenderer.invoke("save-vertex-api-key", key),
testEnterpriseConnection: (provider, config) =>
diff --git a/src/helpers/environment.js b/src/helpers/environment.js
index 7fc667661..9d05c4efa 100644
--- a/src/helpers/environment.js
+++ b/src/helpers/environment.js
@@ -141,6 +141,18 @@ class EnvironmentManager {
}
// Enterprise providers — AWS Bedrock
+ getBedrockRegion() {
+ return this._getKey("BEDROCK_REGION");
+ }
+ saveBedrockRegion(value) {
+ return this._saveKey("BEDROCK_REGION", value);
+ }
+ getBedrockProfile() {
+ return this._getKey("BEDROCK_PROFILE");
+ }
+ saveBedrockProfile(value) {
+ return this._saveKey("BEDROCK_PROFILE", value);
+ }
getBedrockAccessKeyId() {
return this._getKey("BEDROCK_ACCESS_KEY_ID");
}
@@ -161,14 +173,44 @@ class EnvironmentManager {
}
// Enterprise providers — Azure OpenAI
+ getAzureEndpoint() {
+ return this._getKey("AZURE_OPENAI_ENDPOINT");
+ }
+ saveAzureEndpoint(value) {
+ return this._saveKey("AZURE_OPENAI_ENDPOINT", value);
+ }
getAzureApiKey() {
return this._getKey("AZURE_OPENAI_API_KEY");
}
saveAzureApiKey(key) {
return this._saveKey("AZURE_OPENAI_API_KEY", key);
}
+ getAzureDeployment() {
+ return this._getKey("AZURE_OPENAI_DEPLOYMENT");
+ }
+ saveAzureDeployment(value) {
+ return this._saveKey("AZURE_OPENAI_DEPLOYMENT", value);
+ }
+ getAzureApiVersion() {
+ return this._getKey("AZURE_OPENAI_API_VERSION");
+ }
+ saveAzureApiVersion(value) {
+ return this._saveKey("AZURE_OPENAI_API_VERSION", value);
+ }
// Enterprise providers — GCP Vertex AI
+ getVertexProject() {
+ return this._getKey("VERTEX_PROJECT");
+ }
+ saveVertexProject(value) {
+ return this._saveKey("VERTEX_PROJECT", value);
+ }
+ getVertexLocation() {
+ return this._getKey("VERTEX_LOCATION");
+ }
+ saveVertexLocation(value) {
+ return this._saveKey("VERTEX_LOCATION", value);
+ }
getVertexApiKey() {
return this._getKey("VERTEX_API_KEY");
}
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 56cb16f8b..b68b991a4 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -2392,6 +2392,18 @@ class IPCHandlers {
});
// Enterprise provider key handlers
+ ipcMain.handle("get-bedrock-region", async () => {
+ return this.environmentManager.getBedrockRegion();
+ });
+ ipcMain.handle("save-bedrock-region", async (event, value) => {
+ return this.environmentManager.saveBedrockRegion(value);
+ });
+ ipcMain.handle("get-bedrock-profile", async () => {
+ return this.environmentManager.getBedrockProfile();
+ });
+ ipcMain.handle("save-bedrock-profile", async (event, value) => {
+ return this.environmentManager.saveBedrockProfile(value);
+ });
ipcMain.handle("get-bedrock-access-key-id", async () => {
return this.environmentManager.getBedrockAccessKeyId();
});
@@ -2410,12 +2422,42 @@ class IPCHandlers {
ipcMain.handle("save-bedrock-session-token", async (event, key) => {
return this.environmentManager.saveBedrockSessionToken(key);
});
+ ipcMain.handle("get-azure-endpoint", async () => {
+ return this.environmentManager.getAzureEndpoint();
+ });
+ ipcMain.handle("save-azure-endpoint", async (event, value) => {
+ return this.environmentManager.saveAzureEndpoint(value);
+ });
ipcMain.handle("get-azure-api-key", async () => {
return this.environmentManager.getAzureApiKey();
});
ipcMain.handle("save-azure-api-key", async (event, key) => {
return this.environmentManager.saveAzureApiKey(key);
});
+ ipcMain.handle("get-azure-deployment", async () => {
+ return this.environmentManager.getAzureDeployment();
+ });
+ ipcMain.handle("save-azure-deployment", async (event, value) => {
+ return this.environmentManager.saveAzureDeployment(value);
+ });
+ ipcMain.handle("get-azure-api-version", async () => {
+ return this.environmentManager.getAzureApiVersion();
+ });
+ ipcMain.handle("save-azure-api-version", async (event, value) => {
+ return this.environmentManager.saveAzureApiVersion(value);
+ });
+ ipcMain.handle("get-vertex-project", async () => {
+ return this.environmentManager.getVertexProject();
+ });
+ ipcMain.handle("save-vertex-project", async (event, value) => {
+ return this.environmentManager.saveVertexProject(value);
+ });
+ ipcMain.handle("get-vertex-location", async () => {
+ return this.environmentManager.getVertexLocation();
+ });
+ ipcMain.handle("save-vertex-location", async (event, value) => {
+ return this.environmentManager.saveVertexLocation(value);
+ });
ipcMain.handle("get-vertex-api-key", async () => {
return this.environmentManager.getVertexApiKey();
});
diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts
index 9d30a8767..67c435548 100644
--- a/src/hooks/useSettings.ts
+++ b/src/hooks/useSettings.ts
@@ -58,26 +58,6 @@ export interface ApiKeySettings {
customReasoningApiKey: string;
}
-export interface EnterpriseProviderSettings {
- // AWS Bedrock
- bedrockAuthMode: "sso" | "keys";
- bedrockRegion: string;
- bedrockProfile: string;
- bedrockAccessKeyId: string;
- bedrockSecretAccessKey: string;
- bedrockSessionToken: string;
- // Azure OpenAI
- azureEndpoint: string;
- azureApiKey: string;
- azureDeploymentName: string;
- azureApiVersion: string;
- // GCP Vertex AI
- vertexAuthMode: "adc" | "apikey";
- vertexProject: string;
- vertexLocation: string;
- vertexApiKey: string;
-}
-
export interface PrivacySettings {
cloudBackupEnabled: boolean;
telemetryEnabled: boolean;
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 8f43c2eb2..87db48ebc 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -639,11 +639,13 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
setBedrockRegion: (value: string) => {
if (isBrowser) localStorage.setItem("bedrockRegion", value);
set({ bedrockRegion: value });
+ window.electronAPI?.saveBedrockRegion?.(value);
debouncedPersistToEnv();
},
setBedrockProfile: (value: string) => {
if (isBrowser) localStorage.setItem("bedrockProfile", value);
set({ bedrockProfile: value });
+ window.electronAPI?.saveBedrockProfile?.(value);
debouncedPersistToEnv();
},
setBedrockAccessKeyId: (key: string) => {
@@ -667,6 +669,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
setAzureEndpoint: (value: string) => {
if (isBrowser) localStorage.setItem("azureEndpoint", value);
set({ azureEndpoint: value });
+ window.electronAPI?.saveAzureEndpoint?.(value);
debouncedPersistToEnv();
},
setAzureApiKey: (key: string) => {
@@ -678,11 +681,13 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
setAzureDeploymentName: (value: string) => {
if (isBrowser) localStorage.setItem("azureDeploymentName", value);
set({ azureDeploymentName: value });
+ window.electronAPI?.saveAzureDeployment?.(value);
debouncedPersistToEnv();
},
setAzureApiVersion: (value: string) => {
if (isBrowser) localStorage.setItem("azureApiVersion", value);
set({ azureApiVersion: value });
+ window.electronAPI?.saveAzureApiVersion?.(value);
debouncedPersistToEnv();
},
setVertexAuthMode: (value: string) => {
@@ -692,11 +697,13 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
setVertexProject: (value: string) => {
if (isBrowser) localStorage.setItem("vertexProject", value);
set({ vertexProject: value });
+ window.electronAPI?.saveVertexProject?.(value);
debouncedPersistToEnv();
},
setVertexLocation: (value: string) => {
if (isBrowser) localStorage.setItem("vertexLocation", value);
set({ vertexLocation: value });
+ window.electronAPI?.saveVertexLocation?.(value);
debouncedPersistToEnv();
},
setVertexApiKey: (key: string) => {
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 188ddbe4c..af5a32625 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -841,14 +841,28 @@ declare global {
saveCustomReasoningKey?: (key: string) => Promise<void>;
// Enterprise provider key persistence
+ getBedrockRegion?: () => Promise<string | null>;
+ saveBedrockRegion?: (value: string) => Promise<void>;
+ getBedrockProfile?: () => Promise<string | null>;
+ saveBedrockProfile?: (value: string) => Promise<void>;
getBedrockAccessKeyId?: () => Promise<string | null>;
saveBedrockAccessKeyId?: (key: string) => Promise<void>;
getBedrockSecretAccessKey?: () => Promise<string | null>;
saveBedrockSecretAccessKey?: (key: string) => Promise<void>;
getBedrockSessionToken?: () => Promise<string | null>;
saveBedrockSessionToken?: (key: string) => Promise<void>;
+ getAzureEndpoint?: () => Promise<string | null>;
+ saveAzureEndpoint?: (value: string) => Promise<void>;
getAzureApiKey?: () => Promise<string | null>;
saveAzureApiKey?: (key: string) => Promise<void>;
+ getAzureDeployment?: () => Promise<string | null>;
+ saveAzureDeployment?: (value: string) => Promise<void>;
+ getAzureApiVersion?: () => Promise<string | null>;
+ saveAzureApiVersion?: (value: string) => Promise<void>;
+ getVertexProject?: () => Promise<string | null>;
+ saveVertexProject?: (value: string) => Promise<void>;
+ getVertexLocation?: () => Promise<string | null>;
+ saveVertexLocation?: (value: string) => Promise<void>;
getVertexApiKey?: () => Promise<string | null>;
saveVertexApiKey?: (key: string) => Promise<void>;
testEnterpriseConnection?: (