Repository navigation
Replies: 1 comment 1 reply
|
I have not yet looked into the details of how Bitwarden implements web-push, but it can probably be done i think. There is a crate called web-push-native which seems to be able to get it to work. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Use case
Third-party Android clients such as Keyguard cannot receive the existing push notifications: the relay delivers through FCM tokens bound to Bitwarden's own Firebase project, and
register_push_deviceonly accepts Android/iOS device types. As a result, a "Log in with device" request is only noticed when the client app is open (WebSocket hub). For people who log out instead of locking and re-login by approving from their phone, this makes the feature unusable.Proposal
Implement the server side of the Web Push API that Bitwarden already defines, sending directly with standard Web Push instead of Azure:
rsa_key.pemis handled.GET /api/config→push.vapidPublicKey.pushTechnologystays0, so official clients keep using the WebSocket hub and nothing changes for them.PUT(andPOST, which Bitwarden keeps as an alias)/api/devices/identifier/{id}/web-push-authwith body{ endpoint, p256dh, auth }, stored in three new nullable columns ondevices(one migration for each of sqlite/mysql/postgresql).send_to_push_relayis called), also POST to the device's Web Push endpoint: RFC 8291 encryption (aes128gcm), RFC 8292 VAPID signature, RFC 8030 headers (TTL,Urgency). Payload: only IDs, same shape as Bitwarden's (type,payloadwithUserIdandId), like the relay today.404/410from the push service, clear the subscription (RFC 8030 §7.3).On the phone, the user picks any UnifiedPush distributor (ntfy, Sunup, gCompat-UP…). The server code is the same for all of them: plain Web Push, no distributor-specific code, no relay, no developer secret.
What does not change
PUSH_ENABLED, FCM/APNs tokens) is untouched.pushTechnology: 0).make_http_request, so the current non-global IP blocking applies; I would additionally requirehttpsendpoints and avoid logging endpoint URLs (they act as secrets).Questions before I write code
WEB_PUSH_ENABLED, defaultfalse), or enabled by default?ring(already a dependency; tested against the RFC 8291 §5 example), or theweb-push-nativecrate?Urgency: lowfor sync events), or only auth requests (types 15/16)?I can write the PR and the tests. A matching client implementation is planned for Keyguard.
All reactions