p2p_chat/ui/runner/actions/commands/
info.rs1use anyhow::Result;
3use base64::prelude::BASE64_STANDARD;
4use base64::Engine;
5
6use super::super::context::CommandContext;
7
8pub async fn show_info(context: &CommandContext) -> Result<()> {
16 let output = format!(
17 "Your Identity:\n Peer ID: {}\n E2E Public Key: {}",
18 context.node().identity.peer_id,
19 BASE64_STANDARD.encode(context.node().identity.hpke_public_key())
20 );
21 context.emit_chat(output);
22 Ok(())
23}
24
25pub async fn show_check_message(context: &CommandContext) -> Result<()> {
31 context.emit_chat("✅ Mailbox discovery runs automatically every few seconds.");
32 Ok(())
33}
34
35pub async fn show_help(context: &CommandContext) -> Result<()> {
41 let help_text = "Available commands:\n friend <peer_id> <e2e_key> [nickname] - Add a friend and optionally assign a nickname\n friends - List all friends\n send <peer_id_or_nickname> <message> - Send a message\n history <peer_id_or_nickname> [count] - Show message history (default: 20, max: 1000)\n peers - Show connected peers\n info - Show your identity\n check - Check for new messages in mailboxes\n help - Show this help\n exit - Exit the application";
42 context.emit_chat(help_text);
43 Ok(())
44}