noise_protocol/
lib.rs

1//! Rust implementation of the [Noise Protocol
2//! Framework](http://www.noiseprotocol.org/).
3//!
4//! # Basic Usage
5//!
6//! Initialize a [`HandshakeState`] with [`HandshakeState::new`] or
7//! [`HandshakeStateBuilder`], call [`HandshakeState::write_message`] and
8//! [`HandshakeState::read_message`] to complete the handshake, and finally call
9//! [`HandshakeState::get_ciphers`] to get a pair of [`CipherState`] to
10//! encrypt/decrypt further transport messages.
11//!
12//! # Crypto Primitives
13//!
14//! This crate only contains an abstract implementation of the protocol.
15//! Concrete implementations of the crypto primitives, wrapping around some
16//! popular libraries, are provided in sibling crates, e.g., `noise-ring`,
17//! `noise-sodiumoxide` and `noise-rust-crypto`.
18//!
19//! Other implementations of the crypto primitives can be easily plugged in by
20//! implementing the [`DH`], [`Cipher`] and [`Hash`] traits.
21
22#![warn(missing_docs)]
23#![cfg_attr(not(feature = "use_std"), no_std)]
24
25mod cipherstate;
26mod handshakepattern;
27mod handshakestate;
28mod symmetricstate;
29mod traits;
30
31#[cfg(feature = "use_alloc")]
32#[macro_use]
33extern crate alloc;
34
35pub use crate::cipherstate::CipherState;
36pub use crate::traits::{Cipher, Hash, U8Array, DH};
37
38/// Handshake patterns.
39pub mod patterns {
40    pub use crate::handshakepattern::*;
41}
42
43pub use crate::handshakestate::{Error, ErrorKind, HandshakeState, HandshakeStateBuilder};