()
| 1169 | } |
| 1170 | |
| 1171 | export async function removeApiKey(): Promise<void> { |
| 1172 | await maybeRemoveApiKeyFromMacOSKeychain() |
| 1173 | |
| 1174 | // Also remove from config instead of returning early, for older clients |
| 1175 | // that set keys before we supported keychain. |
| 1176 | saveGlobalConfig(current => ({ |
| 1177 | ...current, |
| 1178 | primaryApiKey: undefined, |
| 1179 | })) |
| 1180 | |
| 1181 | // Clear memo cache |
| 1182 | getApiKeyFromConfigOrMacOSKeychain.cache.clear?.() |
| 1183 | clearLegacyApiKeyPrefetch() |
| 1184 | } |
| 1185 | |
| 1186 | async function maybeRemoveApiKeyFromMacOSKeychain(): Promise<void> { |
| 1187 | try { |
no test coverage detected