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