diff options
| author | Patrick | 2023-09-13 22:04:23 +0200 |
|---|---|---|
| committer | Patrick | 2023-09-13 22:04:23 +0200 |
| commit | 80dc4ce95cbe915a3aaa7e2e18f545916d6ec769 (patch) | |
| tree | 3a9423ee2f917d6631eb96970bdb4f391cd01a35 /examples/Canonical.c | |
| parent | b231872efcb97e52856f5972efd161c6e9b03cd6 (diff) | |
| download | matrix_esp_thesis-80dc4ce95cbe915a3aaa7e2e18f545916d6ec769.tar.gz matrix_esp_thesis-80dc4ce95cbe915a3aaa7e2e18f545916d6ec769.zip | |
actually add Canonical and Verify examples :()
Diffstat (limited to 'examples/Canonical.c')
| -rw-r--r-- | examples/Canonical.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/Canonical.c b/examples/Canonical.c new file mode 100644 index 0000000..d3a1905 --- /dev/null +++ b/examples/Canonical.c @@ -0,0 +1,28 @@ +#include <matrix.h>
+#include <mjson.h>
+#include <olm/sas.h>
+
+#include <stdio.h>
+
+int
+main(void)
+{
+ const char json[] =
+ "{"
+ "\"method\":\"m.sas.v1\","
+ "\"from_device\":\"ULZZOKJBYN\","
+ "\"key_agreement_protocols\":[\"curve25519-hkdf-sha256\",\"curve25519\"],"
+ "\"hashes\":[\"sha256\"],"
+ "\"message_authentication_codes\":[\"hkdf-hmac-sha256.v2\",\"org.matrix.msc3783.hkdf-hmac-sha256\",\"hkdf-hmac-sha256\",\"hmac-sha256\"],"
+ "\"short_authentication_string\":[\"decimal\",\"emoji\"],"
+ "\"transaction_id\":\"CmMReoy5AK59qd7pa6EO7ocbFwX03isB\""
+ "}";
+
+ char canonical[1024];
+
+ JsonCanonicalize(json, strlen(json), canonical, 1024);
+
+ printf("%s\n", canonical);
+
+ return 0;
+}
|
