update base64 to 0.21.2

Signed-off-by: June <june@girlboss.ceo>
merge-requests/551/head
June 11 months ago
parent d2bfcb018e
commit 5a7bade476

2
Cargo.lock generated

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

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

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

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

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

Loading…
Cancel
Save