MCPcopy
hub / github.com/codeaashu/claude-code / performLogout

Function performLogout

src/commands/logout/logout.tsx:16–48  ·  view source on GitHub ↗
({
  clearOnboarding = false
})

Source from the content-addressed store, hash-verified

14import { clearToolSchemaCache } from '../../utils/toolSchemaCache.js';
15import { resetUserCache } from '../../utils/user.js';
16export async function performLogout({
17 clearOnboarding = false
18}): Promise<void> {
19 // Flush telemetry BEFORE clearing credentials to prevent org data leakage
20 const {
21 flushTelemetry
22 } = await import('../../utils/telemetry/instrumentation.js');
23 await flushTelemetry();
24 await removeApiKey();
25
26 // Wipe all secure storage data on logout
27 const secureStorage = getSecureStorage();
28 secureStorage.delete();
29 await clearAuthRelatedCaches();
30 saveGlobalConfig(current => {
31 const updated = {
32 ...current
33 };
34 if (clearOnboarding) {
35 updated.hasCompletedOnboarding = false;
36 updated.subscriptionNoticeCount = 0;
37 updated.hasAvailableSubscription = false;
38 if (updated.customApiKeyResponses?.approved) {
39 updated.customApiKeyResponses = {
40 ...updated.customApiKeyResponses,
41 approved: []
42 };
43 }
44 }
45 updated.oauthAccount = undefined;
46 return updated;
47 });
48}
49
50// clearing anything memoized that must be invalidated when user/session/auth changes
51export async function clearAuthRelatedCaches(): Promise<void> {

Callers 3

callFunction · 0.85
installOAuthTokensFunction · 0.85
authLogoutFunction · 0.85

Calls 6

flushTelemetryFunction · 0.85
removeApiKeyFunction · 0.85
getSecureStorageFunction · 0.85
clearAuthRelatedCachesFunction · 0.85
saveGlobalConfigFunction · 0.85
deleteMethod · 0.65

Tested by

no test coverage detected