1
0
mirror of https://github.com/QRouland/UTPass.git synced 2026-01-10 19:36:57 +00:00

Rewrite get all key with rnp

This commit is contained in:
2025-02-01 13:45:55 +01:00
parent 74a001eefc
commit b9b038b1ae
13 changed files with 327 additions and 240 deletions

View File

@@ -2,6 +2,7 @@
#include "getkeysjob.h"
#include <QJsonDocument>
#include <QJsonObject>
extern "C" {
#include <rnp/rnp.h>
#include <rnp/rnp_err.h>
@@ -14,6 +15,14 @@ GetKeysJob::GetKeysJob(QDir rnp_homedir):
}
QJsonDocument GetKeysJob::fingerprint_map_key_info(const QString fingerprint)
{
rnp_key_handle_t handle;
rnp_locate_key(this->m_ffi, "fingerprint", fingerprint.toLocal8Bit().data(), &handle);
char *result;
rnp_key_to_json( handle, 0, &result);
return QJsonDocument::fromJson(result);
}
void GetKeysJob::run()
{
@@ -23,7 +32,13 @@ void GetKeysJob::run()
QSet<QString> fingerprints = QSet<QString>();
this->load_full_keyring(&fingerprints);
auto key_infos = QList<QJsonDocument>();
QList<QJsonDocument>::iterator i;
for (auto i = fingerprints.begin(), end = fingerprints.end(); i != end; ++i) {
key_infos.append(this->fingerprint_map_key_info(*i));
}
//Get all infos keys
emit resultSuccess(fingerprints);
emit resultSuccess(key_infos);
qDebug() << "[GetKeysJob] Finished Successfully ";
}