File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ use ed25519_dalek as ed25519;
2424use failure:: Fail ;
2525use super :: error:: DecodingError ;
2626use zeroize:: Zeroize ;
27+ use core:: fmt;
2728
2829/// An Ed25519 keypair.
2930pub struct Keypair ( ed25519:: Keypair ) ;
@@ -66,6 +67,12 @@ impl Keypair {
6667 }
6768}
6869
70+ impl fmt:: Debug for Keypair {
71+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
72+ f. debug_struct ( "Keypair" ) . field ( "public" , & self . 0 . public ) . finish ( )
73+ }
74+ }
75+
6976impl Clone for Keypair {
7077 fn clone ( & self ) -> Keypair {
7178 let mut sk_bytes = self . 0 . secret . to_bytes ( ) ;
@@ -135,6 +142,12 @@ impl Clone for SecretKey {
135142 }
136143}
137144
145+ impl fmt:: Debug for SecretKey {
146+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
147+ write ! ( f, "SecretKey" )
148+ }
149+ }
150+
138151impl SecretKey {
139152 /// Generate a new Ed25519 secret key.
140153 pub fn generate ( ) -> SecretKey {
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ use sha2::{Digest as ShaDigestTrait, Sha256};
2626use secp256k1:: { Message , Signature } ;
2727use super :: error:: { DecodingError , SigningError } ;
2828use zeroize:: Zeroize ;
29+ use core:: fmt;
2930
3031/// A Secp256k1 keypair.
3132#[ derive( Clone ) ]
@@ -51,6 +52,12 @@ impl Keypair {
5152 }
5253}
5354
55+ impl fmt:: Debug for Keypair {
56+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
57+ f. debug_struct ( "Keypair" ) . field ( "public" , & self . public ) . finish ( )
58+ }
59+ }
60+
5461/// Promote a Secp256k1 secret key into a keypair.
5562impl From < SecretKey > for Keypair {
5663 fn from ( secret : SecretKey ) -> Keypair {
@@ -70,6 +77,12 @@ impl From<Keypair> for SecretKey {
7077#[ derive( Clone ) ]
7178pub struct SecretKey ( secp256k1:: SecretKey ) ;
7279
80+ impl fmt:: Debug for SecretKey {
81+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
82+ write ! ( f, "SecretKey" )
83+ }
84+ }
85+
7386impl SecretKey {
7487 /// Generate a new Secp256k1 secret key.
7588 pub fn generate ( ) -> SecretKey {
You can’t perform that action at this time.
0 commit comments