diff options
author | Paul Fariello <paul@fariello.eu> | 2019-02-26 19:03:08 +0140 |
---|---|---|
committer | Paul Fariello <paul@fariello.eu> | 2019-04-10 16:03:50 +0200 |
commit | b1ae220aa47ff503fe368e4802061be159dfb42b (patch) | |
tree | 73876b55d33a41046b05e1f1baec6ce19e08ad6c /src/omemo | |
parent | f9216fddb106d46bac2d13d9dfe175b4a475a789 (diff) | |
download | profani-tty-b1ae220aa47ff503fe368e4802061be159dfb42b.tar.gz |
Create signal session
Diffstat (limited to 'src/omemo')
-rw-r--r-- | src/omemo/omemo.c | 19 | ||||
-rw-r--r-- | src/omemo/omemo.h | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/omemo/omemo.c b/src/omemo/omemo.c index 32fdce42..95de1aa2 100644 --- a/src/omemo/omemo.c +++ b/src/omemo/omemo.c @@ -249,15 +249,30 @@ omemo_set_device_list(const char *const jid, GList * device_list) } void -omemo_start_device_session(const char *const jid, uint32_t device_id, const unsigned char *const prekey, size_t prekey_len) +omemo_start_device_session(const char *const jid, uint32_t device_id, + uint32_t prekey_id, const unsigned char *const prekey_raw, size_t prekey_len, + uint32_t signed_prekey_id, const unsigned char *const signed_prekey_raw, + size_t signed_prekey_len, const unsigned char *const signature, + size_t signature_len, const unsigned char *const identity_key_raw, + size_t identity_key_len) { + session_pre_key_bundle *bundle; signal_protocol_address address = { jid, strlen(jid), device_id }; session_builder *builder; session_builder_create(&builder, omemo_ctx.store, &address, omemo_ctx.signal); - //session_builder_process_pre_key_bundle(builder, prekey); + + ec_public_key *prekey; + curve_decode_point(&prekey, prekey_raw, prekey_len, omemo_ctx.signal); + ec_public_key *signed_prekey; + curve_decode_point(&signed_prekey, signed_prekey_raw, signed_prekey_len, omemo_ctx.signal); + ec_public_key *identity_key; + curve_decode_point(&identity_key, identity_key_raw, identity_key_len, omemo_ctx.signal); + + session_pre_key_bundle_create(&bundle, 0, device_id, prekey_id, prekey, signed_prekey_id, signed_prekey, signature, signature_len, identity_key); + session_builder_process_pre_key_bundle(builder, bundle); } static void diff --git a/src/omemo/omemo.h b/src/omemo/omemo.h index 26bd6e65..bf42b3e3 100644 --- a/src/omemo/omemo.h +++ b/src/omemo/omemo.h @@ -15,6 +15,6 @@ void omemo_prekeys(GList **prekeys, GList **ids, GList **lengths); void omemo_set_device_list(const char *const jid, GList * device_list); void omemo_start_session(const char *const barejid); -void omemo_start_device_session(const char *const jid, uint32_t device_id, const unsigned char *const prekey, size_t prekey_len); +void omemo_start_device_session(const char *const jid, uint32_t device_id, uint32_t prekey_id, const unsigned char *const prekey, size_t prekey_len, uint32_t signed_prekey_id, const unsigned char *const signed_prekey, size_t signed_prekey_len, const unsigned char *const signature, size_t signature_len, const unsigned char *const identity_key, size_t identity_key_len); gboolean omemo_loaded(void); |