feat(desktop): wipe local crypto + caches on sign-out

This commit is contained in:
byGalax
2026-05-16 17:09:01 +02:00
parent 41359816f1
commit 50bfb5b137
2 changed files with 58 additions and 1 deletions
+4 -1
View File
@@ -20,6 +20,7 @@ import {
import { useTranslation } from 'react-i18next';
import { ensureInstallId } from '../lib/installId';
import { wipeLocalState } from '../lib/memoryWipe';
import { setSecretStoreUser } from '../lib/secretStore';
import { supabase } from '../lib/supabase';
import { cachedUserKey, ensureLegacyMigrated } from '../lib/userIdentity';
@@ -235,11 +236,13 @@ export function AuthProvider({ children }: { children: ReactNode }) {
}, [session, profile, refreshProfile]);
const signOut = useCallback(async () => {
const uid = session?.user.id ?? null;
await updateOwnProfile(supabase, { presenceState: 'offline' }).catch((err: unknown) => {
console.warn('offline update before sign-out failed', err);
});
await supabaseSignOut(supabase);
}, []);
await wipeLocalState(uid);
}, [session]);
const value = useMemo<AuthContextValue>(
() => ({