mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 15:56:01 +00:00
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>
39 lines
2.3 KiB
Python
Executable File
39 lines
2.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Reproduce the pinned Nexus source and DroidDeck credential transport."""
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
|
|
recipe = Path(__file__).resolve().parent
|
|
cache = Path(sys.argv[1]).resolve()
|
|
lock = json.loads((recipe / 'backend.lock.json').read_text())
|
|
local_patches = ['droiddeck-credentials.patch', 'droiddeck-launch-view.patch', 'droiddeck-library-subscriptions.patch',
|
|
'droiddeck-credential-fallback.patch', 'droiddeck-credential-diagnostics.patch']
|
|
identity = hashlib.sha256((recipe / 'backend.lock.json').read_bytes() + b''.join((recipe / name).read_bytes() for name in local_patches)).hexdigest()
|
|
source = cache / ('source-' + identity[:16])
|
|
if not (source / '.prepared').is_file():
|
|
if source.exists():
|
|
raise RuntimeError('Incomplete Xbox source directory; inspect it before retrying: ' + str(source))
|
|
source.mkdir(parents=True)
|
|
nexus = cache / ('nexus-' + lock['nexusCommit'])
|
|
for directory, remote, commit in ((source, lock['repository'], lock['commit']),
|
|
(nexus, 'https://github.com/domsvoboda/xodus-nexus.git', lock['nexusCommit'])):
|
|
directory.mkdir(parents=True, exist_ok=True)
|
|
if not (directory / '.git').is_dir():
|
|
subprocess.run(['git', 'init', '-q', str(directory)], check=True)
|
|
subprocess.run(['git', '-C', str(directory), 'fetch', '-q', '--depth', '1', remote, commit], check=True)
|
|
subprocess.run(['git', '-C', str(directory), 'checkout', '-q', '--detach', 'FETCH_HEAD'], check=True)
|
|
assert subprocess.check_output(['git', '-C', str(directory), 'rev-parse', 'HEAD'], text=True).strip() == commit
|
|
assert hashlib.sha256((source / 'Cargo.lock').read_bytes()).hexdigest() == lock['cargoLockSha256']
|
|
for patch in lock['patches']:
|
|
file = nexus / 'assets' / patch['file']
|
|
assert hashlib.sha256(file.read_bytes()).hexdigest() == patch['sha256']
|
|
subprocess.run(['git', '-C', str(source), 'apply', str(file)], check=True)
|
|
for name in local_patches:
|
|
subprocess.run(['git', '-C', str(source), 'apply', str(recipe / name)], check=True)
|
|
(source / '.prepared').write_text(identity + '\n')
|
|
assert (source / '.prepared').read_text().strip() == identity
|
|
print(source)
|