forked from blue/squawk
41 lines
798 B
C
41 lines
798 B
C
|
/*
|
||
|
* 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
|