keypair: use public key for Debug output
There is no need to hash up the secret for Keypair. It already has a "fingerprint" in the form of its public key. We should just use that.
This commit is contained in:
parent
a16e5ecd49
commit
b8ac971745
10
src/key.rs
10
src/key.rs
|
@ -772,7 +772,6 @@ impl<'de> serde::Deserialize<'de> for PublicKey {
|
||||||
/// [`cbor`]: https://docs.rs/cbor
|
/// [`cbor`]: https://docs.rs/cbor
|
||||||
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
|
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
|
||||||
pub struct Keypair(ffi::Keypair);
|
pub struct Keypair(ffi::Keypair);
|
||||||
impl_display_secret!(Keypair);
|
|
||||||
impl_fast_comparisons!(Keypair);
|
impl_fast_comparisons!(Keypair);
|
||||||
|
|
||||||
impl Keypair {
|
impl Keypair {
|
||||||
|
@ -972,6 +971,15 @@ impl Keypair {
|
||||||
pub fn non_secure_erase(&mut self) { self.0.non_secure_erase(); }
|
pub fn non_secure_erase(&mut self) { self.0.non_secure_erase(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for Keypair {
|
||||||
|
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||||
|
f.debug_struct("Keypair")
|
||||||
|
.field("pubkey", &self.public_key())
|
||||||
|
.field("secret", &"<hidden>")
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<Keypair> for SecretKey {
|
impl From<Keypair> for SecretKey {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(pair: Keypair) -> Self { SecretKey::from_keypair(&pair) }
|
fn from(pair: Keypair) -> Self { SecretKey::from_keypair(&pair) }
|
||||||
|
|
Loading…
Reference in New Issue