diff --git a/crates/sip-auth/src/digest.rs b/crates/sip-auth/src/digest.rs index 2e9d5f1..958a61e 100644 --- a/crates/sip-auth/src/digest.rs +++ b/crates/sip-auth/src/digest.rs @@ -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, } impl DigestCredentials { pub fn new(user: U, password: P) -> Self where - U: Into, - P: Into, + U: Into, + P: Into>, { Self { user: user.into(), @@ -204,13 +204,13 @@ impl DigestAuthenticator { ) -> Result { 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);