diff --git a/ml-kem/src/decapsulation_key.rs b/ml-kem/src/decapsulation_key.rs index aa17487..30571a3 100644 --- a/ml-kem/src/decapsulation_key.rs +++ b/ml-kem/src/decapsulation_key.rs @@ -186,6 +186,7 @@ where type KeySize = U64; } +/// Initialize [`DecapsulationKey`] from a 64-byte uniformly random [`Seed`] value. impl

KeyInit for DecapsulationKey

where P: KemParams, @@ -196,6 +197,20 @@ where } } +/// Serialize the 64-byte [`Seed`] value used to initialize this [`DecapsulationKey`]. +/// +/// # Panics +/// If this [`DecapsulationKey`] was initialized using legacy expanded key support +/// (see [`ExpandedKeyEncoding`]). +impl

KeyExport for DecapsulationKey

+where + P: KemParams, +{ + fn to_bytes(&self) -> Seed { + self.to_seed().expect("should be initialized from a seed") + } +} + /// DEPRECATED: support for encoding and decoding [`DecapsulationKey`]s in the legacy expanded form, /// as opposed to the more widely adopted [`Seed`] form. ///