Skip to main content

World-class CLI for symmetric encryption of secrets - legacy v1 compatible, modern v2 secure

Project description

Prometheus

CI Python License: MIT

World-class CLI for symmetric encryption of secrets. Legacy v1 compatible, modern v2 secure.

Features

  • Crypto v2 (recommended): ChaCha20-Poly1305 + Argon2id — authenticated encryption with forward secrecy
  • Crypto v1 (legacy): XOR + SHA-256 + Base64 — backward compatible, NOT recommended for new encryption
  • Auto-detect: Automatically detects algorithm version from ciphertext format
  • Interactive mode: Guided prompts for encrypt/decrypt operations
  • Multiple output formats: Human-readable panels, JSON, quiet mode

Install

pip install prometheus-crypto

Or with optional Argon2id support (recommended):

pip install "prometheus-crypto[crypto]"

Quick Start

Encrypt

# Interactive mode
prometheus encrypt --secret "my-secret-key" --plaintext "password123"

# JSON output
prometheus encrypt --secret "my-secret-key" --plaintext "password123" --format json

# Quiet output (just the ciphertext)
prometheus encrypt --secret "my-secret-key" --plaintext "password123" --format quiet

# Force v1 legacy algorithm
prometheus encrypt --secret "my-secret-key" --plaintext "password123" --algo v1

Decrypt

# Auto-detect version from ciphertext
prometheus decrypt --secret "my-secret-key" --ciphertext "v2|salt|nonce|ct|tag"

# JSON output
prometheus decrypt --secret "my-secret-key" --ciphertext "v2|salt|nonce|ct|tag" --format json

Interactive Mode

prometheus interactive
Choose operation:
  (e) Encrypt
  (d) Decrypt
  (v) Show version
  (f) Finish
>> e
Secret: my-secret-key
Password: password123
┌─────────────── Encrypted ───────────────┐
│ v2|...                                  │
└──────────────── algorithm: v2 ──────────┘

Version & Info

prometheus version    # Algorithm info
prometheus info       # Full architecture details

Architecture

src/prometheus/
├── domain/          # Core business logic (no dependencies)
│   ├── entities.py  # Profile, GlobalConfig
│   ├── value_objects.py  # SecretKey, Plaintext, Ciphertext
│   ├── ports.py     # CryptoPort, ConfigPort, StoragePort, OutputPort
│   └── events.py    # Domain events
├── cipher/          # Crypto adapters
│   ├── v1_legacy/   # XOR + SHA-256 + Base64 (INMUTABLE)
│   ├── v2_modern/   # ChaCha20-Poly1305 + Argon2id
│   └── factory.py   # Auto-detect version, adapter selection
├── cli/             # Typer + Rich CLI
│   └── app.py       # encrypt, decrypt, interactive, version, info
└── adapters/        # Future: storage, config, keyring adapters

Hexagonal architecture (Ports & Adapters):

  • Domain is pure business logic with zero I/O dependencies
  • Ports define interfaces (CryptoPort, ConfigPort, StoragePort, OutputPort)
  • Adapters implement those interfaces for concrete technologies

Security

v2 (Recommended)

  • Key derivation: Argon2id (OWASP 2024: 3 iterations, 64MB memory, 4 parallelism)
  • Fallback: PBKDF2-SHA256 (600k iterations) if argon2-cffi is not installed
  • Encryption: ChaCha20-Poly1305 AEAD (12-byte nonce, 16-byte tag)
  • Forward secrecy: Random salt + nonce per encryption
  • Format: v2|salt_b64|nonce_b64|ciphertext_b64|tag_b64

v1 (Legacy)

  • NOT cryptographically secure
  • XOR + SHA-256 + Base64/latin1 encoding
  • Retained solely for backward compatibility with existing v1 ciphertexts
  • Do not use for new encryption — use v2 instead

Development

Setup

git clone https://github.com/Kemquiros/Prometheus.git
cd Prometheus
python -m venv .venv
source .venv/bin/activate
pip install -e ".[crypto,dev]"

Quality

ruff check src/ tests/         # Lint
mypy src/prometheus/ --strict  # Type check
pytest tests/ -v               # Tests

Test Coverage

pytest tests/ --cov=prometheus --cov-report=term-missing

Coverage threshold: 90% (enforced in CI).

License

MIT — see LICENSE.md

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

prometheus_crypto-2.0.0.tar.gz (530.1 kB view details)

Uploaded Source

Built Distribution

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

prometheus_crypto-2.0.0-py3-none-any.whl (43.1 kB view details)

Uploaded Python 3

File details

Details for the file prometheus_crypto-2.0.0.tar.gz.

File metadata

  • Download URL: prometheus_crypto-2.0.0.tar.gz
  • Upload date:
  • Size: 530.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for prometheus_crypto-2.0.0.tar.gz
Algorithm Hash digest
SHA256 0685752182d17b0a17bbece28eb2dd4f94de256bbe266492c28808f1725ba3ab
MD5 d4cb11246898de92c34d004c19243e40
BLAKE2b-256 d05072926015f04f64eb95285887b8ae86917a4d9ca12b79a4e91c3dae473037

See more details on using hashes here.

File details

Details for the file prometheus_crypto-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for prometheus_crypto-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34b78b6aecf8abe26ead0c30f8539cffc140b535707ae259be9ac6bb116b5ae0
MD5 9ca22080d8e83b7be0a3de0bafb2cea7
BLAKE2b-256 17f913987ef24af89ca0fafa7695aaabfa43523456ce029fe656d27949f96316

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