This is the current push notifications code. It uses the full payload rather than the signal type. It creates needed certs and doesn't require any third-party libs outside the cryptography library
This is the current push notifications code. It uses the full payload rather than the signal type. It creates needed certs and doesn't require any third-party libs outside the cryptography library
These keys need to be persisted because the public key is sent to the browser's PushNotification service.
The reason for the PKCS8 file is just for debugging and can be removed
These keys need to be persisted because the public key is sent to the browser's PushNotification service.
The reason for the PKCS8 file is just for debugging and can be removed
Then it's easy, i prefer this. Because let's face it, that frombase64 code doesn't do so much. Don't see a reason to exclude browsers for such simple functionality.
Then it's easy, i prefer this. Because let's face it, that frombase64 code doesn't do so much. Don't see a reason to exclude browsers for such simple functionality.
Python base64 parsing discards excessive padding (=) but will not add it if it's missing, causing it to think the base64 is bad if it isn't 4 char aligned
Python base64 parsing discards excessive padding (`=`) but will not add it if it's missing, causing it to think the base64 is bad if it isn't 4 char aligned
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This is the current push notifications code. It uses the full payload rather than the signal type. It creates needed certs and doesn't require any third-party libs outside the cryptography library
@@ -65,0 +51,4 @@console.log("Notification closed", event);})self.addEventListener("fetch", (event) => {Only added because somewhere while reading this was a requirement on some browsers to get push notifications to work with WPAs
@@ -0,0 +20,4 @@PRIVATE_KEY_FILE = Path("./notification-private.pem")PRIVATE_KEY_PKCS8_FILE = Path("./notification-private.pkcs8.pem")PUBLIC_KEY_FILE = Path("./notification-public.pem")These keys need to be persisted because the public key is sent to the browser's PushNotification service.
The reason for the PKCS8 file is just for debugging and can be removed
@@ -31,0 +8,4 @@const keyResponse = await fetch('/push.json')const keyData = await keyResponse.json()const publicKey = Uint8Array.from(atob(keyData.publicKey), c => c.charCodeAt(0))In the future this can be replaced with
Uint8Array.fromBase64()It's just not available in chrome/old firefox ;PThen it's easy, i prefer this. Because let's face it, that frombase64 code doesn't do so much. Don't see a reason to exclude browsers for such simple functionality.
@@ -0,0 +149,4 @@salt = os.urandom(16)user_key_bytes = base64.urlsafe_b64decode(p256dh + "==")Python base64 parsing discards excessive padding (
=) but will not add it if it's missing, causing it to think the base64 is bad if it isn't 4 char aligned@@ -31,0 +52,4 @@}});};registerServiceWorker(true).catch(console.error);Some browsers will show the permission prompt immediately, others require a "registered" interaction
5a5d1cb3ddto272998f757