Skip to content

Commit 7fd8aac

Browse files
feat: Add Interactive TUI mode with scrollable command output
- Implement complete TUI framework using ratatui 0.28 + crossterm 0.28 - Add Interactive command to CLI with 6 menu categories - Implement real PKCS#11 command execution for info and list-slots - Add comprehensive scrolling system with PageUp/PageDown support - Fix scrolling logic consistency between render and scroll methods - Disable tracing for interactive mode to prevent TUI corruption - Add demo script and comprehensive documentation - Support both SoftHSM2 and Kryoptic HSM providers TUI Features: - Menu-driven interface with hierarchical navigation - Real-time status feedback with emojis and progress indicators - Scrollable command output for large results (tested with 146+ lines) - Graceful error handling and recovery - Clean terminal management and proper cleanup Architecture: - crates/rust-hsm-cli/src/commands/interactive.rs (765 lines) - Modular command execution with real PKCS#11 integration - Consistent error handling and status management - Memory-safe PKCS#11 lifecycle (initialize/finalize) Tested extensively in Docker with multiple HSM providers and various output sizes. Foundation ready for expanding to full PKCS#11 functionality.
1 parent 6b05c18 commit 7fd8aac

8 files changed

Lines changed: 1635 additions & 8 deletions

File tree

crates/rust-hsm-cli/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ toml = "0.8"
1717
dirs = "5.0"
1818
serde = { version = "1.0", features = ["derive"] }
1919
serde_json = "1.0"
20+
ratatui = "0.28"
21+
crossterm = "0.28"
2022

2123
[dev-dependencies]
2224
tempfile = "3.13"

crates/rust-hsm-cli/src/cli.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,4 +641,11 @@ pub enum Commands {
641641
#[arg(long, default_value = "text")]
642642
format: String,
643643
},
644+
645+
/// Launch interactive terminal interface for guided HSM operations
646+
Interactive {
647+
/// Token label (uses config default if not specified)
648+
#[arg(long)]
649+
label: Option<String>,
650+
},
644651
}

0 commit comments

Comments
 (0)