QXmpp Version: 1.5.6
Loading...
Searching...
No Matches
QXmppOmemoStorage.h
1// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPOMEMOSTORAGE_H
6#define QXMPPOMEMOSTORAGE_H
7
8#include "QXmppTask.h"
9#include "qxmppomemo_export.h"
10
11#include <optional>
12
13#include <QDateTime>
14#include <QFuture>
15
16class QXMPPOMEMO_EXPORT QXmppOmemoStorage
17{
18public:
22 struct OwnDevice
23 {
30 uint32_t id = 0;
31
37 QString label;
38
43
48
55 uint32_t latestSignedPreKeyId = 1;
56
63 uint32_t latestPreKeyId = 1;
64 };
65
71 struct Device
72 {
76 QString label;
77
81 QByteArray keyId;
82
86 QByteArray session;
87
94 int unrespondedSentStanzasCount = 0;
95
103 int unrespondedReceivedStanzasCount = 0;
104
111 };
112
117 {
121 QDateTime creationDate;
122
126 QByteArray data;
127 };
128
133 {
137 std::optional<OwnDevice> ownDevice;
138
142 QHash<uint32_t, SignedPreKeyPair> signedPreKeyPairs;
143
147 QHash<uint32_t, QByteArray> preKeyPairs;
148
153 QHash<QString, QHash<uint32_t, Device>> devices;
154 };
155
156 virtual ~QXmppOmemoStorage() = default;
157
159
160 virtual QXmppTask<void> setOwnDevice(const std::optional<OwnDevice> &device) = 0;
161
162 virtual QXmppTask<void> addSignedPreKeyPair(uint32_t keyId, const SignedPreKeyPair &keyPair) = 0;
163 virtual QXmppTask<void> removeSignedPreKeyPair(uint32_t keyId) = 0;
164
165 virtual QXmppTask<void> addPreKeyPairs(const QHash<uint32_t, QByteArray> &keyPairs) = 0;
166 virtual QXmppTask<void> removePreKeyPair(uint32_t keyId) = 0;
167
168 virtual QXmppTask<void> addDevice(const QString &jid, uint32_t deviceId, const Device &device) = 0;
169 virtual QXmppTask<void> removeDevice(const QString &jid, uint32_t deviceId) = 0;
170 virtual QXmppTask<void> removeDevices(const QString &jid) = 0;
171
173};
174
175#endif // QXMPPOMEMOSTORAGE_H
The QXmppOmemoStorage class stores data used by XEP-0384: OMEMO Encryption.
Definition QXmppOmemoStorage.h:17
virtual QXmppTask< void > addPreKeyPairs(const QHash< uint32_t, QByteArray > &keyPairs)=0
virtual QXmppTask< void > removeSignedPreKeyPair(uint32_t keyId)=0
virtual QXmppTask< OmemoData > allData()=0
virtual QXmppTask< void > removePreKeyPair(uint32_t keyId)=0
virtual QXmppTask< void > addSignedPreKeyPair(uint32_t keyId, const SignedPreKeyPair &keyPair)=0
virtual QXmppTask< void > addDevice(const QString &jid, uint32_t deviceId, const Device &device)=0
virtual QXmppTask< void > setOwnDevice(const std::optional< OwnDevice > &device)=0
virtual QXmppTask< void > removeDevice(const QString &jid, uint32_t deviceId)=0
virtual QXmppTask< void > removeDevices(const QString &jid)=0
virtual QXmppTask< void > resetAll()=0
Definition QXmppTask.h:62
Definition QXmppOmemoStorage.h:72
QByteArray keyId
Definition QXmppOmemoStorage.h:81
QString label
Definition QXmppOmemoStorage.h:76
QByteArray session
Definition QXmppOmemoStorage.h:86
QDateTime removalFromDeviceListDate
Definition QXmppOmemoStorage.h:110
Definition QXmppOmemoStorage.h:133
QHash< uint32_t, QByteArray > preKeyPairs
Definition QXmppOmemoStorage.h:147
std::optional< OwnDevice > ownDevice
Definition QXmppOmemoStorage.h:137
QHash< uint32_t, SignedPreKeyPair > signedPreKeyPairs
Definition QXmppOmemoStorage.h:142
QHash< QString, QHash< uint32_t, Device > > devices
Definition QXmppOmemoStorage.h:153
Definition QXmppOmemoStorage.h:23
QString label
Definition QXmppOmemoStorage.h:37
QByteArray privateIdentityKey
Definition QXmppOmemoStorage.h:42
QByteArray publicIdentityKey
Definition QXmppOmemoStorage.h:47
Definition QXmppOmemoStorage.h:117
QByteArray data
Definition QXmppOmemoStorage.h:126
QDateTime creationDate
Definition QXmppOmemoStorage.h:121