Skip to content

Commit

Permalink
Print DHT key in debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
gjedeer committed Mar 24, 2018
1 parent f8f68e7 commit 3b26f4e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions main.c
Expand Up @@ -1526,11 +1526,18 @@ int main(int argc, char *argv[])

if(client_mode)
{
uint8_t dht_key[TOX_PUBLIC_KEY_SIZE];
char_t readable_dht_key[2 * TOX_PUBLIC_KEY_SIZE + 1];

tox_self_get_address(tox, tox_id);
id_to_string(tox_printable_id, tox_id);
tox_printable_id[TOX_ADDRESS_SIZE * 2] = '\0';
log_printf(L_DEBUG, "Generated Tox ID: %s\n", tox_printable_id);

tox_self_get_dht_id(tox, dht_key);
to_hex(readable_dht_key, dht_key, TOX_PUBLIC_KEY_SIZE);
log_printf(L_DEBUG, "DHT key: %s\n", readable_dht_key);

if(!remote_tox_id)
{
log_printf(L_ERROR, "Tox id is required in client mode. Use -i 58435984ABCDEF475...\n");
Expand All @@ -1540,6 +1547,9 @@ int main(int argc, char *argv[])
}
else
{
uint8_t dht_key[TOX_PUBLIC_KEY_SIZE];
char_t readable_dht_key[2 * TOX_PUBLIC_KEY_SIZE + 1];

write_save(tox);

if(!use_shared_secret)
Expand All @@ -1553,6 +1563,10 @@ int main(int argc, char *argv[])
tox_printable_id[TOX_ADDRESS_SIZE * 2] = '\0';
log_printf(L_INFO, "Using Tox ID: %s\n", tox_printable_id);

tox_self_get_dht_id(tox, dht_key);
to_hex(readable_dht_key, dht_key, TOX_PUBLIC_KEY_SIZE);
log_printf(L_DEBUG, "DHT key: %s\n", readable_dht_key);

tox_callback_friend_request(tox, accept_friend_request);
do_server_loop();
clear_rules();
Expand Down

0 comments on commit 3b26f4e

Please sign in to comment.