Skip to content

Getting Started

This guide gets you from zero to encrypted secrets in about 5 minutes. By the end, you’ll have:

  • dotsecenv installed
  • A vault configured with your GPG identity
  • Your first secret stored and retrieved

You need a GPG key. Most developers already have one for signing git commits. If not, you have two options:

Terminal window
# Generate a new GPG key with dotsecenv
dotsecenv identity create
# Enter your name and email when prompted

This uses FIPS-compliant defaults (P-384 curve, 2-year expiration). See identity create for algorithm options.

  1. Install dotsecenv

    Terminal window
    brew tap dotsecenv/tap
    brew install dotsecenv

    Verify installation:

    Terminal window
    dotsecenv version
  2. Initialize configuration

    Create a config file:

    Terminal window
    dotsecenv init config

    This creates ~/.config/dotsecenv/config with default settings.

  3. Create a vault

    Terminal window
    dotsecenv init vault

    This creates an encrypted vault file at ~/.config/dotsecenv/vault.

  4. Login with your GPG key

    Terminal window
    dotsecenv login

    This lists your available GPG keys and prompts you to select one. You can also specify a fingerprint directly:

    Terminal window
    dotsecenv login YOUR_FINGERPRINT

    The login creates a cryptographically signed proof that you control the secret key.

  5. Store your first secret

    Terminal window
    echo "my-secret-database-password" | dotsecenv secret store DATABASE_PASSWORD

    The secret is now encrypted in your vault.

  6. Retrieve the secret

    Terminal window
    dotsecenv secret get DATABASE_PASSWORD
    # Output: my-secret-database-password
  1. Config file (~/.config/dotsecenv/config) stores your settings and vault location
  2. Vault file (~/.config/dotsecenv/vault) is an encrypted JSONL file containing:
    • Your identity (GPG public key fingerprint)
    • Encrypted secrets
  3. Login associated your GPG key with dotsecenv so it knows which key to use for encryption/decryption

The real power comes from automatic secret loading. Install the shell plugin:

Terminal window
curl -fsSL https://raw.githubusercontent.com/dotsecenv/plugin/main/install.sh | bash

Then create a .secenv file in your project:

Terminal window
# .secenv - secrets loaded automatically when you cd into the directory
DATABASE_PASSWORD={dotsecenv}
API_KEY={dotsecenv/MY_API_KEY}

When you cd into the directory, dotsecenv prompts you to load the secrets.


Before moving on, verify:

  • dotsecenv version shows version info
  • dotsecenv vault describe shows your vault with your identity
  • dotsecenv secret get DATABASE_PASSWORD returns your secret