diff --git a/README.md b/README.md index 77e6bcb..2f35d88 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ navigator.serviceWorker.register('/service-worker.js') The VAPID public key you generated earlier is made available to the client as a `UInt8Array`. To do this, one way would be to expose the urlsafe-decoded bytes from Ruby to JavaScript when rendering the HTML template. ```javascript -window.vapidPublicKey = new Uint8Array(<%= Base64.urlsafe_decode64(ENV['VAPID_PUBLIC_KEY']).bytes %>); +window.vapidPublicKey = <%= ENV['VAPID_PUBLIC_KEY'].delete('=') %>); ``` Your JavaScript code uses the `pushManager` interface to subscribe to push notifications, passing the VAPID public key to the subscription settings.