forked from blue/squawk
ref(omemo): reformat qomemo/
This commit is contained in:
parent
574210f5d9
commit
bbeeee4c8a
12
qomemo/TODO
12
qomemo/TODO
@ -1,12 +0,0 @@
|
||||
* Generate device w/ keys
|
||||
* PubSub set urn:xmpp:omemo:1:devices to announce new device
|
||||
* PubSub set urn:xmpp:omemo:1:bundles to announce new key bundles
|
||||
* PubSub get urn:xmpp:omemo:1:bundles to get user bundles
|
||||
|
||||
Sending a message:
|
||||
* Create urn:xmpp:sce:0 with padding and content
|
||||
* Add <encrypted xmlns='urn:xmpp:omemo:1'> with header (key list) and payload (b64)
|
||||
|
||||
Receiving a message:
|
||||
* Check <keys> => <key>
|
||||
* Decrypt (TODO)
|
@ -8,7 +8,9 @@
|
||||
#include <QString>
|
||||
|
||||
class QXmppPubSubIq;
|
||||
|
||||
class QXmppElement;
|
||||
|
||||
class QXmppIq;
|
||||
|
||||
namespace QXmpp::Omemo {
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QList>
|
||||
|
||||
class QXmppElement;
|
||||
|
||||
class QXmppIq;
|
||||
|
||||
namespace QXmpp::Omemo {
|
||||
|
@ -11,5 +11,4 @@ int QXmpp::Omemo::DeviceKeyStorage::generateDeviceId() {
|
||||
return 1 + random.bounded(INT32_MAX - 1);
|
||||
}
|
||||
|
||||
QXmpp::Omemo::DeviceKeyStorage::DeviceKeyStorage(int deviceId)
|
||||
: deviceId(deviceId) {}
|
||||
QXmpp::Omemo::DeviceKeyStorage::DeviceKeyStorage(int deviceId) : deviceId(deviceId) {}
|
||||
|
@ -7,8 +7,7 @@
|
||||
|
||||
QXmpp::Omemo::DeviceService::DeviceService(QObject *parent) : QObject(parent) {}
|
||||
|
||||
void QXmpp::Omemo::DeviceService::onDeviceListReceived(
|
||||
const QString &jid, const QXmpp::Omemo::DeviceList &list) {
|
||||
void QXmpp::Omemo::DeviceService::onDeviceListReceived(const QString &jid, const QXmpp::Omemo::DeviceList &list) {
|
||||
|
||||
for (const auto &device : list.devices) {
|
||||
qInfo() << "Got device for" << jid << ":" << device.id;
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
explicit DeviceService(QObject *parent);
|
||||
|
||||
public slots:
|
||||
void onDeviceListReceived(const QString &jid, const DeviceList &list);
|
||||
void onDeviceListReceived(const QString &jid, const QXmpp::Omemo::DeviceList &list);
|
||||
|
||||
private:
|
||||
QMap<QString, UserDeviceList> device_lists{};
|
||||
|
@ -18,8 +18,7 @@ using namespace QXmpp::Omemo;
|
||||
Manager::Manager()
|
||||
: deviceService(new DeviceService(this)),
|
||||
omemoVariant(new Variant::Conversations) {
|
||||
connect(this, &Manager::deviceListReceived, deviceService.get(),
|
||||
&DeviceService::onDeviceListReceived);
|
||||
connect(this, &Manager::deviceListReceived, deviceService.get(), &DeviceService::onDeviceListReceived);
|
||||
}
|
||||
|
||||
bool QXmpp::Omemo::Manager::handleStanza(const QDomElement &stanza) {
|
||||
|
@ -25,7 +25,7 @@ public slots:
|
||||
void fetchOwnDevices();
|
||||
|
||||
signals:
|
||||
void deviceListReceived(const QString &jid, const DeviceList &list);
|
||||
void deviceListReceived(const QString &jid, const QXmpp::Omemo::DeviceList &list);
|
||||
|
||||
protected:
|
||||
void setClient(QXmppClient *client) override;
|
||||
|
@ -6,12 +6,14 @@
|
||||
|
||||
#include <QRandomGenerator>
|
||||
|
||||
#define RPAD_ALPHABET "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
||||
|
||||
constexpr int RPAD_MAX_LENGTH = 200;
|
||||
|
||||
QString QXmpp::Sce::generatePadding() {
|
||||
QRandomGenerator random{};
|
||||
QString result{};
|
||||
QString alphabet{ QStringLiteral("!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~") };
|
||||
QString alphabet{QStringLiteral(RPAD_ALPHABET)};
|
||||
|
||||
auto length = random.bounded(RPAD_MAX_LENGTH);
|
||||
result.resize(length);
|
||||
|
@ -35,7 +35,8 @@ int Signal::Store::SignedPreKeyStore::loadSignedPreKey(signal_buffer **record, u
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Signal::Store::SignedPreKeyStore::storeSignedPreKey(uint32_t signed_pre_key_id, uint8_t *record, size_t record_len) {
|
||||
int
|
||||
Signal::Store::SignedPreKeyStore::storeSignedPreKey(uint32_t signed_pre_key_id, uint8_t *record, size_t record_len) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -6,5 +6,4 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
QXmpp::Omemo::UserDeviceList::UserDeviceList(QString jid)
|
||||
: jid(std::move(jid)) {}
|
||||
QXmpp::Omemo::UserDeviceList::UserDeviceList(QString jid) : jid(std::move(jid)) {}
|
||||
|
@ -5,11 +5,13 @@
|
||||
#pragma once
|
||||
|
||||
class QXmppElement;
|
||||
|
||||
class QXmppIq;
|
||||
|
||||
namespace QXmpp::Omemo {
|
||||
|
||||
class Device;
|
||||
|
||||
class DeviceList;
|
||||
|
||||
namespace Variant {
|
||||
|
Loading…
Reference in New Issue
Block a user