Skip to content

Commit

Permalink
Fix deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
backspace committed Oct 25, 2023
1 parent 34fbc06 commit 8b059b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion unmnemonic_devices_vrs/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use axum::{
extract::FromRequestParts,
http::{request::Parts, StatusCode},
};
use base64::{engine::general_purpose, Engine as _};
use std::str::from_utf8;

// Adapted from https://www.shuttle.rs/blog/2023/09/27/rust-vs-go-comparison#middleware-1
Expand Down Expand Up @@ -30,7 +31,9 @@ where
if let Some(auth_header) = auth_header {
if auth_header.starts_with("Basic ") {
let credentials = auth_header.trim_start_matches("Basic ");
let decoded = base64::decode(credentials).unwrap_or_default();
let decoded = general_purpose::STANDARD
.decode(credentials)
.expect("Unable to decode credentials");
let credential_str = from_utf8(&decoded).unwrap_or("");

// Our username and password are hardcoded here.
Expand Down

0 comments on commit 8b059b9

Please sign in to comment.