Upgrade base64 to v0.22 (#15304)

This PR upgrades the `base64` dependency to v0.22.

Supersedes #15300.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-07-26 17:40:38 -04:00 committed by GitHub
parent 03ebbcbef6
commit e423f03ba6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 20 deletions

View file

@ -9,6 +9,7 @@ use axum::{
middleware::Next,
response::IntoResponse,
};
use base64::prelude::*;
use prometheus::{exponential_buckets, register_histogram, Histogram};
pub use rpc::auth::random_token;
use scrypt::{
@ -155,10 +156,7 @@ pub async fn create_access_token(
/// protection.
pub fn hash_access_token(token: &str) -> String {
let digest = sha2::Sha256::digest(token);
format!(
"$sha256${}",
base64::encode_config(digest, base64::URL_SAFE)
)
format!("$sha256${}", BASE64_URL_SAFE.encode(digest))
}
/// Encrypts the given access token with the given public key to avoid leaking it on the way