Package-level declarations
Types
The authorization-code grant with PKCE (RFC 6749 §4.1 + RFC 7636) through a loopback redirect (RFC 8252 §7.3): the app listens on LoopbackRedirect.port while the user signs in in the browser.
The device authorization grant (RFC 8628): show a code, the user approves it elsewhere.
A one-shot HTTP listener on the loopback interface for an OAuth redirect (RFC 8252 §7.3). Bound to 127.0.0.1 only — never reachable from the network.
How the browser hands the authorization code back to the app.
A ChatBackend for signed-in providers: takes a fresh access token each turn and builds the protocol backend with it. If the provider rejects the token (401) before anything was streamed, it refreshes once and retries.
The network half of OAuth: build authorize URLs, exchange and refresh tokens, run the device flow. No Android dependencies, so it is unit-tested on the JVM against a local server. Tokens and codes never appear in exception messages.
A sign-in that failed in a way the user should see (denied, expired, wrong state…).
Sign-in methods the app can offer, and what each one produces.
Tokens from an OAuth sign-in. Persist them encrypted (the demo uses SecretStore); never log them.
A way to sign in: AuthorizationCodeFlow (browser) or DeviceCodeFlow (code on another screen).
Hands out a usable access token, refreshing it when it's about to expire. Refreshes are single-flight: concurrent callers wait for one refresh instead of racing (providers that rotate refresh tokens would otherwise invalidate each other's).
Where signed-in tokens live; implement it over encrypted storage.