squawk/qomemo/database.h

41 lines
798 B
C
Raw Normal View History

2021-05-13 14:50:59 +00:00
/*
* Created by victoria on 2021-05-13.
*/
#pragma once
#include <QBuffer>
#include <QString>
#include <lmdb.h>
namespace QXmpp::Omemo {
class Database {
public:
explicit Database(QString jid);
~Database();
Database(const Database &) = delete;
Database(Database &&) = delete;
Database &operator=(const Database &) = delete;
QBuffer loadIdentityKey();
bool saveIdentityKey(const QBuffer &identityKey);
int loadActiveDeviceId();
bool saveActiveDeviceId(int deviceId);
QBuffer loadIdentityKeySecret(int deviceId);
bool saveIdentityKeySecret(int deviceId, const QBuffer &identityKeySecret);
const QString jid;
private:
MDB_env *env{};
MDB_dbi dbiDevices{};
MDB_dbi dbiKeys{};
MDB_dbi dbiPreKeys{};
MDB_dbi dbiIdentityKeys{};
};
} // namespace QXmpp::Omemo