Skip to content

Commit

Permalink
[#472] remove Debug from SessionRecord
Browse files Browse the repository at this point in the history
- also add a cheap Debug impl for PrivateKey which leaks no info
  • Loading branch information
cosmicexplorer committed Sep 9, 2022
1 parent ab29fed commit f3f76e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions rust/protocol/src/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ impl TryFrom<&[u8]> for PrivateKey {
}
}

impl fmt::Debug for PrivateKey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/* Calculating the equivalent public key isn't free, and we want to discourage printing out
* the actual private key data, so we just provide the key type here. */
write!(f, "PrivateKey {{ key_type={} }}", self.key_type())
}
}

#[derive(Copy, Clone)]
pub struct KeyPair {
pub public_key: PublicKey,
Expand Down
2 changes: 1 addition & 1 deletion rust/protocol/src/state/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ impl From<&SessionState> for SessionStructure {
}
}

#[derive(Clone, Debug)]
#[derive(Clone)]
pub struct SessionRecord {
current_session: Option<SessionState>,
previous_sessions: Vec<Vec<u8>>,
Expand Down

0 comments on commit f3f76e5

Please sign in to comment.