X-Git-Url: https://gitweb.ps.run/matrix_esp_thesis/blobdiff_plain/fb5f3a8652d1cd3e4d8207f8718359f90636b5b3..6646bd126f9faf1e687b203512d29da243acaa90:/src/matrix.h diff --git a/src/matrix.h b/src/matrix.h index 38fb767..a06eab9 100644 --- a/src/matrix.h +++ b/src/matrix.h @@ -21,6 +21,7 @@ #define OLM_IDENTITY_KEYS_JSON_SIZE 128 #define DEVICE_KEY_SIZE 44 #define SIGNING_KEY_SIZE 44 +#define ONETIME_KEY_SIZE 44 #define KEY_SHARE_EVENT_LEN 1024 @@ -29,8 +30,9 @@ #define OLM_SESSION_MEMORY_SIZE 3352 #define OLM_ENCRYPT_RANDOM_SIZE 32 +#define OLM_OUTBOUND_SESSION_RANDOM_SIZE (32*2) -#define OLM_ONETIME_KEYS_RANDOM_SIZE 32*10 +#define OLM_ONETIME_KEYS_RANDOM_SIZE (32*10) #define OLM_KEY_ID_SIZE 32 #define OLM_SIGNATURE_SIZE 128 @@ -53,11 +55,11 @@ Randomize(uint8_t * random, int randomLen); bool JsonEscape( - char * sIn, int sInLen, + const char * sIn, int sInLen, char * sOut, int sOutCap); bool JsonSign( - char * sIn, int sInLen, + const char * sIn, int sInLen, char * sOut, int sOutCap); // Matrix Device @@ -91,9 +93,12 @@ typedef struct MatrixOlmSession { } MatrixOlmSession; bool -MatrixOlmSessionInit( +MatrixOlmSessionTo( MatrixOlmSession * session, - const char * deviceId); + OlmAccount * olmAccount, + const char * deviceId, + const char * deviceKey, + const char * deviceOnetimeKey); bool MatrixOlmSessionEncrypt( @@ -191,6 +196,13 @@ bool MatrixClientUploadDeviceKeys( MatrixClient * client); +bool +MatrixClientClaimOnetimeKey( + MatrixClient * client, + const char * userId, + const char * deviceId, + char * outOnetimeKey, int outOnetimeKeyCap); + bool MatrixClientLoginPassword( MatrixClient * client, @@ -215,11 +227,12 @@ MatrixClientSendEventEncrypted( bool MatrixClientSync( MatrixClient * client, - char * outSyncBuffer, int outSyncCap); + char * outSync, int outSyncCap); bool MatrixClientShareMegolmOutSession( MatrixClient * client, + const char * userId, const char * deviceId, MatrixMegolmOutSession * session); @@ -244,6 +257,7 @@ MatrixClientSetMegolmOutSession( bool MatrixClientGetOlmSession( MatrixClient * client, + const char * userId, const char * deviceId, MatrixOlmSession ** outSession); @@ -285,6 +299,10 @@ bool MatrixHttpInit( MatrixClient * client); +bool +MatrixHttpConnect( + MatrixClient * client); + bool MatrixHttpDeinit( MatrixClient * client);