Files
andon/scripts/generate-vapid.ts
Julien Calixte 0745ad14f0 feat(push): owner enrolment UI, service worker and VAPID keygen (T10)
EnableNotifications subscribes the owner's device with the public VAPID
key and stores it; sw.js receives pushes and opens /defects on click;
`pnpm vapid:keys` mints the key pair.
2026-05-28 01:23:10 +02:00

11 lines
460 B
TypeScript

// One-off helper to mint a VAPID key pair for Web Push (T10).
// Run with `pnpm vapid:keys`, then paste the values into your .env:
// NUXT_PUBLIC_VAPID_PUBLIC_KEY (sent to the browser)
// NUXT_VAPID_PRIVATE_KEY (server secret — never expose)
import webpush from 'web-push'
const { publicKey, privateKey } = webpush.generateVAPIDKeys()
console.log('NUXT_PUBLIC_VAPID_PUBLIC_KEY=' + publicKey)
console.log('NUXT_VAPID_PRIVATE_KEY=' + privateKey)