From e4b19545b00dfcf94ec1eadb45ee3f912c03538f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 15 Oct 2014 10:36:21 -0700 Subject: [PATCH] generate a new keypair if one isn't found in settings --- libraries/networking/src/AccountManager.cpp | 6 ++++++ libraries/networking/src/DataServerAccountInfo.h | 1 + 2 files changed, 7 insertions(+) diff --git a/libraries/networking/src/AccountManager.cpp b/libraries/networking/src/AccountManager.cpp index 356f369ec6..650e0e3321 100644 --- a/libraries/networking/src/AccountManager.cpp +++ b/libraries/networking/src/AccountManager.cpp @@ -146,6 +146,12 @@ void AccountManager::setAuthURL(const QUrl& authURL) { } else { requestProfile(); } + + // if we don't have a private key in settings we should generate a new keypair + if (!_accountInfo.hasPrivateKey()) { + qDebug() << "No private key present - generating a new key-pair."; + generateNewKeypair(); + } } } } diff --git a/libraries/networking/src/DataServerAccountInfo.h b/libraries/networking/src/DataServerAccountInfo.h index 2f02a7aee3..9804bd755c 100644 --- a/libraries/networking/src/DataServerAccountInfo.h +++ b/libraries/networking/src/DataServerAccountInfo.h @@ -44,6 +44,7 @@ public: void setWalletID(const QUuid& walletID); const QByteArray& getUsernameSignature(); + bool hasPrivateKey() const { return !_privateKey.isEmpty(); } void setPrivateKey(const QByteArray& privateKey); qint64 getBalance() const { return _balance; }