mirror of
https://github.com/ratspeak/ratdeck.git
synced 2026-10-15 05:59:52 +00:00
Opportunistic (non-link) delivery must strip dest_hash from the LXMF payload — it's carried by the RNS packet header. Python prepends it back on receive; we now do the same. Previously ratdeck always included dest_hash when sending and never prepended it when receiving, breaking interop in both directions. - packFull: return [src:16][sig:64][msgpack] instead of [dest:16][src:16][sig:64][msgpack] - onPacketReceived: prepend dest_hash from packet header before unpacking - sendDirect: use messageId computed by packFull instead of re-hashing wire payload - Add docs/WIRE-FORMAT.md documenting the exact format for all delivery methods
34 lines
895 B
C++
34 lines
895 B
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <Bytes.h>
|
|
#include <Identity.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
enum class LXMFStatus : uint8_t {
|
|
DRAFT = 0, QUEUED, SENDING, SENT, DELIVERED, FAILED
|
|
};
|
|
|
|
struct LXMFMessage {
|
|
RNS::Bytes sourceHash;
|
|
RNS::Bytes destHash;
|
|
double timestamp = 0;
|
|
std::string content;
|
|
std::string title;
|
|
RNS::Bytes signature;
|
|
|
|
LXMFStatus status = LXMFStatus::DRAFT;
|
|
bool incoming = false;
|
|
bool read = false;
|
|
int retries = 0;
|
|
unsigned long lastRetryMs = 0;
|
|
uint32_t savedCounter = 0;
|
|
RNS::Bytes messageId;
|
|
|
|
static std::vector<uint8_t> packContent(double timestamp, const std::string& content, const std::string& title);
|
|
std::vector<uint8_t> packFull(const RNS::Identity& signingIdentity);
|
|
static bool unpackFull(const uint8_t* data, size_t len, LXMFMessage& msg);
|
|
const char* statusStr() const;
|
|
};
|