Skip to content

Commit e345feb

Browse files
tottotoabr-egn
andauthored
Update to base64 0.22 (#1500)
Co-authored-by: Abraham Egnor <[email protected]>
1 parent 7a2bea7 commit e345feb

File tree

9 files changed

+22
-14
lines changed

9 files changed

+22
-14
lines changed

Cargo.lock

Lines changed: 6 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ tracing-unstable = ["dep:tracing", "dep:log", "bson3?/serde_json-1"]
7979
text-indexes-unstable = []
8080

8181
[dependencies]
82-
base64 = "0.13.0"
82+
base64 = "0.22"
8383
bitflags = "2"
8484
chrono = { version = "0.4.32", default-features = false, features = [
8585
"now",

src/base64.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use base64::{engine::general_purpose::STANDARD, DecodeError, Engine as _};
2+
3+
pub(crate) fn encode<T: AsRef<[u8]>>(input: T) -> String {
4+
STANDARD.encode(input)
5+
}
6+
7+
pub(crate) fn decode<T: AsRef<[u8]>>(input: T) -> Result<Vec<u8>, DecodeError> {
8+
STANDARD.decode(input)
9+
}

src/client/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mod x509;
1515

1616
use std::{borrow::Cow, fmt::Debug, str::FromStr};
1717

18-
use crate::{bson::RawDocumentBuf, bson_compat::cstr, options::ClientOptions};
18+
use crate::{base64, bson::RawDocumentBuf, bson_compat::cstr, options::ClientOptions};
1919
use derive_where::derive_where;
2020
use hmac::{digest::KeyInit, Mac};
2121
use rand::Rng;

src/client/auth/aws.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use http::Request;
99
use serde::Deserialize;
1010

1111
use crate::{
12+
base64,
1213
bson::{doc, spec::BinarySubtype, Binary, Bson, Document},
1314
client::{
1415
auth::{

src/client/auth/scram.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use std::sync::LazyLock;
1818
use tokio::sync::RwLock;
1919

2020
use crate::{
21+
base64,
2122
bson::{Bson, Document},
2223
bson_compat::cstr,
2324
client::{

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub use ::mongocrypt;
2525

2626
pub mod action;
2727
pub mod atlas_search;
28+
mod base64;
2829
pub(crate) mod bson_compat;
2930
mod bson_util;
3031
pub mod change_stream;

src/test/csfle.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use mongocrypt::ctx::{Algorithm, KmsProvider, KmsProviderType};
2626
use std::sync::LazyLock;
2727

2828
use crate::{
29+
base64,
2930
client_encryption::{ClientEncryption, EncryptKey},
3031
options::{CollectionOptions, ReadConcern, TlsOptions, WriteConcern},
3132
Client,

src/test/csfle/prose.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use mongocrypt::ctx::Algorithm;
1313
use tokio::net::TcpListener;
1414

1515
use crate::{
16+
base64,
1617
bson::{
1718
doc,
1819
rawdoc,

0 commit comments

Comments
 (0)