SDK Reference

Node.js SDK

The SDK loads secrets at runtime into process.env. Pair it with keydrop run for build-time injection.

Installation

$npm install keydrop

Usage

ESM

app.jsJavaScript
import { init } from "keydrop";

await init();

// process.env now contains your secrets

CommonJS

app.jsJavaScript
const { init } = require("keydrop");

await init();

// process.env now contains your secrets

init (options?)

Fetches and decrypts secrets from KeyDrop. Injects them into process.env. Call this before your server starts.

Options

keyProject key (default: KEYDROP_KEY env var)
overrideOverride existing env vars (default: false)

Example

await init({ key: "proj_x82js8sh" });

When to use the SDK

Use init() in production so secrets load when your app starts. Use keydrop run for local development and CI/CD builds.