To and from b58 string on encryption public key

This commit is contained in:
Jedrzej Stuczynski
2020-02-04 12:39:03 +00:00
parent 6c32d64194
commit 8caf218aed
+8
View File
@@ -104,6 +104,14 @@ impl PublicKey {
let key = MontgomeryPoint(bytes);
Self(key)
}
pub fn to_base58_string(&self) -> String {
bs58::encode(&self.to_bytes()).into_string()
}
pub fn from_base58_string(val: String) -> Self {
Self::from_bytes(&bs58::decode(&val).into_vec().unwrap())
}
}
impl PemStorableKey for PublicKey {