mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
Xbox: fix sign-in on phones with a slow StrongBox Keystore (#1521)
On some phones (tester: Honor BKQ-N49, Android 17) Xbox sign-in stopped with "the Xbox helper stopped with exit code 1" before Microsoft's page opened. The backend asks the app to read and save credentials over a socket and waits 10 s for each reply. The app sealed credentials with a StrongBox-backed Keystore key, and each StrongBox operation took 7-15 s on that phone, so the backend gave up. The app still finished those saves afterwards, leaving a record without a username that every later attempt had to read back slowly. - Seal new store credentials with a TEE Keystore key (v2 envelopes); v1 envelopes still open with the old key and move to v2 on their next write. - A sign-in discards an Xbox record without a username (an unfinished sign-in) before starting the backend. - The backend waits 30 s for the app's credential reply. - The backend names the failing step instead of only credential-io (socket connect/exchange, session lock, missing socket name/port/key), and falls back to a keyed 127.0.0.1 port when the abstract socket is refused. - The app's credential listener logs and retries accept errors, serves each connection on its own thread, and logs slow requests with per-stage times. Refs #1337, #1300 Co-authored-by: KeegantheVeganat0r <58369898+KeegantheVeganat0r@users.noreply.github.com>
This commit is contained in:
1 parent
82d8eb3b79
commit
5ca1f610ab
11 files changed
+541
-41
No files matched your search
@@ -201,4 +201,20 @@ class StoreAccountsCipherTest {
|
||||
assertFalse(StoreAccounts.isUnavailable(Store.AMAZON))
|
||||
assertFalse(file(Store.AMAZON).exists())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun teeEnvelopesUseTheCurrentKeyAndOlderOnesTheLegacyKey() {
|
||||
val legacy = SecretKeySpec(ByteArray(32) { 7 }, "AES")
|
||||
val keys = object : CredentialCipher.KeyProvider {
|
||||
override fun key(): SecretKey = key
|
||||
override fun legacy(): SecretKey = legacy
|
||||
override val version: Int get() = CredentialCipher.VERSION_TEE
|
||||
}
|
||||
val old = CredentialCipher.seal("old", CredentialCipher.KeyProvider { legacy })
|
||||
assertEquals(CredentialCipher.VERSION, old.getInt("v"))
|
||||
assertEquals("old", CredentialCipher.open(old, keys))
|
||||
val new = CredentialCipher.seal("new", keys)
|
||||
assertEquals(CredentialCipher.VERSION_TEE, new.getInt("v"))
|
||||
assertEquals("new", CredentialCipher.open(new, keys))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user