summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJune <june@girlboss.ceo>2023-08-01 14:48:50 -1000
committerJune <june@girlboss.ceo>2023-08-01 14:48:50 -1000
commit5a7bade476d9fa91c7c59f858d9481097b819bf9 (patch)
tree3cee6c22dc4e102e5809a6809813920f1aeff854
parentd2bfcb018ed40eb91b6f7dd31727e24f2b992727 (diff)
downloadconduit-5a7bade476d9fa91c7c59f858d9481097b819bf9.zip
update base64 to 0.21.2
Signed-off-by: June <june@girlboss.ceo>
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/api/client_server/voip.rs3
-rw-r--r--src/service/globals/mod.rs4
-rw-r--r--src/service/sending/mod.rs24
5 files changed, 18 insertions, 17 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 7ddf487..cdf1821 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -368,7 +368,7 @@ dependencies = [
"async-trait",
"axum",
"axum-server",
- "base64 0.13.1",
+ "base64 0.21.2",
"bytes",
"clap",
"crossbeam",
diff --git a/Cargo.toml b/Cargo.toml
index 7a157f4..9828162 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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
diff --git a/src/api/client_server/voip.rs b/src/api/client_server/voip.rs
index 4990c17..f0d91f7 100644
--- a/src/api/client_server/voip.rs
+++ b/src/api/client_server/voip.rs
@@ -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 {
diff --git a/src/service/globals/mod.rs b/src/service/globals/mod.rs
index 875a457..e9bd0da 100644
--- a/src/service/globals/mod.rs
+++ b/src/service/globals/mod.rs
@@ -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
}
diff --git a/src/service/sending/mod.rs b/src/service/sending/mod.rs
index 14d83be..b441144 100644
--- a/src/service/sending/mod.rs
+++ b/src/service/sending/mod.rs
@@ -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(),
},