feat(desktop): wipe local crypto + caches on sign-out
This commit is contained in:
@@ -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>(
|
||||
() => ({
|
||||
|
||||
Reference in New Issue
Block a user