Skip to content

Commit

Permalink
change type of user back to String and password to Vec<u8>
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Funke committed Jul 17, 2024
1 parent aa439b3 commit edfa820
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions crates/sip-auth/src/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ use sip_types::header::typed::{
use sip_types::print::{AppendCtx, PrintCtx, UriContext};

pub struct DigestCredentials {
user: BytesStr,
password: BytesStr,
user: String,
password: Vec<u8>,
}

impl DigestCredentials {
pub fn new<U, P>(user: U, password: P) -> Self
where
U: Into<BytesStr>,
P: Into<BytesStr>,
U: Into<String>,
P: Into<Vec<u8>>,
{
Self {
user: user.into(),
Expand Down Expand Up @@ -204,13 +204,13 @@ impl DigestAuthenticator {
) -> Result<DigestResponse, Error> {
let cnonce = BytesStr::from(uuid::Uuid::new_v4().simple().to_string());

let mut ha1 = hash(
let mut ha1 = hash([
format!(
"{}:{}:{}",
credentials.user, challenge.realm, credentials.password
)
.as_bytes(),
);
"{}:{}:",
credentials.user,
challenge.realm
).as_bytes(), &credentials.password
].concat().as_slice());

if is_session {
ha1 = format!("{}:{}:{}", ha1, challenge.nonce, cnonce);
Expand Down

0 comments on commit edfa820

Please sign in to comment.