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

@dahp/postern

v1.0.4

Published

Let people send a password, text, link or file from their phone to your page or app by scanning a QR code. End-to-end encrypted (HPKE, RFC 9180).

Readme

@dahp/postern

Let people send a password, text, link or file from their phone to your web page or app. They scan a QR code, type or paste on the phone, and it arrives end-to-end encrypted. No app to install, no accounts.

  • Private: encrypted on the phone with a one-time key only your page holds (HPKE, RFC 9180: X25519, HKDF-SHA256, AES-256-GCM). The relay passes on ciphertext it can't read.
  • Small: one button, or a headless API for your own design.
  • Works everywhere JavaScript runs: browsers, smart-TV web apps (Samsung Tizen, LG webOS), Electron, Node 20+. Plain HTTP long polling where WebSocket isn't available.
  • Open protocol: native apps (Android, Google TV, iOS, Apple TV) can use the REST API directly.

Live demo: https://postern.dahp.io/developers · Browser extension: Chrome Web Store · Firefox Add-ons

Install

npm install @dahp/postern

Or with a script tag, which defines window.Postern:

<script src="https://cdn.jsdelivr.net/npm/@dahp/postern@1/dist/postern.global.js"></script>

Add a "From phone" button to a field

<input type="password" id="password" data-postern>
<script type="module">
  import { attachAll } from "@dahp/postern/ui";
  attachAll();
</script>

Or place the button yourself:

<input type="password" id="password">
<postern-button for="password"></postern-button>

The button opens a dialog with the QR code. After the phone sends, the user checks the 4-digit code and clicks Use it, and the field is filled the way typing would fill it, so React, Vue and Angular see the change.

To handle the item yourself (files, for example), cancel the default fill:

button.addEventListener("postern-receive", (event) => {
  event.preventDefault();
  const { item, code } = event.detail;
  // item: { type: "password" | "text" | "url", text } or { type: "file", name, mime, bytes }
});

Your own interface

import { open } from "@dahp/postern/ui";
const received = await open({ types: ["file"] }); // { item, code }, or null if closed

No interface at all, for TV apps and custom designs:

import { receive, drawQr } from "@dahp/postern";

const session = await receive({ types: ["password", "text"] });
drawQr(canvas, session.link);            // or render session.link with any QR library
const { item, code } = await session.result;
// Show `code` and use `item` only after the user confirms it matches their phone.

session.cancel() ends it. session.result rejects with a PosternError whose code is expired (after 2 minutes), cancelled or decrypt_failed.

Options

| Option | Meaning | Default | |---|---|---| | server | Relay address, for example your self-hosted relay | https://postern.dahp.io | | types | What the phone may send: password, text, url, file | all; the button picks by field type | | transport | "websocket", "poll" or "auto" | "auto" | | onStatus | Called with "connecting", "waiting" or "offline" | none | | signal | An AbortSignal that cancels | none | | scanner (UI) | startScanner from @dahp/postern/scanner, for offline mode | off |

Offline mode

Without internet, the phone can show its encrypted message as a QR code. To read it with the computer's camera:

import { open } from "@dahp/postern/ui";
import { startScanner } from "@dahp/postern/scanner";
await open({ scanner: startScanner });

With your own scanner, pass the scanned text to session.acceptOffline(text).

Server-side rendering

Every entry point imports safely on the server (Next.js, Nuxt, SvelteKit, Astro and others). @dahp/postern/ui registers <postern-button> only in the browser, so call open(), attach() and attachAll() from browser code, for example in a click handler or after the page mounts.

Content-Security-Policy

If your site sets one, allow the relay: connect-src https://postern.dahp.io wss://postern.dahp.io. The dialog needs no inline scripts or styles. Restyle it with --postern-accent, --postern-radius and --postern-font.

Self-hosting

The relay is open source and runs on your own server or as a Docker image; pass its address as server. See selfhost/ in the repository.

Protocol

The full specification and test vectors are in docs/PROTOCOL.md. In short: the QR holds https://postern.dahp.io/#v=1&id=<session>&k=<public key>; the phone posts {"v":1,"enc","ct"} to /api/s/<session>; the receiver waits on a WebSocket or polls /api/s/<session>/wait.

Terms

Using the public relay at postern.dahp.io is subject to the Terms of Use. If you add Postern to your product, you're responsible for your integration and your own users (section 5). The dialog links to the Terms of whichever relay it uses.

License

Apache-2.0. © 2026 DAHP Tech LLC.