pub fn clear_api_key() -> Result<()>Expand description
Clear every saved API key from config-file storage AND the durable secret store.
The full-wipe logout path (codewhale-tui --logout, auth logout)
calls this to remove credentials so the next request can’t
silently use a stale config key (#343). The function removes the legacy
root api_key entry and every api_key entry nested in a
[providers.<name>] table, leaving keys like api_key_env, comments,
and formatting untouched, then deletes every provider’s secret-store
slot — symmetric with CLI logout (#5159) — so a stored credential cannot
survive logout and reappear through the read chain (#5196). The TUI
/logout command stays single-provider and goes through
clear_active_provider_api_key instead.
Environment variables (DEEPSEEK_API_KEY, etc.) are intentionally
not unset — they are managed by the user’s shell and outside the
CLI’s purview. Config::active_route_api_key’s explicit-override path
(Path 0) ensures a freshly-entered key still wins over a stale env
var that lingers from a previous session.