Skip to content

Conversation

@mcginty
Copy link
Collaborator

@mcginty mcginty commented Jan 28, 2026

This supports both Android and iOS push services, and will allow for the forwarding of encrypted notifications from clients that the targets can decrypt in the background before displaying a more useful notification from the payload.

Closes #20
Closes TryQuiet/quiet#3086

const _logger = baseLogger.extend(config.socket.id)
_logger.debug(`Initializing push notifications WS event handlers`)

async function handleSendPushNotifications(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be easier to port this into an independent server for p2p-only users if we implemented this as an https endpoint. We don't really need web socket features for this afaik. I recognize it's probably easier to just use the qss socket for now though since you can just copy the existing pattern though.

@mcginty mcginty force-pushed the feat/20-push-notifications branch 2 times, most recently from 40d837e to d1fb4d0 Compare February 3, 2026 02:31
@mcginty
Copy link
Collaborator Author

mcginty commented Feb 3, 2026

@adrastaea this is now rewritten to offer QPS up as an HTTP API based on the rough spec in the Notion doc including the UCAN token generation. The Firebase Admin API code is hooked up, but I've been testing on a mock service that can be enabled in local dev environments, so still a bit more to be done there and to make sure the payloads for the /v1/push API is right.

@mcginty mcginty force-pushed the feat/20-push-notifications branch from e0fc9e3 to dea4aea Compare February 4, 2026 22:09
QPS provides the ability to deliver push notifications to devices using
Quiet, using the Firebase Cloud Messaging API to support both Android
and iOS service.

This adds an HTTP API with two endpoints:
 - `POST /v1/register` will register a device notification token and the
   server will respond back with a UCAN token to indicate.

 - `POST /v1/push` will send a single notification to a single device,
   based on the provided UCAN token.

Includes a tool to test WebPush notification via Firebase.

TODO:
 - Still finalize data structures for notification payload.
@mcginty mcginty force-pushed the feat/20-push-notifications branch from dea4aea to 815be0e Compare February 4, 2026 22:15
@mcginty mcginty marked this pull request as ready for review February 4, 2026 22:17
/**
* Mock implementation for testing without Firebase credentials
*/
private sendMock(deviceToken: string, payload: PushPayload): PushResult {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something, but is there a reason why this is actual code in the service rather than using jest.mock in the unit tests? My concern is production code carrying test-only logic complicating reasoning about the code.

Copy link
Collaborator Author

@mcginty mcginty Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I kept it available outside of tests so that one can poke at it locally via the client - it will refuse to allow this mock mode when the environment is production, but I can also just put this in test code only before we merge this.

apns: {
payload: {
aps: {
contentAvailable: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need mutableContent: true in order to allow the NSE to modify the notification based on what it pulls and decrypts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, will do - this data structure as-is is currently a "placeholder" since I wasn't sure what all was needed for our uses.

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.

Push Notifications Create Push Notification Service

2 participants