abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--examples/Keys.c28
2 files changed, 34 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 8197ee5..bfcb1de 100644
--- a/Makefile
+++ b/Makefile
@@ -26,4 +26,9 @@ out/examples/%: examples/%.c src/*
.PHONY: examples
-examples: out/examples/Login out/examples/Send out/examples/SendEncrypted out/examples/Sync \ No newline at end of file
+examples: out/examples/Login out/examples/Send out/examples/SendEncrypted out/examples/Sync
+
+out/olm/libolm.a:
+ cd out/olm
+ cmake -DBUILD_SHARED_LIBS=OFF -DOLM_TESTS=OFF ../../ext/olm
+ cmake --build . \ No newline at end of file
diff --git a/examples/Keys.c b/examples/Keys.c
new file mode 100644
index 0000000..77196ba
--- /dev/null
+++ b/examples/Keys.c
@@ -0,0 +1,28 @@
+#include <matrix.h>
+#include <stdio.h>
+
+#define SERVER "https://matrix.org"
+#define ACCESS_TOKEN "syt_cHNjaG8_yBvTjVTquGCikvsAenOJ_49mBMO"
+#define DEVICE_ID "MAZNCCZLBR"
+#define USER_ID "@pscho:matrix.org"
+#define ROOM_ID "!XKFUjAsGrSSrpDFIxB:matrix.org"
+
+int
+main(void)
+{
+ MatrixClient client;
+ MatrixClientInit(&client,
+ SERVER);
+
+ MatrixHttpInit(&client);
+
+ MatrixClientGenerateOnetimeKeys(&client,
+ 10);
+
+ MatrixClientUploadDeviceKeys(&client);
+ MatrixClientUploadOnetimeKeys(&client);
+
+ MatrixHttpDeinit(&client);
+
+ return 0;
+}