MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / logout

Function logout

apps/client/src/code/auth/logout.ts:6–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { clearClientTokenExpirations } from './tokens';
5
6export async function logout() {
7 mainLogger.sub('logout').info('Logging out');
8
9 const logoutPromise = trpcClient.sessions.logout.mutate();
10
11 authStore().loggedIn = false;
12
13 // Clear storage
14
15 internals.sessionStorage.removeItem('demo');
16
17 internals.storage.removeItem('userId');
18 internals.storage.removeItem('sessionId');
19 internals.storage.removeItem('personalGroupId');
20
21 internals.storage.removeItem('publicKeyring');
22 internals.storage.removeItem('encryptedPrivateKeyring');
23 internals.storage.removeItem('encryptedSymmetricKeyring');
24
25 // Clear token expirations
26
27 clearClientTokenExpirations();
28
29 // Clear loggedIn
30
31 clearCookie('loggedIn');
32
33 await (globalThis as any).electronBridge?.clearLoggedInCookie();
34
35 internals.storage.removeItem('loggedIn');
36
37 try {
38 await logoutPromise;
39 } catch (error) {
40 mainLogger.error(error);
41 }
42
43 location.href = multiModePath('/');
44}

Callers 1

tryRefreshTokensFunction · 0.90

Calls 4

clearCookieFunction · 0.90
multiModePathFunction · 0.90
subMethod · 0.80

Tested by

no test coverage detected