How classx/dark-matter works
Project Type and Purpose
• This is a single-binary, command-line vault utility named “Dark Matter,” written in Rust (Cargo project).
• Its purpose is to provide secure file storage (“vault”) by encrypting files with GPG, tracking them with an embedded SQLite database, and exposing a CLI for standard file‐management operations (add, list, update, remove, export) plus key validation.
Main Components
a. User / Terminal
• The user invokes commands in a shell.
b. Dark Matter CLI (Rust Binary)
• Argument parsing & dispatch
• Core vault logic orchestrator
• Sub-components (could be drawn as internal modules/layers):
• Encryption Module (interfaces with GPG/GPGME)
• Database Module (interacts with SQLite)
• Filesystem Module (reads/writes vault directory)
c. GPG Subsystem
• External service (GPG or GPGME library) that performs actual encryption/decryption and key management.
d. SQLite Database
• Embedded file ‘dark_matter.db’ inside vault directory storing metadata: file versions, timestamps, key hashes.
e. Vault File Store (Filesystem)
• Directory containing the encrypted file blobs.
Relationships and Data Flows
• User → CLI: issues commands (init, add, list, update, remove, export, validate).
• CLI → GPG Subsystem:
• init/validate: verify key existence & fingerprint
• /update/export: encrypt/decrypt file streams
• CLI → SQLite DB:
• init: create/open database schema
• /update/remove: insert/update/delete metadata records
• Query metadata
• CLI → Filesystem:
• /update: write encrypted files to vault
• export: read encrypted file, send to GPG for decryption, write plaintext out
• remove: delete encrypted file
Architectural Patterns and Principles
• Layered design (Presentation/CLI → Application core → Persistence/encryption).
• Single responsibility: each module handles one concern (CLI parsing vs. crypto vs. storage).
• External dependencies are abstracted behind Rust modules (GPGME crate or CLI calls).
• No network—local filesystem & embedded DB.
Technologies and Frameworks
• Rust (Cargo)
• GPG / GPGME (C library binding)
• SQLite (via rusqlite or similar crate)
• Standard filesystem APIs