Skip to content

Quickstart

GitHub →

Install

brew install madstone-tech/tap/mdstn-cipher

Other ways to install are on the Installation page.

1. Encrypt with a file password

No keys needed. Without a method flag, encrypt asks for a file password:

mdstn-cipher encrypt secret.pdf          # writes secret.pdf.mdstn
mdstn-cipher decrypt secret.pdf.mdstn    # asks for the password, writes secret.pdf

decrypt never replaces an existing file: if secret.pdf is still there, it stops and asks you to choose a path with -o or to pass --force.

2. Encrypt for yourself

The first time you encrypt for yourself, Cipher creates your default key and shows its 24-word recovery phrase once. Write the phrase down: it is the only way to get the key back if you lose the database.

mdstn-cipher encrypt notes.md --key-passphrase-file key-pass.txt
mdstn-cipher decrypt notes.md.mdstn -o notes-copy.md

The key passphrase protects your private key on disk. See Keys and recovery.

3. Encrypt for someone else

If the recipient has published their key to the directory, encrypt to their email:

mdstn-cipher encrypt report.pdf --for alice@example.com

Several recipients, any one of whom can decrypt:

mdstn-cipher encrypt report.pdf --recipient alice@example.com --recipient bob@example.com

Or encrypt to a raw X25519 public key (base64 of 32 bytes, or a file that holds it):

mdstn-cipher encrypt report.pdf --recipient-key alice.pub

To let others encrypt to your email, publish your key. See Key discovery (CKD).

4. Back up your keys

mdstn-cipher backup     # writes ~/.mdstn/backups/cipher-backup-<timestamp>.json

In scripts

Every command runs without a terminal. Read secrets from files or stdin, and use --json for output a program can parse:

mdstn-cipher encrypt snap.db --recipient-key "$PUB" -o snap.mdstn
mdstn-cipher encrypt big.tar --password-file /run/secrets/pw
mdstn-cipher decrypt snap.mdstn --key-passphrase-file - -o snap.db < pw

Exit codes tell failures apart: 2 tampered file, 3 not a recipient, 4 wrong file password. The full list is on the Format and security page.