Skip to content

CLI Reference

Reference for Cipher v0.1.0. Run mdstn-cipher help <command> for inline help.

Synopsis

mdstn-cipher [command] [flags]

Zero-config file encryption with managed key lifecycle.

Global flags

These apply to every command.

FlagShortTypeDefaultDescription
--configstring~/.mdstn/cipher.tomlConfig file path
--dbstring~/.mdstn/cipher.dbDatabase path
--verbose-vboolfalseVerbose output
--jsonboolfalseOutput in JSON format

encrypt

Encrypt a file. Modes: for yourself (default), for a recipient (--for), or with a passphrase.

mdstn-cipher encrypt <file> [flags]
FlagShortTypeDefaultDescription
--forstringEncrypt for a recipient email (public key discovered via CKD)
--passphrasestringEncrypt with a passphrase (no stored key required)
--output-ostring<file>.mdstnOutput file path
mdstn-cipher encrypt secret.pdf
mdstn-cipher encrypt secret.pdf --for alice@team.com
mdstn-cipher encrypt secret.pdf --passphrase

decrypt

Decrypt a .mdstn file. The method is auto-detected from the file header.

mdstn-cipher decrypt <file> [flags]
FlagShortTypeDefaultDescription
--passphrasestringPassphrase for decryption
--output-ostringOutput file path
mdstn-cipher decrypt secret.pdf.mdstn --output secret.pdf

keys

Manage encryption keys.

mdstn-cipher keys <subcommand>
SubcommandDescription
listList all keys
createCreate a new key
delete <key-id>Delete a key
alias <key-id> <alias>Set an alias for a key
export <key-id>Export a key
publishPublish your public key to CKD
unpublishRemove your public key from CKD

keys create flags:

FlagTypeDefaultDescription
--typestringx25519Key type: x25519 or aes256
--aliasstringKey alias
--expires-indurationLifetime, e.g. 30d, 4w, 720h
--expires-atRFC3339Absolute expiry timestamp

keys export flags:

FlagShortTypeDefaultDescription
--formatstringpemExport format: pem or raw
--output-ostringOutput file path

keys publish / keys unpublish flags:

FlagTypeDefaultDescription
--emailstringYour email address (required)
--server-urlstring$CIPHER_SERVER_URLCKD server URL (optional)
mdstn-cipher keys create --alias project-key --expires-in 90d
mdstn-cipher keys export abc123 --format raw --output key.bin
mdstn-cipher keys publish --email alice@team.com

share

Share keys with team members via a policy/grant model.

mdstn-cipher share <subcommand>
SubcommandDescription
create <key> --with <email>Share a key with another user
listList owned policies and received grants
revoke <policy-id> <grantee-id>Revoke a share grant
mdstn-cipher share create project-key --with bob@team.com

lookup

Look up a public key by email via CKD.

mdstn-cipher lookup <email> [flags]
FlagTypeDefaultDescription
--saveboolfalseSave the result to the local CKD cache
--jsonboolfalseOutput as JSON
mdstn-cipher lookup alice@team.com --save

recover

Recover an identity key from a server backup or a BIP39 mnemonic.

mdstn-cipher recover <subcommand>
SubcommandDescription
from-serverRecover a key from the server backup (--key-id <id>)
from-mnemonicRecover a key from a BIP39 mnemonic (interactive)
mdstn-cipher recover from-server --key-id abc123
mdstn-cipher recover from-mnemonic

backup

Export keys and policies to a backup file.

mdstn-cipher backup [flags]
FlagShortTypeDefaultDescription
--output-ostringcipher-backup-YYYYMMDD.jsonOutput file path
mdstn-cipher backup -o mybackup.json

restore

Import keys and policies from a backup file.

mdstn-cipher restore <backup-file> [flags]
FlagTypeDefaultDescription
--forceboolfalseOverwrite existing keys and policies
mdstn-cipher restore mybackup.json --force

api-key

Manage API keys for programmatic access (keys are formatted ck_live_…).

mdstn-cipher api-key <subcommand>
SubcommandDescription
createCreate an API key (--name <n>, --scopes <list>)
listList all API keys
revoke <id>Revoke an API key

api-key create flags:

FlagTypeDefaultDescription
--namestringName for the API key
--scopesstringadminComma-separated scopes
mdstn-cipher api-key create --name ci-bot --scopes read,encrypt

db

Manage database migrations.

mdstn-cipher db <subcommand>
SubcommandDescription
upApply all pending migrations
downRoll back the most recent migration
statusShow applied and pending migrations
create <name>Create a new blank migration file
mdstn-cipher db status

check-expiry

Scan keys for expiry and record deduplicated notifications. Intended for cron/scripts.

mdstn-cipher check-expiry

mcp

Start the MCP server for AI assistants over stdio JSON-RPC. See MCP Server.

mdstn-cipher mcp

serve

Start the Cipher server (REST API + CKD endpoint + dashboard). Requires PostgreSQL.

mdstn-cipher serve [flags]
FlagTypeDefaultDescription
--portint8080Server port
--db-urlstring$DATABASE_URLPostgreSQL connection URL
mdstn-cipher serve --port 8080 --db-url postgres://user:pass@localhost/cipher

version

Show version information.

mdstn-cipher version [--json]

completion

Generate a shell completion script.

mdstn-cipher completion <bash|zsh|fish|powershell>
mdstn-cipher completion zsh > _mdstn-cipher