pub struct CodexTokenManager { /* private fields */ }Expand description
Manages OAuth tokens for the Codex backend API.
Holds an Arc<dyn OAuthCredentialStorage> so callers can swap in keyring-backed,
file-backed, or in-memory stores without changing this type.
Implementations§
Source§impl CodexTokenManager
impl CodexTokenManager
pub fn new(store: Arc<dyn OAuthCredentialStorage>, credential_key: &str) -> Self
Sourcepub async fn get_valid_token(&self) -> Result<(String, String), LlmError>
pub async fn get_valid_token(&self) -> Result<(String, String), LlmError>
Get a valid access token and account ID.
Returns (access_token, account_id). The account ID is extracted from
the JWT’s https://api.openai.com/auth claim field chatgpt_account_id.
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Clear the cached token (e.g. after a 401 response)
Auto Trait Implementations§
impl !Freeze for CodexTokenManager
impl !RefUnwindSafe for CodexTokenManager
impl Send for CodexTokenManager
impl Sync for CodexTokenManager
impl Unpin for CodexTokenManager
impl UnsafeUnpin for CodexTokenManager
impl !UnwindSafe for CodexTokenManager
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> 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>
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 moreCreates a shared type from an unshared type.