Skip to content

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

refactor(corti): fold BYOK reasoning key into the shared secret-key manifest (#1127)

Gabriel Stein647125d068bb
diff --git a/preload.js b/preload.js
index 87ab2d566..62e374456 100644
--- a/preload.js
+++ b/preload.js
@@ -13,6 +13,7 @@ const BYOK_KEY_BRIDGES = [
{ base: "mistral", get: "getMistralKey", save: "saveMistralKey" },
{ base: "openrouter", get: "getOpenrouterKey", save: "saveOpenrouterKey" },
{ base: "tinfoil", get: "getTinfoilKey", save: "saveTinfoilKey" },
+ { base: "corti", get: "getCortiKey", save: "saveCortiKey" },
];
const secretKeyApi = {};
for (const k of BYOK_KEY_BRIDGES) {
@@ -379,8 +380,6 @@ contextBridge.exposeInMainWorld("electronAPI", {
saveCortiClientId: (key) => ipcRenderer.invoke("save-corti-client-id", key),
getCortiClientSecret: () => ipcRenderer.invoke("get-corti-client-secret"),
saveCortiClientSecret: (key) => ipcRenderer.invoke("save-corti-client-secret", key),
- getCortiApiKey: () => ipcRenderer.invoke("get-corti-api-key"),
- saveCortiApiKey: (key) => ipcRenderer.invoke("save-corti-api-key", key),
proxyCortiTranscription: (data) => ipcRenderer.invoke("proxy-corti-transcription", data),
getTinfoilChatModels: () => ipcRenderer.invoke("get-tinfoil-chat-models"),
proxyTinfoilTranscription: (data) => ipcRenderer.invoke("proxy-tinfoil-transcription", data),
diff --git a/src/config/secretKeys.js b/src/config/secretKeys.js
index 480811be2..115d5ed6d 100644
--- a/src/config/secretKeys.js
+++ b/src/config/secretKeys.js
@@ -57,6 +57,13 @@ const BYOK_API_KEYS = [
save: "saveTinfoilKey",
storeKey: "tinfoilApiKey",
},
+ {
+ base: "corti",
+ env: "CORTI_API_KEY",
+ get: "getCortiKey",
+ save: "saveCortiKey",
+ storeKey: "cortiApiKey",
+ },
];
module.exports = { BYOK_API_KEYS };
diff --git a/src/helpers/environment.js b/src/helpers/environment.js
index f4eb701d1..e4a23f9ae 100644
--- a/src/helpers/environment.js
+++ b/src/helpers/environment.js
@@ -13,7 +13,6 @@ const SECRET_KEYS = [
"DEEPGRAM_API_KEY",
"CORTI_CLIENT_ID",
"CORTI_CLIENT_SECRET",
- "CORTI_API_KEY",
"CUSTOM_TRANSCRIPTION_API_KEY",
"CUSTOM_CLEANUP_API_KEY",
"BEDROCK_ACCESS_KEY_ID",
@@ -294,14 +293,6 @@ class EnvironmentManager {
return this._saveKey("CORTI_CLIENT_SECRET", key);
}
- getCortiApiKey() {
- return this._getKey("CORTI_API_KEY");
- }
-
- saveCortiApiKey(key) {
- return this._saveKey("CORTI_API_KEY", key);
- }
-
getCustomTranscriptionKey() {
return this._getKey("CUSTOM_TRANSCRIPTION_API_KEY");
}
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index a7daefffe..6150be7d1 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -2752,14 +2752,6 @@ class IPCHandlers {
return this.environmentManager.saveCortiClientSecret(key);
});
- ipcMain.handle("get-corti-api-key", async () => {
- return this.environmentManager.getCortiApiKey();
- });
-
- ipcMain.handle("save-corti-api-key", async (event, key) => {
- return this.environmentManager.saveCortiApiKey(key);
- });
-
ipcMain.handle(
"proxy-corti-transcription",
async (event, { audioBuffer, language, environment, tenant }) => {
diff --git a/src/services/ReasoningService.ts b/src/services/ReasoningService.ts
index 684109d95..773fc4400 100644
--- a/src/services/ReasoningService.ts
+++ b/src/services/ReasoningService.ts
@@ -108,7 +108,7 @@ class ReasoningService extends BaseReasoningService {
groq: () => window.electronAPI.getGroqKey(),
openrouter: () => window.electronAPI.getOpenrouterKey(),
tinfoil: () => window.electronAPI.getTinfoilKey?.(),
- corti: () => window.electronAPI.getCortiApiKey?.(),
+ corti: () => window.electronAPI.getCortiKey?.(),
};
apiKey = (await keyGetters[provider]()) ?? undefined;
@@ -941,7 +941,7 @@ class ReasoningService extends BaseReasoningService {
const groqKey = await window.electronAPI?.getGroqKey?.();
const openrouterKey = await window.electronAPI?.getOpenrouterKey?.();
const tinfoilKey = await window.electronAPI?.getTinfoilKey?.();
- const cortiKey = await window.electronAPI?.getCortiApiKey?.();
+ const cortiKey = await window.electronAPI?.getCortiKey?.();
const localAvailable = await window.electronAPI?.checkLocalReasoningAvailable?.();
logger.logReasoning("API_KEY_CHECK", {
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 8d4466f03..11b02219b 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -770,7 +770,7 @@ const SECRET_IPC_SAVERS = {
openrouter: "saveOpenrouterKey",
cortiClientId: "saveCortiClientId",
cortiClientSecret: "saveCortiClientSecret",
- cortiApiKey: "saveCortiApiKey",
+ cortiApiKey: "saveCortiKey",
tinfoil: "saveTinfoilKey",
customTranscription: "saveCustomTranscriptionKey",
cleanupCustom: "saveCleanupCustomKey",
@@ -1338,11 +1338,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
debouncedSaveSecret("cortiClientSecret", key);
invalidateApiKeyCaches("corti");
},
- setCortiApiKey: (key: string) => {
- set({ cortiApiKey: key });
- debouncedSaveSecret("cortiApiKey", key);
- invalidateApiKeyCaches("corti");
- },
+ setCortiApiKey: createSecretSetter("cortiApiKey", "cortiApiKey", "corti"),
setCortiEnvironment: createStringSetter("cortiEnvironment"),
setCortiTenant: createStringSetter("cortiTenant"),
setTinfoilApiKey: createSecretSetter("tinfoilApiKey", "tinfoil", "tinfoil"),
@@ -2040,7 +2036,7 @@ export async function initializeSettings(): Promise<void> {
window.electronAPI.getOpenrouterKey?.(),
window.electronAPI.getCortiClientId?.(),
window.electronAPI.getCortiClientSecret?.(),
- window.electronAPI.getCortiApiKey?.(),
+ window.electronAPI.getCortiKey?.(),
window.electronAPI.getTinfoilKey?.(),
window.electronAPI.getCustomTranscriptionKey?.(),
window.electronAPI.getCleanupCustomKey?.(),
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 54ab0b49e..555e82a2d 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -1046,8 +1046,8 @@ declare global {
saveCortiClientId?: (key: string) => Promise<void>;
getCortiClientSecret?: () => Promise<string | null>;
saveCortiClientSecret?: (key: string) => Promise<void>;
- getCortiApiKey?: () => Promise<string | null>;
- saveCortiApiKey?: (key: string) => Promise<void>;
+ getCortiKey?: () => Promise<string | null>;
+ saveCortiKey?: (key: string) => Promise<void>;
proxyCortiTranscription?: (data: {
audioBuffer: ArrayBuffer;
language: string;