npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

edgepush

v0.1.1

Published

web push notifications on webcrypto, zero deps, runs on workers deno bun and node

Downloads

272

Readme

edgepush

web push notifications on webcrypto. zero deps. runs on workers, deno, bun, node and anywhere else crypto.subtle exists.

npm i edgepush

why

the package everyone uses does 6.2M downloads a week, was last published in january 2024, carries five dependencies, and is wired directly to node's crypto and https modules. that means it does not run on cloudflare workers, deno deploy, bun's edge target, or any other runtime without node builtins — which is where a lot of push senders now live.

the whole of web push is four crypto.subtle calls: ecdh on p-256, hkdf, aes-128-gcm, and an es256 jwt. none of it needs node.

use

import { sendNotification, generateVapidKeys } from 'edgepush'

// once, and keep these. the public key goes to the browser
const keys = await generateVapidKeys()

const result = await sendNotification(
  subscription,                       // straight from pushManager.subscribe()
  JSON.stringify({ title: 'hello' }),
  { vapid: { ...keys, subject: 'mailto:[email protected]' } }
)

if (result.expired) await db.deleteSubscription(subscription.endpoint)

expired is the one response you have to act on. a 404 or 410 means the browser has thrown the subscription away and it will never work again, so it is returned rather than thrown — pruning dead subscriptions is normal business, not an error. everything else non-2xx throws a PushError.

bring your own transport

import { buildRequest } from 'edgepush'

const { endpoint, headers, body } = await buildRequest(sub, payload, { vapid })
await myQueue.push({ endpoint, headers, body })

useful when you batch pushes, retry through a queue, or are somewhere global fetch is not what you want to use.

testing your own pipeline

servers do not hold subscription private keys, so this is not part of sending — but it makes an end to end test possible:

import { encryptPayload, decryptPayload } from 'edgepush'

const body = await encryptPayload(sub, 'hello')
const back = await decryptPayload(body, { privateKey, publicKey, auth })
// -> Uint8Array of 'hello'

conformance

the encryption is checked byte for byte against the test vector in rfc 8291 appendix a. that is the whole reason to trust it: given the same salt and the same ephemeral key, this library produces exactly the bytes the specification says it should.

the round trip is then tested the other way, with a fresh random salt and sender key each time, to prove a real browser can read what we send.

35 tests covering:

  • the rfc vector, and the rfc vector decrypting back to its plaintext
  • fresh salt and ephemeral key per message, asserted by comparing two sends
  • a payload ceiling of 3993 bytes, enforced before any crypto runs
  • subscription keys rejected when they are the wrong length, the wrong prefix, not base64url, or not actually a point on p-256
  • vapid tokens bound to a single push service, capped at 24 hours per rfc 8292, refused when the private key does not match the public key, and refused when the claims have been swapped
  • 404/410 handled as expiry, other statuses as failures, with the service response truncated rather than echoed whole
  • base64url round tripping at every length, with padding and non-alphabet input handled explicitly

api

  • sendNotification(sub, payload, opts){ status, expired, body }
  • buildRequest(sub, payload, opts){ endpoint, headers, body }
  • generateVapidKeys(){ publicKey, privateKey }
  • vapidHeader(endpoint, vapid) → the Authorization value
  • verifyVapid(header) → the claims, or throws
  • encryptPayload(sub, payload) / decryptPayload(body, keys)
  • isExpired(status) → boolean
  • toB64 / fromB64 — base64url

opts takes ttl, urgency (very-lowhigh), topic, and fetch.

errors are all PushError with a code: BAD_SUBSCRIPTION, PAYLOAD_TOO_LARGE, BAD_VAPID_KEY, BAD_ENDPOINT, REJECTED.

notes

payloads are capped at 3993 bytes after encryption overhead, for the 4096 byte record size every push service accepts. send an id and let the service worker fetch the rest.

a fresh ephemeral key pair and salt are generated for every message. the salt and senderKey options exist only so the rfc vector can be reproduced in a test — reusing either in production would undo the encryption.

runtime

needs global crypto.subtle, so node 20 or newer (node 18 went end of life in april 2025 and never exposed webcrypto as a global). workers, deno and bun all have it.

license

MIT