From 972910c763fd2fed23266d3bbe7e6a9778921e65 Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 6 Oct 2026 12:45:45 +0200 Subject: [PATCH] Verify profile signatures survive avatar and display name updates --- src/chat/chat_join.h | 1 + tools/chatgui/tests/test_avatars.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/chat/chat_join.h b/src/chat/chat_join.h index 4f3396c1..91b82e8d 100644 --- a/src/chat/chat_join.h +++ b/src/chat/chat_join.h @@ -79,6 +79,7 @@ #include #include +#include "member_sync.h" struct UTUN_INSTANCE; diff --git a/tools/chatgui/tests/test_avatars.cpp b/tools/chatgui/tests/test_avatars.cpp index d73717b1..6798f0e4 100644 --- a/tools/chatgui/tests/test_avatars.cpp +++ b/tools/chatgui/tests/test_avatars.cpp @@ -109,6 +109,13 @@ private slots: } chat_core_update_my_name(testInstance, "quote\"\\name"); chat_core_sync_my_addresses(testInstance); for (const auto& channel : channels) { + char profile[MS_USERINFO_MAX + 1], name[128]; uint8_t signature[64]; uint64_t timestamp; + QCOMPARE(chat_core_get_my_profile(testInstance, channel.channelId.toLatin1().constData(), profile, sizeof(profile), signature, ×tamp), 0); + QCOMPARE(json_flat_get(profile, "name", name, sizeof(name)), 0); QCOMPARE(QString::fromLatin1(name), QString("quote\"\\name")); + uint8_t join[64], signedBytes[MS_USERINFO_MAX + 73]; uint64_t joinTimestamp; + QCOMPARE(topo_node_sqlite_member_get_join(testInstance->topo_sqlite_db, channel.channelId.toLatin1().constData(), testInstance->node_id, join, &joinTimestamp), 0); + int length = member_sync_build_update_msg(join, timestamp, profile, signedBytes, sizeof(signedBytes)); QVERIFY(length > 0); + QCOMPARE(sc_ed25519_verify(testInstance->my_ed25519_pubkey, signedBytes, length, signature), SC_OK); uint8_t wire[CHAT_MEMBER_DISPLAY_SIZE]; QCOMPARE(chat_core_get_single_member(testInstance, channel.channelId.toLatin1().constData(), testInstance->node_id, wire), 0); QCOMPARE(mf_get64(wire + 79), testInstance->node_id); QCOMPARE(manager.image(channel.channelId, testInstance->node_id).pixelColor(128, 128), QColor(Qt::blue));