aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/api')
-rw-r--r--src/wallet/api/wallet.cpp14
-rw-r--r--src/wallet/api/wallet.h3
-rw-r--r--src/wallet/api/wallet2_api.h10
3 files changed, 27 insertions, 0 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 3f6bfec9e..680da26ce 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -2205,6 +2205,20 @@ void WalletImpl::keyReuseMitigation2(bool mitigation)
m_wallet->key_reuse_mitigation2(mitigation);
}
+bool WalletImpl::lockKeysFile()
+{
+ return m_wallet->lock_keys_file();
+}
+
+bool WalletImpl::unlockKeysFile()
+{
+ return m_wallet->unlock_keys_file();
+}
+
+bool WalletImpl::isKeysFileLocked()
+{
+ return m_wallet->is_keys_file_locked();
+}
} // namespace
namespace Bitmonero = Monero;
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
index eefb2fe94..58be686fc 100644
--- a/src/wallet/api/wallet.h
+++ b/src/wallet/api/wallet.h
@@ -188,6 +188,9 @@ public:
virtual void segregatePreForkOutputs(bool segregate) override;
virtual void segregationHeight(uint64_t height) override;
virtual void keyReuseMitigation2(bool mitigation) override;
+ virtual bool lockKeysFile() override;
+ virtual bool unlockKeysFile() override;
+ virtual bool isKeysFileLocked() override;
private:
void clearStatus() const;
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
index f54255e91..0cd0ff5cf 100644
--- a/src/wallet/api/wallet2_api.h
+++ b/src/wallet/api/wallet2_api.h
@@ -900,6 +900,12 @@ struct Wallet
//! Initiates a light wallet import wallet request
virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) = 0;
+
+ //! locks/unlocks the keys file; returns true on success
+ virtual bool lockKeysFile() = 0;
+ virtual bool unlockKeysFile() = 0;
+ //! returns true if the keys file is locked
+ virtual bool isKeysFileLocked() = 0;
};
/**
@@ -1070,6 +1076,10 @@ struct WalletManager
* @param password - password to verify
* @param no_spend_key - verify only view keys?
* @return - true if password is correct
+ *
+ * @note
+ * This function will fail when the wallet keys file is opened because the wallet program locks the keys file.
+ * In this case, Wallet::unlockKeysFile() and Wallet::lockKeysFile() need to be called before and after the call to this function, respectively.
*/
virtual bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key) const = 0;