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

@trevixal/extension-security

v1.0.5

Published

Security for the Trevixal editor: password-encrypted documents with expiry, encrypted storage, and copy restrictions.

Readme

@trevixal/extension-security

CI npm types license

Documentation · Live editor · Changelog · Issues

The Trevixal editor

Features

  • Password-encrypted documents with expiry
  • Encrypted storage and copy restrictions
  • 2.9 kB minified and gzipped, with TypeScript types in the package

Password-encrypted documents, expiry, an encrypted storage wrapper, and copy/print restrictions.

npm install @trevixal/extension-security

Encrypting a document

import { encryptDocument, decryptDocument, WrongPasswordError } from '@trevixal/extension-security'

const envelope = await encryptDocument(editor.getJSON(), password, {
  expiresAt: Date.now() + 7 * 864e5,
})

try {
  const { payload } = await decryptDocument(envelope, password)
  editor.setContent(payload)
} catch (error) {
  if (error instanceof WrongPasswordError) askAgain()
}

The envelope is plain JSON ({ format, version, kdf, iterations, salt, iv, cipher, data, expiresAt }) so it stores and travels like any other document. The key is stretched with PBKDF2-SHA256 (310,000 rounds by default) and the content sealed with AES-GCM, both through the browser's own WebCrypto. There is no cipher code here to audit or keep current, which is the point.

The iteration count travels in the envelope, so a ceiling of ten million is enforced on what one may ask for: without it, a hostile file could ask for a number that hangs the tab.

An encrypted key-value store

import { createEncryptedStorage, createWebStorage } from '@trevixal/extension-security'

const vault = createEncryptedStorage(createWebStorage(localStorage, 'app:'), password)

A drop-in KeyValueStorage, so autosave and the document workspace can write through it unchanged and a draft on disk is unreadable without the password. The password may be an async getter, for hosts that prompt lazily.

Restrictions

import { applyRestrictions, restrictionsAllow } from '@trevixal/extension-security'

const release = applyRestrictions(
  editor,
  { copy: true, print: true },
  { onBlocked: (action) => say(`${action} is blocked`) },
)

copy, cut, paste, print, download and contextMenu. Print also swallows the shortcut, reports beforeprint, and injects a print-media rule that blanks the surface if the dialog is opened another way.

These keep an honest user honest. They are not a confidentiality control, anything rendered in a browser can be read out of it, and should not be sold as one.

Expiry

isExpired(expiresAt) and describeExpiry(expiresAt). The description rounds down: forty-five days reads as "in 1 month", never "in 2 months". This string tells someone when a document stops opening, and the failure mode of overstating it is losing access while believing there was time.

License

Apache-2.0