Browse Source

Finalize unsigned initial profiles before channel bootstrap

master
evgeny 6 days ago
parent
commit
d946a1b93a
  1. 10
      src/chat/chat_sync.c

10
src/chat/chat_sync.c

@ -1161,7 +1161,10 @@ static void cs_handle_join_info_req(struct chat_sync* cs, uint64_t peer,
uint8_t my_update_sig[64] = {0}; uint64_t my_update_ts;
char juser[MS_USERINFO_MAX + 1];
if (chat_core_get_my_profile(cs->inst, ch_id, juser, sizeof(juser), my_update_sig, &my_update_ts) < 0) {
uint8_t err[1] = { CS_MSG_ERROR }; cs_send(cs, ch_id, peer, err, sizeof(err)); return;
chat_core_update_my_member(cs->inst);
if (chat_core_get_my_profile(cs->inst, ch_id, juser, sizeof(juser), my_update_sig, &my_update_ts) < 0) {
uint8_t err[1] = { CS_MSG_ERROR }; cs_send(cs, ch_id, peer, err, sizeof(err)); return;
}
}
uint64_t my_signed_by = 0; uint8_t my_signature[64] = {0};
topo_node_sqlite_member_get_sign(cs->inst->topo_sqlite_db, ch_id, myid, &my_signed_by, my_signature);
@ -1609,7 +1612,10 @@ static int cs_send_channel_invite(struct chat_sync* cs, struct UTUN_INSTANCE* in
topo_node_sqlite_member_get_join(vdb, ch_id, inst->node_id, join_sig, &join_ts); }
uint8_t upd_sig[64] = {0}; uint64_t upd_ts;
char juser[MS_USERINFO_MAX + 1];
if (chat_core_get_my_profile(inst, ch_id, juser, sizeof(juser), upd_sig, &upd_ts) < 0) return -1;
if (chat_core_get_my_profile(inst, ch_id, juser, sizeof(juser), upd_sig, &upd_ts) < 0) {
chat_core_update_my_member(inst);
if (chat_core_get_my_profile(inst, ch_id, juser, sizeof(juser), upd_sig, &upd_ts) < 0) return -1;
}
/* join-ключ: генерируем и регистрируем локально (инвайтер == connection-узел),
чтобы джойнер смог пройти JOIN_INFO_REQ с валидным ключом. */
uint64_t join_key = 0;

Loading…
Cancel
Save