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

@e4a/pg-js

v1.10.0

Published

Browser SDK for PostGuard — end-to-end encrypted file sharing with identity-based encryption

Readme

For full documentation, visit docs.postguard.eu.

TypeScript/JavaScript SDK for PostGuard, published as @e4a/pg-js on npm. Works in both browsers and Node.js.

PostGuard encrypts data for recipients based on their identity attributes (email address, phone number, etc.) rather than traditional public keys. Recipients prove their identity via Yivi to decrypt. This SDK is the main way web applications and email add-ons integrate with PostGuard.

Quick Start

npm install @e4a/pg-js
import { PostGuard } from '@e4a/pg-js';

const pg = new PostGuard({
  pkgUrl: 'https://pkg.postguard.eu',
});

// Encrypt
const sealed = pg.encrypt({
  sign: pg.sign.apiKey('your-api-key'),
  recipients: [pg.recipient.email('[email protected]')],
  files: fileList,
});
const { uuid } = await sealed.upload();

// Decrypt
const opened = pg.open({ uuid });
const result = await opened.decrypt({ element: '#yivi-popup' });
result.download();

See the full API reference for encryption options, signing methods, recipient types, and email helpers.

Server-side usage (Node, Bun, Deno)

The SDK works in non-browser runtimes for the encrypt + upload path when signing via sign.apiKey or a custom sign.session callback. No polyfills required.

Minimum runtime versions:

| Runtime | Minimum | Notes | | ------- | ------- | ------------------------------------------------------------------------------------------- | | Node | 22+ | Enforced via engines.node. The build tool requires Node 22.18+; runtime is tested on 22 and 24. | | Bun | 1.0.16+ | First release with AbortSignal.any (the SDK's tightest web-API requirement) | | Deno | 1.39+ | First release with AbortSignal.any |

Other notes:

  • sign.yivi(...) requires a DOM and is browser-only. The SDK throws a clear YiviSessionError upfront on non-browser runtimes — use sign.apiKey or sign.session instead.
  • For decryption, result.blob and result.plaintext are universal; result.download(...) triggers a browser download and is browser-only.
  • sealed.upload() refuses data: ReadableStream — use sealed.toBytes() for streaming, or pass data as Uint8Array.

A manual smoke test for any runtime lives at scripts/smoke.mjs. Set PG_API_KEY to a staging key to exercise the full upload pipeline:

PG_API_KEY=PG-... node scripts/smoke.mjs
PG_API_KEY=PG-... bun  scripts/smoke.mjs
PG_API_KEY=PG-... deno run -A scripts/smoke.mjs

Development

Install dependencies and build:

npm install
npm run prebuild
npm run build

Run the tests:

npm run test

Releasing

Releases are handled by semantic-release on the main branch. When commits land on main, semantic-release determines the next version from conventional commit messages and publishes to npm automatically.

License

MIT