mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Added function to get public and private key from Tox object.
This commit is contained in:
parent
9a74e5d058
commit
07ddbb8858
|
@ -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.
|
||||
|
|
|
@ -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 ************/
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user