Introduce wrappers around CZCViewingKey

This commit is contained in:
Jack Grigg
2018-04-24 22:53:54 +01:00
parent 472f75bc2d
commit 8bf3a3d700
4 changed files with 25 additions and 7 deletions

View File

@@ -379,6 +379,21 @@ boost::optional<libzcash::PaymentAddress> DecodePaymentAddress(const std::string
}
}
std::string EncodeViewingKey(const libzcash::ViewingKey& vk)
{
return CZCViewingKey(vk).ToString();
}
boost::optional<libzcash::ViewingKey> DecodeViewingKey(const std::string& str)
{
CZCViewingKey vk(str);
try {
return vk.Get();
} catch (const std::runtime_error&) {
return boost::none;
}
}
std::string EncodeSpendingKey(const libzcash::SpendingKey& zkey)
{
return CZCSpendingKey(zkey).ToString();