\r
\r
#define USER_ID_SIZE 64\r
+#define ROOM_ID_SIZE 128\r
#define SERVER_SIZE 20\r
#define ACCESS_TOKEN_SIZE 40\r
#define DEVICE_ID_SIZE 20\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
- const char * sIn, int sInLen,\r
- char * sOut, int sOutCap);\r
- \r
-bool JsonSign(\r
- const char * sIn, int sInLen,\r
- char * sOut, int sOutCap);\r
-\r
// Matrix Device\r
\r
typedef struct MatrixDevice {\r
} MatrixMegolmInSession;\r
\r
typedef struct MatrixMegolmOutSession {\r
- const char * roomId;\r
+ char roomId[ROOM_ID_SIZE];\r
\r
OlmOutboundGroupSession * session;\r
char memory[MEGOLM_OUTBOUND_SESSION_MEMORY_SIZE];\r
MatrixMegolmOutSessionInit(\r
MatrixMegolmOutSession * session,\r
const char * roomId);\r
- \r
+\r
bool\r
MatrixMegolmOutSessionEncrypt(\r
MatrixMegolmOutSession * session,\r
const char * plaintext,\r
char * outBuffer, int outBufferCap);\r
\r
+bool\r
+MatrixMegolmOutSessionSave(\r
+ MatrixMegolmOutSession * session,\r
+ const char * filename,\r
+ const char * key);\r
+ \r
+bool\r
+MatrixMegolmOutSessionLoad(\r
+ MatrixMegolmOutSession * session,\r
+ const char * filename,\r
+ const char * key);\r
+\r
\r
// Matrix Client\r
\r
MatrixClient * client,\r
const char * server);\r
\r
+bool\r
+MatrixClientSave(\r
+ MatrixClient * client,\r
+ const char * filename);\r
+\r
+bool\r
+MatrixClientLoad(\r
+ MatrixClient * client,\r
+ const char * filename);\r
+\r
bool\r
MatrixClientSetAccessToken(\r
MatrixClient * client,\r
const char * roomId,\r
MatrixMegolmOutSession session);\r
\r
+bool\r
+MatrixClientInitMegolmOutSession(\r
+ MatrixClient * client,\r
+ const char * roomId);\r
+\r
bool\r
MatrixClientGetOlmSession(\r
MatrixClient * client,\r
\r
\r
\r
+\r
bool\r
MatrixHttpInit(\r
MatrixClient * client);\r
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