Design docs for Android push notifications, matching what iOS has today: DM and mention notifications with real message text, grouped per conversation, and tapping one opens it. - **[ADR 0004](docs/adr/0004-push-gateway-hides-device-platform.md):** one push gateway per app distribution serves both platforms, and the relay can't tell an Android installation from an iOS one. - **[ADR 0005](docs/adr/0005-android-push-enrollment-attestation.md):** Android enrollment requires hardware Key Attestation on a locked bootloader, verified offline. Later installation calls are signed with the attested key. - **[ADR 0006](docs/adr/0006-android-notifications-run-app-dart-code.md):** Android builds notifications with the app's own Dart code in a background engine, instead of a native port of the iOS extension. - **[PLANS/ANDROID_PUSH.md](PLANS/ANDROID_PUSH.md):** the spec, plus the tickets it splits into. - **CONTEXT.md:** defines *wake signal* and *push gateway*. The privacy model stays the same: pushes carry a fixed wake signal and nothing about any event. ### Validation A throwaway [prototype](https://github.com/block/buzz/tree/prototype/android-push-headless-dart) checked ADR 0006 against FCM's ~10 s handler budget. It started a headless Dart engine from a killed app, signed in to a local relay and updated a placeholder notification with the real text. | Device | Wake to real text (median, 12 cold runs) | Memory (PSS) | |---|---|---| | Pixel 9a | 0.51 s (worst 0.54 s) | ~45 MB | | Emulator, CPU slowed ~8x | 0.80 s (worst 1.05 s) | ~57 MB | The relay ran on the same machine, so real network latency is still unmeasured. With an unresponsive relay, the placeholder notification stayed and the native watchdog ended the handler. This PR changes documentation only, so no app run applies. ### Regressions None. This PR adds documentation only and changes no behavior. The design keeps iOS push working through the rollout, and the relay learns no more about devices than it does today. --------- Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: Tom Brow <tomb@squareup.com>
2.6 KiB
The push gateway hides each installation's platform from the relay
A relay should learn as little as possible about the devices its members use, so that device details can't help correlate one person's identities. So a push gateway serves one mobile app (an internal build, the public build or a fork's app) on every platform it ships on, rather than one gateway per platform. The installation's platform and push service live only inside the gateway-sealed grant, which the relay stores but can't read. The relay's push lease carries the same fixed transport value on every platform, uses one set of priority classes that the gateway maps to each platform, and follows the same renewal schedule on every platform. Every delivery request the relay sends goes to one platform-neutral gateway route and is the same whatever the device is.
Considered options
- One gateway per platform, with the relay choosing a gateway by platform. It would keep the gateway's one-transport data model, but the relay would have to know each installation's platform.
- Remove
transportfrom the lease. It would tidy the format, but released clients and relays require it, so removing it would need an ordered rollout across clients and relays. Since every platform sends the same constant, it tells the relay nothing, and the leftover value (which names APNs) is the accepted cost.
Consequences
The relay still sees each installation's IP address and connection behavior, which correlate more strongly than platform does. This decision removes the one signal that the push protocol itself added.
One installation still holds a single grant per relay, so two identities on one phone publish leases with the same opaque endpoint, and the relay can link them. Per-identity grants are out of scope for now, but we want to keep them possible. A fork can run its own gateway that issues them. Our gateway allows one delegation per installation and relay today, so offering them there later means relaxing that rule.
Android installations use Firebase Cloud Messaging and require Google Play services. We are interested in also supporting UnifiedPush later, for Android phones without Google Play services (for example privacy-focused Android builds), which fits Buzz's privacy and self-sovereignty goals. That would mean the gateway posting wake signals to push servers its users choose, which brings its own security work. It becomes worth doing once Buzz ships outside Google Play. This ADR doesn't commit to it; it would be one more push service the gateway knows about, with no change on the relay.