MatthieuLemoine / electron-push-receiver

A module to bring Web Push support to Electron allowing it to receive notifications from Firebase Cloud Messaging (FCM).
https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0
MIT License
191 stars 62 forks source link

No way to get "auth" and "p256dh" keys #1

Open igor10k opened 6 years ago

igor10k commented 6 years ago

Looks like only token is exposed but auth and p256dh keys are also needed for encryption.

In fact it would've been better to expose an object representing PushSubscribtion instead of just token.

{
  "endpoint": `https://fcm.googleapis.com/fcm/send/dGcJGabyhHheJYlNGCeX....`,
  "keys": {
    "p256dh": "BIPUL12DLfytvTajnryr2PR...",
    "auth":"FPssNDTKnInHVndST...."
  }
}
MatthieuLemoine commented 6 years ago

You want to have access to the encryption keys for sending notification ? You don't need those if you are sending notifications using FCM. FCM is handling the encryption part.

If you're talking about decryption, push-receiver already decrypts the notifications.

MatthieuLemoine commented 6 years ago

And if you're talking about FCM registration. It's already taken care of by push-receiver that's why you only need the FCM token.

igor10k commented 6 years ago

@MatthieuLemoine Chrome 50+ allows receiving payloads within notification but to send this payload the back end needs those keys for encryption.

https://developers.google.com/web/updates/2016/03/web-push-encryption

MatthieuLemoine commented 6 years ago

Ok I see the use case.

For now electron-push-receiver & push-receiver only supports sending notifications through FCM using the FCM serverKey provided by the Firebase console.

What I understand is that you want to use your own push server using the Web Push Protocol. Unfortunately, it's not currently supported by push-receiver.

But it would be great to add support for this.