webpush icon indicating copy to clipboard operation
webpush copied to clipboard

Update for new web push

Open tranvanhieu01012002 opened this issue 1 year ago • 1 comments

Currently browser support newSubscription, so I create new PR to handle new keys for web push. new web push

Task:

  • Update migrate file -> remove old key, update to new keys, add option UUID
  • Add option UUID on document
  • Update send method on src/WebPushChannel.php to allow insert by new key
  • Update test script

tranvanhieu01012002 avatar Jul 11 '24 17:07 tranvanhieu01012002

@cretueusebiu can you check my PR?

tranvanhieu01012002 avatar Jul 22 '24 15:07 tranvanhieu01012002

can this be merged into the main?

dlabsnl avatar Jan 06 '25 22:01 dlabsnl

On the surface this looks like a breaking change, or am I missing something?

eugenefvdm avatar Jan 07 '25 03:01 eugenefvdm

On the surface this looks like a breaking change, or am I missing something?

@eugenefvdm Yes, there is a big change, Webpush change from public_key and token to p256dh and auth keys https://w3c.github.io/push-api/#dom-pushencryptionkeyname https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/getKey

tranvanhieu01012002 avatar Jan 14 '25 16:01 tranvanhieu01012002

I don't understand to need for this PR, to be honest. There is no recent, breaking spec change in de PushSubscription API, as far as I know. I'm using the PushSubscription API in combination with this library for several years now and it's working fine.

It might be good to know that this library supports the auth and p256dh keys already. If you apply the HasPushSubscriptions trait to a Notifiable model you can call updatePushSubscription() with the endpoint as first parameter, the p256dh keys as second parameter and the auth key als third parameter. So, there a no code and database changes needed in my opinion, however this could be stated more clearly in the documentation and maybe the variable names can be changed - however a PHPdoc alone could be helpful.

So, I don't think this PR in this form is necessary. However, improvements to the docs to align better with the terminology from the PushSubscription API can be very helpful.

joostdebruijn avatar Feb 25 '25 15:02 joostdebruijn

I've updated the README with some direct references to the terminology of the Push API. I'll close this PR, thanks for your contribution.

joostdebruijn avatar Mar 03 '25 18:03 joostdebruijn