From edfa820436b8195582e2092045ffef6009485d86 Mon Sep 17 00:00:00 2001 From: Tobias Funke Date: Wed, 17 Jul 2024 16:03:43 +0200 Subject: [PATCH] change type of user back to String and password to Vec --- crates/sip-auth/src/digest.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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);