Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): keep startup responsive with a locked Linux keyring #23823

Closedjuliusmarmingewants to merge 14 commits intomain fromrefs/pull/23823/headopened View on GitHub

Showing 2 changed files with 213 additions and 6 deletions.

x
0 of 2 viewed, 2 left
165 additions and 0 deletionsapps/desktop/src/electron/ElectronSafeStorage.test.tsAdded
View file
@@ -0,0 +1,165 @@
+import { assert, describe, it } from "@effect/vitest";
+import * as HostProcess from "@t3tools/shared/HostProcess";
+import * as Cause from "effect/Cause";
+import * as Effect from "effect/Effect";
+import * as Exit from "effect/Exit";
+import * as Fiber from "effect/Fiber";
+import * as Option from "effect/Option";
+import { beforeEach, vi } from "vite-plus/test";
+​
+const safeStorage = vi.hoisted(() => ({
+ isEncryptionAvailable: vi.fn(),
+ encryptString: vi.fn(),
+ decryptString: vi.fn(),
+ isAsyncEncryptionAvailable: vi.fn(),
+ encryptStringAsync: vi.fn(),
+ decryptStringAsync: vi.fn(),
+ getSelectedStorageBackend: vi.fn(),
+}));
+​
+vi.mock("electron", () => ({ safeStorage }));
+​
+import * as ElectronSafeStorage from "./ElectronSafeStorage.ts";
+​
+describe("ElectronSafeStorage", () => {
+ beforeEach(() => vi.resetAllMocks());
+​
+ it.effect("waits on the async keyring instead of blocking on a locked one", () =>
+ Effect.gen(function* () {
+ const ready = Promise.withResolvers<boolean>();
+ // The sync API answers, but on Linux it blocks the main loop while a locked