The project's first commit, six days and 16 releases after it started. Everything up to this point existed only as files on one machine, with no history and no undo. Contents: single Gradle module, 62 Kotlin files (11,244 lines) and the Needle 2 JNI bridge, 70 tools, 87 passing unit tests, and the five documents in docs/ plus DEVELOPMENT_HISTORY.md and README.md. Not tracked: build outputs (build/, .cxx/, .gradle/), the release APKs in dist/ (~800 MB, rebuildable), local.properties, and .claude/settings.local.json — all machine-specific. The prebuilt libneedle.a files (38 MB) *are* tracked on purpose, so a checkout builds without depending on Hugging Face still serving them.
103 lines
5.2 KiB
Markdown
103 lines
5.2 KiB
Markdown
# The Stitch signing key
|
|
|
|
> **Short version:** a proper release key now exists at `~/.stitch-release-key/`. **Back that folder up
|
|
> off this machine today.** Nothing uses it yet — builds still use the old debug key on purpose, because
|
|
> switching keys forces an uninstall. The switch happens once, deliberately, in the order below.
|
|
|
|
---
|
|
|
|
## Why any of this matters
|
|
|
|
Android refuses to install an app over one signed with a different key. It is a security rule and there
|
|
is no way around it. So the key a release is signed with decides whether a future update can install
|
|
over your phone's copy of Stitch, or whether you have to uninstall first — which erases your API key,
|
|
wake phrase, notes, memories and reminders.
|
|
|
|
Until now, every Stitch release has been signed with **this machine's Android debug key**
|
|
(`~/.android/debug.keystore`). That worked, but it is the wrong key for something you rely on:
|
|
|
|
- It is a throwaway key the Android tools generate automatically, and any tool can regenerate it.
|
|
- It expires. Debug keys are valid for 30 years from creation, but they are not treated as durable.
|
|
- If this machine is ever reinstalled and that file is lost, you can never update Stitch again without
|
|
uninstalling it first.
|
|
|
|
## The new key
|
|
|
|
| | |
|
|
|---|---|
|
|
| Location | `~/.stitch-release-key/stitch-release.jks` |
|
|
| Password file | `~/.stitch-release-key/keystore.properties` (permissions `600`) |
|
|
| Alias | `stitch` |
|
|
| Algorithm | RSA 4096, SHA384withRSA |
|
|
| Valid until | 16 September 2056 |
|
|
| SHA-256 | `79:43:B9:19:BA:DC:EC:CE:F7:C3:67:84:D6:E8:26:8E:7A:54:74:66:06:11:20:37:34:D6:37:9B:21:54:EE:9C` |
|
|
|
|
The password was randomly generated and is stored beside the keystore. That is a deliberate trade-off
|
|
for a personal, single-user, sideloaded app: the folder is `700`, both files are `600`, and the real
|
|
risk here is losing the key, not someone stealing it off your own machine.
|
|
|
|
### Back it up now
|
|
|
|
The whole folder, somewhere that is not this machine — an encrypted drive, a password manager's file
|
|
attachment, or private cloud storage:
|
|
|
|
```sh
|
|
tar czf stitch-release-key-backup.tar.gz -C ~ .stitch-release-key
|
|
```
|
|
|
|
If you lose it, every future Stitch update requires an uninstall. The key cannot be regenerated —
|
|
a new key with identical details is still a different key to Android.
|
|
|
|
## How the build uses it
|
|
|
|
It does not, yet. In `app/build.gradle.kts`:
|
|
|
|
```kotlin
|
|
val useReleaseKey = project.hasProperty("releaseKey") && releaseKeyProps.exists()
|
|
```
|
|
|
|
- `./gradlew assembleRelease` → **debug key** (unchanged; installs over your current Stitch)
|
|
- `./gradlew assembleRelease -PreleaseKey` → **release key** (will NOT install over your current Stitch)
|
|
|
|
Verify either one without building:
|
|
|
|
```sh
|
|
./gradlew :app:signingReport # Store: ~/.android/debug.keystore
|
|
./gradlew :app:signingReport -PreleaseKey # Store: ~/.stitch-release-key/stitch-release.jks
|
|
```
|
|
|
|
## The cutover — do these in order
|
|
|
|
Doing this out of order loses your data. That is the entire reason the backup feature was built first.
|
|
|
|
1. **Back up the key folder** off this machine (above).
|
|
2. On the phone: **Settings → Backup & restore → Save a backup.** Choose a passphrase, write it down,
|
|
and put the file somewhere that is not the phone.
|
|
3. **Check the backup is real** — open the file and confirm it is a few KB of JSON with
|
|
`"format": "stitch-backup"` at the top. An empty or missing file means stop.
|
|
4. Build the changeover release: `./gradlew assembleRelease -PreleaseKey`, copy to `dist/`, verify the
|
|
version with `aapt dump badging`.
|
|
5. On the phone: **uninstall Stitch.** Everything is erased at this point — this is the moment the
|
|
backup exists for.
|
|
6. Install the new APK.
|
|
7. **Settings → Backup & restore → Restore from a backup**, pick the file, type the passphrase.
|
|
8. Close and reopen Stitch.
|
|
9. Re-grant the special permissions — accessibility (Phone control), notification access, Do Not
|
|
Disturb and "modify system settings". **Android does not restore these**, and no app can grant them.
|
|
The backup cannot help here; it is a one-off cost of the changeover.
|
|
10. Check: does the wake phrase still wake it? Does the AI provider still answer? Are your notes and
|
|
reminders there?
|
|
11. From then on, always build with `-PreleaseKey`, and updates install over the top as before.
|
|
|
|
Until step 4 happens, keep building **without** the flag.
|
|
|
|
## If something goes wrong
|
|
|
|
| Problem | What to do |
|
|
|---|---|
|
|
| "App not installed" when installing the new APK | The old Stitch is still there. Uninstall it first (step 5) |
|
|
| Restore says the passphrase is wrong | AES-GCM cannot tell a wrong passphrase from a damaged file. Re-copy the file from wherever you stored it and try again. There is no recovery without the passphrase |
|
|
| Restored, but the AI provider doesn't work | The API key restores, but check Settings → AI & provider → Test connection. If the key looks empty, paste it again |
|
|
| Restored, but the wake phrase never triggers | The fingerprints restore, but the listening service needs a restart — close and reopen Stitch. If it still misses you, retrain (5 recordings) |
|
|
| On-device model gone | Expected. Model files are gigabytes and are not in the backup. Download it again in Settings → On-device model |
|