pub fn save_api_key(api_key: &str) -> Result<SavedCredential>Expand description
Save the active provider’s API key.
The selected durable secret backend is attempted first. On success the
config keeps only non-secret auth metadata and any older plaintext copy is
removed. When the secret-store write fails (OS permission denied, corrupt
or read-only file backend, etc.), the save fails loudly rather than writing
the key to plaintext config.toml.
Under cfg(test) the secret-store path is enabled only when the test sets
both an isolated CODEWHALE_HOME and an explicit backend, preventing unit
tests from touching the developer’s real credential store.