Skip to content

Commit

Permalink
Add extra trace info
Browse files Browse the repository at this point in the history
  • Loading branch information
mihai-dinculescu committed Dec 26, 2024
1 parent da8684a commit 3a8301c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tapo/src/api/protocol/klap_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,20 @@ impl KlapProtocol {
}

self.cookie = TapoProtocol::get_cookie(response.cookies())?;
trace!("Cookie: {}", self.cookie);

let response_body = response.bytes().await.map_err(anyhow::Error::from)?;
trace!("Response body: {:?}", response_body.to_vec());

let (remote_seed, server_hash) = response_body.split_at(16);
trace!("Remote seed: {remote_seed:?}");
trace!("Server hash: {server_hash:?}");
let local_hash = KlapCipher::sha256(&[local_seed, remote_seed, auth_hash].concat());
trace!("local_seed, remote_seed, auth_hash: {local_hash:?}");
let local_hash2 = KlapCipher::sha256(&[remote_seed, local_seed, auth_hash].concat());
trace!("remote_seed, local_seed, auth_hash: {local_hash2:?}");
let local_hash3 = KlapCipher::sha256(&[remote_seed, auth_hash].concat());
trace!("remote_seed, auth_hash: {local_hash3:?}");

if local_hash != server_hash {
warn!("Local hash does not match server hash");
Expand Down

0 comments on commit 3a8301c

Please sign in to comment.