pub enum CredentialState {
Active,
Expired {
expires_at: u64,
},
SignedOut,
Unreadable(String),
}Expand description
Current access token, proactively refreshed when the stored token
is within REFRESH_SKEW_SECS of expiry (or already expired) and a
refresh token is available. The PARSLEE_ACCESS_TOKEN env override
always wins and is never refreshed — it’s a deliberate injection for
tests/CI. Returns None only when no token is available at all.
Request-time consumers (notably car-inference) should call this
instead of access_token: it’s the difference between a lapsed
token producing a 401 burst that poisons 30-day model health and a
transparent refresh-and-proceed (#313).
Why there is no usable Parslee access token — for ERROR MESSAGES, not for
control flow.
access_token_refreshing returns a bare Option, so every failure renders
as “no credential … run car auth login”. That reads as never
authenticated, and the three states below need different remedies: a token
that aged out mid-run is not the same problem as a signed-out account, and
neither is a keychain that momentarily could not be read. A long job dying
on the first with the message for the second is Parslee-ai/car#797.
Consulted only on the failure path, so the extra store read costs nothing in the hot path.
Variants§
Active
Credentials exist and the access token is not past expiry.
Expired
Credentials exist but the access token is expired (or within the refresh skew) and refresh did not yield a new one — commonly because the refresh token itself is spent, or the network refused.
SignedOut
A published tombstone: no account is active. This is the only state that genuinely means “log in”.
Unreadable(String)
The credential store could not be read at all (locked keychain, helper timeout). Says nothing about whether credentials exist.
Trait Implementations§
Source§impl Clone for CredentialState
impl Clone for CredentialState
Source§fn clone(&self) -> CredentialState
fn clone(&self) -> CredentialState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more