Skip to content
Draft
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
3 changes: 0 additions & 3 deletions bhttp/src/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
8 changes: 4 additions & 4 deletions ohttp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> {
pub fn from_config(config: &KeyConfig) -> Res<Self> {
// 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);
Expand All @@ -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<Self> {
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
Expand Down
6 changes: 3 additions & 3 deletions ohttp/src/rh/hpke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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<Self> {
pub fn new(config: Config, pk_r: &PublicKey, info: &[u8]) -> Res<Self> {
let mut csprng = thread_rng();

macro_rules! dispatch_hpkes_new {
Expand Down