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

@sprigr/apps-d1-kv

v0.2.1

Published

Per-install D1 key-value helpers for marketplace apps. Two flavours over the same table shape `(key TEXT PRIMARY KEY, value TEXT NOT NULL, updated_at TEXT NOT NULL)`, which the app owns via its own migration:

Readme

@sprigr/apps-d1-kv

Per-install D1 key-value helpers for marketplace apps. Two flavours over the same table shape (key TEXT PRIMARY KEY, value TEXT NOT NULL, updated_at TEXT NOT NULL), which the app owns via its own migration:

  • makeSettingsStore for non-sensitive install state (get / set / delete / getAll).
  • makeD1TokenStore for credential material, TokenStore-compatible with @sprigr/apps-oauth-utils.

This is the canonical source. sprigr-apps carries a vendored mirror at packages/d1-kv for the handful of apps that use the vendor mechanism rather than the npm pin; keep the two identical.

At-rest encryption (makeD1TokenStore)

makeD1TokenStore holds provider credentials (OAuth refresh tokens, access tokens, and in a few apps the OAuth client secret), so it takes a required encryption option. There is no default, because the failure mode of a default would be silent: a store that quietly wrote cleartext looks identical to one that works.

makeD1TokenStore({
  db,
  table: 'acme_secrets',
  encryption: { mode: 'encrypt', kek: env.ACME_TOKEN_KEK },
});

Modes:

| mode | reads | writes | | --- | --- | --- | | encrypt | sealed and legacy cleartext, re-sealing a legacy row on read | AES-GCM sealed | | decrypt-only | sealed and legacy cleartext | cleartext | | cleartext | cleartext only (a sealed row throws) | cleartext |

encrypt and decrypt-only throw at construction when kek is absent or blank. The store never falls back to cleartext on its own.

The construction is the one apps/email-imap-pop already uses: SHA-256 of the KEK gives a 256-bit AES-GCM key, and each value is sealed under a fresh 96-bit IV. Sealed values carry a sprigr.enc.v1. prefix, which is what lets a reader tell them from pre-existing cleartext rows with no migration and no backfill.

decrypt-only exists for the rollback-safe first release of an app: once a decrypt-capable build is the oldest build you would roll back to, flip that app to encrypt.

The KEK is per install. Declare it in the app manifest as a secret with auto_generate: true so the platform mints 32 random bytes per install and the publisher never sees it. Note that a secret added to a manifest after the app's first publish is only provisioned to new installs; installs that already exist keep env.<KEY> === undefined (sprigr-team's backfillInstallPublisherSecrets covers publisher_provides only). Adopt encrypt in an app with live installs only once that gap is closed, or every one of them will throw at construction.