diff options
| author | Patrick | 2023-11-13 21:09:43 +0100 |
|---|---|---|
| committer | Patrick | 2023-11-13 21:09:43 +0100 |
| commit | 760426d17bc296232b9fedf7e114cb699e2697ae (patch) | |
| tree | 613d79a87d4c7b4ec975463a2b8fdeb29dc53092 /examples/Decrypt.c | |
| parent | 0b5fc6b640af6f13fe56a6e77598d96db78bb56c (diff) | |
| download | matrix_esp_thesis-760426d17bc296232b9fedf7e114cb699e2697ae.tar.gz matrix_esp_thesis-760426d17bc296232b9fedf7e114cb699e2697ae.zip | |
fix examples
Diffstat (limited to 'examples/Decrypt.c')
| -rw-r--r-- | examples/Decrypt.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/examples/Decrypt.c b/examples/Decrypt.c index ec320f0..7923693 100644 --- a/examples/Decrypt.c +++ b/examples/Decrypt.c @@ -26,10 +26,9 @@ int main(void)
{
MatrixClient client;
- MatrixClientInit(&client,
- SERVER);
+ MatrixClientInit(&client);
- MatrixHttpInit(&client);
+ MatrixHttpInit(&client.hc, SERVER);
MatrixClientSetUserId(&client, USER_ID);
@@ -42,7 +41,7 @@ main(void) MatrixClientGenerateOnetimeKeys(&client, 10);
MatrixClientUploadOnetimeKeys(&client);
- MatrixClientUploadDeviceKey(&client);
+ MatrixClientUploadDeviceKeys(&client);
static char eventBuffer[1024];
MatrixClientGetRoomEvent(&client,
@@ -94,8 +93,7 @@ main(void) 128);
GetLine(keyStartJson, 1024);
printf("keyStartJson: %s\n", keyStartJson);
- int concatLen =
- snprintf(concat, 1024, "%s%s", publicKey, keyStartJson);
+ snprintf(concat, 1024, "%s%s", publicKey, keyStartJson);
printf("concat: %s\n", concat);
olm_sha256(olmUtil, concat, strlen(concat), commitment, 256);
printf("hash: %s\n", commitment);
@@ -290,15 +288,12 @@ main(void) getchar();
- MatrixMegolmInSession megolmSession;
-
MatrixClientRequestMegolmInSession(&client,
ROOM_ID,
SESSION_ID,
SENDER_KEY,
USER_ID,
- DEVICE_ID,
- &megolmSession);
+ DEVICE_ID);
// // decrypt room key
@@ -310,7 +305,7 @@ main(void) static char encrypted[2048];
static char decrypted[2048];
printf("encrypted:");
- gets(encrypted);
+ fgets(encrypted, 2048, stdin);
printf("(%d) %s;\n", strlen(encrypted), encrypted);
MatrixOlmSessionDecrypt(olmSession,
1, encrypted, decrypted, 2048);
@@ -337,7 +332,7 @@ main(void) MatrixClientDeleteDevice(&client);
- MatrixHttpDeinit(&client);
+ MatrixHttpDeinit(&client.hc);
return 0;
}
|
