Struct AuthService
pub struct AuthService { /* private fields */ }Implementations§
Source§impl AuthService
impl AuthService
pub fn from_config(config: &Config) -> Self
pub fn new(state_dir: &Path, encrypt_secrets: bool) -> Self
pub async fn load_profiles(&self) -> Result<AuthProfilesData>
Sourcepub async fn list_profile_ids(&self) -> Result<Vec<String>>
pub async fn list_profile_ids(&self) -> Result<Vec<String>>
Read-only listing of persisted profile IDs (no decrypt, no migration).
pub async fn store_openai_tokens( &self, profile_name: &str, token_set: TokenSet, account_id: Option<String>, set_active: bool, ) -> Result<AuthProfile>
pub async fn store_gemini_tokens( &self, profile_name: &str, token_set: TokenSet, account_id: Option<String>, set_active: bool, ) -> Result<AuthProfile>
pub async fn store_xai_tokens( &self, profile_name: &str, token_set: TokenSet, account_id: Option<String>, set_active: bool, ) -> Result<AuthProfile>
pub async fn store_model_provider_token( &self, model_provider: &str, profile_name: &str, token: &str, metadata: HashMap<String, String>, set_active: bool, ) -> Result<AuthProfile>
pub async fn set_active_profile( &self, model_provider: &str, requested_profile: &str, ) -> Result<String>
pub async fn remove_profile( &self, model_provider: &str, requested_profile: &str, ) -> Result<bool>
pub async fn get_profile( &self, model_provider: &str, profile_override: Option<&str>, ) -> Result<Option<AuthProfile>>
pub async fn get_provider_bearer_token( &self, model_provider: &str, profile_override: Option<&str>, ) -> Result<Option<String>>
pub async fn get_valid_openai_access_token( &self, profile_override: Option<&str>, ) -> Result<Option<String>>
pub async fn get_valid_gemini_access_token( &self, profile_override: Option<&str>, client_id: &str, client_secret: &str, ) -> Result<Option<String>>
Sourcepub async fn get_valid_xai_access_token(
&self,
profile_override: Option<&str>,
) -> Result<Option<String>>
pub async fn get_valid_xai_access_token( &self, profile_override: Option<&str>, ) -> Result<Option<String>>
Return a valid xAI OAuth access token, refreshing it when the cached token is close to expiry and a refresh token is available.
Sourcepub async fn get_gemini_profile(
&self,
profile_override: Option<&str>,
) -> Result<Option<AuthProfile>>
pub async fn get_gemini_profile( &self, profile_override: Option<&str>, ) -> Result<Option<AuthProfile>>
Get Gemini profile info (for model_provider initialization).
Sourcepub async fn store_email_oauth2_tokens(
&self,
channel_alias: &str,
profile_name: &str,
token_set: TokenSet,
) -> Result<AuthProfile>
pub async fn store_email_oauth2_tokens( &self, channel_alias: &str, profile_name: &str, token_set: TokenSet, ) -> Result<AuthProfile>
Store an OAuth2 token set for an email channel (keyed by channel alias,
e.g. "email.hotmail"). The alias is used as the profile’s
model_provider field so profiles are namespaced per channel instance.
pub async fn get_valid_email_oauth2_token( &self, channel_alias: &str, profile_override: Option<&str>, token_url: &str, client_id: &str, scopes: &[String], ) -> Result<Option<String>>
Trait Implementations§
Source§impl Clone for AuthService
impl Clone for AuthService
Source§fn clone(&self) -> AuthService
fn clone(&self) -> AuthService
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuthService
impl !RefUnwindSafe for AuthService
impl Send for AuthService
impl Sync for AuthService
impl Unpin for AuthService
impl UnsafeUnpin for AuthService
impl !UnwindSafe for AuthService
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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