How vxfemboy/purrcrypt works
Main Components
• CLI Interface: Highlight the entry point (src/main.rs) that parses commands (genkey, encrypt, decrypt, import-key, list-keys, set-dialect) and directs them to the appropriate modules.
• Library/Business Logic: Represent the core logic inside src/lib.rs that manages the interplay between cryptographic functions and the “pet” encoding.
• Cryptography Module: Include src/crypto.rs, which handles the elliptic curve crypto algorithms, indicating that it’s responsible for the secure encryption/decryption processes.
• Cipher Module: Focus on the src/cipher/ directory (with mod.rs and patterns.rs) where the conversion of data to and from “cat speak” or “dog speak” (i.e., the “fluffy disguise”) is implemented.
• Key Management: Identify src/keys.rs and src/keystore.rs as responsible for key generation, storage, and retrieval. This component is critical in managing secure keys and ensuring that private keys are never leaked.
• Configuration & Debug: Include src/config.rs and src/debug.rs to denote configuration handling and debugging/logging functionalities that assist in running and troubleshooting the tool.
Relationships & Interactions
• The CLI (main.rs) acts as the controller: it processes user inputs (commands) and then calls into the shared library in lib.rs.
• lib.rs acts as a facade coordinating between the cryptography routines (crypto.rs), the transformation provided by the cipher module (cipher/mod.rs and patterns.rs), and key management (keys.rs and keystore.rs).
• Data flow is such that when a user runs an encryption command, the input file is passed to the encryption module (via crypto.rs) which then calls the cipher module to wrap the secure data in pet-speak. A similar reverse flow happens during decryption.
• Configuration parameters from config.rs and logging functionality from debug.rs help in managing runtime behavior and diagnosing issues.
Architectural Patterns & Design Principles
• Separation of Concerns is clearly applied: the CLI is separate from the business logic; cryptographic functions are separate from the presentation transformation (pet-speak ciphering).
• Modularity: Each key part of the encryption process (parsing, key management, crypto, and encoding) is implemented in its own module.
Technologies, Frameworks, & Tools
• Rust is the language; highlight that it uses Cargo (via Cargo.toml) for dependency and build management.
• The design might reference the secp256k1 elliptic curve cryptography (as mentioned in the README).
Instructing the Principal Software Engineer – What
• Use clear, labeled blocks for each component (CLI, Lib, Crypto Module, Cipher Module, Key Management, Config, Debug).
• That all core processes (key generation, encryption, decryption, key import) are detailed, noting that although the pet-speak is playful, it rests on robust cryptography.