IAiKeyStore

References
public interface IAiKeyStore
Persistent storage for LLM-provider API keys. Implementations use the platform's native secret store: macOS Keychain on macOS, DPAPI-encrypted file on Windows. Keys are scoped to the current OS user account and to a specific AiProvider, so an Anthropic key and a Google key can coexist.

Methods

DeleteKey

#
void DeleteKey(AiProvider provider)
Removes the stored key for the given provider. Silent if no key was stored.
provider (AiProvider)

SetKey

#
void SetKey(AiProvider provider, string apiKey)
Stores the given API key for the given provider, overwriting any existing entry. Throws on failure.
provider (AiProvider)
apiKey (string)

TryGetKey

#
string TryGetKey(AiProvider provider)
Returns the stored API key for the given provider, or null if none is stored or it cannot be read.
provider (AiProvider)