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

updating-secrets

v1.1.1

Published

Automatically update secrets on an interval with support for seamless secret rotation.

Readme

updating-secrets

Automatically update secrets on an interval with support for seamless secret rotation.

Reference docs: https://electrovir.github.io/updating-secrets

Install

npm i updating-secrets

Usage

Basics

First, define your set of secrets:

import {defineSecrets, rotatableSecretShape} from 'updating-secrets';

// example collection of secrets
export const mySecrets = defineSecrets({
    databaseCredentials: {
        description: 'All credentials and access information needed for accessing the database.',
        whereToFind:
            'These values are automatically generated by RDS and only stored in AWS Secrets Manager.',
        adapterConfig: {
            aws: {
                rootOf: 'prod/DatabaseCredentials',
            },
        },
        shape: {
            password: '',
            dbname: '',
            port: -1,
            host: '',
            username: '',
        },
    },
    stripeSecret: {
        description: 'Keys for accessing and authenticating with Stripe.',
        whereToFind: 'Navigate to Developers > API keys > Standard keys > Secret key.',
        adapterConfig: {
            aws: {
                keyIn: 'prod/BackendSecrets',
            },
        },
    },
    adminPassword: {
        description:
            'Password required by the admin to access sensitive information on the website.',
        whereToFind: 'This is randomly generated and stored in AWS Secrets Manager.',
        adapterConfig: {
            aws: {
                keyIn: 'prod/BackendSecrets',
            },
        },
        shape: rotatableSecretShape,
    },
});

Second, choose your secrets adapters:

  • https://www.npmjs.com/package/@updating-secrets/infisical-adapter
  • https://www.npmjs.com/package/@updating-secrets/aws-secrets-manager-adapter
  • SecretsJsonFileAdapter: loads secrets from a JSON file.
  • StaticSecretsAdapter: allows you to define all secrets values in-place.

Or create your own:

import {BaseSecretsAdapter, type ProcessedSecretDefinitions} from 'updating-secrets';

export class MyCustomSecretsAdapter extends BaseSecretsAdapter {
    constructor() {
        super('MyCustomSecretsAdapter');
    }

    public override loadSecrets(secrets: Readonly<ProcessedSecretDefinitions>) {
        // load secrets here
        return {};
    }
}

Lastly, create an instance of UpdatingSecrets (with createUpdatingSecrets):

import {SecretsManager} from '@aws-sdk/client-secrets-manager';
import {AwsSecretsManagerAdapter, createUpdatingSecrets} from '@updating-secrets/aws-secrets-manager-adapter';
import {mySecrets} from './define-secrets.example.js';

const updatingSecrets = await createUpdatingSecrets(mySecrets, [
    new AwsSecretsManagerAdapter(
        new SecretsManager({
            region: 'us-east-1',
        }),
    ),
]);

Rotatable secrets

To create a seamlessly rotatable secret, use rotatableSecretShape in the secret definition's shape property, either as the root (shape: rotatableSecretShape) or as a sub-property (secret: {id: '', secret: rotatableSecretShape}).

Use this secret in the following way:

  • always store the secret with JSON like {current: 'latest-value'}
  • when rotation is needed, move the old value to the legacy property: {current: 'new-value', legacy: 'old-value'}
  • in your code, always access the secret .current
  • if you need to compare a third party's usage of the secret (for example, if the secret is an API key that you distributed to them), use UpdatingSecrets.compareRotatableSecret() to allow both the current and the legacy secret to pass comparisons:
    // assuming the `apiKey` secret is defined with `shape: rotatableSecretShape`
    updatingSecrets.compareRotatableSecret(request.headers.apiKey, updatingSecrets.get.apiKey);