diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 0f8301c96b..0f57370aa0 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -349,7 +349,8 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) { // nodes will currently use this to add resources to data-web that relate to our domain const QVariant* idValueVariant = valueForKeyPath(settingsMap, METAVERSE_DOMAIN_ID_KEY_PATH); if (idValueVariant) { - nodeList->setSessionUUID(idValueVariant->toString()); + QUuid domainID { idValueVariant->toString() }; + nodeList->setSessionUUID(domainID); } connect(nodeList.data(), &LimitedNodeList::nodeAdded, this, &DomainServer::nodeAdded); @@ -490,7 +491,8 @@ void DomainServer::setupICEHeartbeatForFullNetworking() { // to send ICE heartbeats we'd better have a private key locally with an uploaded public key auto& accountManager = AccountManager::getInstance(); - if (!accountManager.getAccountInfo().hasPrivateKey()) { + auto domainID = accountManager.getAccountInfo().getDomainID(); + if (!accountManager.getAccountInfo().hasPrivateKey() || domainID != limitedNodeList->getSessionUUID()) { accountManager.generateNewDomainKeypair(limitedNodeList->getSessionUUID()); } diff --git a/libraries/networking/src/DataServerAccountInfo.cpp b/libraries/networking/src/DataServerAccountInfo.cpp index 5d633a8df1..ae6d7c4c9b 100644 --- a/libraries/networking/src/DataServerAccountInfo.cpp +++ b/libraries/networking/src/DataServerAccountInfo.cpp @@ -175,12 +175,12 @@ void DataServerAccountInfo::setPrivateKey(const QByteArray& privateKey) { QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info) { out << info._accessToken << info._username << info._xmppPassword << info._discourseApiKey - << info._walletID << info._privateKey; + << info._walletID << info._privateKey << info._domainID; return out; } QDataStream& operator>>(QDataStream &in, DataServerAccountInfo& info) { in >> info._accessToken >> info._username >> info._xmppPassword >> info._discourseApiKey - >> info._walletID >> info._privateKey; + >> info._walletID >> info._privateKey >> info._domainID; return in; } diff --git a/libraries/networking/src/DataServerAccountInfo.h b/libraries/networking/src/DataServerAccountInfo.h index 9b80de5422..8f6fb83f79 100644 --- a/libraries/networking/src/DataServerAccountInfo.h +++ b/libraries/networking/src/DataServerAccountInfo.h @@ -42,10 +42,6 @@ public: const QUuid& getWalletID() const { return _walletID; } void setWalletID(const QUuid& walletID); - - QByteArray getUsernameSignature(const QUuid& connectionToken); - bool hasPrivateKey() const { return !_privateKey.isEmpty(); } - void setPrivateKey(const QByteArray& privateKey); qint64 getBalance() const { return _balance; } float getBalanceInSatoshis() const { return _balance / SATOSHIS_PER_CREDIT; } @@ -54,6 +50,13 @@ public: void setHasBalance(bool hasBalance) { _hasBalance = hasBalance; } Q_INVOKABLE void setBalanceFromJSON(QNetworkReply& requestReply); + QByteArray getUsernameSignature(const QUuid& connectionToken); + bool hasPrivateKey() const { return !_privateKey.isEmpty(); } + void setPrivateKey(const QByteArray& privateKey); + + void setDomainID(const QUuid& domainID) { _domainID = domainID; } + const QUuid& getDomainID() const { return _domainID; } + bool hasProfile() const; void setProfileInfoFromJSON(const QJsonObject& jsonObject); @@ -72,6 +75,7 @@ private: QUuid _walletID; qint64 _balance; bool _hasBalance; + QUuid _domainID; // if this holds account info for a domain, this holds the ID of that domain QByteArray _privateKey; };