Skip to main content

CLI and TUI editor for mm-crypt (encrypted text file editing, shell encrypt/decrypt)

Project description

mm-crypt-cli

Command-line interface and TUI editor built on top of mm-crypt. Stdlib argparse only — the one runtime dependency is mm-crypt itself, which depends only on cryptography.

Install

uv tool install mm-crypt-cli

This installs the mm-crypt executable.

Commands

mm-crypt fernet  (f)  keygen   (g)
                      encrypt  (e)
                      decrypt  (d)
mm-crypt openssl (o)  encrypt  (e)
                      decrypt  (d)
mm-crypt scrypt  (s)  encrypt  (e)
                      decrypt  (d)
mm-crypt editor  (e)  <path>

Groups and commands have single-letter aliases, so mm-crypt f e -k … is shorthand for mm-crypt fernet encrypt --key ….

Secret sources

Every command that needs a key or password takes exactly one of three mutually exclusive flags:

Flavor Flags
Fernet key --key / --key-file / --key-env
Password --password / --password-file / --password-env

--key / --password are insecure — the literal value is recorded in shell history and visible via ps. Prefer --key-file / --password-file or --key-env / --password-env for anything non-throwaway.

I/O convention

All encrypt/decrypt commands read from --input / -i (default: stdin) and write to --output / -o (default: stdout).

Text vs. binary

OpenSSL and scrypt commands accept --binary / -b:

  • default (no flag): UTF-8 text in, base64 out on encrypt; base64 in, UTF-8 text out on decrypt;
  • --binary: raw bytes on both sides.

Fernet is text-only (its tokens are already URL-safe base64).

Fernet

mm-crypt fernet keygen > my.key
echo -n "hello" | mm-crypt fernet encrypt --key-file my.key > token.txt
mm-crypt fernet decrypt --key-file my.key --input token.txt

OpenSSL (AES-256-CBC)

Fully interoperable with the openssl enc CLI binary. Equivalent openssl(1) invocations:

encrypt (base64):   openssl enc -aes-256-cbc -pbkdf2 -iter 1000000 -salt -base64 -pass pass:PASS -in in.txt -out out.b64
decrypt (base64):   openssl enc -d -aes-256-cbc -pbkdf2 -iter 1000000 -base64 -pass pass:PASS -in in.b64 -out out.txt
encrypt (--binary): openssl enc -aes-256-cbc -pbkdf2 -iter 1000000 -salt -pass pass:PASS -in in.bin -out out.bin
decrypt (--binary): openssl enc -d -aes-256-cbc -pbkdf2 -iter 1000000 -pass pass:PASS -in in.bin -out out.bin
echo -n "hello" | mm-crypt openssl encrypt --password-env MYPASS > out.b64
mm-crypt openssl decrypt --password-env MYPASS --input out.b64

scrypt (Tarsnap scrypt(1)-compatible)

Fully interoperable with the upstream scrypt binary (brew install scrypt / apt install scrypt / pacman -S scrypt). Base64 mode wraps the same binary blob for text pipelines; scrypt(1) has no native base64 mode.

KDF parameters (--log-n / -N, --r, --p) are only meaningful on encrypt; on decrypt they're read from the file header — no flags needed.

echo -n "hello" | mm-crypt scrypt encrypt --password-env MYPASS > out.b64
mm-crypt scrypt decrypt --password-env MYPASS --input out.b64

editor

mm-crypt editor <path> opens a scrypt-encrypted text file in a hand-rolled terminal editor, decrypts it in memory, and writes the edits back as a fresh scrypt blob on Ctrl+S. Creates the file on first save if it doesn't exist.

mm-crypt editor notes.scrypt            # edit (or create)
mm-crypt editor notes.scrypt --view     # read-only

The password is read interactively via getpass and is never accepted via flag, env var, or file. POSIX only (uses termios, fcntl, SIGWINCH); Windows is not supported.

Full design and security spec — flow, atomic-save guarantees, threat model, why we don't use a TUI library — in docs/tui-editor.md.

Exit codes and error format

Exit Meaning
0 Success (or --help / --version).
1 Recoverable error. Printed to stderr as Error: <message> [<CODE>], where <CODE> is an UPPER_SNAKE_CASE token (MISSING_SECRET, DECRYPTION_FAILED, INVALID_INPUT, …).
2 argparse usage error (unknown option, missing subcommand).

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

mm_crypt_cli-0.0.1.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

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

mm_crypt_cli-0.0.1-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file mm_crypt_cli-0.0.1.tar.gz.

File metadata

  • Download URL: mm_crypt_cli-0.0.1.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mm_crypt_cli-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5a63f6d8121704ae7e784425e953c40d7d869efbdf4d526a048df3eec24c4ca6
MD5 0ba253b9c4ceaaca8b93bd63ea6782e2
BLAKE2b-256 7d02d7358c1e008e5229451f6899f7cd098fe3a3814616410a75eb6221083e90

See more details on using hashes here.

File details

Details for the file mm_crypt_cli-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mm_crypt_cli-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mm_crypt_cli-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c8b23a52ea3a6653504beeb783b435736e1d0669dc277c68d02a46ae33f8dcb
MD5 b6d9db0ac78c16e9fa7c0c23f6f447a3
BLAKE2b-256 5a7351b5c764e9e18b4126275ac0129524c057f2d8874b758d112fd5686fe87c

See more details on using hashes here.

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