Open source library and CLI

Work with .env secrets without ever seeing them.

envsitter lists keys, fingerprints values with HMAC-SHA-256, and answers yes or no questions about them. Values stay in memory, so they never reach your terminal, your logs, or an AI agent's context.

$ npm install envsitter
Read the docs
.env, as envsitter reports it
API_TOKEN DATABASE_URL NODE_ENV PORT STRIPE_SECRET_KEY

Keys are readable. Values never leave memory.

zsh
$ envsitter keys --file .envAPI_TOKEN DATABASE_URL NODE_ENV PORT STRIPE_SECRET_KEY$ pbpaste | envsitter match \ --file .env \ --key STRIPE_SECRET_KEY \ --candidate-stdin --json{ "key": "STRIPE_SECRET_KEY", "match": true }

Match operators

Ask questions about a value. Get a boolean back.

Every operator evaluates the value in-process and returns only true or false. Equality is checked by comparing HMAC digests, never the raw strings.

exists

The key is present in the source.

is_empty

The value is exactly the empty string.

is_equalneeds a candidate

Deterministic match against a candidate you supply, compared in constant time.

partial_match_prefixneeds a candidate

The value starts with the candidate.

partial_match_suffixneeds a candidate

The value ends with the candidate.

partial_match_regexneeds a candidate

The value matches a regex such as /^sk-/.

is_number

The value parses as a finite number.

is_boolean

The value is true or false, ignoring case and surrounding spaces.

is_string

The value is neither a number nor a boolean.

CLI

Every command keeps values in memory.

Output contains keys, booleans, lengths, fingerprints, and line numbers. Commands that change files are dry runs until you pass --write.

$ npx envsitter keys --file .env

Exit codes: 0 success or match, 1 no match, 2 usage or runtime error.

CommandWhat it does
keysList the keys in an env file
fingerprintDeterministic HMAC fingerprint of one key
matchMatch a candidate or operator against one, many, or all keys
match-by-keyBulk match a different candidate per key
scanDetect value shapes: JWT, URL, base64
redactReplace secret values in text read from stdin
validateCheck dotenv syntax with line and column
copyCopy keys between env files, with rename and conflict policy
format, reorderSort and organize keys, by section or globally
annotateAdd a comment above a key
addAdd a new key, failing if it already exists
setCreate or update a key
unsetSet a key to an empty value
deleteRemove one or more keys

Library

The same guarantees, typed.

Build envsitter into release scripts, audits, or your own agent tools. Nothing in the API returns a plaintext value.

Path helpers such as isSensitiveEnvFile tell your tooling which files hold real secrets and which are committed templates like .env.example.

check-secrets.ts
import { EnvSitter, setEnvFileKey } from 'envsitter';

const es = EnvSitter.fromDotenvFile('.env');

await es.listKeys();                              // ['API_TOKEN', 'PORT', ...]
await es.matchCandidate('API_TOKEN', candidate);  // true or false
await es.matchKey('PORT', { op: 'is_number' });   // true
await es.fingerprintKey('API_TOKEN');             // hmac-sha256 digest + length

// Dry run unless write: true. Returns a plan, never the value.
await setEnvFileKey({ file: '.env', key: 'API_TOKEN', value: next, write: true });

Security model

Comparisons without disclosure.

Values are read in-process for comparisons, but the library never returns them and the CLI never prints them.

Keyed fingerprints

Fingerprints are HMAC-SHA-256 with a local pepper, not raw hashes that are easy to dictionary-guess. The pepper comes from ENVSITTER_PEPPER or a .envsitter/pepper file created with mode 0600.

Constant-time equality

is_equal hashes the candidate and the stored value with the same pepper and compares the digests in constant time.

Candidates over stdin

Pass candidates and new values with --candidate-stdin or --value-stdin so secrets stay out of your shell history.

Not a secret manager: envsitter does not encrypt, sync, or relocate values. It works on your env sources in place.

For AI coding agents

Give your agent envsitter, not your secrets.

envsitter-guard is an OpenCode plugin for OpenCode 1 and 2. It blocks agents from reading or editing secret env files and gives them fifteen envsitter tools that never return values.

Explore the guard