diff --git a/README.md b/README.md index c367e5a..bf6d19f 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,17 @@ # Anonymous Secure Mail Transfer Protocol (ASMTP) -ASMTP put together pub/sub peer to peer protocol [`poldercast`], blockchain technology +**ASMTP** brings together pub/sub peer to peer protocol [`poldercast`], blockchain technology from [`keynesis`] and encryption protocol [`noise`] to build a secure and anonymous network protocol as an alternative to [SMTP] (Simple Mail Transfer Protocol). -ASMTP was written as a tool to initially securely exchange messages with friends and -colleagues. Tools that provides End to End encryptions often keep hidden from their +**ASMTP** was written as a tool to initially securely exchange messages with friends and +colleagues. Other tools that provides End to End encryptions often keep hidden from their users that they are still collecting metadata (such as who talks to whom and what -time). `Signal` is an interesting messaging tool. However they still requires you -to have a phone number to register on their platform. This is not something I am happy -with too. If the telephone company decides to block `Signal` from sending you -the authentication code you are screwed. They may even intercept that authentication -code to register in our stead. Scary. +time). -ASMTP does not relies on any third party. Just like in the spirit of the old [SMTP], +**ASMTP** does not relies on any third party. Just like in the spirit of the old [SMTP], messages are relayed from the mail server of the sender to the mail server -of the recipient and it may use an intermediate route to do so. (yes, [SMTP] -used to be decentralized by design until big companies started to offer -_"free"_ email services). However, unlike [SMTP], the sender and the recipient -identifier (email address for [SMTP]) is not known. Also unlike [SMTP] it is -not possible to receive messages from senders that are not "allowed" to. +of the recipient and it may use an intermediate route to do so. # Deployment diff --git a/asmtp-cli/src/bin/asmtp-cli.rs b/asmtp-cli/src/bin/asmtp-cli.rs index d2302ac..6963aac 100644 --- a/asmtp-cli/src/bin/asmtp-cli.rs +++ b/asmtp-cli/src/bin/asmtp-cli.rs @@ -664,21 +664,44 @@ async fn sync_new_messages( .with_context(|| format!("Failed to load messages for {topic}", topic = topic))?; } + let pb = ProgressBar::new_spinner().with_style(style.spinner.clone()); + pb.set_message("waiting for messages..."); + pb.enable_steady_tick(style.spinner_interval); + + let mut counter: usize = 0; + while let Ok(Some((_peer, message))) = timeout(std::time::Duration::from_secs(2), connection.next()).await { let message = message?; + counter += 1; if let Some((topic, m)) = message.topic_checked() { - eprintln!( + pb.println(format!( "incoming message for {topic}", - topic = style.topic.apply_to(topic) - ); + topic = style.topic.apply_to(topic), + )); let message = asmtp_storage::Message::open(state.db(), topic)?; message.insert(m)?; } } + pb.finish_and_clear(); + + if counter > 0 { + eprintln!( + "{prefix} You have no new messages", + prefix = style.dialoguer.success_prefix, + ); + } else { + let plural = if counter > 1 { "s" } else { "" }; + eprintln!( + "{prefix} You have {count} new message{plural}", + prefix = style.dialoguer.success_prefix, + count = counter, + plural = plural, + ); + } Ok(()) } diff --git a/asmtpd/src/bin/asmtpd-cli.rs b/asmtpd/src/bin/asmtpd-cli.rs index 1f0015c..7b84d3f 100644 --- a/asmtpd/src/bin/asmtpd-cli.rs +++ b/asmtpd/src/bin/asmtpd-cli.rs @@ -93,14 +93,10 @@ async fn make_gossip(password: Option, config: PathBuf) -> Result<()> { password } else { dialoguer::Password::new() - .with_confirmation( - "Confirm new password", - "Password mismatched, put your game together", - ) .allow_empty_password(false) - .with_prompt("Enter new password") + .with_prompt("Enter password") .interact() - .context("Failed to confirm new password")? + .context("Failed gather password")? }; config.secret.password = Some(password); diff --git a/asmtpd/src/config.yaml b/asmtpd/src/config.yaml index d8e515e..666044a 100644 --- a/asmtpd/src/config.yaml +++ b/asmtpd/src/config.yaml @@ -39,7 +39,8 @@ network: heart_beat: { secs: 1, nanos: 0 } # initial list of known gossips - known_gossips: [] + known_gossips: + - "80007353f1e7fb03b2346638b4e2b93f810c84853787970be0844df63cdc9979a01d0221561d561f667d26482dc49b0ef76a32f94aeecb4c01191510ca8ec977bd714545888ad0117fa81a176922927114db64cbc6666d2fa2877207baabe0080489fac7c054335c68fcc90d" gossiping: # number of seconds between 2 gossips to a specific node from our size