pub struct FileAuthProvider { /* private fields */ }Expand description
File-based AuthProvider.
Concurrency: a single Mutex guards the in-memory cache. Read-heavy
workloads should consider Arc<AuthProvider> + cloning; writes are
rare (interactive login) so a coarse lock is fine.
Implementations§
Source§impl FileAuthProvider
impl FileAuthProvider
Sourcepub fn resolve_api_key(&self, provider: &str) -> Option<String>
pub fn resolve_api_key(&self, provider: &str) -> Option<String>
Resolve an API key against the in-memory boot-time cache.
Use get_api_key_sync for the
dynamic path that re-reads path from disk — that’s the one
Oxicode::create_provider consults, so it picks up writes from
external singletons (e.g. the CLI’s shared_auth_storage()).
Trait Implementations§
Source§impl AuthProvider for FileAuthProvider
impl AuthProvider for FileAuthProvider
Source§fn get_api_key_sync(&self, provider: &str) -> Result<Option<String>, SdkError>
fn get_api_key_sync(&self, provider: &str) -> Result<Option<String>, SdkError>
Sync fast-path — re-reads path from disk on every call so
external writers (e.g. the CLI’s shared_auth_storage() singleton
at oxicode-cli/src/store/auth_storage.rs:1135, which maintains its own
independent in-memory cache) are reflected without restart. This is
the credential source Oxicode::create_provider consults at build /
switch_model / refresh_credentials time; per-call file I/O is
negligible on those paths. Issue #40.
Source§fn get_api_key(
&self,
provider: &str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, SdkError>> + Send + '_>>
fn get_api_key( &self, provider: &str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, SdkError>> + Send + '_>>
Source§fn set_api_key(
&self,
provider: &str,
key: &str,
) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>>
fn set_api_key( &self, provider: &str, key: &str, ) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>>
Source§fn delete_api_key(
&self,
provider: &str,
) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>>
fn delete_api_key( &self, provider: &str, ) -> Pin<Box<dyn Future<Output = Result<(), SdkError>> + Send + '_>>
Source§fn get_oauth(
&self,
provider: &str,
) -> Pin<Box<dyn Future<Output = Result<Option<OAuthToken>, SdkError>> + Send + '_>>
fn get_oauth( &self, provider: &str, ) -> Pin<Box<dyn Future<Output = Result<Option<OAuthToken>, SdkError>> + Send + '_>>
Auto Trait Implementations§
impl !Freeze for FileAuthProvider
impl !RefUnwindSafe for FileAuthProvider
impl Send for FileAuthProvider
impl Sync for FileAuthProvider
impl Unpin for FileAuthProvider
impl UnsafeUnpin for FileAuthProvider
impl UnwindSafe for FileAuthProvider
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.