Skip to main content

A command-line credential vault with strong encryption, GPG-protected master key, and optional 2FA support.

Project description

Cavern

CI PyPI version Python versions License: MIT Code style: black

A command-line credential vault. Store passwords, API keys, SSH passphrases, and 2FA seeds in encrypted files protected by your GPG identity.

Features

  • Strong encryption. Every secret is encrypted with AES-256-GCM, with authenticated decryption that detects tampering.
  • GPG-protected master key. Unlocking the vault uses the same passphrase or smartcard you already use for GPG. No new password to remember.
  • Password generation. Generate strong random passwords with configurable length, character classes, and exclusion of visually ambiguous characters.
  • TOTP / 2FA codes. Store otpauth:// URIs alongside your credentials and generate live time-based codes on demand.
  • Tags and search. Tag secrets by team, environment, or project. Search by name substring or by tag.
  • Encrypted audit log. Every operation is recorded in a capped, encrypted log you can review with cavern audit.
  • Git sync. Auto-commit on every change. Push the encrypted vault to any git remote for backup or multi-machine sync.
  • Bulk transfer. Export selected secrets to a passphrase-encrypted file for moving between machines or backing up independent of GPG; import a plaintext JSON file when migrating from another tool.
  • Clipboard with auto-clear. Copy a secret to the clipboard and it wipes itself after 45 seconds — only if you haven't copied something else in the meantime.
  • Session caching. Cache the unlocked key for a configurable TTL so you're not re-prompted for every command.

What cavern is good for

  • Personal credential management on Linux or macOS, replacing a plaintext password file or an unencrypted note app.
  • Storing more than passwords: API keys, OAuth refresh tokens, SSH key passphrases, 2FA recovery codes, database connection strings, and one-time recovery phrases.
  • Multi-machine sync without trusting a third-party service: push the encrypted vault to any git remote you control.
  • Workflows where the vault directory might be backed up, snapshotted, or copied — and the backup itself shouldn't reveal what's stored inside.

Security

  • Encrypted at rest with industry-standard cryptography (AES-256-GCM authenticated encryption, HKDF for key derivation, 256-bit keys throughout).
  • Tamper-evident. Modifying a stored secret in any way causes decryption to fail with a clear error rather than silently returning corrupted data.
  • No plaintext metadata on disk. A directory listing of your vault doesn't reveal which services you have accounts at, doesn't leak the size of any individual secret, and doesn't expose your tags. The on-disk filenames are derived from a keyed hash; secret sizes are bucketed.
  • Strict file permissions. All vault files are written with 0600 (AlkaidCheng read/write only); the vault directory is 0700.
  • Cheap key rotation. Rotate the master key whenever you want; filenames stay the same and content ciphertexts are not re-encrypted, so rotation is fast even on large vaults.

For the full architecture, threat model, and the things cavern does not protect against, see docs/SECURITY.md and docs/KNOWN_ISSUES.md. Read both before relying on cavern for sensitive workloads.

Install

pip install cavern              # core install
pip install cavern[totp]        # add 2FA / TOTP support

Requirements:

  • Python 3.10 or newer
  • gpg on PATH with at least one secret key
  • A clipboard backend for -c flags: xclip, xsel, or wl-clipboard on Linux; pbcopy on macOS (preinstalled)
  • git, optional, for sync support

Cavern is POSIX-only. Linux and macOS are supported; Windows raises ImportError at import time. Use under WSL2 if you need Windows.

Quick start

# 1. Initialize, encrypted to your GPG identity
cavern init you@example.com

# 2. Cache the unlocked key for 10 minutes
cavern unlock --ttl 10m

# 3. Store something
cavern insert work/aws/prod         # prompts for the value, hidden

# 4. Retrieve to clipboard with 45-second auto-clear
cavern show -c work/aws/prod

# 5. Lock when you're done
cavern lock

Commands

# --- Storing secrets ---
cavern insert work/github                              # prompt for value
cavern insert -m work/aws                              # multiline (paste otpauth URIs, recovery codes, etc.)
cavern generate work/db --length 32 --exclude-ambiguous

# --- Retrieving ---
cavern show work/github                                # to stdout
cavern show -c work/github                             # to clipboard, auto-clear after 45s
cavern otp work/github                                 # 2FA code (requires the totp extra)

# --- Listing & search ---
cavern ls                                              # all secret names
cavern ls work/                                        # by prefix
cavern find aws                                        # case-insensitive substring match
cavern tag work/aws cloud production critical
cavern tag --search production                         # find secrets by tag
cavern tag --list                                      # all tags currently in use

# --- Maintenance ---
cavern mv work/old work/new                            # rename
cavern rm work/old                                     # delete (with confirm)
cavern audit --limit 50                                # encrypted operation log
cavern rotate-key                                      # rotate the master key
cavern reindex                                         # reconcile the manifest with disk

# --- Bulk transfer ---
cavern dump --prefix work/ -o backup.cvd               # passphrase-encrypted export
cavern dump --tag production --armor -o -              # armored output to stdout
cavern load -i backup.cvd                              # decrypt and import
cavern bulk-insert secrets.json                        # plaintext JSON → vault (migration tool)

# --- Session control ---
cavern unlock --ttl 5m                                 # cache the unlocked key
cavern lock                                            # clear session, reload gpg-agent
cavern --no-cache show foo                             # bypass the cache for one command

# --- Git sync ---
cavern git remote add origin git@github.com:you/secrets.git
cavern git push -u origin main

Run cavern --help for the full list, or cavern <command> --help for any specific subcommand.

Documentation

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cavern-0.1.0.tar.gz (73.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cavern-0.1.0-py3-none-any.whl (50.9 kB view details)

Uploaded Python 3

File details

Details for the file cavern-0.1.0.tar.gz.

File metadata

  • Download URL: cavern-0.1.0.tar.gz
  • Upload date:
  • Size: 73.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cavern-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aec5cf45b72c89452939e23c20d6e6db7e19bd2098eb1f055af61e8929b343c6
MD5 d1643030588961c521c49c1430e7afa5
BLAKE2b-256 2800ccd296d8ecee294a7f32b70fde22d67a68f21486e4698ce325a1aa2cf9d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for cavern-0.1.0.tar.gz:

Publisher: release.yml on AlkaidCheng/cavern

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cavern-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cavern-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 50.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cavern-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9472770a30dff2176863fa1a0882e77c3ca867ae29f2600d91abe1f34003c979
MD5 93cf31c410a9ad453081a055e9bbbf36
BLAKE2b-256 de42046b94c1efef3e4d2d3790e77373b122f6da8565a112d06b00db28c32518

See more details on using hashes here.

Provenance

The following attestation bundles were made for cavern-0.1.0-py3-none-any.whl:

Publisher: release.yml on AlkaidCheng/cavern

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page