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

titan-vault-node

v2.0.0

Published

Zero-trust, E2E encrypted, drop-in replacement for dotenv.

Readme

🛡️ Titan Vault (Node.js SDK) — Modo Paranoia & Zero-Trust

SDK de seguridad Zero-Trust, Criptografía E2E, Envenenamiento de process.env y Protección de Memoria RAM.

titan-vault-node resuelve la vulnerabilidad fundamental de Node.js: la exposición de secretos en texto plano en la memoria RAM (Heap Dumps) y process.env.


⚡ ¿Por qué dotenv y process.env son inseguros?

  1. Memory Dumps: Cualquier vulnerabilidad que permita un volcado de memoria (heapdump, coredump, inspector v8) expone todas las variables de entorno en texto plano.
  2. Inmutabilidad V8: En Node.js, process.env almacena strings inmutables. El recolector de basura (GC) no puede sobreescribir con ceros esas cadenas en memoria.
  3. Peligro de Logs: Un simple console.log(process.env) o reporte de error APM filtra todas tus credenciales.

🛡️ La Solución: Modo Paranoia (Los 4 Pilares)

titan-vault-node implementa una arquitectura de grado militar:

  1. Patrón Bootstrap (Arranque Seguro): Pausa el arranque del runtime para negociar llaves efímeras (RSA-2048 + AES-256-CFB) y proteger la memoria antes de evaluar el código de negocio.
  2. Envenenamiento de process.env: Borra los secretos del entorno global y coloca un Proxy reactivo. Si alguien o una librería de terceros intenta hacer process.env.JWT_SECRET, la ejecución se interrumpe con ParanoiaBlockedError. Además, las variables secretas no son enumerables (no aparecen en Object.keys() ni console.log(process.env)).
  3. Criptografía Nativa C++ (KeyObject): Las llaves simétricas (JWT, cookies, AES) se cargan directamente como instancias nativas crypto.KeyObject de C++, invisibles a búsquedas de strings en el heap de V8.
  4. Inyección JIT en Bases de Datos:
    • Sequelize: Gancho beforeConnect para inyectar contraseñas microsegundos antes del handshake, y afterConnect para nulificar (password = null) de inmediato.
    • node-postgres (pg): Función asíncrona de contraseña bajo demanda (async () => password).
  5. CaaS / Transit Engine: Criptografía como Servicio. Permite firmar tokens o cifrar datos directamente en el servidor Titan Vault sin mantener ninguna llave en memoria.

💻 Guía de Integración

1. El Patrón Bootstrap (bootstrap.js o src/index.ts)

Crea un archivo de arranque que cargue el SDK antes de importar el servidor:

// bootstrap.ts
import { TitanVault } from 'titan-vault-node';

async function main() {
  // 1. Arma el Modo Paranoia y asegura la memoria
  await TitanVault.armParanoiaMode({
    vaultUrl: process.env.VAULT_URL || 'http://127.0.0.1:8200',
    vaultToken: process.env.VAULT_APP_TOKEN,
    path: 'mi_aplicacion_env',
  });

  // 2. Importa el servidor dinámicamente UNA VEZ que la memoria está blindada
  await import('./server.js');
}

main();

2. Firma y Validación de Tokens JWT (C++ KeyObject)

Compatible de forma nativa con jsonwebtoken, jose y el módulo crypto de Node.js:

import jwt from 'jsonwebtoken';
import { TitanVault } from 'titan-vault-node';

// Obtiene el KeyObject de C++ (Invisible en volcados de RAM)
const jwtKey = TitanVault.secrets.get('JWT_SECRET');

// Firmar
const token = jwt.sign({ userId: 123, role: 'admin' }, jwtKey, {
  algorithm: 'HS256',
  expiresIn: '2h',
});

// Verificar
const payload = jwt.verify(token, jwtKey);

3. Conexión Segura a Base de Datos (JIT)

Con Sequelize:

import { Sequelize } from 'sequelize';
import { TitanVault } from 'titan-vault-node';

export const sequelize = new Sequelize({
  dialect: 'postgres',
  host: TitanVault.config.get('DB_HOST'),
  database: TitanVault.config.get('DB_NAME'),
  username: TitanVault.config.get('DB_USER'),
  // No pongas password aquí
});

// Registra el inyector JIT
TitanVault.databases.hookSequelize(sequelize, {
  credentialKey: 'DB_PASSWORD',
});

Con pg (node-postgres):

import pg from 'pg';
import { TitanVault } from 'titan-vault-node';

export const pool = new pg.Pool({
  host: TitanVault.config.get('DB_HOST'),
  user: TitanVault.config.get('DB_USER'),
  database: TitanVault.config.get('DB_NAME'),
  // Inyección JIT asíncrona por conexión
  password: TitanVault.databases.getPgPasswordProvider('DB_PASSWORD'),
});

4. Criptografía como Servicio (Transit Engine / CaaS)

Para máxima seguridad, puedes delegar el cifrado y la firma directamente a Titan Vault (cero llaves en tu app):

import { TitanVault } from 'titan-vault-node';

// Cifrar datos con AES-256-GCM en el Vault
const ciphertext = await TitanVault.transit.encrypt('mi-llave', 'Texto Ultra Confidencial');

// Descifrar en el Vault
const plaintext = await TitanVault.transit.decrypt('mi-llave', ciphertext);

// Firmar datos con HMAC-SHA256 en el Vault
const signature = await TitanVault.transit.sign('mi-firma-jwt', 'payload.a.firmar');

// Verificar firma en el Vault
const isValid = await TitanVault.transit.verify('mi-firma-jwt', 'payload.a.firmar', signature);

5. Parámetros de Configuración No Sensibles

const port = TitanVault.config.get('PORT', '3000');
const host = TitanVault.config.get('HOST', '0.0.0.0');

6. Verificación de Hardening en Contenedores

TitanVault.verifyRuntimeHardening();

🍯 Tripwires y Honeytokens

Si un atacante inspecciona process.env e intenta leer la variable trampa VAULT_EMERGENCY_RECOVERY_TOKEN, Titan Vault detona inmediatamente una alerta de intrusión hacia el servidor central y sella la bóveda.