54 releases (breaking)

0.46.0 Jan 14, 2025
0.45.0 Aug 9, 2024
0.44.0 Nov 5, 2023
0.43.0 Jun 20, 2023
0.4.0 Mar 29, 2019

#176 in Cryptography

Download history 26011/week @ 2024-12-25 50939/week @ 2025-01-01 69129/week @ 2025-01-08 87135/week @ 2025-01-15 79311/week @ 2025-01-22 71461/week @ 2025-01-29 81545/week @ 2025-02-05 88940/week @ 2025-02-12 73970/week @ 2025-02-19 79762/week @ 2025-02-26 80010/week @ 2025-03-05 82915/week @ 2025-03-12 73327/week @ 2025-03-19 81686/week @ 2025-03-26 68170/week @ 2025-04-02 69734/week @ 2025-04-09

306,775 downloads per month
Used in 317 crates (13 directly)

MIT license

365KB
7K SLoC

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 libp2p_core::InboundUpgrade and 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 libp2p_core::{transport::MemoryTransport, upgrade, Transport};
use libp2p_identity as identity;
use libp2p_noise as noise;

let id_keys = identity::Keypair::generate_ed25519();
let noise = noise::Config::new(&id_keys).unwrap();
let builder = MemoryTransport::default()
    .upgrade(upgrade::Version::V1)
    .authenticate(noise);
// let transport = builder.multiplex(...);

Dependencies

~7–18MB
~246K SLoC