mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Update legacy database hashes automatically
This commit is contained in:
parent
fccbb98b8e
commit
493b51882b
@ -149,6 +149,16 @@ QJsonObject BrowserAction::handleGetDatabaseHash(const QJsonObject& json, const
|
||||
|
||||
QJsonObject message = buildMessage(newNonce);
|
||||
message["hash"] = hash;
|
||||
|
||||
// Update a legacy database hash if found
|
||||
const QJsonArray hashes = decrypted.value("connectedKeys").toArray();
|
||||
if (!hashes.isEmpty()) {
|
||||
const QString legacyHash = getLegacyDatabaseHash();
|
||||
if (hashes.contains(legacyHash)) {
|
||||
message["oldHash"] = legacyHash;
|
||||
}
|
||||
}
|
||||
|
||||
return buildResponse(action, message, newNonce);
|
||||
}
|
||||
|
||||
@ -528,6 +538,17 @@ QString BrowserAction::getReturnValue(const BrowserService::ReturnValue returnVa
|
||||
}
|
||||
|
||||
QString BrowserAction::getDatabaseHash()
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
QByteArray hash =
|
||||
QCryptographicHash::hash(
|
||||
m_browserService.getDatabaseRootUuid().toUtf8(),
|
||||
QCryptographicHash::Sha256)
|
||||
.toHex();
|
||||
return QString(hash);
|
||||
}
|
||||
|
||||
QString BrowserAction::getLegacyDatabaseHash()
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
QByteArray hash =
|
||||
|
@ -75,6 +75,7 @@ private:
|
||||
QString getErrorMessage(const int errorCode) const;
|
||||
QString getReturnValue(const BrowserService::ReturnValue returnValue) const;
|
||||
QString getDatabaseHash();
|
||||
QString getLegacyDatabaseHash();
|
||||
|
||||
QString encryptMessage(const QJsonObject& message, const QString& nonce);
|
||||
QJsonObject decryptMessage(const QString& message, const QString& nonce);
|
||||
|
Loading…
Reference in New Issue
Block a user