Skip to content
Source
Docs
Explore
Skills
MCP servers
For agents
Search or jump to…
Sign in
Sign up
pingdotgg
/
t3code
Pull requests
pingdotgg
t3code
Public
Synced with GitHub
Popular #1
Fork
0
0
0
0
1
2
3
4
5
6
7
8
9
Code
Architecture
Issues
Pull requests
Community
Assets
CI
Agents
Settings
fix(desktop): a locked Linux keyring no longer freezes startup
#35065
Send to my agent
Open
juliusmarminge
wants to merge 2 commits into
main
from
refs/pull/35065/head
·
opened
3 weeks ago
View on GitHub
Conversation
3
Commits
2
Files changed
2
Impact
Showing
2 changed files
with
118 additions
and
16 deletions
.
x
0 of 2 viewed, 2 left
Files
Hide whitespace
Unified
Split
61 additions and 0 deletions
+61
-0
apps/desktop/src/electron/ElectronSafeStorage.test.ts
Added
Diff
Before/After
Viewed
apps/desktop/src/electron/ElectronSafeStorage.test.ts
View file
@@ -0,0 +1,61 @@
1
+
import
*
as
HostProcess
from
"@t3tools/shared/HostProcess"
;
2
+
import
*
as
Effect
from
"effect/Effect"
;
3
+
import
*
as
Exit
from
"effect/Exit"
;
4
+
import
*
as
Fiber
from
"effect/Fiber"
;
5
+
import
{ assert, it }
from
"@effect/vitest"
;
6
+
import
{ vi }
from
"vite-plus/test"
;
7
+
8
+
const
safeStorage = vi.
hoisted
(() => ({
9
+
isEncryptionAvailable
: vi.
fn
(),
10
+
encryptString
: vi.
fn
(),
11
+
decryptString
: vi.
fn
(),
12
+
encryptStringAsync
: vi.
fn
(),
13
+
decryptStringAsync
: vi.
fn
(),
14
+
}));
15
+
16
+
vi.
mock
(
"electron"
, () => ({ safeStorage }));
17
+
18
+
import
*
as
ElectronSafeStorage
from
"./ElectronSafeStorage.ts"
;
19
+
20
+
it.
effect
(
"waits for a locked Linux keyring without calling the blocking sync API"
, () =>
21
+
Effect
.
gen
(
function
* () {
22
+
vi.
resetAllMocks
();
23
+
const
unlocked =
Promise
.
withResolvers
<
void
>();
24
+
safeStorage.
encryptStringAsync
.
mockImplementation
(
async
(value:
string
) => {
25
+
await
unlocked.
promise
;
26
+
// Chromium encrypts empty plaintext to an empty buffer, with no version prefix.
27
+
return
value ===
""
?
Buffer
.
alloc
(
0
) :
Buffer
.
from
(
`v11
${
value
}
`
);
28
+
});
29
+
safeStorage.
decryptStringAsync
.
mockImplementation
(
async
(value:
Buffer
) => ({
30
+
result
: value.
subarray
(
3
).
toString
(),
Home
Search
Explore
Menu