Added function to get public and private key from Tox object.

This commit is contained in:
irungentoo 2014-07-30 10:29:46 -04:00
parent 9a74e5d058
commit 07ddbb8858
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 18 additions and 0 deletions

View File

@ -481,6 +481,20 @@ void tox_set_nospam(Tox *tox, uint32_t nospam)
set_nospam(&(m->fr), nospam);
}
/* Copy the public and secret key from the Tox object.
public_key and secret_key must be 32 bytes big.
if the pointer is NULL, no data will be copied to it.*/
void tox_get_keys(Tox *tox, uint8_t *public_key, uint8_t *secret_key)
{
Messenger *m = tox;
if (public_key)
memcpy(public_key, m->net_crypto->self_public_key, crypto_box_PUBLICKEYBYTES);
if (secret_key)
memcpy(secret_key, m->net_crypto->self_secret_key, crypto_box_SECRETKEYBYTES);
}
/**********GROUP CHAT FUNCTIONS: WARNING Group chats will be rewritten so this might change ************/
/* Set the callback for group invites.

View File

@ -361,6 +361,10 @@ void tox_callback_connection_status(Tox *tox, void (*function)(Tox *tox, int32_t
uint32_t tox_get_nospam(const Tox *tox);
void tox_set_nospam(Tox *tox, uint32_t nospam);
/* Copy the public and secret key from the Tox object.
public_key and secret_key must be 32 bytes big.
if the pointer is NULL, no data will be copied to it.*/
void tox_get_keys(Tox *tox, uint8_t *public_key, uint8_t *secret_key);
/**********GROUP CHAT FUNCTIONS: WARNING Group chats will be rewritten so this might change ************/