Root cause of the recurring 401: a revoked key was hardcoded in startup-recovery.ts and onboarding-service.ts and reseeded into composio_settings on every launch, and the interim fix shipped cred.txt as a visible file under resources/. - electron.vite.config.ts reads the gitignored cred.txt at build time and injects the key into the main-process bundle as __COMPOSIO_API_KEY__; no credential file is packaged and the key is not user-visible or configurable. The renderer bundle never sees it. - Delete both hardcoded-key seeders; migration 046 purges stored api_key and never-read toolkits rows while keeping entity_id and auth_config state. - Stop shipping composio_settings in the renderer snapshot.
20 lines
784 B
TypeScript
20 lines
784 B
TypeScript
import { describe, expect, test } from "vitest";
|
|
import { composioApiKey, normalizeComposioApiKey } from "../../src/main/services/composio/composio-credentials";
|
|
|
|
describe("composio credential resolution", () => {
|
|
test("trims the embedded key", () => {
|
|
expect(normalizeComposioApiKey(" ak_live ")).toBe("ak_live");
|
|
});
|
|
|
|
test("a blank key resolves to null so callers report the integration as unconfigured", () => {
|
|
expect(normalizeComposioApiKey("")).toBeNull();
|
|
expect(normalizeComposioApiKey(" ")).toBeNull();
|
|
});
|
|
|
|
test("without the build-time injection the key is null", () => {
|
|
// Vitest runs without the electron-vite define — the same shape as a
|
|
// build from a checkout that has no cred.txt.
|
|
expect(composioApiKey()).toBeNull();
|
|
});
|
|
});
|