style: format

This commit is contained in:
2021-01-01 22:34:57 +08:00
parent ba35489cdf
commit de0184e253
8 changed files with 20 additions and 2 deletions

View File

@@ -10,14 +10,16 @@ use std::str::FromStr;
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct JsonKeyPair {
pub tag: Option<String>,
pub identity: String,
pub pri_key: String,
pub pub_key: String,
}
impl JsonKeyPair {
pub fn from(pri_key: SecretKey, pub_key: PublicKey) -> Self {
pub fn from(pri_key: SecretKey, pub_key: PublicKey, tag: Option<String>) -> Self {
JsonKeyPair {
tag,
identity: make_btc_address(&pub_key),
pri_key: format!("{}", pri_key),
pub_key: format!("{}", pub_key),