Skip to content

Commit

Permalink
Bump dependencies version to match Fedora.
Browse files Browse the repository at this point in the history
This PR bumps the following dependencies in order to match Fedora's
packaged ones as they're way newer than the current ones in
docker_credential.

 - base64: v0.21.7
 - rstest: v0.18.2

It also changes deprecated base64 functions.

Signed-off-by: Daniel Mellado <dmellado@redhat.com>
  • Loading branch information
danielmellado committed Feb 27, 2024
1 parent 45f1f50 commit d7dca31
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 31 deletions.
110 changes: 83 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ travis-ci = { repository = "keirlawson/docker_credential" }
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
base64 = "0.10.1"
base64 = "0.21.7"

[dev-dependencies]
rstest = "0.15.0"
rstest = "0.18.2"
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use std::error::Error;
use std::fmt;
use std::path::{Path, PathBuf};
use std::str;
use base64::Engine;
use base64::engine::general_purpose;

type Result<T> = std::result::Result<T, CredentialRetrievalError>;

Expand Down Expand Up @@ -67,7 +69,7 @@ fn config_dir() -> Option<PathBuf> {
}

fn decode_auth(encoded_auth: &str) -> Result<DockerCredential> {
let decoded = base64::decode(encoded_auth)
let decoded = general_purpose::STANDARD_NO_PAD.decode(encoded_auth)
.map_err(|_| CredentialRetrievalError::CredentialDecodingError)?;
let decoded =
str::from_utf8(&decoded).map_err(|_| CredentialRetrievalError::CredentialDecodingError)?;
Expand Down Expand Up @@ -149,7 +151,7 @@ mod tests {

#[test]
fn decodes_auth_when_no_helpers() {
let encoded_auth = base64::encode("some_user:some_password");
let encoded_auth = general_purpose::STANDARD_NO_PAD.encode("some_user:some_password");
let mut auths = HashMap::new();
auths.insert(
String::from("some server"),
Expand Down

0 comments on commit d7dca31

Please sign in to comment.