aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-07-09 18:35:54 +0100
committerMark Haines <mark.haines@matrix.org>2015-07-09 18:35:54 +0100
commit373acefde7be92f86b8294b325519ad916b1e054 (patch)
tree9d80437d0b059808eb3cd960d4517fdc59ab4731 /src
parent5634be05074168e33b77246bbc9b60bd683759d8 (diff)
Add c bindings for the methods for managing one time keys
Diffstat (limited to 'src')
-rw-r--r--src/account.cpp4
-rw-r--r--src/olm.cpp35
2 files changed, 36 insertions, 3 deletions
diff --git a/src/account.cpp b/src/account.cpp
index ede327b..6a76583 100644
--- a/src/account.cpp
+++ b/src/account.cpp
@@ -48,7 +48,7 @@ std::size_t olm::Account::remove_key(
}
std::size_t olm::Account::new_account_random_length() {
- return 12 * 32;
+ return 2 * 32;
}
std::size_t olm::Account::new_account(
@@ -64,8 +64,6 @@ std::size_t olm::Account::new_account(
olm::curve25519_generate_key(random, identity_keys.curve25519_key);
random += 32;
- generate_one_time_keys(10, random, random_length - 64);
-
return 0;
}
diff --git a/src/olm.cpp b/src/olm.cpp
index 65d0648..6450999 100644
--- a/src/olm.cpp
+++ b/src/olm.cpp
@@ -370,12 +370,47 @@ size_t olm_account_one_time_keys(
}
+size_t olm_account_mark_keys_as_published(
+ OlmAccount * account
+) {
+ return from_c(account)->mark_keys_as_published();
+}
+
+
+size_t olm_account_max_number_of_one_time_keys(
+ OlmAccount * account
+) {
+ return from_c(account)->max_number_of_one_time_keys();
+}
+
+
+size_t olm_account_generate_one_time_keys_random_length(
+ OlmAccount * account,
+ size_t number_of_keys
+) {
+ return from_c(account)->generate_one_time_keys_random_length(number_of_keys);
+}
+
+
+size_t olm_account_generate_one_time_keys(
+ OlmAccount * account,
+ size_t number_of_keys,
+ void const * random, size_t random_length
+) {
+ return from_c(account)->generate_one_time_keys(
+ number_of_keys,
+ from_c(random), random_length
+ );
+}
+
+
size_t olm_create_outbound_session_random_length(
OlmSession * session
) {
return from_c(session)->new_outbound_session_random_length();
}
+
size_t olm_create_outbound_session(
OlmSession * session,
OlmAccount * account,