pub struct KeysConfig {
pub api_keys: HashMap<String, String>,
pub tokens: HashMap<String, String>,
pub service_accounts: HashMap<String, String>,
pub oauth_tokens: HashMap<String, String>,
pub custom_headers: HashMap<String, HashMap<String, String>>,
}Expand description
Structure for storing API keys and secrets
Fields§
§api_keys: HashMap<String, String>Provider API keys - provider_name -> api_key
tokens: HashMap<String, String>Additional authentication tokens (e.g., for search providers)
service_accounts: HashMap<String, String>Service account JSON strings for providers like Google Vertex AI
oauth_tokens: HashMap<String, String>OAuth tokens for providers that use OAuth
custom_headers: HashMap<String, HashMap<String, String>>Custom headers that contain sensitive values (renamed from auth_headers)
Implementations§
Source§impl KeysConfig
impl KeysConfig
Sourcepub fn set_api_key(&mut self, provider: String, api_key: String) -> Result<()>
pub fn set_api_key(&mut self, provider: String, api_key: String) -> Result<()>
Set an API key for a provider
Sourcepub fn get_api_key(&self, provider: &str) -> Option<&String>
pub fn get_api_key(&self, provider: &str) -> Option<&String>
Get an API key for a provider
Sourcepub fn remove_api_key(&mut self, provider: &str) -> Result<bool>
pub fn remove_api_key(&mut self, provider: &str) -> Result<bool>
Remove an API key for a provider
Sourcepub fn set_service_account(
&mut self,
provider: String,
sa_json: String,
) -> Result<()>
pub fn set_service_account( &mut self, provider: String, sa_json: String, ) -> Result<()>
Set a service account JSON for a provider
Sourcepub fn get_service_account(&self, provider: &str) -> Option<&String>
pub fn get_service_account(&self, provider: &str) -> Option<&String>
Get a service account JSON for a provider
Sourcepub fn set_token(&mut self, name: String, token: String) -> Result<()>
pub fn set_token(&mut self, name: String, token: String) -> Result<()>
Set an authentication token
Sourcepub fn set_auth_headers(
&mut self,
provider: String,
headers: HashMap<String, String>,
) -> Result<()>
pub fn set_auth_headers( &mut self, provider: String, headers: HashMap<String, String>, ) -> Result<()>
Set authentication headers for a provider
Sourcepub fn get_auth_headers(&self, provider: &str) -> HashMap<String, String>
pub fn get_auth_headers(&self, provider: &str) -> HashMap<String, String>
Get authentication headers for a provider (returns custom headers)
Sourcepub fn get_auth(&self, provider: &str) -> Option<ProviderAuth>
pub fn get_auth(&self, provider: &str) -> Option<ProviderAuth>
Get authentication for a provider (returns the appropriate auth type)
Sourcepub fn list_providers_with_keys(&self) -> Vec<String>
pub fn list_providers_with_keys(&self) -> Vec<String>
List all providers with configured keys
Sourcepub fn has_auth(&self, provider: &str) -> bool
pub fn has_auth(&self, provider: &str) -> bool
Check if a provider has any authentication configured
Sourcepub fn migrate_from_provider_configs(config: &Config) -> Result<Self>
pub fn migrate_from_provider_configs(config: &Config) -> Result<Self>
Migrate keys from old provider configs to centralized keys.toml
Trait Implementations§
Source§impl Clone for KeysConfig
impl Clone for KeysConfig
Source§fn clone(&self) -> KeysConfig
fn clone(&self) -> KeysConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KeysConfig
impl Debug for KeysConfig
Source§impl Default for KeysConfig
impl Default for KeysConfig
Source§fn default() -> KeysConfig
fn default() -> KeysConfig
Source§impl<'de> Deserialize<'de> for KeysConfig
impl<'de> Deserialize<'de> for KeysConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for KeysConfig
impl RefUnwindSafe for KeysConfig
impl Send for KeysConfig
impl Sync for KeysConfig
impl Unpin for KeysConfig
impl UnwindSafe for KeysConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more