Skip to content

Commit

Permalink
Update to base64 0.22.1
Browse files Browse the repository at this point in the history
This is just simple dependency update to avoid people having duplicate (old) versions of base64 in their dependency tree if they use this crate
  • Loading branch information
AaronDewes committed Feb 28, 2025
1 parent 569a526 commit aeaf57c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion jsonrpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ proxy = ["socks"]
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = [ "raw_value" ] }

base64 = { version = "0.13.0", optional = true }
base64 = { version = "0.22.1", optional = true }
minreq = { version = "2.7.0", features = ["json-using-serde"], optional = true }
socks = { version = "0.3.4", optional = true}

Expand Down
7 changes: 5 additions & 2 deletions jsonrpc/src/http/minreq_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ use std::{error, fmt};
use crate::client::Transport;
use crate::{Request, Response};

use base64::engine::general_purpose::STANDARD as BASE64;
use base64::Engine;

const DEFAULT_URL: &str = "http://localhost";
const DEFAULT_PORT: u16 = 8332; // the default RPC port for bitcoind.
#[cfg(not(jsonrpc_fuzz))]
Expand Down Expand Up @@ -123,7 +126,7 @@ impl Builder {
if let Some(ref pass) = pass {
s.push_str(pass.as_ref());
}
self.tp.basic_auth = Some(format!("Basic {}", &base64::encode(s.as_bytes())));
self.tp.basic_auth = Some(format!("Basic {}", &BASE64.encode(s.as_bytes())));
self
}

Expand All @@ -144,7 +147,7 @@ impl Builder {
/// let client = MinreqHttpTransport::builder().cookie_auth(cookie);
/// ```
pub fn cookie_auth<S: AsRef<str>>(mut self, cookie: S) -> Self {
self.tp.basic_auth = Some(format!("Basic {}", &base64::encode(cookie.as_ref().as_bytes())));
self.tp.basic_auth = Some(format!("Basic {}", &BASE64.encode(cookie.as_ref().as_bytes())));
self
}

Expand Down
7 changes: 5 additions & 2 deletions jsonrpc/src/http/simple_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ use std::sync::{Arc, Mutex, MutexGuard};
use std::time::Duration;
use std::{error, fmt, io, net, num};

use base64::engine::general_purpose::STANDARD as BASE64;
use base64::Engine;

#[cfg(feature = "proxy")]
use socks::Socks5Stream;

Expand Down Expand Up @@ -377,13 +380,13 @@ impl Builder {
if let Some(ref pass) = pass {
auth.push_str(pass.as_ref());
}
self.tp.basic_auth = Some(format!("Basic {}", &base64::encode(auth.as_bytes())));
self.tp.basic_auth = Some(format!("Basic {}", &BASE64.encode(auth.as_bytes())));
self
}

/// Adds authentication information to the transport using a cookie string ('user:pass').
pub fn cookie_auth<S: AsRef<str>>(mut self, cookie: S) -> Self {
self.tp.basic_auth = Some(format!("Basic {}", &base64::encode(cookie.as_ref().as_bytes())));
self.tp.basic_auth = Some(format!("Basic {}", &BASE64.encode(cookie.as_ref().as_bytes())));
self
}

Expand Down

0 comments on commit aeaf57c

Please sign in to comment.