Skip to content

Instantly share code, notes, and snippets.

View EECOLOR's full-sized avatar

EECOLOR EECOLOR

  • Kaliber
  • Utrecht, Netherlands
View GitHub Profile
@EECOLOR
EECOLOR / generateVapidKeys.js
Last active February 24, 2025 00:13
Web push without external libraries
#!/usr/bin/env node
import { generateKeyPairSync } from 'node:crypto'
import { statSync, writeFileSync } from 'node:fs'
ensureKeyFile('./config/vapid_keys.json')
function ensureKeyFile(keyFile) {
if (statSync(keyFile, { throwIfNoEntry: false })?.isFile())
return