2019-02-22 13:17:26 -05:00
|
|
|
#include <glib.h>
|
|
|
|
|
2019-02-26 13:53:06 -05:00
|
|
|
#include "ui/ui.h"
|
2019-02-19 12:38:15 -05:00
|
|
|
#include "config/account.h"
|
|
|
|
|
2019-02-26 13:53:06 -05:00
|
|
|
#define OMEMO_ERR_UNSUPPORTED_CRYPTO -10000
|
2019-03-06 12:17:11 -05:00
|
|
|
#define OMEMO_ERR_GCRYPT -20000
|
2019-02-26 13:53:06 -05:00
|
|
|
|
2019-02-19 12:58:40 -05:00
|
|
|
typedef struct omemo_context_t omemo_context;
|
|
|
|
|
2019-02-26 13:53:06 -05:00
|
|
|
typedef struct omemo_key {
|
2019-03-21 19:03:16 -04:00
|
|
|
unsigned char *data;
|
2019-02-26 13:53:06 -05:00
|
|
|
size_t length;
|
|
|
|
gboolean prekey;
|
|
|
|
uint32_t device_id;
|
2019-03-06 11:10:28 -05:00
|
|
|
uint32_t id;
|
2019-02-26 13:53:06 -05:00
|
|
|
} omemo_key_t;
|
|
|
|
|
2019-02-19 13:23:50 -05:00
|
|
|
void omemo_init(void);
|
2019-03-01 12:41:20 -05:00
|
|
|
void omemo_on_connect(ProfAccount *account);
|
2019-03-21 19:03:16 -04:00
|
|
|
void omemo_on_disconnect(void);
|
2019-02-19 13:23:50 -05:00
|
|
|
void omemo_generate_crypto_materials(ProfAccount *account);
|
2019-03-21 19:03:16 -04:00
|
|
|
void omemo_key_free(omemo_key_t *key);
|
2019-04-08 13:09:25 -04:00
|
|
|
void omemo_publish_crypto_materials(void);
|
2019-02-21 13:04:01 -05:00
|
|
|
|
|
|
|
uint32_t omemo_device_id(void);
|
|
|
|
void omemo_identity_key(unsigned char **output, size_t *length);
|
|
|
|
void omemo_signed_prekey(unsigned char **output, size_t *length);
|
|
|
|
void omemo_signed_prekey_signature(unsigned char **output, size_t *length);
|
2019-02-25 11:27:11 -05:00
|
|
|
void omemo_prekeys(GList **prekeys, GList **ids, GList **lengths);
|
2019-02-24 23:24:03 -05:00
|
|
|
void omemo_set_device_list(const char *const jid, GList * device_list);
|
2019-03-07 12:58:15 -05:00
|
|
|
GKeyFile *omemo_identity_keyfile(void);
|
|
|
|
void omemo_identity_keyfile_save(void);
|
2019-03-07 01:20:29 -05:00
|
|
|
GKeyFile *omemo_sessions_keyfile(void);
|
|
|
|
void omemo_sessions_keyfile_save(void);
|
2019-03-07 12:24:33 -05:00
|
|
|
char *omemo_format_fingerprint(const char *const fingerprint);
|
2019-03-07 13:05:11 -05:00
|
|
|
char *omemo_own_fingerprint(gboolean formatted);
|
|
|
|
void omemo_trust(const char *const jid, const char *const fingerprint);
|
2019-03-13 14:03:07 -04:00
|
|
|
void omemo_untrust(const char *const jid, const char *const fingerprint);
|
2019-03-25 12:50:46 -04:00
|
|
|
GList *omemo_known_device_identities(const char *const jid);
|
|
|
|
gboolean omemo_is_trusted_identity(const char *const jid, const char *const fingerprint);
|
2019-03-25 13:27:36 -04:00
|
|
|
char *omemo_fingerprint_autocomplete(const char *const search_str, gboolean previous);
|
|
|
|
void omemo_fingerprint_autocomplete_reset(void);
|
2019-02-21 13:04:01 -05:00
|
|
|
|
2019-02-25 11:27:11 -05:00
|
|
|
void omemo_start_session(const char *const barejid);
|
2019-03-15 17:58:01 -04:00
|
|
|
void omemo_start_muc_sessions(const char *const roomjid);
|
2019-03-06 11:10:28 -05:00
|
|
|
void omemo_start_device_session(const char *const jid, uint32_t device_id, GList *prekeys, 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);
|
2019-02-25 11:27:11 -05:00
|
|
|
|
2019-02-21 13:04:01 -05:00
|
|
|
gboolean omemo_loaded(void);
|
2019-03-18 14:50:28 -04:00
|
|
|
char * omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc);
|
2019-03-14 15:45:47 -04:00
|
|
|
char * omemo_on_message_recv(const char *const from, uint32_t sid, const unsigned char *const iv, size_t iv_len, GList *keys, const unsigned char *const payload, size_t payload_len, gboolean muc);
|