feat: Yandex sign-in with device code, keychain storage and account status

- ym-api wraps yamuse: device-code flow, token refresh, account status,
  and its own Error type that the UI acts on (expired, denied, network)
- Credentials live in the system keychain, never print their tokens, and
  refresh when within a week of expiry; a rejected token is forgotten
- Sign-in screen with code, QR, copy/open-in-browser, countdown and a
  pasted-token fallback; restoring/unreachable screens on startup
- Sidebar account chip and Settings account card with Plus status and
  sign-out; Settings re-reads the account when opened
- Live device-code test behind --ignored
This commit is contained in:
Yuriy Panov committed 2026-10-15 14:25:45 +06:00
1 parent c4928ae7fe
commit 43e8f86a5d
17 files changed
+2811 -127

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
//! Talks to the real Yandex servers. Run with `cargo test -p ym-api -- --ignored`.
use ym_api::auth::{Auth, Poll};
#[tokio::test]
#[ignore = "network"]
async fn device_code_is_issued_and_pending() {
let auth = Auth::new().unwrap();
let code = auth.request_code().await.expect("device code");
assert!(!code.user_code.is_empty());
assert!(code.verification_url.starts_with("https://"));
assert!(code.interval.as_secs() >= 3);
// Nobody confirmed it, so the first poll must say "pending", not fail.
assert_eq!(auth.poll(&code).await.expect("poll"), Poll::Pending);
}