]> gitweb.ps.run Git - matrix_esp_thesis/blob - examples/Canonical.c
update code block to include 'c' specifier
[matrix_esp_thesis] / examples / Canonical.c
1 #include <matrix.h>\r
2 #include <mjson.h>\r
3 #include <olm/sas.h>\r
4 \r
5 #include <stdio.h>\r
6 \r
7 int\r
8 main(void)\r
9 {\r
10     const char json[] =\r
11     "{"\r
12     "\"method\":\"m.sas.v1\","\r
13     "\"from_device\":\"ULZZOKJBYN\","\r
14     "\"key_agreement_protocols\":[\"curve25519-hkdf-sha256\",\"curve25519\"],"\r
15     "\"hashes\":[\"sha256\"],"\r
16     "\"message_authentication_codes\":[\"hkdf-hmac-sha256.v2\",\"org.matrix.msc3783.hkdf-hmac-sha256\",\"hkdf-hmac-sha256\",\"hmac-sha256\"],"\r
17     "\"short_authentication_string\":[\"decimal\",\"emoji\"],"\r
18     "\"transaction_id\":\"CmMReoy5AK59qd7pa6EO7ocbFwX03isB\""\r
19     "}";\r
20     \r
21     char canonical[1024];\r
22 \r
23     JsonCanonicalize(json, strlen(json), canonical, 1024);\r
24 \r
25     printf("%s\n", canonical);\r
26 \r
27     return 0;\r
28 }\r