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

@kavishkagaya/do-secrets

v0.1.1

Published

Encrypted, per-tenant secret storage for Cloudflare Workers, built on Durable Objects.

Readme

do-secrets

Encrypted, per-tenant secret storage for Cloudflare Workers, built on Durable Objects.

One Durable Object instance per id — team, user, project, any string you choose. Each store's data is encrypted with a key deterministically derived from a single master secret and the store's own id: physically isolated storage per tenant, no shared table, no per-tenant key management.

Quick start

npm install @kavishkagaya/do-secrets

src/index.ts — your Worker's entrypoint. Durable Object classes must be exported from here, not just from wherever you define them. Re-exporting SecretStore under your binding's name is enough — no subclass needed unless you want to customize behavior (see below):

export { SecretStore as TeamSecrets } from "@kavishkagaya/do-secrets";

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const teamId = "team_123"; // from your own auth check — see Design below
    const store = env.TEAM_SECRETS.get(env.TEAM_SECRETS.idFromName(teamId));

    await store.putJSON("provider:google", { clientId, clientSecret });
    const config = await store.getJSON<{ clientId: string; clientSecret: string }>(
      "provider:google"
    );

    return Response.json(config);
  },
};
# wrangler.toml
[[durable_objects.bindings]]
name = "TEAM_SECRETS"
class_name = "TeamSecrets"

[[migrations]]
tag = "v1"
new_sqlite_classes = ["TeamSecrets"]
wrangler secret put DO_SECRET_MASTER_KEY   # required before first deploy — put/get
                                             # throw a clear error if this was skipped
wrangler deploy

Usage

const store = env.TEAM_SECRETS.get(env.TEAM_SECRETS.idFromName(teamId));

// raw strings
await store.put("token", accessToken);
await store.get("token"); // string | null

// structured values — reaches for JSON.stringify/parse for you
await store.putJSON("provider:google", config);
await store.getJSON<Config>("provider:google"); // Config | null

await store.list("provider:"); // string[] of keys, values stay encrypted
await store.delete("provider:google");
await store.clear(); // wipes everything for this id

Customizing

SecretStore is a plain class, so subclassing works normally if you want to add behavior — logging, validation, whatever. No config options or hooks to learn:

export class LoggedSecrets extends SecretStore {
  async put(key: string, value: string) {
    console.log(`writing ${key}`);
    return super.put(key, value);
  }
}

Design

  • No auth. The Durable Object binding is the trust boundary — whoever can reach env.TEAM_SECRETS in your Worker is authorized. Gate access in your own request handler before you compute an id; this library never sees or checks who's calling.
  • No key rotation. One DO_SECRET_MASTER_KEY, forever. Losing it makes every store's data permanently unrecoverable — there is no fallback key version.
  • Cloudflare Workers only. Built on Durable Objects and the Web Crypto API. Not portable to other runtimes.