This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useCallback } from 'react';
|
||||
import { usePlatform } from '../platform';
|
||||
import { clearDecryptionCache } from '../components/channel/Messages';
|
||||
|
||||
/**
|
||||
* useLogout — wipes all client-side auth state and hard-reloads the
|
||||
@@ -16,6 +17,16 @@ export function useLogout(): () => Promise<void> {
|
||||
const { session } = usePlatform();
|
||||
|
||||
return useCallback(async () => {
|
||||
// Flush in-memory plaintext before anything else so a failure in a
|
||||
// later step (e.g. platform session clear throws, reload never
|
||||
// fires) still wipes decrypted message content from this tab's
|
||||
// heap. The hard reload below normally covers this already.
|
||||
try {
|
||||
clearDecryptionCache();
|
||||
} catch (err) {
|
||||
console.warn('Failed to clear decryption cache:', err);
|
||||
}
|
||||
|
||||
try {
|
||||
await session?.clear?.();
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user