@@ -9,6 +9,8 @@ pub struct KeyInfo {
99 pub raw_private_key : HexBytes ,
1010 #[ serde( skip_serializing_if = "Option::is_none" ) ]
1111 pub wif_private_key : Option < PrivateKey > ,
12+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
13+ pub uncompressed_wif_private_key : Option < PrivateKey > ,
1214 pub public_key : PublicKey ,
1315 pub xonly_public_key : XOnlyPublicKey ,
1416 pub uncompressed_public_key : PublicKey ,
@@ -18,9 +20,14 @@ pub struct KeyInfo {
1820impl GetInfo < KeyInfo > for PrivateKey {
1921 fn get_info ( & self , network : Network ) -> KeyInfo {
2022 let pubkey = self . public_key ( & SECP ) ;
23+ let mut compressed_wif_privkey = * self ;
24+ compressed_wif_privkey. compressed = true ;
25+ let mut uncompressed_wif_privkey = * self ;
26+ uncompressed_wif_privkey. compressed = false ;
2127 KeyInfo {
2228 raw_private_key : ( & self . inner [ ..] ) . into ( ) ,
23- wif_private_key : Some ( * self ) ,
29+ wif_private_key : Some ( compressed_wif_privkey) ,
30+ uncompressed_wif_private_key : Some ( uncompressed_wif_privkey) ,
2431 public_key : pubkey,
2532 xonly_public_key : pubkey. inner . into ( ) ,
2633 uncompressed_public_key : {
@@ -43,6 +50,7 @@ impl GetInfo<KeyInfo> for secp256k1::SecretKey {
4350 KeyInfo {
4451 raw_private_key : self [ ..] . into ( ) ,
4552 wif_private_key : None ,
53+ uncompressed_wif_private_key : None ,
4654 public_key : btc_pubkey,
4755 xonly_public_key : pubkey. into ( ) ,
4856 uncompressed_public_key : PublicKey {
0 commit comments