zilencer: Add endpoint to register push device to bouncer.

This commit adds a zilencer endpoint to let self-hosted
servers register push devices to whom mobile push notifications
will be sent.

POST "/api/v1/remotes/push/e2ee/register"
Payload: realm_uuid, push_account_id, encrypted_push_registration,
bouncer_public_key

The post request needs to be authenticated with the server’s API key.

Note: For Zulip Cloud, a background fact about the push bouncer is
that it runs on the same server and database as the main application;
it’s not a separate service.
So, as an optimization, we plan to directly call the
`do_register_remote_push_device` function and skip the HTTP request.
This commit is contained in:
Prakhar Pratyush
2025-06-10 22:52:32 +05:30
committed by Tim Abbott
parent 5facec1cc3
commit 3c6a3b0d77
6 changed files with 377 additions and 3 deletions

View File

@@ -643,6 +643,9 @@ class RemotePushDevice(models.Model):
# Each app install (token) can have multiple accounts (push_account_id).
# The (push_account_id, token) pair needs to be unique to avoid sending
# redundant notifications to the same account on a device.
#
# Also, the unique index created is used by a query in
# 'do_register_remote_push_device'.
fields=["push_account_id", "token"],
name="unique_remote_push_device_push_account_id_token",
),