Commit 44223cf
authored
refactor: split main.rs into modules (#44)
* refactor: split main.rs into cli, io, macros, and commands modules
Split the 1256-line main.rs into a modular structure:
- cli.rs: CLI definitions (Cli, Commands, Algorithm, OutputFormat)
- macros.rs: 6 dispatch macros (kem_keygen!, dsa_keygen!, etc.)
- io.rs: encode/decode helpers and write_secret_file
- commands/: 7 command handlers (keygen, encaps, decaps, sign, verify, info, completions)
- main.rs: entry point with mod declarations and match dispatch only
No functional changes. All 30 tests pass.
* fix: address PR review comments for module split
- Fully-qualify rng(), Zeroizing, anyhow!() in dispatch macros to
eliminate hidden caller-side import dependencies
- Add sync_all() before rename in write_secret_file for crash safety
- Clean up temp file on rename failure to avoid leaving secret material
- Remove now-unused anyhow/rng imports from command modules and io.rs
* fix: correct function names in unreachable branch comments
Update comments referencing nonexistent `detect_kem_algorithm` to the
actual method names: `detect_kem_from_pub_key` and `detect_kem_from_sec_key`.1 parent 11838bc commit 44223cf
14 files changed
+1264
-1168
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
0 commit comments