[network/ruqola] src/core/encryption: read password
Laurent Montel <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit a664674d4733d1bb4944991553744926a4faa998 by Laurent Montel.
Committed on 04/08/2026 at 06:06.
Pushed by mlaurent into branch 'master'.
read password
M +21 -0 src/core/encryption/e2ekeymanager.cpp
M +2 -0 src/core/encryption/e2ekeymanager.h
https://invent.kde.org/network/ruqola/-/commit/a664674d4733d1bb4944991553744926a4faa998
diff --git a/src/core/encryption/e2ekeymanager.cpp b/src/core/encryption/e2ekeymanager.cpp
index 49872b5b1b..4e641a1a30 100644
--- a/src/core/encryption/e2ekeymanager.cpp
+++ b/src/core/encryption/e2ekeymanager.cpp
@@ -184,6 +184,27 @@ void E2eKeyManager::slotPasswordWritten(QKeychain::Job *baseJob)
}
}
+void E2eKeyManager::readPassword()
+{
+ auto readJob = new ReadPasswordJob(u"Ruqola"_s);
+ connect(readJob, &Job::finished, this, &E2eKeyManager::slotPasswordRead);
+ readJob->setKey(passwordKeyIdentifier());
+ readJob->start();
+}
+
+void E2eKeyManager::slotPasswordRead(QKeychain::Job *baseJob)
+{
+ auto job = qobject_cast<ReadPasswordJob *>(baseJob);
+ Q_ASSERT(job);
+ if (!job->error()) {
+ // TODO mPassword = job->textData();
+ qCDebug(RUQOLA_ENCRYPTION_LOG) << "OK, we have the password now";
+ // TODO Q_EMIT passwordAvailable();
+ } else {
+ qCWarning(RUQOLA_ENCRYPTION_LOG) << "We have an error during reading password " << job->errorString() << " Account name " << mAccount->accountName();
+ }
+}
+
void E2eKeyManager::postponeDecryption()
{
setStatus(Status::DecryptionPostponned);
diff --git a/src/core/encryption/e2ekeymanager.h b/src/core/encryption/e2ekeymanager.h
index b8fa42960f..e588878edf 100644
--- a/src/core/encryption/e2ekeymanager.h
+++ b/src/core/encryption/e2ekeymanager.h
@@ -58,11 +58,13 @@ Q_SIGNALS:
void verifyKeyDone();
private:
+ LIBRUQOLACORE_NO_EXPORT void readPassword();
LIBRUQOLACORE_NO_EXPORT void verifyExistingKey(const QJsonObject &json);
LIBRUQOLACORE_NO_EXPORT bool startUploadGeneratedKey(const QByteArray &publicKey, const QByteArray &encryptedPrivateKey);
LIBRUQOLACORE_NO_EXPORT void storePassword(const QString &password);
LIBRUQOLACORE_NO_EXPORT void slotPasswordWritten(QKeychain::Job *baseJob);
[[nodiscard]] LIBRUQOLACORE_NO_EXPORT QString passwordKeyIdentifier() const;
+ LIBRUQOLACORE_NO_EXPORT void slotPasswordRead(QKeychain::Job *baseJob);
Status mStatus = Status::Unknown;
QString mGeneratedPassword;
QByteArray mDecodedPrivateKey;