Skip to main content

Crate car_auth

Crate car_auth 

Source
Expand description

Shared Parslee OAuth2 PKCE + token/keychain logic.

Used by car-cli (car auth login parslee, loopback flow) and by car-server (the auth.* JSON-RPC surface that CAR Host.app’s signup GUI drives). The keychain keys + default service exactly match what car-inference reads at request time (PARSLEE_ACCESS_TOKEN, default "car" service) — see car-inference remote.rs::lease_key.

Structs§

TokenSet
/connect/token success body.

Constants§

DEFAULT_API_BASE
PARSLEE_ACCESS_TOKEN_KEY
PARSLEE_API_BASE_KEY
PARSLEE_EXPIRES_AT_KEY
PARSLEE_REFRESH_TOKEN_KEY

Functions§

access_token
Current access token (env override first, then keychain).
api_base
Resolve the API base: explicit override → stored → default.
authorize_url
Build the /connect/authorize URL the user opens in a browser.
clear_tokens
Remove all stored Parslee credentials. Idempotent.
exchange_code
Exchange an authorization code + PKCE verifier for tokens.
fetch_status
Fetch the Parslee session JSON for the stored token. Returns the raw response body (the caller renders it). Ok(None) = not signed in.
new_state
Opaque OAuth state value (CSRF guard).
pkce_challenge
PKCE S256 challenge for a verifier.
pkce_verifier
PKCE code verifier (URL-safe, no padding).
store_tokens
Persist a token set + the API base into the OS keychain (default "car" service — the same place car-inference reads from).