#!/usr/bin/env node

// Proper VAPID key generator using web-push library
import webpush from 'web-push'

console.log('🔑 VAPID Key Generator for Push Notifications')
console.log('')

try {
  // Generate proper VAPID keys using web-push
  const vapidKeys = webpush.generateVAPIDKeys()
  
  console.log('📋 Add these to your .env file:')
  console.log('')
  console.log(`VITE_VAPID_PUBLIC_KEY=${vapidKeys.publicKey}`)
  console.log(`VITE_PUSH_NOTIFICATIONS_ENABLED=true`)
  console.log('')
  console.log('🔐 Private key (keep secure, for backend only):')
  console.log(`VAPID_PRIVATE_KEY=${vapidKeys.privateKey}`)
  console.log('')
  console.log('✅ Once added, restart your dev server to apply the changes.')
  console.log('')
  console.log('ℹ️  These are cryptographically secure VAPID keys suitable for production.')
  
} catch (error) {
  console.error('❌ Error generating VAPID keys:', error)
  process.exit(1)
}