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

secret-strobe

v1.0.0

Published

Runtime memory sanitizer for API secrets. Wraps sensitive strings in a zero-fill buffer and auto-wipes them from the heap once used or after a TTL.

Readme

secret-strobe

Runtime memory sanitizer for API secrets. API keys, JWTs, and database strings often linger in Node.js process memory long after they are needed, leaving them exposed to heap dumps and memory-scraping attacks. secret-strobe wraps sensitive values in a zero-fill buffer and wipes them from the heap once used or after a configurable TTL.

Why

Strings in JavaScript are immutable. Once a secret exists as a plain string, there is no reliable way to scrub it. secret-strobe keeps the value inside a Buffer it controls, exposes it through a guarded read(), and zero-fills that buffer on demand so the bytes actually leave memory.

Features

  • Zero-fills the underlying buffer on wipe(), after a TTL, or immediately after read().
  • Out-of-band monitor that alerts when high-entropy values linger in the heap past maxAge.
  • Optional live heap scanning for suspicious high-entropy strings.
  • No runtime dependencies, zero-fill via crypto.randomBytes.

Install

npm install secret-strobe

Usage

Wrap a secret

var strobe = require('secret-strobe');

var apiKey = strobe('sk_live_AbCdEfGh', {
  ttl: 5000,          // auto-wipe after 5 seconds
  wipeOnRead: false
});

// ...use it
console.log(apiKey.redact());   // c***** 24 chars

var value = apiKey.read();      // real value
doWork(value);

apiKey.wipe();                  // zero-fill now, no need to wait

Auto-wipe after a request

var strobe = require('secret-strobe');

function handler(req, res) {
  var token = strobe(req.headers.authorization, { wipeOnRead: true });
  try {
    authenticate(token.read());
  } finally {
    token.wipe();
  }
}

Out-of-band heap monitoring

var strobe = require('secret-strobe');

strobe.monitor.on('warn', function (secret, info) {
  console.warn('High-entropy value found in memory:', info);
});

strobe.monitor.on('alert', function (secret, redacted) {
  console.warn('Secret exceeded maxAge:', redacted);
  secret.wipe();
});

strobe.start({ interval: 5000 });

Heap scanning

strobe.start({
  scanHeap: true,
  heapScanInterval: 30000,
  entropyThreshold: 4.5,
  minLength: 12
});

The heap scanner walks the V8 snapshot and reports strings whose Shannon entropy exceeds the threshold.

API

strobe(value, options?)

Returns a new Secret and registers it with the default monitor.

  • value - string or Buffer
  • options.encoding - encoding used when reading (utf8 default)
  • options.ttl - auto-wipe after this many ms
  • options.maxAge - alert threshold for the monitor (ms)
  • options.wipeOnRead - wipe immediately after read()

Secret

  • read() / toString() - return the value, throws if wiped or expired
  • wipe() / destroy() - zero-fill the buffer
  • expired() - has the value aged past its TTL/maxAge
  • redact() - safe display string
  • .length, .entropy, .wiped, .createdAt

strobe.monitor

Default Monitor instance.

  • monitor.on(event, fn) - alert, warn, start, stop
  • monitor.start(options?) - begin periodic checks
  • monitor.stop() - stop checks
  • monitor.observe(secret) / monitor.release(secret)

strobe.start(options?) / strobe.stop()

Convenience wrappers that configure and start/stop the default monitor.

License

MIT