#!/usr/bin/env node // Simple VAPID key generator for testing push notifications // In production, you'd want to use proper cryptographic libraries console.log('🔑 VAPID Key Generator for Push Notifications') console.log('') // Generate a random string for testing function generateTestKey(length = 64) { const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_' let result = '' for (let i = 0; i < length; i++) { result += chars.charAt(Math.floor(Math.random() * chars.length)) } return result } // Generate test VAPID keys const publicKey = generateTestKey(87) // Base64 URL-safe, typical length const privateKey = generateTestKey(43) // Base64 URL-safe, typical length console.log('📋 Add these to your .env file:') console.log('') console.log(`VITE_VAPID_PUBLIC_KEY=${publicKey}`) console.log(`VITE_PUSH_NOTIFICATIONS_ENABLED=true`) console.log('') console.log('⚠️ IMPORTANT: These are test keys for development only!') console.log(' For production, generate proper VAPID keys using:') console.log(' - web-push library: npx web-push generate-vapid-keys') console.log(' - online tool: https://vapidkeys.com/') console.log('') console.log('🔐 Private key (keep secure, for backend only):') console.log(`VAPID_PRIVATE_KEY=${privateKey}`) console.log('') console.log('✅ Once added, restart your dev server to apply the changes.')