mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-11 00:07:15 +01:00
diet-guard's copy was not cosmetic drift from todo's: it takes the device-code and token URLs as parameters, because GitHub's device-flow endpoints send no CORS headers and its desktop **web** build has to route both through a local proxy (`github_client_factory_web.dart` passes them). Shipping only todo's hardcoded version would have broken that build the moment diet-guard adopted the package. So the package takes the more capable variant: `deviceCodeUrl`/`tokenUrl` default to GitHub's own URLs, leaving every other consumer unaffected, and `githubDeviceCodeUrl`/`githubTokenUrl` are exported so callers can reference the defaults rather than retyping the literals. 23 tests (two new ones pin both the defaults and an override actually being used for the request), 100% line coverage, clean analyze. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U4Rj3s7K2qzrLNgJqqPhno
28 lines
1.1 KiB
Dart
28 lines
1.1 KiB
Dart
/// GitHub OAuth **Device Flow** for kuhy's Flutter apps: the auth client and
|
|
/// the modal that drives it.
|
|
///
|
|
/// Four apps (todo, home_inventory, diet-guard, wake-alarm) each carried a
|
|
/// copy of both halves — the todo and home_inventory clients were
|
|
/// byte-identical, as were the diet-guard and wake-alarm dialogs. This
|
|
/// package is that shared copy.
|
|
///
|
|
/// Device flow needs only a public `client_id` (no client secret), which is
|
|
/// what makes it safe for a distributed app; the resulting access token is
|
|
/// then used exactly like a PAT.
|
|
///
|
|
/// Deliberately **not** part of `sync_settings_ui`: that package is
|
|
/// Firebase-only by an explicit 2026-08-12 decision, and folding a GitHub
|
|
/// flow into it would reverse that. The GitHub mirror in these apps is
|
|
/// legacy-but-load-bearing code, so it gets its own home rather than being
|
|
/// merged into the Firebase path or deleted.
|
|
library;
|
|
|
|
export 'src/device_auth.dart'
|
|
show
|
|
DeviceAuthException,
|
|
DeviceCodeResponse,
|
|
GitHubDeviceAuth,
|
|
githubDeviceCodeUrl,
|
|
githubTokenUrl;
|
|
export 'src/device_code_dialog.dart' show DeviceCodeDialog;
|