Skip to content

Commit

Permalink
Update base64 to 0.20 (#3335)
Browse files Browse the repository at this point in the history
* Update base64 to 0.20

* Fix object_store
  • Loading branch information
tustvold authored Dec 12, 2022
1 parent 19f8e8c commit b2a1283
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion arrow-flight/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ arrow-array = { version = "29.0.0", path = "../arrow-array" }
arrow-buffer = { version = "29.0.0", path = "../arrow-buffer" }
arrow-ipc = { version = "29.0.0", path = "../arrow-ipc" }
arrow-schema = { version = "29.0.0", path = "../arrow-schema" }
base64 = { version = "0.13", default-features = false }
base64 = { version = "0.20", default-features = false, features = ["std"] }
tonic = { version = "0.8", default-features = false, features = ["transport", "codegen", "prost"] }
bytes = { version = "1", default-features = false }
prost = { version = "0.11", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion object_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ url = "2.2"
walkdir = "2"

# Cloud storage support
base64 = { version = "0.13", default-features = false, optional = true }
base64 = { version = "0.20", default-features = false, features = ["std"], optional = true }
quick-xml = { version = "0.26.0", features = ["serialize"], optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
serde_json = { version = "1.0", default-features = false, optional = true }
Expand Down
10 changes: 8 additions & 2 deletions object_store/src/gcp/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@
use crate::client::retry::RetryExt;
use crate::client::token::TemporaryToken;
use crate::RetryConfig;
use base64::engine::fast_portable::FastPortable;
use reqwest::{Client, Method};
use ring::signature::RsaKeyPair;
use snafu::{ResultExt, Snafu};
use std::time::{Duration, Instant};

const URL_SAFE_NO_PAD: FastPortable = FastPortable::from(
&base64::alphabet::URL_SAFE,
base64::engine::fast_portable::NO_PAD,
);

#[derive(Debug, Snafu)]
pub enum Error {
#[snafu(display("No RSA key found in pem file"))]
Expand Down Expand Up @@ -166,7 +172,7 @@ impl OAuthProvider {
)
.context(SignSnafu)?;

let signature = base64::encode_config(&sig_bytes, base64::URL_SAFE_NO_PAD);
let signature = base64::encode_engine(&sig_bytes, &URL_SAFE_NO_PAD);
let jwt = [message, signature].join(".");

let body = [
Expand Down Expand Up @@ -218,5 +224,5 @@ fn decode_first_rsa_key(private_key_pem: String) -> Result<RsaKeyPair> {

fn b64_encode_obj<T: serde::Serialize>(obj: &T) -> Result<String> {
let string = serde_json::to_string(obj).context(EncodeSnafu)?;
Ok(base64::encode_config(string, base64::URL_SAFE_NO_PAD))
Ok(base64::encode_engine(string, &URL_SAFE_NO_PAD))
}
4 changes: 2 additions & 2 deletions parquet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ zstd = { version = "0.12.0", optional = true, default-features = false }
chrono = { version = "0.4.23", default-features = false, features = ["alloc"] }
num = { version = "0.4", default-features = false }
num-bigint = { version = "0.4", default-features = false }
base64 = { version = "0.13", default-features = false, features = ["std"], optional = true }
base64 = { version = "0.20", default-features = false, features = ["std", ], optional = true }
clap = { version = "4", default-features = false, features = ["std", "derive", "env", "help", "error-context", "usage"], optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
serde_json = { version = "1.0", default-features = false, features = ["std"], optional = true }
Expand All @@ -66,7 +66,7 @@ twox-hash = { version = "1.6", default-features = false }
paste = { version = "1.0" }

[dev-dependencies]
base64 = { version = "0.13", default-features = false, features = ["std"] }
base64 = { version = "0.20", default-features = false, features = ["std"] }
criterion = { version = "0.4", default-features = false }
snap = { version = "1.0", default-features = false }
tempfile = { version = "3.0", default-features = false }
Expand Down

0 comments on commit b2a1283

Please sign in to comment.