]> gitweb.ps.run Git - matrix_esp_thesis/blobdiff - src/matrix.h
esp32 build, cli
[matrix_esp_thesis] / src / matrix.h
index 72e865ff81c8e2f35c39c9fb358aa90dfaefa498..32b8294c835dd82c90bc0276c6c378d21dbf783f 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
 #define NUM_OLM_SESSIONS 10\r
 #define NUM_DEVICES 10\r
 \r
-void\r
-Randomize(uint8_t * random, int randomLen);\r
-\r
-bool\r
-JsonEscape(\r
-    char * sIn, int sInLen,\r
-    char * sOut, int sOutCap);\r
-    \r
-bool JsonSign(\r
-    char * sIn, int sInLen,\r
-    char * sOut, int sOutCap);\r
-\r
 // Matrix Device\r
 \r
 typedef struct MatrixDevice {\r
@@ -91,9 +81,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 +184,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 +215,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 +245,7 @@ MatrixClientSetMegolmOutSession(
 bool\r
 MatrixClientGetOlmSession(\r
     MatrixClient * client,\r
+    const char * userId,\r
     const char * deviceId,\r
     MatrixOlmSession ** outSession);\r
 \r
@@ -281,6 +283,7 @@ MatrixClientRequestDeviceKeys(
 \r
 \r
 \r
+\r
 bool\r
 MatrixHttpInit(\r
     MatrixClient * client);\r
@@ -316,4 +319,19 @@ MatrixHttpPut(
     char * outResponseBuffer, int outResponseCap,\r
     bool authenticated);\r
 \r
+// util\r
+\r
+void\r
+Randomize(uint8_t * random, int randomLen);\r
+\r
+bool\r
+JsonEscape(\r
+    const char * sIn, int sInLen,\r
+    char * sOut, int sOutCap);\r
+    \r
+bool JsonSign(\r
+    MatrixClient * client,\r
+    const char * sIn, int sInLen,\r
+    char * sOut, int sOutCap);\r
+\r
 #endif\r