QXmpp: QXmppOmemoDeviceBundle_p.h Source File

QXmpp Version: 1.14.2

Loading...
Searching...
No Matches
QXmppOmemoDeviceBundle_p.h
1// SPDX-FileCopyrightText: 2021 Germán Márquez Mejía <mancho@olomono.de>
2// SPDX-FileCopyrightText: 2021 Melvin Keskin <melvo@olomono.de>
3//
4// SPDX-License-Identifier: LGPL-2.1-or-later
5
6#ifndef QXMPPOMEMODEVICEBUNDLE_H
7#define QXMPPOMEMODEVICEBUNDLE_H
8
9#include "QXmppGlobal.h"
10
11#include <QHash>
12
13class QDomElement;
14class QXmlStreamWriter;
15
16class QXMPP_AUTOTEST_EXPORT QXmppOmemoDeviceBundle
17{
18public:
19 QByteArray publicIdentityKey() const;
20 void setPublicIdentityKey(const QByteArray &key);
21
22 QByteArray signedPublicPreKey() const;
23 void setSignedPublicPreKey(const QByteArray &key);
24
25 uint32_t signedPublicPreKeyId() const;
26 void setSignedPublicPreKeyId(uint32_t id);
27
28 QByteArray signedPublicPreKeySignature() const;
29 void setSignedPublicPreKeySignature(const QByteArray &signature);
30
31 QHash<uint32_t, QByteArray> publicPreKeys() const;
32 void addPublicPreKey(uint32_t id, const QByteArray &key);
33 void removePublicPreKey(uint32_t id);
34
36 void parse(const QDomElement &element);
37 void toXml(QXmlStreamWriter *writer) const;
39
40 static bool isOmemoDeviceBundle(const QDomElement &element);
41
42private:
43 QByteArray m_publicIdentityKey;
44 QByteArray m_signedPublicPreKey;
45 uint32_t m_signedPublicPreKeyId = 0;
46 QByteArray m_signedPublicPreKeySignature;
47 QHash<uint32_t, QByteArray> m_publicPreKeys;
48};
49
50Q_DECLARE_TYPEINFO(QXmppOmemoDeviceBundle, Q_MOVABLE_TYPE);
51
52#endif // QXMPPOMEMODEVICEBUNDLE_H