From 738e4c4222144dfefa594ac50adefc9c3e3cdb9e Mon Sep 17 00:00:00 2001 From: Pauljd Date: Tue, 10 Nov 2026 01:30:16 +0000 Subject: [PATCH] Play signing plan: the debug key, rotation, Play flavour, version codes Co-Authored-By: Claude Opus 5.5 --- docs/PLAY-APP-SIGNING-2026-11-10.md | 2 + docs/PLAY-SIGNING-PLAN-2026-11-10.md | 108 +++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 docs/PLAY-SIGNING-PLAN-2026-11-10.md diff --git a/docs/PLAY-APP-SIGNING-2026-11-10.md b/docs/PLAY-APP-SIGNING-2026-11-10.md index 3e3a44fb..b2d58b99 100644 --- a/docs/PLAY-APP-SIGNING-2026-11-10.md +++ b/docs/PLAY-APP-SIGNING-2026-11-10.md @@ -2,6 +2,8 @@ Research only. No keys were created, exported or uploaded. +**Update, same night:** the current key turned out to be an Android debug key, which Play refuses. See PLAY-SIGNING-PLAN-2026-11-10.md for the way through (rotate to a proper key first, then give Play that key). + ## How it works for a new app - Every new Play app uses Play App Signing. Google holds the **app signing key** and signs what people install. diff --git a/docs/PLAY-SIGNING-PLAN-2026-11-10.md b/docs/PLAY-SIGNING-PLAN-2026-11-10.md new file mode 100644 index 00000000..3861c654 --- /dev/null +++ b/docs/PLAY-SIGNING-PLAN-2026-11-10.md @@ -0,0 +1,108 @@ +# Orbit on Google Play: signing and release plan (10 November 2026) + +This is a plan only. No key has been generated, exported, uploaded or replaced, and both TVs are unchanged. Every step +marked **(your OK)** waits for your separate approval. + +Your direction is Option A: keep Orbit's signing identity, so the TVs can move to the Play version without losing household +data. Below are your six points, then the order I'd do things in. + +--- + +## 1. The current key: what it is and how it's backed up + +What I checked, from the certificate inside the APKs (the key itself wasn't opened): + +| | | +| --- | --- | +| Certificate | `CN=Android Debug, O=Android, C=US`, an Android **debug** key | +| Algorithm and size | RSA 2048, certificate signed with SHA-256 with RSA | +| Valid | 31 Oct 2026 to 23 Oct 2056 | +| Certificate SHA-256 | `042f963772f0b6f8b983742287f9487d7e2cfc8491676966c60297d3390558e1` | +| Signature schemes | v2 only (no v1, no v3) | +| Where it lives | `orbit-tv/.tooling/android/debug.keystore`, created by the build tools on 31 October. Every release build uses it (`signingConfig = debug` in build.gradle.kts). | +| Keystore file SHA-256 | `e7267d42c23b128daba81c1cb5c4ba348d7e0e73be8a860115bf89c6216dbe98` | + +**What this means:** + +- **Strength is fine.** RSA 2048 meets Play's minimum, and the private key is unique to this file. +- **The identity isn't.** A debug keystore uses the public password `android`, so the file itself is the only protection. +- **Play refuses it.** Google Play rejects anything "signed in debug mode". That certainly applies to uploads, so this key can't be the upload key. Google doesn't say whether the PEPK route also accepts a debug certificate as the app signing key. Either way, I wouldn't make it Orbit's public identity for 30 years. +- **It breaks rule 5 today.** The key sits in a folder that I, the build tools and anything else on this PC can read. + +**Backup integrity.** You checked the Bitwarden copy against the local file on 8 November. The stick wasn't mounted tonight, so I couldn't check that copy. To check both, decrypt each to a temporary file yourself and compare its SHA-256 with `e7267d42…be98` above. I can prepare a script that only prints match or no match, and you'd type the passphrases. + +## 2. How Play takes an existing key + +From Play Console Help, "Use Play App Signing": + +1. Create the app in Play Console. By default, Google will generate an app signing key for it. +2. Create an **upload key** (RSA 2048 or more) and sign the app bundle with it. +3. Upload the bundle to the **internal testing** track only. +4. **Before any open-testing or production release**: go to Protected with Play > Play Store protection > Manage Play app signing, choose **Change key**, then **Provide a copy of your app signing key**. +5. Play Console shows a PEPK command with its own encryption key. PEPK encrypts the key on your machine, and you upload the encrypted zip it produces. +6. After that first public release, the key can only change through Play's **Upgrade key**. + +## 3. The way through: rotate to a proper key first, then give Play that key + +Android has supported **signing-key rotation** since Android 9 (the TVs run Android 14). An APK signed with a new key plus +a "lineage" signed by the old key installs as an ordinary update. Android then trusts the new key for that app from then on. + +So Option A becomes: + +1. **(your OK)** You create a proper **app signing key** (RSA 4096, your own name in the certificate) on your machine, with the stick mounted. It never goes into the repository, CI, or a folder I can read. +2. **(your OK)** You create the lineage (debug key to new key) with `apksigner rotate`. The lineage file isn't secret. +3. **(your OK)** You sign one self-hosted release with the new key and the lineage. The TVs take it as a normal update and keep all their data. +4. **(your OK)** You give that new key to Play through PEPK (step 2 above). Play's builds then carry the same key the TVs now trust. +5. The debug key retires. It stays backed up so older APKs can still be checked, and it's removed from `.tooling`. + +Things to settle in the test before the TVs see it: + +- **The Rooms updater compares keys.** Rooms passes updates between TVs and only accepts "signed by exactly the same keys". During rotation it would refuse the first rotated build. The rotated build has to go to each TV by adb, or the check has to learn about lineage. +- **Older Android.** Orbit supports Android 8 (minSdk 26), where rotation doesn't exist. The lineage keeps the old signature for Android 8 devices. The Play edition could simply start at Android 9. + +## 3b. A test that can be undone, on a disposable install + +Nothing on the TVs, and no real key: + +1. Make two throwaway keys (a stand-in "debug" key and a stand-in "new" key) in a scratch folder. Delete them afterwards. +2. Build the playtest app (its own package, `tv.orbit.classic.playtest`, its own data). Sign version N with the stand-in old key. +3. Install it on a disposable device: an Android TV emulator on this PC (not installed yet) or the playtest slot. Fill it with copied test data: the install-snapshot fixtures and a made-up schedule. +4. Take a snapshot. Install version N+1, signed with the stand-in new key plus the lineage. Take another snapshot, compare them (the same compare_snapshots tool), and check it still plays. +5. Install N+2 signed with the **new key alone**, as Play would sign it, and confirm it updates. +6. Confirm that an APK signed only with the old key is now **refused**. That shows the rotation took. +7. To undo: uninstall the disposable app. The test data is a copy, so nothing real is lost. + +## 4. The Play build, without self-update + +A `play` product flavour beside today's build (call it `household`): + +- **Manifest:** `REQUEST_INSTALL_PACKAGES` is removed in the Play flavour (`tools:node="remove"`). +- **Code:** RoomUpdates' install path (PackageInstaller) lives only in the household source set. The Play flavour gets a version that never offers an install and says "Updates come from Google Play". +- **adb test switches** (shadow comparison, the provider and player switches) are left out of Play, or limited to debuggable builds. +- **Release gate:** verify.sh builds both flavours. It fails if the Play bundle contains `REQUEST_INSTALL_PACKAGES`, `PackageInstaller`, the playtest hook, or a server address. +- **Output:** the Play flavour builds an .aab, signed with the upload key. + +## 5. Where keys live + +| Key | Where | Who uses it | +| --- | --- | --- | +| App signing key (new) | Stick and Bitwarden only, gpg-encrypted as today. Mounted only while you sign. | You, by hand, for self-hosted releases and the one PEPK upload | +| Upload key | Your machine, outside the project, plus one backup. CI never has it. | Signs the .aab before upload. If it leaks, Google can reset it. | +| Debug key (old) | Kept in backups only, retired from `.tooling` after the rotation | Nothing after the rotation | + +Builds from CI and from me stay **unsigned for release**, or signed with a throwaway test key that no TV trusts. A small script you run signs the release APK and the .aab. The Play Console's own encryption key is only ever used inside PEPK on your machine. + +## 6. Self-hosted and Play releases side by side + +- **One package and one key.** After the rotation, a TV can move between a self-hosted build and the Play build in either direction without reinstalling, because both are signed with the same key. +- **One version-code counter.** Each release gets one build number. `versionCode = build × 10 + channel`, where 0 is self-hosted and 2 is Play. The Play build of a release is always higher than the self-hosted build of the same release, and the next release's self-hosted build is higher than both. Android never downgrades, so neither channel can get stuck behind the other. +- **Version names** say the channel: `1.4.0`, and `1.4.0-play` for Play. +- **Updates.** A TV on the Play version updates only through Play. A self-hosted TV keeps the Rooms updater, which only ever accepts the same package and key. + +## Order I'd suggest + +1. The disposable rotation test (no real keys; your OK to set up the emulator). +2. The Play flavour, the gate checks and the version-code scheme (code only, build only). +3. Check the backups (you type passphrases). +4. Create the new key and rotate the TVs (your OK at each step). +5. Developer account, upload key and the PEPK upload (your OK).