node: create valid key file when an empty description is provided
Fixes certusone/wormhole#257 Change-Id: If0d9883513f4908cdd8303f24a999d1d612fad30
This commit is contained in:
parent
270bd78e98
commit
933442ac8a
|
@ -114,10 +114,13 @@ func writeGuardianKey(key *ecdsa.PrivateKey, description string, filename string
|
||||||
return fmt.Errorf("failed to open file: %w", err)
|
return fmt.Errorf("failed to open file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
a, err := armor.Encode(f, GuardianKeyArmoredBlock, map[string]string{
|
headers := map[string]string{
|
||||||
"Description": description,
|
"PublicKey": ethcrypto.PubkeyToAddress(key.PublicKey).String(),
|
||||||
"PublicKey": ethcrypto.PubkeyToAddress(key.PublicKey).String(),
|
}
|
||||||
})
|
if description != "" {
|
||||||
|
headers["Description"] = description
|
||||||
|
}
|
||||||
|
a, err := armor.Encode(f, GuardianKeyArmoredBlock, headers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue