| Crates.io | sf-cli |
| lib.rs | sf-cli |
| version | 1.0.6 |
| created_at | 2025-09-14 02:24:53.620823+00 |
| updated_at | 2025-09-14 03:11:27.899173+00 |
| description | Secure file encryption CLI/TUI tool with password protection |
| homepage | https://github.com/npv2k1/sf-cli |
| repository | https://github.com/npv2k1/sf-cli |
| max_upload_size | |
| id | 1838308 |
| size | 315,363 |
A secure file encryption tool with password protection, supporting both command-line and terminal user interface modes.
git clone https://github.com/npv2k1/sf-cli.git
cd sf-cli
cargo build --release
Download the latest binary from the Releases page.
# Show help
./sf-cli --help
# Encrypt a file with password prompt
./sf-cli encrypt secret.txt
# Encrypt with compression and custom output
./sf-cli encrypt data.txt -c -o data.sf.gz
# Encrypt with password from command line (not recommended for production)
./sf-cli encrypt file.txt -p mypassword
# Decrypt a file
./sf-cli decrypt secret.sf
# Decrypt with compression
./sf-cli decrypt data.sf.gz -c
# Encrypt an entire directory
./sf-cli encrypt my_folder/
# Decrypt a directory
./sf-cli decrypt my_folder.sf
Watch mode monitors directories for file changes and automatically processes them:
# Watch directory and auto-encrypt new files
./sf-cli watch-encrypt /path/to/source --password mypass
# Watch with target directory and delete source files
./sf-cli watch-encrypt /path/to/source -t /path/to/encrypted -d --password mypass
# Watch with file extension filtering (only .txt and .doc files)
./sf-cli watch-encrypt /path/to/source -e "txt,doc" --password mypass
# Process existing files on startup
./sf-cli watch-encrypt /path/to/source --process-existing --password mypass
# Watch directory and auto-decrypt encrypted files
./sf-cli watch-decrypt /path/to/encrypted -t /path/to/decrypted --password mypass
# Watch decrypt with compression and delete source
./sf-cli watch-decrypt /path/to/encrypted -c -d --password mypass
Start the interactive mode:
./sf-cli tui
# or simply
./sf-cli
1 - Encrypt file/directory2 - Decrypt file/directoryEnter - Confirm inputEsc - Return to main menuq - Quit applicationEncrypted files contain:
# Create a test file
echo "This is sensitive data" > secret.txt
# Encrypt it
./sf-cli encrypt secret.txt
# Output: β Encrypt secret.txt -> secret.sf (83 bytes)
# Decrypt it
./sf-cli decrypt secret.sf
# Output: β Decrypt secret.sf -> secret (23 bytes)
# Setup watch directories
mkdir -p /tmp/documents /tmp/encrypted /tmp/decrypted
# Start watching for new documents to encrypt
./sf-cli watch-encrypt /tmp/documents -t /tmp/encrypted -p mypassword &
# Add files to watch - they will be automatically encrypted
echo "Confidential report" > /tmp/documents/report.txt
echo "Meeting notes" > /tmp/documents/notes.txt
# Files automatically encrypted to /tmp/encrypted/
# Start watching encrypted directory for auto-decryption
./sf-cli watch-decrypt /tmp/encrypted -t /tmp/decrypted -p mypassword &
# Any new .sf files in /tmp/encrypted will be auto-decrypted to /tmp/decrypted/
# Watch only specific file types and delete originals
./sf-cli watch-encrypt /home/user/documents \
--target-dir /backup/encrypted \
--extensions "txt,doc,pdf" \
--delete-source \
--process-existing \
--password mypassword
# Watch with compression
./sf-cli watch-encrypt /data/logs \
--compress \
--delete-source \
--password logpass
# Create a large repetitive file
python3 -c "print('repeated data ' * 10000)" > large.txt
# Encrypt with compression
./sf-cli encrypt large.txt -c
# Achieves 95%+ compression ratio on repetitive data
# Create a directory with files
mkdir my_docs
echo "Document 1" > my_docs/doc1.txt
echo "Document 2" > my_docs/doc2.txt
# Encrypt the entire directory
./sf-cli encrypt my_docs/
# Output: β Encrypt my_docs -> my_docs.sf (218 bytes, compressed)
# Decrypt the directory
./sf-cli decrypt my_docs.sf
# Restores the complete directory structure
sf-cli/
βββ src/
β βββ crypto.rs # Encryption/decryption engine
β βββ compression.rs # Compression utilities
β βββ file_ops.rs # File and directory operations
β βββ progress.rs # Progress tracking
β βββ models.rs # Data structures
β βββ tui.rs # Terminal user interface
β βββ lib.rs # Library root
β βββ main.rs # CLI application
βββ tests/ # Integration tests
βββ examples/ # Usage examples
βββ docs/ # Documentation
cargo build
cargo test
cargo run --example basic_usage
cargo clippy -- -D warnings
cargo fmt
SF-CLI includes an automated version management script for releasing new versions:
# Increment patch version (1.0.4 β 1.0.5)
./scripts/version.sh patch
# Increment minor version (1.0.4 β 1.1.0)
./scripts/version.sh minor
# Increment major version (1.0.4 β 2.0.0)
./scripts/version.sh major
# Test without making changes
./scripts/version.sh patch --dry-run
The script automatically:
Cargo.toml versionSee scripts/README.md for detailed usage and options.
This project uses GitHub Actions for continuous integration and deployment:
CI: Runs on every push and pull request to main
Release: Automatically creates releases
Security: Weekly security audits and checks on main branch
Development Releases (automatic):
Stable Releases (manual):
git tag v1.0.0 && git push origin v1.0.0)This project is licensed under either of
at your option.