diff options
| author | Patrick | 2023-09-13 22:01:42 +0200 |
|---|---|---|
| committer | Patrick | 2023-09-13 22:01:42 +0200 |
| commit | b231872efcb97e52856f5972efd161c6e9b03cd6 (patch) | |
| tree | 24a1f20d8ad9135d97b62b72887d67615e6a897c /src/matrix.h | |
| parent | 504241758d7b832af61939beaf61b0e0574174c4 (diff) | |
| download | matrix_esp_thesis-b231872efcb97e52856f5972efd161c6e9b03cd6.tar.gz matrix_esp_thesis-b231872efcb97e52856f5972efd161c6e9b03cd6.zip | |
sync in verify
Diffstat (limited to 'src/matrix.h')
| -rw-r--r-- | src/matrix.h | 68 |
1 files changed, 55 insertions, 13 deletions
diff --git a/src/matrix.h b/src/matrix.h index da0e859..4037f09 100644 --- a/src/matrix.h +++ b/src/matrix.h @@ -49,7 +49,7 @@ #define NUM_MEGOLM_SESSIONS 10
#define NUM_OLM_SESSIONS 10
-#define NUM_DEVICES 10
+#define NUM_DEVICES 100
// Matrix Device
@@ -106,6 +106,14 @@ MatrixOlmSessionUnpickle( const void * key, int keyLen);
bool
+MatrixOlmSessionFrom(
+ MatrixOlmSession * session,
+ OlmAccount * olmAccount,
+ const char * deviceId,
+ const char * deviceKey,
+ const char * encrypted);
+
+bool
MatrixOlmSessionTo(
MatrixOlmSession * session,
OlmAccount * olmAccount,
@@ -130,23 +138,35 @@ MatrixOlmSessionDecrypt( // Matrix Megolm Session
typedef struct MatrixMegolmInSession {
+ char roomId[ROOM_ID_SIZE];
+ char id[MEGOLM_SESSION_ID_SIZE];
+ char key[MEGOLM_SESSION_KEY_SIZE];
+
OlmInboundGroupSession * session;
+ char memory[MEGOLM_OUTBOUND_SESSION_MEMORY_SIZE];
+
} MatrixMegolmInSession;
bool
+MatrixMegolmInSessionInit(
+ MatrixMegolmInSession * session,
+ const char * roomId,
+ const char * sessionId,
+ const char * sessionKey, int sessionKeyLen);
+
+bool
MatrixMegolmInSessionDecrypt(
- MatrixMegolmInSession * megolmInSession,
- const char * encrypted,
+ MatrixMegolmInSession * session,
+ const char * encrypted, int encryptedLen,
char * outDecrypted, int outDecryptedCap);
typedef struct MatrixMegolmOutSession {
char roomId[ROOM_ID_SIZE];
+ char id[MEGOLM_SESSION_ID_SIZE];
+ char key[MEGOLM_SESSION_KEY_SIZE];
OlmOutboundGroupSession * session;
char memory[MEGOLM_OUTBOUND_SESSION_MEMORY_SIZE];
-
- char id[MEGOLM_SESSION_ID_SIZE];
- char key[MEGOLM_SESSION_KEY_SIZE];
} MatrixMegolmOutSession;
bool
@@ -306,15 +326,25 @@ MatrixClientGetMegolmOutSession( MatrixMegolmOutSession ** outSession);
bool
-MatrixClientSetMegolmOutSession(
+MatrixClientNewMegolmOutSession(
MatrixClient * client,
const char * roomId,
- MatrixMegolmOutSession session);
+ MatrixMegolmOutSession ** outSession);
bool
-MatrixClientInitMegolmOutSession(
+MatrixClientGetMegolmInSession(
MatrixClient * client,
- const char * roomId);
+ const char * roomId, int roomIdLen,
+ const char * sessionId, int sessionIdLen,
+ MatrixMegolmInSession ** outSession);
+
+bool
+MatrixClientNewMegolmInSession(
+ MatrixClient * client,
+ const char * roomId,
+ const char * sessionId,
+ const char * sessionKey,
+ MatrixMegolmInSession ** outSession);
bool
MatrixClientRequestMegolmInSession(
@@ -323,11 +353,18 @@ MatrixClientRequestMegolmInSession( const char * sessionId,
const char * senderKey,
const char * userId,
- const char * deviceId, // TODO: remove deviceId (query all devices)
- MatrixMegolmInSession * outMegolmInSession);
+ const char * deviceId); // TODO: remove deviceId (query all devices)
bool
-MatrixClientGetOlmSession(
+MatrixClientGetOlmSessionIn(
+ MatrixClient * client,
+ const char * userId,
+ const char * deviceId,
+ const char * encrypted,
+ MatrixOlmSession ** outSession);
+
+bool
+MatrixClientGetOlmSessionOut(
MatrixClient * client,
const char * userId,
const char * deviceId,
@@ -424,6 +461,11 @@ JsonEscape( char * sOut, int sOutCap);
bool
+JsonCanonicalize(
+ const char * sIn, int sInLen,
+ char * sOut, int sOutCap);
+
+bool
JsonSign(
MatrixClient * client,
const char * sIn, int sInLen,
|
