Skip to content

Show who wrote, where, and the first line in a push, on iPhone (GRYT-1688) - #316

Merged
sivert-io merged 1 commit into
mainfrom
claude/GRYT-1688-encrypted-previews
Oct 7, 2026
Merged

sivert-io merged 1 commit into
mainfrom
claude/GRYT-1688-encrypted-previews

Conversation

@sivert-io

@sivert-io sivert-io commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Pushes said "Gryt · New message". With this and the server half, an iPhone shows "Alice", "#general · Gryt" and the first line. Only this phone can read it.

  • The phone makes a random 32-byte key for each server, with its push capability, and sends it as previewKey in push:register. A new capability gets a new key. Forgetting a server deletes its key.
  • The keys, by the relay's tag for each server, go into the app group's defaults through a small native module (modules/push-preview), because the extension can't reach the app's own storage.
  • A new Notification Service Extension, GrytNotify (targets/notify, plugins/withNotificationExtension.js), opens the sealed preview with CryptoKit and swaps in the title, subtitle and body. If anything doesn't open (no key, wrong key, an old server), it leaves the relay's fixed text, so the worst case is what it was before.

Apple side, already done: the App ID chat.gryt.app.notify is registered with App Groups and group.chat.gryt.app. CI makes its profile on the next build (the dry run lists it as "would create"), and the entitlement check from #313 stops the upload if the extension comes out without its group.

The server half is Gryt-chat/server#286 and the relay half is Gryt-chat/push#3. Android keeps the fixed text for now (GRYT-1698).

Tested:

  • The extension's actual Swift, compiled with a small harness, opens a blob sealed by the server code and returns "Alice | #general · Gryt | build is green 🎉". A wrong key, no key or another server's tag return nothing, so the fixed text stays.
  • expo prebuild generates the target with its plist and entitlements, and the target builds for the simulator on its own.
  • tsc is clean and the notify tests pass.

Not tested: a real push to a phone. That needs this build on TestFlight and the server on beta.

🤖 Generated with Claude Code

…1688)

Pushes said "Gryt · New message". With this and the server half, an iPhone shows "Alice", "#general · Gryt" and the first line. Only this phone can read it.

- The phone makes a random 32-byte key for each server, with its push capability, and sends it as `previewKey` in `push:register`. A new capability gets a new key. Forgetting a server deletes its key.
- The keys, by the relay's tag for each server, go into the app group's defaults through a small native module (`modules/push-preview`), because the extension can't reach the app's own storage.
- A new Notification Service Extension, `GrytNotify` (`targets/notify`, `plugins/withNotificationExtension.js`), opens the sealed preview with CryptoKit and swaps in the title, subtitle and body. If anything doesn't open (no key, wrong key, an old server), it leaves the relay's fixed text, so the worst case is what it was before.

Apple side, already done: the App ID `chat.gryt.app.notify` is registered with App Groups and `group.chat.gryt.app`. CI makes its profile on the next build (the dry run lists it as "would create"), and the entitlement check from mobile#313 stops the upload if the extension comes out without its group.

The server half is in Gryt-chat/server and the relay half in Gryt-chat/push (linked below). Android keeps the fixed text for now (GRYT-1698).

Tested:

- The extension's actual Swift, compiled with a small harness, opens a blob sealed by the server code and returns "Alice | #general · Gryt | build is green 🎉". A wrong key, no key or another server's tag return nothing, so the fixed text stays.
- `expo prebuild` generates the target with its plist and entitlements, and the target builds for the simulator on its own.
- tsc is clean and the notify tests pass.

Not tested: a real push to a phone. That needs this build on TestFlight and the server on beta.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sivert-io
sivert-io merged commit c7f8fbe into main Oct 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant