Skip to main content

Module oauth_probe

Module oauth_probe 

Source
Expand description

OAuth token-file probing: the oauth_status canonical-value constants, OAuthProbeStatus, and probe_oauth_status itself.

Split out of the single ~2193-line resolver.rs (pure relocation, no behavior change) — self-contained, on-disk OAuth token-file probing with no dependency on the rest of the resolver module.

Modules§

oauth_status
Canonical-value enumeration for OAuth-class IdentityAccount.status.

Enums§

OAuthProbeStatus
Result of probing a per-bundle OAuth token directory.

Constants§

MAX_SIGN_IN_VALUE
The longest sign-in value that is withheld (bytes). A file a container can write could hold a value so large that the matcher of every withheld value no longer builds, so a longer one is not withheld.

Functions§

claude_token_expiry_ms
When the access token in a Claude config dir’s .credentials.json expires (unix ms), or None when the file is missing, unreadable or has no expiry. A token that expired before a turn failed on “OAuth access token has expired” cannot be the one that is there now if this reads later.
probe_oauth_status
Cheap on-disk probe of the per-bundle OAuth token file for a provider. No network calls — just reads + parses the token JSON, then compares expiresAt against now_ms.
release_sign_in
Stops withholding every value read from the sign-in files under config dir dir: the account that owned the directory is deleted, and its credentials with it.
sign_in_file
The file probe_oauth_status reads the sign-in of provider from under config dir dir, or None for a provider it does not read a file for.
withhold_sign_in
Keeps the tokens in a sign-in file just read out of every transcript: the CLI reads the file itself and renews both tokens while an agent runs, so each look at the file holds what is there now. An access token is withheld until its own expiry, even after a renewed one is in the file (the old one still works); a value with no known expiry stays withheld after the file holds another (up to withhold::KEPT_PER_OWNER per owner). A look that finds no token (a sign-out) leaves what was held.