Skip to content

Commit

Permalink
Merge pull request #10 from jelmer/base64-0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
tesaguri committed Jun 18, 2024
2 parents 8dba1dc + 975c7e9 commit ffd0fb6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions oauth1-request/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ name = "pull_9"
required-features = ["std"]

[dependencies]
base64 = { version = "0.13", default-features = false }
base64 = { version = "0.21", default-features = false }
cfg-if = "1"
fmt-cmp = "0.1.1"
oauth-credentials = { version = "0.3", default-features = false }
Expand All @@ -48,7 +48,7 @@ rsa06 = { version = "0.6", optional = true, package = "rsa" }
js-sys = { version = "0.3", optional = true }

[dev-dependencies]
base64 = "0.13"
base64 = "0.21"
# Trick to make `proc-macro-crate` work in doctests.
oauth1-request = { version = "0.6", path = "", default-features = false }
version-sync = "0.9"
Expand Down
5 changes: 4 additions & 1 deletion oauth1-request/src/serializer/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use core::fmt::{self, Display, Write};
use core::num::NonZeroU64;
use core::str;

use base64::{Engine as _};
use rand::prelude::*;

use crate::signature_method::{Sign, SignatureMethod};
Expand Down Expand Up @@ -431,7 +432,9 @@ fn gen_nonce<'a, R: RngCore + CryptoRng>(buf: &'a mut [u8; NONCE_LEN], rng: &mut
let i = rand.iter().position(|&b| b != 0).unwrap_or(rand.len());
let rand = &rand[i..];

let len = base64::encode_config_slice(&rand, base64::URL_SAFE_NO_PAD, buf);
let len = base64::engine::general_purpose::URL_SAFE_NO_PAD
.encode_slice(&rand, buf)
.unwrap();
let buf = &buf[..len];

str::from_utf8(buf).unwrap()
Expand Down
4 changes: 2 additions & 2 deletions oauth1-request/src/signature_method/digest_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ impl<U: Update> UpdateSign<U> {

impl<A: AsRef<[u8]>> Display for Base64PercentEncodeDisplay<A> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
let d = PercentEncode(Base64Display::with_config(
let d = PercentEncode(Base64Display::new(
self.0.as_ref(),
base64::STANDARD,
&base64::engine::general_purpose::STANDARD,
));
Display::fmt(&d, f)
}
Expand Down

0 comments on commit ffd0fb6

Please sign in to comment.