network library leveraging keynesis

3 releases (breaking)

0.3.1 Feb 9, 2022
0.3.0 Feb 9, 2022
0.2.0 Dec 9, 2021
0.1.0 Nov 24, 2021

#697 in #cryptography

Download history 78/week @ 2023-01-24 45/week @ 2023-01-31 39/week @ 2023-02-07 53/week @ 2023-02-14 65/week @ 2023-02-21 29/week @ 2023-02-28 62/week @ 2023-03-07 63/week @ 2023-03-14 38/week @ 2023-03-21 125/week @ 2023-03-28 18/week @ 2023-04-04 36/week @ 2023-04-11 26/week @ 2023-04-18 78/week @ 2023-04-25 35/week @ 2023-05-02 57/week @ 2023-05-09

212 downloads per month


5.5K SLoC


This crate implements the network part of the Anonymous Secure Mail Transfer Protocol (ASMTP). See siblings libraries for the other part of the protocol as well as keynesis.

This crates does not contain material to keep and manage multiple connections, see asmtpd's code for that. Instead here we are focusing on the low level part of the protocol. Providing the core features such as the protocol for the establishing handshakes (establishing a secure bidirectional connection with forward secrecy enabled: noise).


the handshake is pretty simple, it consist of one byte of protocol version and followed by the [IK] noise pattern handshake messages. This allows for the initiator to open their identity only to the expected peer.


Once the connection is established all messages in or out are encrypted with forward secrecy. We have guarantee that the remote peer is the expected peer and they also have means to authenticate our node.

Now we can send messages.

Lack of multiplexing

as you can see there is no Request/Response to the messages. While it is possible to request a peer to do something for us there is no way of knowing if the node is going to respond to that specific request or not. If after sometimes there is no response you might want to try again. But for now there is no multiplexing of the queries in order to simplify the implementation of the network protocol.

There is exactly 7 message types (8 with the handshake) that goes through the network and while there is room for up to 255 it is likely not to grow much.


This project is licensed under the MIT OR Apache-2.0 dual license.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in ASMTP by you, shall be licensed as MIT OR Apache-2.0 dual license, without any additional terms or conditions.


~172K SLoC