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

directus-extension-key

v0.1.5

Published

Centralized and secure key management extension for Directus

Readme

directus-extension-key

npm version npm downloads License: GPL-3.0 Directus

A Directus bundle extension that provides centralized, secure management of API keys, access tokens, and encryption secrets. It prevents sensitive values from being exposed in configuration files or version control.

Features

  • 🗄️ 2 Storage Providers — Database (encrypted), Environment Variable
  • 🔐 AES-256-GCM Encryption — Database-stored values are encrypted using your Directus SECRET
  • 🖥️ Admin UI — Vue 3 module in the Directus Data Studio sidebar
  • 🔌 REST API — Full CRUD + secure retrieval endpoint
  • 📦 getKey() Helper — Typed function for use in other Directus extensions

Installation

Via npm (recommended)

npm install directus-extension-key

Then place (or symlink) the package inside your Directus extensions/ folder, or use a Docker volume mount — Directus will auto-load it on startup.

Via Docker / local build

# Inside the extension directory
npm install
npm run build

Mount the built output into your Directus container:

# docker-compose.yml
volumes:
  - ./extensions/directus-extension-key/dist:/directus/extensions/directus-extension-key/dist
  - ./extensions/directus-extension-key/package.json:/directus/extensions/directus-extension-key/package.json

Quick Start

  1. Install the extension (see above).
  2. Start Directus — the extension is auto-loaded on startup.
  3. Open the Admin UI at http://localhost:8055/admin → click Key Manager in the left sidebar.

REST API

All routes require an admin Bearer token.

# List all keys (values never exposed)
curl -H "Authorization: Bearer <token>" http://localhost:8055/km/keys

# Create an env-var key
curl -X POST -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"name":"STRIPE_KEY","provider":"env","source":"STRIPE_SECRET"}' \
  http://localhost:8055/km/keys

# Retrieve resolved secret
curl -H "Authorization: Bearer <token>" http://localhost:8055/km/retrieve/STRIPE_KEY
# → { "data": { "name": "STRIPE_KEY", "value": "sk_live_..." } }

# Update a key
curl -X PATCH -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"description":"Updated description"}' \
  http://localhost:8055/km/keys/<id>

# Delete a key
curl -X DELETE -H "Authorization: Bearer <token>" http://localhost:8055/km/keys/<id>

Using getKey() in Other Extensions

import { getKey } from 'directus-extension-key/dist/api.js';

// Inside any hook or endpoint that has the `database` knex instance:
const stripeSecret = await getKey('STRIPE_KEY', database);

Storage Providers

| Provider | How it resolves the value | Recommended for | |---|---|---| | database | Decrypts AES-256-GCM value from DB | Development / low-risk | | env | Returns process.env[varName] | CI/CD / containers |

Security Notes

Warning: If the Directus SECRET env var is rotated, all database-provider keys must be re-created, as the old ciphertext cannot be decrypted with a new key.

  • Raw secret values are never returned by the GET /km/keys list endpoint
  • All endpoints require admin role authentication
  • For production, prefer env providers over database

License

GPL-3.0 © Ankit Chauhan