Merge branch 'base64-update' into 'next'

update base64 to 0.21.2

See merge request famedly/conduit!528
This commit is contained in:
Timo Kösters 2023-08-02 05:06:24 +00:00
commit 174a580319
5 changed files with 18 additions and 17 deletions

2
Cargo.lock generated
View file

@ -368,7 +368,7 @@ dependencies = [
"async-trait",
"axum",
"axum-server",
"base64 0.13.1",
"base64 0.21.2",
"bytes",
"clap",
"crossbeam",

View file

@ -59,7 +59,7 @@ thiserror = "1.0.40"
# Used to generate thumbnails for images
image = { version = "0.24.6", default-features = false, features = ["jpeg", "png", "gif"] }
# Used to encode server public key
base64 = "0.13.1"
base64 = "0.21.2"
# Used when hashing the state
ring = "0.16.20"
# Used when querying the SRV record of other servers

View file

@ -1,4 +1,5 @@
use crate::{services, Result, Ruma};
use base64::{engine::general_purpose, Engine as _};
use hmac::{Hmac, Mac};
use ruma::{api::client::voip::get_turn_server_info, SecondsSinceUnixEpoch};
use sha1::Sha1;
@ -28,7 +29,7 @@ pub async fn turn_server_route(
.expect("HMAC can take key of any size");
mac.update(username.as_bytes());
let password: String = base64::encode_config(mac.finalize().into_bytes(), base64::STANDARD);
let password: String = general_purpose::STANDARD.encode(mac.finalize().into_bytes());
(username, password)
} else {

View file

@ -31,6 +31,8 @@ use tokio::sync::{broadcast, watch::Receiver, Mutex as TokioMutex, Semaphore};
use tracing::{error, info};
use trust_dns_resolver::TokioAsyncResolver;
use base64::{engine::general_purpose, Engine as _};
type WellKnownMap = HashMap<OwnedServerName, (FedDest, String)>;
type TlsNameMap = HashMap<String, (Vec<IpAddr>, u16)>;
type RateLimitState = (Instant, u32); // Time if last failed try, number of failed tries
@ -367,7 +369,7 @@ impl Service {
let mut r = PathBuf::new();
r.push(self.config.database_path.clone());
r.push("media");
r.push(base64::encode_config(key, base64::URL_SAFE_NO_PAD));
r.push(general_purpose::URL_SAFE_NO_PAD.encode(key));
r
}

View file

@ -18,6 +18,8 @@ use crate::{
use federation::transactions::send_transaction_message;
use futures_util::{stream::FuturesUnordered, StreamExt};
use base64::{engine::general_purpose, Engine as _};
use ruma::{
api::{
appservice,
@ -497,17 +499,14 @@ impl Service {
})?,
appservice::event::push_events::v1::Request {
events: pdu_jsons,
txn_id: (&*base64::encode_config(
calculate_hash(
&events
.iter()
.map(|e| match e {
SendingEventType::Edu(b) | SendingEventType::Pdu(b) => &**b,
})
.collect::<Vec<_>>(),
),
base64::URL_SAFE_NO_PAD,
))
txn_id: (&*general_purpose::URL_SAFE_NO_PAD.encode(calculate_hash(
&events
.iter()
.map(|e| match e {
SendingEventType::Edu(b) | SendingEventType::Pdu(b) => &**b,
})
.collect::<Vec<_>>(),
)))
.into(),
},
)
@ -642,7 +641,7 @@ impl Service {
pdus: pdu_jsons,
edus: edu_jsons,
origin_server_ts: MilliSecondsSinceUnixEpoch::now(),
transaction_id: (&*base64::encode_config(
transaction_id: (&*general_purpose::URL_SAFE_NO_PAD.encode(
calculate_hash(
&events
.iter()
@ -651,7 +650,6 @@ impl Service {
})
.collect::<Vec<_>>(),
),
base64::URL_SAFE_NO_PAD,
))
.into(),
},