Skip to content

Commit

Permalink
change type of password to Vec<u8>
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Funke authored and kbalt committed Oct 1, 2024
1 parent dc08fdd commit 3045a92
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions crates/sip-auth/src/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use sip_types::print::{AppendCtx, PrintCtx, UriContext};

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

impl DigestCredentials {
pub fn new<U, P>(user: U, password: P) -> Self
where
U: Into<String>,
P: 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 3045a92

Please sign in to comment.