Loading...
Searching...
No Matches
QXmppOmemoStorage.h
// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPOMEMOSTORAGE_H
#define QXMPPOMEMOSTORAGE_H
#include "QXmppTask.h"
#include "qxmppomemo_export.h"
#include <optional>
#include <QDateTime>
#include <QFuture>
class QXMPPOMEMO_EXPORT QXmppOmemoStorage
{
public:
struct OwnDevice {
uint32_t id = 0;
QString label;
QByteArray privateIdentityKey;
QByteArray publicIdentityKey;
uint32_t latestSignedPreKeyId = 1;
uint32_t latestPreKeyId = 1;
};
struct Device {
QString label;
QByteArray keyId;
QByteArray session;
int unrespondedSentStanzasCount = 0;
int unrespondedReceivedStanzasCount = 0;
QDateTime removalFromDeviceListDate;
};
struct SignedPreKeyPair {
QDateTime creationDate;
QByteArray data;
};
struct OmemoData {
std::optional<OwnDevice> ownDevice;
QHash<uint32_t, SignedPreKeyPair> signedPreKeyPairs;
QHash<uint32_t, QByteArray> preKeyPairs;
QHash<QString, QHash<uint32_t, Device>> devices;
};
virtual ~QXmppOmemoStorage() = default;
virtual QXmppTask<OmemoData> allData() = 0;
virtual QXmppTask<void> setOwnDevice(const std::optional<OwnDevice> &device) = 0;
virtual QXmppTask<void> addSignedPreKeyPair(uint32_t keyId, const SignedPreKeyPair &keyPair) = 0;
virtual QXmppTask<void> removeSignedPreKeyPair(uint32_t keyId) = 0;
virtual QXmppTask<void> addPreKeyPairs(const QHash<uint32_t, QByteArray> &keyPairs) = 0;
virtual QXmppTask<void> removePreKeyPair(uint32_t keyId) = 0;
virtual QXmppTask<void> addDevice(const QString &jid, uint32_t deviceId, const Device &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;
};
#endif // QXMPPOMEMOSTORAGE_H
QXmppOmemoStorage
The QXmppOmemoStorage class stores data used by XEP-0384: OMEMO Encryption.
Definition QXmppOmemoStorage.h:17
QXmppOmemoStorage::addPreKeyPairs
virtual QXmppTask< void > addPreKeyPairs(const QHash< uint32_t, QByteArray > &keyPairs)=0
QXmppOmemoStorage::removeSignedPreKeyPair
virtual QXmppTask< void > removeSignedPreKeyPair(uint32_t keyId)=0
QXmppOmemoStorage::allData
virtual QXmppTask< OmemoData > allData()=0
QXmppOmemoStorage::removePreKeyPair
virtual QXmppTask< void > removePreKeyPair(uint32_t keyId)=0
QXmppOmemoStorage::addSignedPreKeyPair
virtual QXmppTask< void > addSignedPreKeyPair(uint32_t keyId, const SignedPreKeyPair &keyPair)=0
QXmppOmemoStorage::addDevice
virtual QXmppTask< void > addDevice(const QString &jid, uint32_t deviceId, const Device &device)=0
QXmppOmemoStorage::setOwnDevice
virtual QXmppTask< void > setOwnDevice(const std::optional< OwnDevice > &device)=0
QXmppOmemoStorage::removeDevice
virtual QXmppTask< void > removeDevice(const QString &jid, uint32_t deviceId)=0
QXmppOmemoStorage::removeDevices
virtual QXmppTask< void > removeDevices(const QString &jid)=0
QXmppOmemoStorage::resetAll
virtual QXmppTask< void > resetAll()=0
QXmppTask
Definition QXmppTask.h:62
QXmppOmemoStorage::Device
Definition QXmppOmemoStorage.h:70
QXmppOmemoStorage::Device::keyId
QByteArray keyId
Definition QXmppOmemoStorage.h:79
QXmppOmemoStorage::Device::label
QString label
Definition QXmppOmemoStorage.h:74
QXmppOmemoStorage::Device::session
QByteArray session
Definition QXmppOmemoStorage.h:84
QXmppOmemoStorage::Device::removalFromDeviceListDate
QDateTime removalFromDeviceListDate
Definition QXmppOmemoStorage.h:108
QXmppOmemoStorage::OmemoData
Definition QXmppOmemoStorage.h:129
QXmppOmemoStorage::OmemoData::preKeyPairs
QHash< uint32_t, QByteArray > preKeyPairs
Definition QXmppOmemoStorage.h:143
QXmppOmemoStorage::OmemoData::ownDevice
std::optional< OwnDevice > ownDevice
Definition QXmppOmemoStorage.h:133
QXmppOmemoStorage::OmemoData::signedPreKeyPairs
QHash< uint32_t, SignedPreKeyPair > signedPreKeyPairs
Definition QXmppOmemoStorage.h:138
QXmppOmemoStorage::OmemoData::devices
QHash< QString, QHash< uint32_t, Device > > devices
Definition QXmppOmemoStorage.h:149
QXmppOmemoStorage::OwnDevice
Definition QXmppOmemoStorage.h:22
QXmppOmemoStorage::OwnDevice::label
QString label
Definition QXmppOmemoStorage.h:36
QXmppOmemoStorage::OwnDevice::privateIdentityKey
QByteArray privateIdentityKey
Definition QXmppOmemoStorage.h:41
QXmppOmemoStorage::OwnDevice::publicIdentityKey
QByteArray publicIdentityKey
Definition QXmppOmemoStorage.h:46
QXmppOmemoStorage::SignedPreKeyPair
Definition QXmppOmemoStorage.h:114
QXmppOmemoStorage::SignedPreKeyPair::data
QByteArray data
Definition QXmppOmemoStorage.h:123
QXmppOmemoStorage::SignedPreKeyPair::creationDate
QDateTime creationDate
Definition QXmppOmemoStorage.h:118