diff --git a/src/zcash/Address.cpp b/src/zcash/Address.cpp index baefeae4e..1c8dbf2de 100644 --- a/src/zcash/Address.cpp +++ b/src/zcash/Address.cpp @@ -37,3 +37,15 @@ PaymentAddress SpendingKey::address() const { } } + +bool IsValidPaymentAddress(const libzcash::PaymentAddress& zaddr) { + return zaddr.which() != 0; +} + +bool IsValidViewingKey(const libzcash::ViewingKey& vk) { + return vk.which() != 0; +} + +bool IsValidSpendingKey(const libzcash::SpendingKey& zkey) { + return zkey.which() != 0; +} diff --git a/src/zcash/Address.hpp b/src/zcash/Address.hpp index 2dbe10a60..558777e50 100644 --- a/src/zcash/Address.hpp +++ b/src/zcash/Address.hpp @@ -88,4 +88,13 @@ public: } +/** Check whether a PaymentAddress is not an InvalidEncoding. */ +bool IsValidPaymentAddress(const libzcash::PaymentAddress& zaddr); + +/** Check whether a ViewingKey is not an InvalidEncoding. */ +bool IsValidViewingKey(const libzcash::ViewingKey& vk); + +/** Check whether a SpendingKey is not an InvalidEncoding. */ +bool IsValidSpendingKey(const libzcash::SpendingKey& zkey); + #endif // ZC_ADDRESS_H_