Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ml-kem/src/kem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{Encoded, EncodedSizeUser, Seed};
use zeroize::{Zeroize, ZeroizeOnDrop};

// Re-export traits from the `kem` crate
pub use ::kem::{Decapsulate, Encapsulate};
pub use ::kem::{Decapsulate, Encapsulate, KeyInit, KeySizeUser};

/// A shared key resulting from an ML-KEM transaction
pub(crate) type SharedKey = B32;
Expand Down
14 changes: 10 additions & 4 deletions ml-kem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@
//! computers.
//!
//! ```
//! # use ml_kem::*;
//! # use ::kem::{Decapsulate, Encapsulate};
//! let mut rng = rand::rng();
//! use ml_kem::{
//! MlKem768Params,
//! kem::{Decapsulate, Encapsulate, KeyInit}
//! };
//!
//! type DecapsulationKey = ml_kem::kem::DecapsulationKey<MlKem768Params>;
Copy link
Member Author

@tarcieri tarcieri Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could put these type aliases together for people so they don't have to assemble them like this?

Suggested change
//! type DecapsulationKey = ml_kem::kem::DecapsulationKey<MlKem768Params>;
//! use ml_kem::ml_kem_768::DecapsulationKey;

//!
//! // Generate a (decapsulation key, encapsulation key) pair
//! let (dk, ek) = MlKem768::generate(&mut rng);
//! let mut rng = rand::rng();
//! let seed = DecapsulationKey::generate_key_with_rng(&mut rng);
//! let dk = DecapsulationKey::new(&seed);
//! let ek = dk.encapsulator();
//!
//! // Encapsulate a shared key to the holder of the decapsulation key, receive the shared
//! // secret `k_send` and the encapsulated form `ct`.
Expand Down