]> gitweb.ps.run Git - matrix_esp_thesis/blobdiff - src/matrix.h
actually add Canonical and Verify examples :()
[matrix_esp_thesis] / src / matrix.h
index da0e85930b726169adbcd3fd0dcbe663b58f884f..4037f0968705f717c8b6cbd7f17394672662be4b 100644 (file)
@@ -49,7 +49,7 @@
 \r
 #define NUM_MEGOLM_SESSIONS 10\r
 #define NUM_OLM_SESSIONS 10\r
-#define NUM_DEVICES 10\r
+#define NUM_DEVICES 100\r
 \r
 // Matrix Device\r
 \r
@@ -105,6 +105,14 @@ MatrixOlmSessionUnpickle(
     void * pickled, int pickledLen,\r
     const void * key, int keyLen);\r
 \r
+bool\r
+MatrixOlmSessionFrom(\r
+    MatrixOlmSession * session,\r
+    OlmAccount * olmAccount,\r
+    const char * deviceId,\r
+    const char * deviceKey,\r
+    const char * encrypted);\r
+\r
 bool\r
 MatrixOlmSessionTo(\r
     MatrixOlmSession * session,\r
@@ -130,23 +138,35 @@ MatrixOlmSessionDecrypt(
 // Matrix Megolm Session\r
 \r
 typedef struct MatrixMegolmInSession {\r
+    char roomId[ROOM_ID_SIZE];\r
+    char id[MEGOLM_SESSION_ID_SIZE];\r
+    char key[MEGOLM_SESSION_KEY_SIZE];\r
+\r
     OlmInboundGroupSession * session;\r
+    char memory[MEGOLM_OUTBOUND_SESSION_MEMORY_SIZE];\r
+\r
 } MatrixMegolmInSession;\r
 \r
+bool\r
+MatrixMegolmInSessionInit(\r
+    MatrixMegolmInSession * session,\r
+    const char * roomId,\r
+    const char * sessionId,\r
+    const char * sessionKey, int sessionKeyLen);\r
+\r
 bool\r
 MatrixMegolmInSessionDecrypt(\r
-    MatrixMegolmInSession * megolmInSession,\r
-    const char * encrypted,\r
+    MatrixMegolmInSession * session,\r
+    const char * encrypted, int encryptedLen,\r
     char * outDecrypted, int outDecryptedCap);\r
 \r
 typedef struct MatrixMegolmOutSession {\r
     char roomId[ROOM_ID_SIZE];\r
+    char id[MEGOLM_SESSION_ID_SIZE];\r
+    char key[MEGOLM_SESSION_KEY_SIZE];\r
 \r
     OlmOutboundGroupSession * session;\r
     char memory[MEGOLM_OUTBOUND_SESSION_MEMORY_SIZE];\r
-\r
-    char id[MEGOLM_SESSION_ID_SIZE];\r
-    char key[MEGOLM_SESSION_KEY_SIZE];\r
 } MatrixMegolmOutSession;\r
 \r
 bool\r
@@ -306,15 +326,25 @@ MatrixClientGetMegolmOutSession(
     MatrixMegolmOutSession ** outSession);\r
 \r
 bool\r
-MatrixClientSetMegolmOutSession(\r
+MatrixClientNewMegolmOutSession(\r
     MatrixClient * client,\r
     const char * roomId,\r
-    MatrixMegolmOutSession session);\r
+    MatrixMegolmOutSession ** outSession);\r
 \r
 bool\r
-MatrixClientInitMegolmOutSession(\r
+MatrixClientGetMegolmInSession(\r
     MatrixClient * client,\r
-    const char * roomId);\r
+    const char * roomId, int roomIdLen,\r
+    const char * sessionId, int sessionIdLen,\r
+    MatrixMegolmInSession ** outSession);\r
+\r
+bool\r
+MatrixClientNewMegolmInSession(\r
+    MatrixClient * client,\r
+    const char * roomId,\r
+    const char * sessionId,\r
+    const char * sessionKey,\r
+    MatrixMegolmInSession ** outSession);\r
     \r
 bool\r
 MatrixClientRequestMegolmInSession(\r
@@ -323,11 +353,18 @@ MatrixClientRequestMegolmInSession(
     const char * sessionId,\r
     const char * senderKey,\r
     const char * userId,\r
-    const char * deviceId, // TODO: remove deviceId (query all devices)\r
-    MatrixMegolmInSession * outMegolmInSession);\r
+    const char * deviceId); // TODO: remove deviceId (query all devices)\r
 \r
 bool\r
-MatrixClientGetOlmSession(\r
+MatrixClientGetOlmSessionIn(\r
+    MatrixClient * client,\r
+    const char * userId,\r
+    const char * deviceId,\r
+    const char * encrypted,\r
+    MatrixOlmSession ** outSession);\r
+    \r
+bool\r
+MatrixClientGetOlmSessionOut(\r
     MatrixClient * client,\r
     const char * userId,\r
     const char * deviceId,\r
@@ -423,6 +460,11 @@ JsonEscape(
     const char * sIn, int sInLen,\r
     char * sOut, int sOutCap);\r
     \r
+bool\r
+JsonCanonicalize(\r
+    const char * sIn, int sInLen,\r
+    char * sOut, int sOutCap);\r
+    \r
 bool\r
 JsonSign(\r
     MatrixClient * client,\r