Repository navigation
feat(mobile): add encrypted notifications through push relay - #206
Merged
Merged
Conversation
Capture the agreed notification design and testing boundaries published in #196.
Acquire the SQLite writer lock before reading user mutation guards to avoid busy upgrades against delivery workers. Recover unconfirmed test admission with an owned lookup and the same UUID across revision changes and restarts. Refs: #200
This was referenced Oct 3, 2026
This was referenced Oct 16, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Server-originated encrypted mobile notifications through ServerBee Server -> public stateless Cloudflare Workers Relay -> APNs -> iOS Notification Service Extension. The Server owns login, installation/account authorization, category subscriptions and the durable 30-minute delivery window; AES-256-GCM content encryption stays on the Server and decryption stays in the phone's Notification Service Extension.
Architecture decision update (2026-10-03)
This PR implements the approved simpler design. The earlier App Attest/stateful-grant architecture and its acceptance requirements are superseded:
POST /v1/sendWorker endpoint taking the APNs token/environment, event identity/expiry and the existing unchanged AEAD envelope/api/mobile/push/encrypted-register; preserve installation ownership, key lifecycle, logout/revocation, account isolation and authenticated typed-target navigationfetch; enforce hard streaming body/payload bounds, timeouts, bounded concurrency and bounded best-effort source/target/instance-wide limitsThe public endpoint deliberately accepts residual abuse risk. Knowing a valid token permits junk/replayed submissions that can leave a generic notification visible; arbitrary or self-owned-token requests can consume Relay/APNs quota. AEAD protects the encrypted business content, not public endpoint abuse. In-memory limits are per-instance, reset with Workers isolates and do not establish strict global quota enforcement. The Relay receives delivery/envelope metadata and ciphertext, never notification plaintext or content keys; diagnostics must not expose tokens, keys, signing material or request bodies.
Official app identity (2026-10-03)
The official main app, Notification Service Extension and test bundle identifiers are
app.serverbee,app.serverbee.notificationsandapp.serverbee.tests. Private/shared Keychain groups use$(AppIdentifierPrefix)app.serverbeeand$(AppIdentifierPrefix)app.serverbee.push. Historicalcom.serverbee.mobile/com.serverbee.mobile.pushKeychain service labels are intentionally retained for stored-credential compatibility; they are not bundle identifiers. Static identity-drift checks andtestOfficialIdentityReadsHistoricalServiceInDefaultPrivateGrouppassed. Signed-device upgrade continuity remains unverified.Validation status
The simplification and official app identity correction are implemented on
feat/mobile-push-integrationat22c828c4517734b0814240ca4bbe751d126ffa3d. All 17 current PR checks are green, with no pending or failed checks at the final verification on 2026-10-03 at 19:53 UTC. Evidence below is for this exact head:mobile_push_integrationsuite passed all 88 tests with none ignored. Official API generation and the zero-drift gate passedenable_request_signalsettingThe earlier App Attest/grant head
1697f1cced72686d17830897b8f6b6041707f655and its validation remain historical context only.Deployment/configuration checkpoint (2026-10-03, 19:48 UTC): The existing Worker deployment is active.
APNS_TOPICis nowapp.serverbee; the optionalAPNS_ENVIRONMENTSoverride was removed, so the configured default permits sandbox and production. Existing encrypted credential bindings were retained. A safe empty-object POST now returns400 InvalidRequestinstead of503 RelayNotConfigured. This establishes accepted configuration shape only, not signing-key validity or APNs provider acceptance. No request to Apple's APNs provider was made. The Worker runtime bundle is byte-identical betweenae5add3and22c828c, so no code redeploy was needed.Live APNs sandbox/production provider acceptance and delivery, signed-device upgrade continuity, and signed physical-device foreground/background/terminated presentation and taps remain NOT RUN. They require an authorized isolated HTTPS Server/Worker, Apple configuration and credentials, and matching App/NSE provisioning and effective entitlements on a physical device. Simulator/fixture/provider-receipt evidence must stay separate from actual device presentation and navigation. App Attest is no longer a prerequisite. See
tests/manual/mobile-push-integration.mdand the English/Chinese push-relay deployment guides for the remaining acceptance matrix.Historical validation of the superseded App Attest/grant implementation
Validation at
2532e6f2315f0b2b735ebd10190738c100db6c16: 1,544 Server library tests and 270 Server integration tests passed; iOS simulator suites passed 404 tests and 62 selected zh-Hans tests with zero failures or skips; Relay passed 26 tests and secret-transport boundaries passed six cases. Workspace check, strict Clippy, official API generation with zero drift, Web build/types, changed Rust formatting, changed Swift strict lint, and documentation build/types/contracts/routes/browser checks passed. Nine affected checks passed again after integration, including fresh real Server-to-Relay traces and seven actual native consumer/lifecycle tests. Each candidate and integration conflict resolution received independent fixed-SHA review.This record is retained as prior work only. It does not establish the refactored Worker contract, deployment or real APNs/device behavior. Historical local simulator validation used Xcode/iOS SDK 27 and did not establish the CI Xcode 16.4 result.
Refs #196, #197, #198, #199, #200, #201, #202, #203, #204, #205.