diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-07-09 18:35:54 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-07-09 18:35:54 +0100 |
commit | 373acefde7be92f86b8294b325519ad916b1e054 (patch) | |
tree | 9d80437d0b059808eb3cd960d4517fdc59ab4731 /include/olm | |
parent | 5634be05074168e33b77246bbc9b60bd683759d8 (diff) |
Add c bindings for the methods for managing one time keys
Diffstat (limited to 'include/olm')
-rw-r--r-- | include/olm/account.hh | 4 | ||||
-rw-r--r-- | include/olm/olm.hh | 36 |
2 files changed, 30 insertions, 10 deletions
diff --git a/include/olm/account.hh b/include/olm/account.hh index f54758d..da3ca35 100644 --- a/include/olm/account.hh +++ b/include/olm/account.hh @@ -123,8 +123,8 @@ struct Account { /** The largest number of one time keys this account can store. */ std::size_t max_number_of_one_time_keys(); - /** Returns the number of random bytes needed to generate a given number - * of new one time keys. */ + /** The number of random bytes needed to generate a given number of new one + * time keys. */ std::size_t generate_one_time_keys_random_length( std::size_t number_of_keys ); diff --git a/include/olm/olm.hh b/include/olm/olm.hh index 891f953..46f7a68 100644 --- a/include/olm/olm.hh +++ b/include/olm/olm.hh @@ -157,12 +157,8 @@ size_t olm_account_one_time_keys_length( OlmAccount * account ); -/** Writes the public parts of the one time keys for the account into the - * one_time_keys output buffer. The first key will be formatted as though it was - * created with sprintf(output, "[[%10d,\"%43s\"]\n", key_id, key_base64). - * subsequent keys are formatted with ",[%10d,\"%43s\"]\n". The final byte of - * output will be "]". The output can either be parsed as fixed width using - * the above format or by a JSON parser. Returns olm_error() on failure. +/** Writes the public parts of the unpublished one time keys for the account + * into the one_time_keys output buffer. Returns olm_error() on failure. * If the one_time_keys buffer was too small then olm_account_last_error() * will be "OUTPUT_BUFFER_TOO_SMALL". */ size_t olm_account_one_time_keys( @@ -170,8 +166,32 @@ size_t olm_account_one_time_keys( void * one_time_keys, size_t one_time_keys_length ); -/* TODO: Add methods for marking keys as used, generating new keys, and - * tracking which keys have been uploaded to the central servers */ +/** Marks the current set of one time keys as being published. */ +size_t olm_account_mark_keys_as_published( + OlmAccount * account +); + +/** The largest number of one time keys this account can store. */ +size_t olm_account_max_number_of_one_time_keys( + OlmAccount * account +); + +/** The number of random bytes needed to generate a given number of new one + * time keys. */ +size_t olm_account_generate_one_time_keys_random_length( + OlmAccount * account, + size_t number_of_keys +); + +/** Generates a number of new one time keys. If the total number of keys stored + * by this account exceeds max_number_of_one_time_keys() then the old keys are + * discarded. Returns olm_error() on error. If the number of random bytes is + * too small then olm_account_last_error() will be "NOT_ENOUGH_RANDOM". */ +size_t olm_account_generate_one_time_keys( + OlmAccount * account, + size_t number_of_keys, + void const * random, size_t random_length +); /** The number of random bytes needed to create an outbound session */ size_t olm_create_outbound_session_random_length( |