diff --git a/src/web/auth-store.ts b/src/web/auth-store.ts index e98e48b67..53af4469c 100644 --- a/src/web/auth-store.ts +++ b/src/web/auth-store.ts @@ -33,7 +33,7 @@ export function hasWebCredsSync(authDir: string): boolean { } } -function readCredsJsonRaw(filePath: string): string | null { +export function readCredsJsonRaw(filePath: string): string | null { try { if (!fsSync.existsSync(filePath)) { return null; diff --git a/src/web/session.ts b/src/web/session.ts index c02f59388..a9129626f 100644 --- a/src/web/session.ts +++ b/src/web/session.ts @@ -15,6 +15,7 @@ import { ensureDir, resolveUserPath } from "../utils.js"; import { VERSION } from "../version.js"; import { maybeRestoreCredsFromBackup, + readCredsJsonRaw, resolveDefaultWebAuthDir, resolveWebCredsBackupPath, resolveWebCredsPath, @@ -43,21 +44,6 @@ function enqueueSaveCreds( }); } -function readCredsJsonRaw(filePath: string): string | null { - try { - if (!fsSync.existsSync(filePath)) { - return null; - } - const stats = fsSync.statSync(filePath); - if (!stats.isFile() || stats.size <= 1) { - return null; - } - return fsSync.readFileSync(filePath, "utf-8"); - } catch { - return null; - } -} - async function safeSaveCreds( authDir: string, saveCreds: () => Promise | void,