Add Protocol::SignedMessage::serialize

This commit is contained in:
2026-08-05 06:22:51 +03:00
parent 11d207d58f
commit d046cb3412
3 changed files with 23 additions and 29 deletions
+3 -2
View File
@@ -4,20 +4,21 @@
#include "sodium/crypto_sign.h"
#include <cstdint>
#include <string>
#include <vector>
namespace Protocol {
struct SignedMessage {
unsigned char sender_key_fingerprint[crypto_hash_sha256_BYTES];
std::string plaintext;
int64_t timestamp;
unsigned char sender_key_signature[crypto_sign_BYTES]; // signs fields 1-3
unsigned char signature[crypto_sign_BYTES]; // signs fields 1-3
// Fills the fields and signs the plaintext
SignedMessage(unsigned char sender_pub_key[crypto_sign_PUBLICKEYBYTES],
unsigned char sender_priv_key[crypto_sign_SECRETKEYBYTES],
std::string plaintext);
// TODO: bool isMessageTrusted(std::string pub_key);
std::vector<uint8_t> serialize();
};
} // namespace Protocol