diff --git a/bhttp/src/err.rs b/bhttp/src/err.rs index 19d5455..d9d9b6f 100644 --- a/bhttp/src/err.rs +++ b/bhttp/src/err.rs @@ -6,9 +6,6 @@ pub enum Error { ConnectUnsupported, #[error("a field contained invalid Unicode: {0}")] CharacterEncoding(#[from] std::string::FromUtf8Error), - #[error("a chunk of data of {0} bytes is too large")] - #[cfg(feature = "stream")] - ChunkTooLarge(u64), #[error("read a response when expecting a request")] ExpectedRequest, #[error("read a request when expecting a response")] diff --git a/ohttp/src/lib.rs b/ohttp/src/lib.rs index 2baeccd..da448d4 100644 --- a/ohttp/src/lib.rs +++ b/ohttp/src/lib.rs @@ -92,13 +92,13 @@ pub struct ClientRequest { #[cfg(feature = "client")] impl ClientRequest { /// Construct a `ClientRequest` from a specific `KeyConfig` instance. - pub fn from_config(config: &mut KeyConfig) -> Res { + pub fn from_config(config: &KeyConfig) -> Res { // TODO(mt) choose the best config, not just the first. let selected = config.select(config.symmetric[0])?; // Build the info, which contains the message header. let info = build_info(config.key_id, selected)?; - let hpke = HpkeS::new(selected, &mut config.pk, &info)?; + let hpke = HpkeS::new(selected, &config.pk, &info)?; let header = Vec::from(&info[INFO_REQUEST.len() + 1..]); debug_assert_eq!(header.len(), REQUEST_HEADER_LEN); @@ -108,8 +108,8 @@ impl ClientRequest { /// Reads an encoded configuration and constructs a single use client sender. /// See `KeyConfig::decode` for the structure details. pub fn from_encoded_config(encoded_config: &[u8]) -> Res { - let mut config = KeyConfig::decode(encoded_config)?; - Self::from_config(&mut config) + let config = KeyConfig::decode(encoded_config)?; + Self::from_config(&config) } /// Reads an encoded list of configurations and constructs a single use client sender diff --git a/ohttp/src/rh/hpke.rs b/ohttp/src/rh/hpke.rs index 2dcc76d..989dd65 100644 --- a/ohttp/src/rh/hpke.rs +++ b/ohttp/src/rh/hpke.rs @@ -11,8 +11,8 @@ use bitcoin_hpke::{ setup_receiver, setup_sender, Deserializable, OpModeR, OpModeS, Serializable, }; -use ::rand::thread_rng; use log::trace; +use rand::thread_rng; use std::ops::Deref; /// Configuration for `Hpke`. @@ -98,7 +98,7 @@ impl PrivateKey { impl std::fmt::Debug for PrivateKey { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - if let Ok(b) = self.key_data() { + if let Ok(_) = self.key_data() { write!(f, "PrivateKey [REDACTED]") } else { write!(f, "Opaque PrivateKey") @@ -157,7 +157,7 @@ pub struct HpkeS { impl HpkeS { /// Create a new context that uses the KEM mode for sending. - pub fn new(config: Config, pk_r: &mut PublicKey, info: &[u8]) -> Res { + pub fn new(config: Config, pk_r: &PublicKey, info: &[u8]) -> Res { let mut csprng = thread_rng(); macro_rules! dispatch_hpkes_new {