cl_noise_protocol/
lib.rs

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