Expand description
Noise protocol framework support for libp2p.
Note: This crate is still experimental and subject to major breaking changes both on the API and the wire protocol.
This crate provides mwc_libp2p_core::InboundUpgrade
and mwc_libp2p_core::OutboundUpgrade
implementations for various noise handshake patterns (currently IK
, IX
, and XX
)
over a particular choice of Diffie–Hellman key agreement (currently only X25519).
Note: Only the
XX
handshake pattern is currently guaranteed to provide interoperability with other libp2p implementations.
All upgrades produce as output a pair, consisting of the remote’s static public key
and a NoiseOutput
which represents the established cryptographic session with the
remote, implementing futures::io::AsyncRead
and futures::io::AsyncWrite
.
§Usage
Example:
use mwc_libp2p_core::{identity, Transport, upgrade};
use mwc_libp2p_tcp::TcpConfig;
use mwc_libp2p_noise::{Keypair, X25519Spec, NoiseConfig};
let id_keys = identity::Keypair::generate_ed25519();
let dh_keys = Keypair::<X25519Spec>::new().into_authentic(&id_keys).unwrap();
let noise = NoiseConfig::xx(dh_keys).into_authenticated();
let builder = TcpConfig::new().upgrade(upgrade::Version::V1).authenticate(noise);
// let transport = builder.multiplex(...);
Modules§
- handshake
- Noise protocol handshake I/O.
Structs§
- Authentic
Keypair - A DH keypair that is authentic w.r.t. a
identity::PublicKey
. - Handshake
- A future performing a Noise handshake pattern.
- Keypair
- DH keypair.
- Keypair
Identity - The associated public identity of a DH keypair.
- Legacy
Config - Legacy configuration options.
- Noise
Authenticated - A
NoiseAuthenticated
transport upgrade that wraps around anyNoiseConfig
handshake and verifies that the remote identified with aRemoteIdentity::IdentityKey
, aborting otherwise. - Noise
Config - The protocol upgrade configuration.
- Noise
Output - A noise session to a remote.
- Protocol
Params - The parameters of a Noise protocol, consisting of a choice for a handshake pattern as well as DH, cipher and hash functions.
- Public
Key - DH public key.
- Secret
Key - DH secret key.
- X25519
- A X25519 key.
- X25519
Spec - A X25519 key.
Enums§
- IK
- Type tag for the IK handshake pattern.
- IX
- Type tag for the IX handshake pattern.
- Identity
Exchange - The options for identity exchange in an authenticated handshake.
- Noise
Error - mwc_libp2p_noise error type.
- Remote
Identity - The identity of the remote established during a handshake.
- XX
- Type tag for the XX handshake pattern.
Traits§
- Protocol
- A Noise protocol over DH keys of type
C
. The choice ofC
determines the protocol parameters for each handshake pattern.