]> gitweb.ps.run Git - matrix_esp_thesis/blobdiff - src/matrix.h
more changes towards sharing megolm sessions
[matrix_esp_thesis] / src / matrix.h
index 38fb767742cdaf23948313d06ac47a6cfe09d9e3..a06eab9e0edb7c0a510819f3bf4f101ab5019caf 100644 (file)
@@ -21,6 +21,7 @@
 #define OLM_IDENTITY_KEYS_JSON_SIZE 128\r
 #define DEVICE_KEY_SIZE 44\r
 #define SIGNING_KEY_SIZE 44\r
+#define ONETIME_KEY_SIZE 44\r
 \r
 #define KEY_SHARE_EVENT_LEN 1024\r
 \r
@@ -29,8 +30,9 @@
 \r
 #define OLM_SESSION_MEMORY_SIZE 3352\r
 #define OLM_ENCRYPT_RANDOM_SIZE 32\r
+#define OLM_OUTBOUND_SESSION_RANDOM_SIZE (32*2)\r
 \r
-#define OLM_ONETIME_KEYS_RANDOM_SIZE 32*10\r
+#define OLM_ONETIME_KEYS_RANDOM_SIZE (32*10)\r
 #define OLM_KEY_ID_SIZE 32\r
 \r
 #define OLM_SIGNATURE_SIZE 128\r
@@ -53,11 +55,11 @@ Randomize(uint8_t * random, int randomLen);
 \r
 bool\r
 JsonEscape(\r
-    char * sIn, int sInLen,\r
+    const char * sIn, int sInLen,\r
     char * sOut, int sOutCap);\r
     \r
 bool JsonSign(\r
-    char * sIn, int sInLen,\r
+    const char * sIn, int sInLen,\r
     char * sOut, int sOutCap);\r
 \r
 // Matrix Device\r
@@ -91,9 +93,12 @@ typedef struct MatrixOlmSession {
 } MatrixOlmSession;\r
 \r
 bool\r
-MatrixOlmSessionInit(\r
+MatrixOlmSessionTo(\r
     MatrixOlmSession * session,\r
-    const char * deviceId);\r
+    OlmAccount * olmAccount,\r
+    const char * deviceId,\r
+    const char * deviceKey,\r
+    const char * deviceOnetimeKey);\r
 \r
 bool\r
 MatrixOlmSessionEncrypt(\r
@@ -191,6 +196,13 @@ bool
 MatrixClientUploadDeviceKeys(\r
     MatrixClient * client);\r
 \r
+bool\r
+MatrixClientClaimOnetimeKey(\r
+    MatrixClient * client,\r
+    const char * userId,\r
+    const char * deviceId,\r
+    char * outOnetimeKey, int outOnetimeKeyCap);\r
+\r
 bool\r
 MatrixClientLoginPassword(\r
     MatrixClient * client,\r
@@ -215,11 +227,12 @@ MatrixClientSendEventEncrypted(
 bool\r
 MatrixClientSync(\r
     MatrixClient * client,\r
-    char * outSyncBuffer, int outSyncCap);\r
+    char * outSync, int outSyncCap);\r
 \r
 bool\r
 MatrixClientShareMegolmOutSession(\r
     MatrixClient * client,\r
+    const char * userId,\r
     const char * deviceId,\r
     MatrixMegolmOutSession * session);\r
 \r
@@ -244,6 +257,7 @@ MatrixClientSetMegolmOutSession(
 bool\r
 MatrixClientGetOlmSession(\r
     MatrixClient * client,\r
+    const char * userId,\r
     const char * deviceId,\r
     MatrixOlmSession ** outSession);\r
 \r
@@ -285,6 +299,10 @@ bool
 MatrixHttpInit(\r
     MatrixClient * client);\r
 \r
+bool\r
+MatrixHttpConnect(\r
+    MatrixClient * client);\r
+\r
 bool\r
 MatrixHttpDeinit(\r
     MatrixClient * client);\r