forked from blue/squawk
ref(omemo): bundle separate, add db
This commit is contained in:
parent
2654e38665
commit
574210f5d9
9 changed files with 189 additions and 14 deletions
40
qomemo/database.h
Normal file
40
qomemo/database.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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
|
Loading…
Add table
Add a link
Reference in a new issue