web-push-libs / webpush-java

Web Push library for Java
MIT License
318 stars 112 forks source link

Provide support for pre-set applicationServerKey #105

Closed mhueck closed 4 years ago

mhueck commented 4 years ago

According to the W3C spec it should be possible to provide an applicationServerKey during subscription. https://www.w3.org/TR/push-api/#dom-pushsubscriptionoptions-applicationserverkey

At the moment the server key is generated with each message. Unfortunately, the methods encrypt() and generateLocalKeyPair() are both static and therefore cannot be overwritten in a super class otherwise I could just extend the PushService and overwrite the methods to take an existing server key. At the moment I would need to overwrite "preparePost()", which is basically most of the complex code.

Are there any plans to support existing server keys or at least to refactor the code in a way that allows it to be extended for that purpose?

mhueck commented 4 years ago

Sorry, just realized that this is done with VAPID.

martijndwars commented 4 years ago

No problem! Feel free to open a new issue if something else pops up.