diff options
| author | Patrick | 2023-11-13 22:33:49 +0100 |
|---|---|---|
| committer | Patrick | 2023-11-13 22:33:49 +0100 |
| commit | a2b4308fa5bdc55cafa73aa0d70a00528f069ab7 (patch) | |
| tree | b4120bae9ce2ca06ae20ce6b2497e5eb3ae61e85 /esp32/esp_project/main/SendEncrypted.c | |
| parent | 50f9d03ea29a8ae2f82d5edb5404fdebf4316b13 (diff) | |
| download | matrix_esp_thesis-a2b4308fa5bdc55cafa73aa0d70a00528f069ab7.tar.gz matrix_esp_thesis-a2b4308fa5bdc55cafa73aa0d70a00528f069ab7.zip | |
changes to olm and esp
Diffstat (limited to 'esp32/esp_project/main/SendEncrypted.c')
| -rw-r--r-- | esp32/esp_project/main/SendEncrypted.c | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/esp32/esp_project/main/SendEncrypted.c b/esp32/esp_project/main/SendEncrypted.c index 8d813ad..11e9e0d 100644 --- a/esp32/esp_project/main/SendEncrypted.c +++ b/esp32/esp_project/main/SendEncrypted.c @@ -1,65 +1,65 @@ -#define OLMLIB_VERSION_MAJOR 3 -#define OLMLIB_VERSION_MINOR 2 -#define OLMLIB_VERSION_PATCH 15 - -#define OLM_STATIC_DEFINE - -#include <stdio.h> -#include <matrix.h> - -#define SERVER "https://matrix.org" -#define USER_ID "@pscho:matrix.org" -#define ROOM_ID "!XKFUjAsGrSSrpDFIxB:matrix.org" - -int -main(void) -{ - MatrixClient client; - MatrixClientInit(&client); - - MatrixHttpInit(&client.hc, SERVER); - - MatrixClientSetUserId(&client, USER_ID); - - MatrixClientLoginPassword(&client, - "pscho", - "Wc23EbmB9G3faMq", - "Test1"); - - MatrixClientUploadDeviceKeys(&client); - MatrixClientGenerateOnetimeKeys(&client, 10); - MatrixClientUploadOnetimeKeys(&client); - - // create megolmsession - MatrixMegolmOutSession * megolmOutSession; - MatrixClientNewMegolmOutSession(&client, - ROOM_ID, - &megolmOutSession); - printf("megolm session id: %.10s... key: %.10s...\n", megolmOutSession->id, megolmOutSession->key); - - MatrixClientShareMegolmOutSession(&client, - USER_ID, - "ULZZOKJBYN", - megolmOutSession); - - MatrixClientSendEventEncrypted(&client, - ROOM_ID, - "m.room.message", - "{\"body\":\"Hello\",\"msgtype\":\"m.text\"}"); - - MatrixClientDeleteDevice(&client); - - MatrixHttpDeinit(&client.hc); - - return 0; -} - -#include "wifi.h" - -void -app_main(void) -{ - wifi_init("Hundehuette", "Affensicherespw55"); - - main(); -} +#define OLMLIB_VERSION_MAJOR 3
+#define OLMLIB_VERSION_MINOR 2
+#define OLMLIB_VERSION_PATCH 15
+
+#define OLM_STATIC_DEFINE
+
+#include <stdio.h>
+#include <matrix.h>
+
+#define SERVER "https://matrix.org"
+#define USER_ID "@pscho:matrix.org"
+#define ROOM_ID "!XKFUjAsGrSSrpDFIxB:matrix.org"
+
+int
+main(void)
+{
+ MatrixClient client;
+ MatrixClientInit(&client);
+
+ MatrixHttpInit(&client.hc, SERVER);
+
+ MatrixClientSetUserId(&client, USER_ID);
+
+ MatrixClientLoginPassword(&client,
+ "pscho",
+ "Wc23EbmB9G3faMq",
+ "Test1");
+
+ MatrixClientUploadDeviceKeys(&client);
+ MatrixClientGenerateOnetimeKeys(&client, 10);
+ MatrixClientUploadOnetimeKeys(&client);
+
+ // create megolmsession
+ MatrixMegolmOutSession * megolmOutSession;
+ MatrixClientNewMegolmOutSession(&client,
+ ROOM_ID,
+ &megolmOutSession);
+ printf("megolm session id: %.10s... key: %.10s...\n", megolmOutSession->id, megolmOutSession->key);
+
+ MatrixClientShareMegolmOutSession(&client,
+ USER_ID,
+ "ULZZOKJBYN",
+ megolmOutSession);
+
+ MatrixClientSendEventEncrypted(&client,
+ ROOM_ID,
+ "m.room.message",
+ "{\"body\":\"Hello\",\"msgtype\":\"m.text\"}");
+
+ MatrixClientDeleteDevice(&client);
+
+ MatrixHttpDeinit(&client.hc);
+
+ return 0;
+}
+
+#include "wifi.h"
+
+void
+app_main(void)
+{
+ wifi_init("Hundehuette", "Affensicherespw55");
+
+ main();
+}
|
