From fb002c5a0478db26410ececa2e8208aa9e5a4e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sat, 28 Jan 2023 17:33:08 +0100 Subject: [PATCH] Update the base64 dependency --- acme_common/Cargo.toml | 2 +- acme_common/src/lib.rs | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/acme_common/Cargo.toml b/acme_common/Cargo.toml index 28010f1..a87d2b3 100644 --- a/acme_common/Cargo.toml +++ b/acme_common/Cargo.toml @@ -20,7 +20,7 @@ openssl_vendored = ["crypto_openssl", "openssl/vendored", "openssl-sys/vendored" [dependencies] attohttpc = { version = "0.24", default-features = false } -base64 = "0.20" +base64 = "0.21" daemonize = "0.4" env_logger = "0.10" glob = "0.3" diff --git a/acme_common/src/lib.rs b/acme_common/src/lib.rs index c36ab09..c10c0e9 100644 --- a/acme_common/src/lib.rs +++ b/acme_common/src/lib.rs @@ -1,3 +1,4 @@ +use base64::Engine; use daemonize::Daemonize; use std::fs::File; use std::io::prelude::*; @@ -9,12 +10,6 @@ pub mod logs; #[cfg(test)] mod tests; -const URL_SAFE_NO_PAD: base64::engine::fast_portable::FastPortable = - base64::engine::fast_portable::FastPortable::from( - &base64::alphabet::URL_SAFE, - base64::engine::fast_portable::NO_PAD, - ); - macro_rules! exit_match { ($e: expr) => { match $e { @@ -45,11 +40,11 @@ pub fn to_idna(domain_name: &str) -> Result { } pub fn b64_encode>(input: &T) -> String { - base64::encode_engine(input, &URL_SAFE_NO_PAD) + base64::engine::general_purpose::URL_SAFE_NO_PAD.encode(input) } pub fn b64_decode>(input: &T) -> Result, error::Error> { - let res = base64::decode_engine(input, &URL_SAFE_NO_PAD)?; + let res = base64::engine::general_purpose::URL_SAFE_NO_PAD.decode(input)?; Ok(res) }