Add Protocol::SignedMessage struct (not done)

This commit is contained in:
2026-08-04 21:27:06 +03:00
parent 09ae813c76
commit 11d207d58f
6 changed files with 103 additions and 3 deletions
@@ -0,0 +1,23 @@
#pragma once
#include "sodium/crypto_hash_sha256.h"
#include "sodium/crypto_sign.h"
#include <cstdint>
#include <string>
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
// 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);
};
} // namespace Protocol