xmtp-sys 0.1.10

Raw FFI bindings to the XMTP messaging protocol static library (libxmtp_ffi)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
/* automatically generated by rust-bindgen 0.72.1 */

#[repr(i32)]
#[non_exhaustive]
#[doc = " Conversation type."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum XmtpFfiConversationType {
    XMTP_FFI_CONVERSATION_TYPE_DM = 0,
    XMTP_FFI_CONVERSATION_TYPE_GROUP = 1,
    XMTP_FFI_CONVERSATION_TYPE_SYNC = 2,
    XMTP_FFI_CONVERSATION_TYPE_ONESHOT = 3,
}
#[repr(i32)]
#[non_exhaustive]
#[doc = " Group permissions preset."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum XmtpFfiGroupPermissionsPreset {
    XMTP_FFI_GROUP_PERMISSIONS_PRESET_ALL_MEMBERS = 0,
    XMTP_FFI_GROUP_PERMISSIONS_PRESET_ADMIN_ONLY = 1,
    XMTP_FFI_GROUP_PERMISSIONS_PRESET_CUSTOM = 2,
}
#[repr(i32)]
#[non_exhaustive]
#[doc = " Permission policy value."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum XmtpFfiPermissionPolicy {
    XMTP_FFI_PERMISSION_POLICY_ALLOW = 0,
    XMTP_FFI_PERMISSION_POLICY_DENY = 1,
    XMTP_FFI_PERMISSION_POLICY_ADMIN = 2,
    XMTP_FFI_PERMISSION_POLICY_SUPER_ADMIN = 3,
    XMTP_FFI_PERMISSION_POLICY_DOES_NOT_EXIST = 4,
    XMTP_FFI_PERMISSION_POLICY_OTHER = 5,
}
#[repr(i32)]
#[non_exhaustive]
#[doc = " Message kind."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum XmtpFfiMessageKind {
    XMTP_FFI_MESSAGE_KIND_APPLICATION = 0,
    XMTP_FFI_MESSAGE_KIND_MEMBERSHIP_CHANGE = 1,
}
#[repr(i32)]
#[non_exhaustive]
#[doc = " Message delivery status."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum XmtpFfiDeliveryStatus {
    XMTP_FFI_DELIVERY_STATUS_UNPUBLISHED = 0,
    XMTP_FFI_DELIVERY_STATUS_PUBLISHED = 1,
    XMTP_FFI_DELIVERY_STATUS_FAILED = 2,
}
#[repr(i32)]
#[non_exhaustive]
#[doc = " Consent entity type."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum XmtpFfiConsentEntityType {
    XMTP_FFI_CONSENT_ENTITY_TYPE_GROUP_ID = 0,
    XMTP_FFI_CONSENT_ENTITY_TYPE_INBOX_ID = 1,
}
#[repr(i32)]
#[non_exhaustive]
#[doc = " Consent state for an entity."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum XmtpFfiConsentState {
    XMTP_FFI_CONSENT_STATE_UNKNOWN = 0,
    XMTP_FFI_CONSENT_STATE_ALLOWED = 1,
    XMTP_FFI_CONSENT_STATE_DENIED = 2,
}
#[repr(i32)]
#[non_exhaustive]
#[doc = " Preference update kind."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum XmtpFfiPreferenceUpdateKind {
    XMTP_FFI_PREFERENCE_UPDATE_KIND_CONSENT = 0,
    XMTP_FFI_PREFERENCE_UPDATE_KIND_HMAC_KEY = 1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiAuthHandle {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiAvailableArchiveList {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiClient {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiConversation {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiConversationList {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiEnrichedMessageList {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiGroupMemberList {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiHmacKeyMap {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiInboxStateList {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiInboxUpdateCountList {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiKeyPackageStatusList {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiLastReadTimeList {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiMessage {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiMessageList {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiSignatureRequest {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct XmtpFfiStreamHandle {
    _unused: [u8; 0],
}
#[doc = " Options for creating a client. All string fields are borrowed (not freed by this library)."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiClientOptions {
    #[doc = " gRPC v3 host URL (required)."]
    pub host: *const ::core::ffi::c_char,
    #[doc = " Gateway host URL for decentralized API (nullable, enables d14n if set)."]
    pub gateway_host: *const ::core::ffi::c_char,
    #[doc = " Whether the connection is TLS-secured."]
    pub is_secure: i32,
    #[doc = " Path to the SQLite database file. Null = ephemeral."]
    pub db_path: *const ::core::ffi::c_char,
    #[doc = " 32-byte encryption key for the database. Null = unencrypted."]
    pub encryption_key: *const u8,
    #[doc = " Inbox ID (required)."]
    pub inbox_id: *const ::core::ffi::c_char,
    #[doc = " Account identifier string (required)."]
    pub account_identifier: *const ::core::ffi::c_char,
    #[doc = " Identifier kind: 0 = Ethereum, 1 = Passkey."]
    pub identifier_kind: i32,
    #[doc = " Nonce for identity strategy (default 1 if 0)."]
    pub nonce: u64,
    #[doc = " Optional auth handle for gateway authentication. Null = no auth."]
    pub auth_handle: *const XmtpFfiAuthHandle,
    #[doc = " Application version string (nullable)."]
    pub app_version: *const ::core::ffi::c_char,
    #[doc = " Device sync worker mode: 0 = Enabled (default), 1 = Disabled."]
    pub device_sync_worker_mode: i32,
    #[doc = " Allow offline mode. 0 = no (default), 1 = yes."]
    pub allow_offline: i32,
    #[doc = " Client mode: 0 = Default, 1 = Notification (read-only)."]
    pub client_mode: i32,
    #[doc = " Maximum database connection pool size. 0 = use default."]
    pub max_db_pool_size: u32,
    #[doc = " Minimum database connection pool size. 0 = use default."]
    pub min_db_pool_size: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiClientOptions"][::core::mem::size_of::<XmtpFfiClientOptions>() - 112usize];
    ["Alignment of XmtpFfiClientOptions"][::core::mem::align_of::<XmtpFfiClientOptions>() - 8usize];
    ["Offset of field: XmtpFfiClientOptions::host"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, host) - 0usize];
    ["Offset of field: XmtpFfiClientOptions::gateway_host"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, gateway_host) - 8usize];
    ["Offset of field: XmtpFfiClientOptions::is_secure"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, is_secure) - 16usize];
    ["Offset of field: XmtpFfiClientOptions::db_path"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, db_path) - 24usize];
    ["Offset of field: XmtpFfiClientOptions::encryption_key"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, encryption_key) - 32usize];
    ["Offset of field: XmtpFfiClientOptions::inbox_id"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, inbox_id) - 40usize];
    ["Offset of field: XmtpFfiClientOptions::account_identifier"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, account_identifier) - 48usize];
    ["Offset of field: XmtpFfiClientOptions::identifier_kind"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, identifier_kind) - 56usize];
    ["Offset of field: XmtpFfiClientOptions::nonce"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, nonce) - 64usize];
    ["Offset of field: XmtpFfiClientOptions::auth_handle"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, auth_handle) - 72usize];
    ["Offset of field: XmtpFfiClientOptions::app_version"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, app_version) - 80usize];
    ["Offset of field: XmtpFfiClientOptions::device_sync_worker_mode"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, device_sync_worker_mode) - 88usize];
    ["Offset of field: XmtpFfiClientOptions::allow_offline"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, allow_offline) - 92usize];
    ["Offset of field: XmtpFfiClientOptions::client_mode"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, client_mode) - 96usize];
    ["Offset of field: XmtpFfiClientOptions::max_db_pool_size"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, max_db_pool_size) - 100usize];
    ["Offset of field: XmtpFfiClientOptions::min_db_pool_size"]
        [::core::mem::offset_of!(XmtpFfiClientOptions, min_db_pool_size) - 104usize];
};
impl Default for XmtpFfiClientOptions {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " MLS API call statistics (request counts)."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiApiStats {
    pub upload_key_package: i64,
    pub fetch_key_package: i64,
    pub send_group_messages: i64,
    pub send_welcome_messages: i64,
    pub query_group_messages: i64,
    pub query_welcome_messages: i64,
    pub subscribe_messages: i64,
    pub subscribe_welcomes: i64,
    pub publish_commit_log: i64,
    pub query_commit_log: i64,
    pub get_newest_group_message: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiApiStats"][::core::mem::size_of::<XmtpFfiApiStats>() - 88usize];
    ["Alignment of XmtpFfiApiStats"][::core::mem::align_of::<XmtpFfiApiStats>() - 8usize];
    ["Offset of field: XmtpFfiApiStats::upload_key_package"]
        [::core::mem::offset_of!(XmtpFfiApiStats, upload_key_package) - 0usize];
    ["Offset of field: XmtpFfiApiStats::fetch_key_package"]
        [::core::mem::offset_of!(XmtpFfiApiStats, fetch_key_package) - 8usize];
    ["Offset of field: XmtpFfiApiStats::send_group_messages"]
        [::core::mem::offset_of!(XmtpFfiApiStats, send_group_messages) - 16usize];
    ["Offset of field: XmtpFfiApiStats::send_welcome_messages"]
        [::core::mem::offset_of!(XmtpFfiApiStats, send_welcome_messages) - 24usize];
    ["Offset of field: XmtpFfiApiStats::query_group_messages"]
        [::core::mem::offset_of!(XmtpFfiApiStats, query_group_messages) - 32usize];
    ["Offset of field: XmtpFfiApiStats::query_welcome_messages"]
        [::core::mem::offset_of!(XmtpFfiApiStats, query_welcome_messages) - 40usize];
    ["Offset of field: XmtpFfiApiStats::subscribe_messages"]
        [::core::mem::offset_of!(XmtpFfiApiStats, subscribe_messages) - 48usize];
    ["Offset of field: XmtpFfiApiStats::subscribe_welcomes"]
        [::core::mem::offset_of!(XmtpFfiApiStats, subscribe_welcomes) - 56usize];
    ["Offset of field: XmtpFfiApiStats::publish_commit_log"]
        [::core::mem::offset_of!(XmtpFfiApiStats, publish_commit_log) - 64usize];
    ["Offset of field: XmtpFfiApiStats::query_commit_log"]
        [::core::mem::offset_of!(XmtpFfiApiStats, query_commit_log) - 72usize];
    ["Offset of field: XmtpFfiApiStats::get_newest_group_message"]
        [::core::mem::offset_of!(XmtpFfiApiStats, get_newest_group_message) - 80usize];
};
#[doc = " Identity API call statistics (request counts)."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiIdentityStats {
    pub publish_identity_update: i64,
    pub get_identity_updates_v2: i64,
    pub get_inbox_ids: i64,
    pub verify_smart_contract_wallet_signature: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiIdentityStats"][::core::mem::size_of::<XmtpFfiIdentityStats>() - 32usize];
    ["Alignment of XmtpFfiIdentityStats"][::core::mem::align_of::<XmtpFfiIdentityStats>() - 8usize];
    ["Offset of field: XmtpFfiIdentityStats::publish_identity_update"]
        [::core::mem::offset_of!(XmtpFfiIdentityStats, publish_identity_update) - 0usize];
    ["Offset of field: XmtpFfiIdentityStats::get_identity_updates_v2"]
        [::core::mem::offset_of!(XmtpFfiIdentityStats, get_identity_updates_v2) - 8usize];
    ["Offset of field: XmtpFfiIdentityStats::get_inbox_ids"]
        [::core::mem::offset_of!(XmtpFfiIdentityStats, get_inbox_ids) - 16usize];
    ["Offset of field: XmtpFfiIdentityStats::verify_smart_contract_wallet_signature"][::core::mem::offset_of!(
        XmtpFfiIdentityStats,
        verify_smart_contract_wallet_signature
    ) - 24usize];
};
#[doc = " Inbox update count entry (inbox_id → count)."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiInboxUpdateCount {
    pub inbox_id: *mut ::core::ffi::c_char,
    pub count: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiInboxUpdateCount"]
        [::core::mem::size_of::<XmtpFfiInboxUpdateCount>() - 16usize];
    ["Alignment of XmtpFfiInboxUpdateCount"]
        [::core::mem::align_of::<XmtpFfiInboxUpdateCount>() - 8usize];
    ["Offset of field: XmtpFfiInboxUpdateCount::inbox_id"]
        [::core::mem::offset_of!(XmtpFfiInboxUpdateCount, inbox_id) - 0usize];
    ["Offset of field: XmtpFfiInboxUpdateCount::count"]
        [::core::mem::offset_of!(XmtpFfiInboxUpdateCount, count) - 8usize];
};
impl Default for XmtpFfiInboxUpdateCount {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Key package status for an installation."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiKeyPackageStatus {
    #[doc = " Installation ID as hex string (owned)."]
    pub installation_id: *mut ::core::ffi::c_char,
    #[doc = " 1 if valid, 0 if validation error."]
    pub valid: i32,
    #[doc = " not_before timestamp (0 if unavailable)."]
    pub not_before: u64,
    #[doc = " not_after timestamp (0 if unavailable)."]
    pub not_after: u64,
    #[doc = " Validation error message (null if no error, owned)."]
    pub validation_error: *mut ::core::ffi::c_char,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiKeyPackageStatus"]
        [::core::mem::size_of::<XmtpFfiKeyPackageStatus>() - 40usize];
    ["Alignment of XmtpFfiKeyPackageStatus"]
        [::core::mem::align_of::<XmtpFfiKeyPackageStatus>() - 8usize];
    ["Offset of field: XmtpFfiKeyPackageStatus::installation_id"]
        [::core::mem::offset_of!(XmtpFfiKeyPackageStatus, installation_id) - 0usize];
    ["Offset of field: XmtpFfiKeyPackageStatus::valid"]
        [::core::mem::offset_of!(XmtpFfiKeyPackageStatus, valid) - 8usize];
    ["Offset of field: XmtpFfiKeyPackageStatus::not_before"]
        [::core::mem::offset_of!(XmtpFfiKeyPackageStatus, not_before) - 16usize];
    ["Offset of field: XmtpFfiKeyPackageStatus::not_after"]
        [::core::mem::offset_of!(XmtpFfiKeyPackageStatus, not_after) - 24usize];
    ["Offset of field: XmtpFfiKeyPackageStatus::validation_error"]
        [::core::mem::offset_of!(XmtpFfiKeyPackageStatus, validation_error) - 32usize];
};
impl Default for XmtpFfiKeyPackageStatus {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Options for sending a message."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiSendOpts {
    #[doc = " Whether to send a push notification. 1 = yes (default), 0 = no."]
    pub should_push: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiSendOpts"][::core::mem::size_of::<XmtpFfiSendOpts>() - 4usize];
    ["Alignment of XmtpFfiSendOpts"][::core::mem::align_of::<XmtpFfiSendOpts>() - 4usize];
    ["Offset of field: XmtpFfiSendOpts::should_push"]
        [::core::mem::offset_of!(XmtpFfiSendOpts, should_push) - 0usize];
};
#[doc = " Options for listing messages."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiListMessagesOptions {
    #[doc = " Only messages sent after this timestamp (ns). 0 = no filter."]
    pub sent_after_ns: i64,
    #[doc = " Only messages sent before this timestamp (ns). 0 = no filter."]
    pub sent_before_ns: i64,
    #[doc = " Only messages inserted after this timestamp (ns). 0 = no filter."]
    pub inserted_after_ns: i64,
    #[doc = " Only messages inserted before this timestamp (ns). 0 = no filter."]
    pub inserted_before_ns: i64,
    #[doc = " Maximum number of messages. 0 = no limit."]
    pub limit: i64,
    #[doc = " Filter by delivery status: -1 = all, 0 = Unpublished, 1 = Published, 2 = Failed."]
    pub delivery_status: i32,
    #[doc = " Filter by message kind: -1 = all, 0 = Application, 1 = MembershipChange."]
    pub kind: i32,
    #[doc = " Sort direction: 0 = Ascending (default), 1 = Descending."]
    pub direction: i32,
    #[doc = " Sort by: 0 = SentAt (default), 1 = InsertedAt."]
    pub sort_by: i32,
    #[doc = " Include only these content types (nullable). Each element is a ContentType i32 value."]
    pub content_types: *const i32,
    #[doc = " Number of elements in `content_types`. 0 = no filter."]
    pub content_types_count: i32,
    #[doc = " Exclude these content types (nullable). Each element is a ContentType i32 value."]
    pub exclude_content_types: *const i32,
    #[doc = " Number of elements in `exclude_content_types`. 0 = no filter."]
    pub exclude_content_types_count: i32,
    #[doc = " Exclude messages from these sender inbox IDs (nullable C string array)."]
    pub exclude_sender_inbox_ids: *const *const ::core::ffi::c_char,
    #[doc = " Number of elements in `exclude_sender_inbox_ids`. 0 = no filter."]
    pub exclude_sender_inbox_ids_count: i32,
    #[doc = " Whether to exclude disappearing messages. 0 = include (default), 1 = exclude."]
    pub exclude_disappearing: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiListMessagesOptions"]
        [::core::mem::size_of::<XmtpFfiListMessagesOptions>() - 104usize];
    ["Alignment of XmtpFfiListMessagesOptions"]
        [::core::mem::align_of::<XmtpFfiListMessagesOptions>() - 8usize];
    ["Offset of field: XmtpFfiListMessagesOptions::sent_after_ns"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, sent_after_ns) - 0usize];
    ["Offset of field: XmtpFfiListMessagesOptions::sent_before_ns"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, sent_before_ns) - 8usize];
    ["Offset of field: XmtpFfiListMessagesOptions::inserted_after_ns"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, inserted_after_ns) - 16usize];
    ["Offset of field: XmtpFfiListMessagesOptions::inserted_before_ns"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, inserted_before_ns) - 24usize];
    ["Offset of field: XmtpFfiListMessagesOptions::limit"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, limit) - 32usize];
    ["Offset of field: XmtpFfiListMessagesOptions::delivery_status"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, delivery_status) - 40usize];
    ["Offset of field: XmtpFfiListMessagesOptions::kind"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, kind) - 44usize];
    ["Offset of field: XmtpFfiListMessagesOptions::direction"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, direction) - 48usize];
    ["Offset of field: XmtpFfiListMessagesOptions::sort_by"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, sort_by) - 52usize];
    ["Offset of field: XmtpFfiListMessagesOptions::content_types"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, content_types) - 56usize];
    ["Offset of field: XmtpFfiListMessagesOptions::content_types_count"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, content_types_count) - 64usize];
    ["Offset of field: XmtpFfiListMessagesOptions::exclude_content_types"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, exclude_content_types) - 72usize];
    ["Offset of field: XmtpFfiListMessagesOptions::exclude_content_types_count"][::core::mem::offset_of!(
        XmtpFfiListMessagesOptions,
        exclude_content_types_count
    ) - 80usize];
    ["Offset of field: XmtpFfiListMessagesOptions::exclude_sender_inbox_ids"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, exclude_sender_inbox_ids) - 88usize];
    ["Offset of field: XmtpFfiListMessagesOptions::exclude_sender_inbox_ids_count"][::core::mem::offset_of!(
        XmtpFfiListMessagesOptions,
        exclude_sender_inbox_ids_count
    ) - 96usize];
    ["Offset of field: XmtpFfiListMessagesOptions::exclude_disappearing"]
        [::core::mem::offset_of!(XmtpFfiListMessagesOptions, exclude_disappearing) - 100usize];
};
impl Default for XmtpFfiListMessagesOptions {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Options for message disappearing settings."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiDisappearingSettings {
    #[doc = " Timestamp (ns) from which messages start disappearing."]
    pub from_ns: i64,
    #[doc = " Duration (ns) after which messages disappear."]
    pub in_ns: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiDisappearingSettings"]
        [::core::mem::size_of::<XmtpFfiDisappearingSettings>() - 16usize];
    ["Alignment of XmtpFfiDisappearingSettings"]
        [::core::mem::align_of::<XmtpFfiDisappearingSettings>() - 8usize];
    ["Offset of field: XmtpFfiDisappearingSettings::from_ns"]
        [::core::mem::offset_of!(XmtpFfiDisappearingSettings, from_ns) - 0usize];
    ["Offset of field: XmtpFfiDisappearingSettings::in_ns"]
        [::core::mem::offset_of!(XmtpFfiDisappearingSettings, in_ns) - 8usize];
};
#[doc = " A single cursor entry (originator + sequence)."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiCursor {
    pub originator_id: u32,
    pub sequence_id: u64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiCursor"][::core::mem::size_of::<XmtpFfiCursor>() - 16usize];
    ["Alignment of XmtpFfiCursor"][::core::mem::align_of::<XmtpFfiCursor>() - 8usize];
    ["Offset of field: XmtpFfiCursor::originator_id"]
        [::core::mem::offset_of!(XmtpFfiCursor, originator_id) - 0usize];
    ["Offset of field: XmtpFfiCursor::sequence_id"]
        [::core::mem::offset_of!(XmtpFfiCursor, sequence_id) - 8usize];
};
#[doc = " Conversation debug info (epoch, fork status, commit logs, cursors)."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiConversationDebugInfo {
    pub epoch: u64,
    pub maybe_forked: i32,
    pub fork_details: *mut ::core::ffi::c_char,
    #[doc = " -1 = unknown, 0 = no, 1 = yes"]
    pub is_commit_log_forked: i32,
    pub local_commit_log: *mut ::core::ffi::c_char,
    pub remote_commit_log: *mut ::core::ffi::c_char,
    #[doc = " Heap-allocated cursor array. Free with the debug_info_free function."]
    pub cursors: *mut XmtpFfiCursor,
    pub cursors_count: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiConversationDebugInfo"]
        [::core::mem::size_of::<XmtpFfiConversationDebugInfo>() - 64usize];
    ["Alignment of XmtpFfiConversationDebugInfo"]
        [::core::mem::align_of::<XmtpFfiConversationDebugInfo>() - 8usize];
    ["Offset of field: XmtpFfiConversationDebugInfo::epoch"]
        [::core::mem::offset_of!(XmtpFfiConversationDebugInfo, epoch) - 0usize];
    ["Offset of field: XmtpFfiConversationDebugInfo::maybe_forked"]
        [::core::mem::offset_of!(XmtpFfiConversationDebugInfo, maybe_forked) - 8usize];
    ["Offset of field: XmtpFfiConversationDebugInfo::fork_details"]
        [::core::mem::offset_of!(XmtpFfiConversationDebugInfo, fork_details) - 16usize];
    ["Offset of field: XmtpFfiConversationDebugInfo::is_commit_log_forked"]
        [::core::mem::offset_of!(XmtpFfiConversationDebugInfo, is_commit_log_forked) - 24usize];
    ["Offset of field: XmtpFfiConversationDebugInfo::local_commit_log"]
        [::core::mem::offset_of!(XmtpFfiConversationDebugInfo, local_commit_log) - 32usize];
    ["Offset of field: XmtpFfiConversationDebugInfo::remote_commit_log"]
        [::core::mem::offset_of!(XmtpFfiConversationDebugInfo, remote_commit_log) - 40usize];
    ["Offset of field: XmtpFfiConversationDebugInfo::cursors"]
        [::core::mem::offset_of!(XmtpFfiConversationDebugInfo, cursors) - 48usize];
    ["Offset of field: XmtpFfiConversationDebugInfo::cursors_count"]
        [::core::mem::offset_of!(XmtpFfiConversationDebugInfo, cursors_count) - 56usize];
};
impl Default for XmtpFfiConversationDebugInfo {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " A single HMAC key (42-byte key + epoch)."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiHmacKey {
    pub key: *mut u8,
    pub key_len: i32,
    pub epoch: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiHmacKey"][::core::mem::size_of::<XmtpFfiHmacKey>() - 24usize];
    ["Alignment of XmtpFfiHmacKey"][::core::mem::align_of::<XmtpFfiHmacKey>() - 8usize];
    ["Offset of field: XmtpFfiHmacKey::key"][::core::mem::offset_of!(XmtpFfiHmacKey, key) - 0usize];
    ["Offset of field: XmtpFfiHmacKey::key_len"]
        [::core::mem::offset_of!(XmtpFfiHmacKey, key_len) - 8usize];
    ["Offset of field: XmtpFfiHmacKey::epoch"]
        [::core::mem::offset_of!(XmtpFfiHmacKey, epoch) - 16usize];
};
impl Default for XmtpFfiHmacKey {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Group metadata (creator + conversation type)."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiGroupMetadata {
    #[doc = " Creator inbox ID (owned string)."]
    pub creator_inbox_id: *mut ::core::ffi::c_char,
    pub conversation_type: XmtpFfiConversationType,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiGroupMetadata"][::core::mem::size_of::<XmtpFfiGroupMetadata>() - 16usize];
    ["Alignment of XmtpFfiGroupMetadata"][::core::mem::align_of::<XmtpFfiGroupMetadata>() - 8usize];
    ["Offset of field: XmtpFfiGroupMetadata::creator_inbox_id"]
        [::core::mem::offset_of!(XmtpFfiGroupMetadata, creator_inbox_id) - 0usize];
    ["Offset of field: XmtpFfiGroupMetadata::conversation_type"]
        [::core::mem::offset_of!(XmtpFfiGroupMetadata, conversation_type) - 8usize];
};
impl Default for XmtpFfiGroupMetadata {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Permission policy set for a conversation."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiPermissionPolicySet {
    pub add_member_policy: XmtpFfiPermissionPolicy,
    pub remove_member_policy: XmtpFfiPermissionPolicy,
    pub add_admin_policy: XmtpFfiPermissionPolicy,
    pub remove_admin_policy: XmtpFfiPermissionPolicy,
    pub update_group_name_policy: XmtpFfiPermissionPolicy,
    pub update_group_description_policy: XmtpFfiPermissionPolicy,
    pub update_group_image_url_square_policy: XmtpFfiPermissionPolicy,
    pub update_message_disappearing_policy: XmtpFfiPermissionPolicy,
    pub update_app_data_policy: XmtpFfiPermissionPolicy,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiPermissionPolicySet"]
        [::core::mem::size_of::<XmtpFfiPermissionPolicySet>() - 36usize];
    ["Alignment of XmtpFfiPermissionPolicySet"]
        [::core::mem::align_of::<XmtpFfiPermissionPolicySet>() - 4usize];
    ["Offset of field: XmtpFfiPermissionPolicySet::add_member_policy"]
        [::core::mem::offset_of!(XmtpFfiPermissionPolicySet, add_member_policy) - 0usize];
    ["Offset of field: XmtpFfiPermissionPolicySet::remove_member_policy"]
        [::core::mem::offset_of!(XmtpFfiPermissionPolicySet, remove_member_policy) - 4usize];
    ["Offset of field: XmtpFfiPermissionPolicySet::add_admin_policy"]
        [::core::mem::offset_of!(XmtpFfiPermissionPolicySet, add_admin_policy) - 8usize];
    ["Offset of field: XmtpFfiPermissionPolicySet::remove_admin_policy"]
        [::core::mem::offset_of!(XmtpFfiPermissionPolicySet, remove_admin_policy) - 12usize];
    ["Offset of field: XmtpFfiPermissionPolicySet::update_group_name_policy"]
        [::core::mem::offset_of!(XmtpFfiPermissionPolicySet, update_group_name_policy) - 16usize];
    ["Offset of field: XmtpFfiPermissionPolicySet::update_group_description_policy"][::core::mem::offset_of!(
        XmtpFfiPermissionPolicySet,
        update_group_description_policy
    ) - 20usize];
    ["Offset of field: XmtpFfiPermissionPolicySet::update_group_image_url_square_policy"][::core::mem::offset_of!(
        XmtpFfiPermissionPolicySet,
        update_group_image_url_square_policy
    )
        - 24usize];
    ["Offset of field: XmtpFfiPermissionPolicySet::update_message_disappearing_policy"][::core::mem::offset_of!(
        XmtpFfiPermissionPolicySet,
        update_message_disappearing_policy
    )
        - 28usize];
    ["Offset of field: XmtpFfiPermissionPolicySet::update_app_data_policy"]
        [::core::mem::offset_of!(XmtpFfiPermissionPolicySet, update_app_data_policy) - 32usize];
};
impl Default for XmtpFfiPermissionPolicySet {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Group permissions (policy type + policy set)."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiGroupPermissions {
    pub policy_type: XmtpFfiGroupPermissionsPreset,
    pub policy_set: XmtpFfiPermissionPolicySet,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiGroupPermissions"]
        [::core::mem::size_of::<XmtpFfiGroupPermissions>() - 40usize];
    ["Alignment of XmtpFfiGroupPermissions"]
        [::core::mem::align_of::<XmtpFfiGroupPermissions>() - 4usize];
    ["Offset of field: XmtpFfiGroupPermissions::policy_type"]
        [::core::mem::offset_of!(XmtpFfiGroupPermissions, policy_type) - 0usize];
    ["Offset of field: XmtpFfiGroupPermissions::policy_set"]
        [::core::mem::offset_of!(XmtpFfiGroupPermissions, policy_set) - 4usize];
};
impl Default for XmtpFfiGroupPermissions {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " An enriched (decoded) message exposed to C.\n Contains metadata + the original encoded content bytes for upper-layer decoding."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiEnrichedMessage {
    #[doc = " Message ID (hex string, owned)."]
    pub id: *mut ::core::ffi::c_char,
    #[doc = " Group ID (hex string, owned)."]
    pub group_id: *mut ::core::ffi::c_char,
    #[doc = " Sender inbox ID (owned string)."]
    pub sender_inbox_id: *mut ::core::ffi::c_char,
    #[doc = " Sender installation ID (hex string, owned)."]
    pub sender_installation_id: *mut ::core::ffi::c_char,
    #[doc = " Sent timestamp in nanoseconds."]
    pub sent_at_ns: i64,
    #[doc = " Inserted-into-DB timestamp in nanoseconds."]
    pub inserted_at_ns: i64,
    pub kind: XmtpFfiMessageKind,
    pub delivery_status: XmtpFfiDeliveryStatus,
    #[doc = " Content type ID string (e.g. \"xmtp.org/text:1.0\", owned)."]
    pub content_type: *mut ::core::ffi::c_char,
    #[doc = " Fallback text (nullable, owned)."]
    pub fallback_text: *mut ::core::ffi::c_char,
    #[doc = " Expiration timestamp in nanoseconds (0 = no expiration)."]
    pub expires_at_ns: i64,
    #[doc = " Number of reactions."]
    pub num_reactions: i32,
    #[doc = " Number of replies."]
    pub num_replies: i32,
    #[doc = " Raw decrypted content bytes (protobuf-encoded EncodedContent, owned)."]
    pub content_bytes: *mut u8,
    #[doc = " Length of `content_bytes`. 0 if unavailable."]
    pub content_bytes_len: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiEnrichedMessage"][::core::mem::size_of::<XmtpFfiEnrichedMessage>() - 104usize];
    ["Alignment of XmtpFfiEnrichedMessage"]
        [::core::mem::align_of::<XmtpFfiEnrichedMessage>() - 8usize];
    ["Offset of field: XmtpFfiEnrichedMessage::id"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, id) - 0usize];
    ["Offset of field: XmtpFfiEnrichedMessage::group_id"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, group_id) - 8usize];
    ["Offset of field: XmtpFfiEnrichedMessage::sender_inbox_id"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, sender_inbox_id) - 16usize];
    ["Offset of field: XmtpFfiEnrichedMessage::sender_installation_id"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, sender_installation_id) - 24usize];
    ["Offset of field: XmtpFfiEnrichedMessage::sent_at_ns"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, sent_at_ns) - 32usize];
    ["Offset of field: XmtpFfiEnrichedMessage::inserted_at_ns"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, inserted_at_ns) - 40usize];
    ["Offset of field: XmtpFfiEnrichedMessage::kind"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, kind) - 48usize];
    ["Offset of field: XmtpFfiEnrichedMessage::delivery_status"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, delivery_status) - 52usize];
    ["Offset of field: XmtpFfiEnrichedMessage::content_type"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, content_type) - 56usize];
    ["Offset of field: XmtpFfiEnrichedMessage::fallback_text"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, fallback_text) - 64usize];
    ["Offset of field: XmtpFfiEnrichedMessage::expires_at_ns"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, expires_at_ns) - 72usize];
    ["Offset of field: XmtpFfiEnrichedMessage::num_reactions"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, num_reactions) - 80usize];
    ["Offset of field: XmtpFfiEnrichedMessage::num_replies"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, num_replies) - 84usize];
    ["Offset of field: XmtpFfiEnrichedMessage::content_bytes"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, content_bytes) - 88usize];
    ["Offset of field: XmtpFfiEnrichedMessage::content_bytes_len"]
        [::core::mem::offset_of!(XmtpFfiEnrichedMessage, content_bytes_len) - 96usize];
};
impl Default for XmtpFfiEnrichedMessage {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Last-read-time entry (inbox_id → timestamp_ns)."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiLastReadTimeEntry {
    pub inbox_id: *mut ::core::ffi::c_char,
    pub timestamp_ns: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiLastReadTimeEntry"]
        [::core::mem::size_of::<XmtpFfiLastReadTimeEntry>() - 16usize];
    ["Alignment of XmtpFfiLastReadTimeEntry"]
        [::core::mem::align_of::<XmtpFfiLastReadTimeEntry>() - 8usize];
    ["Offset of field: XmtpFfiLastReadTimeEntry::inbox_id"]
        [::core::mem::offset_of!(XmtpFfiLastReadTimeEntry, inbox_id) - 0usize];
    ["Offset of field: XmtpFfiLastReadTimeEntry::timestamp_ns"]
        [::core::mem::offset_of!(XmtpFfiLastReadTimeEntry, timestamp_ns) - 8usize];
};
impl Default for XmtpFfiLastReadTimeEntry {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Options for creating a new group conversation."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiCreateGroupOptions {
    #[doc = " Permission preset: 0 = AllMembers (default), 1 = AdminOnly."]
    pub permissions: i32,
    #[doc = " Group name (nullable)."]
    pub name: *const ::core::ffi::c_char,
    #[doc = " Group description (nullable)."]
    pub description: *const ::core::ffi::c_char,
    #[doc = " Group image URL (nullable)."]
    pub image_url: *const ::core::ffi::c_char,
    #[doc = " Custom app data string (nullable)."]
    pub app_data: *const ::core::ffi::c_char,
    #[doc = " Message disappearing \"from\" timestamp in ns. 0 = not set."]
    pub message_disappear_from_ns: i64,
    #[doc = " Message disappearing \"in\" duration in ns. 0 = not set."]
    pub message_disappear_in_ns: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiCreateGroupOptions"]
        [::core::mem::size_of::<XmtpFfiCreateGroupOptions>() - 56usize];
    ["Alignment of XmtpFfiCreateGroupOptions"]
        [::core::mem::align_of::<XmtpFfiCreateGroupOptions>() - 8usize];
    ["Offset of field: XmtpFfiCreateGroupOptions::permissions"]
        [::core::mem::offset_of!(XmtpFfiCreateGroupOptions, permissions) - 0usize];
    ["Offset of field: XmtpFfiCreateGroupOptions::name"]
        [::core::mem::offset_of!(XmtpFfiCreateGroupOptions, name) - 8usize];
    ["Offset of field: XmtpFfiCreateGroupOptions::description"]
        [::core::mem::offset_of!(XmtpFfiCreateGroupOptions, description) - 16usize];
    ["Offset of field: XmtpFfiCreateGroupOptions::image_url"]
        [::core::mem::offset_of!(XmtpFfiCreateGroupOptions, image_url) - 24usize];
    ["Offset of field: XmtpFfiCreateGroupOptions::app_data"]
        [::core::mem::offset_of!(XmtpFfiCreateGroupOptions, app_data) - 32usize];
    ["Offset of field: XmtpFfiCreateGroupOptions::message_disappear_from_ns"]
        [::core::mem::offset_of!(XmtpFfiCreateGroupOptions, message_disappear_from_ns) - 40usize];
    ["Offset of field: XmtpFfiCreateGroupOptions::message_disappear_in_ns"]
        [::core::mem::offset_of!(XmtpFfiCreateGroupOptions, message_disappear_in_ns) - 48usize];
};
impl Default for XmtpFfiCreateGroupOptions {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Options for listing conversations."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiListConversationsOptions {
    #[doc = " Conversation type filter: -1 = all, 0 = DM, 1 = Group."]
    pub conversation_type: i32,
    #[doc = " Maximum number of conversations to return. 0 = no limit."]
    pub limit: i64,
    #[doc = " Only include conversations created after this timestamp (ns). 0 = no filter."]
    pub created_after_ns: i64,
    #[doc = " Only include conversations created before this timestamp (ns). 0 = no filter."]
    pub created_before_ns: i64,
    #[doc = " Only include conversations with last activity after this timestamp (ns). 0 = no filter."]
    pub last_activity_after_ns: i64,
    #[doc = " Only include conversations with last activity before this timestamp (ns). 0 = no filter."]
    pub last_activity_before_ns: i64,
    #[doc = " Consent state filter (parallel array with `consent_states_count`).\n Values: 0 = Unknown, 1 = Allowed, 2 = Denied."]
    pub consent_states: *const i32,
    #[doc = " Number of consent states in the filter. 0 = no filter."]
    pub consent_states_count: i32,
    #[doc = " Order by: 0 = CreatedAt (default), 1 = LastActivity."]
    pub order_by: i32,
    #[doc = " Whether to include duplicate DMs. 0 = no (default), 1 = yes."]
    pub include_duplicate_dms: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiListConversationsOptions"]
        [::core::mem::size_of::<XmtpFfiListConversationsOptions>() - 72usize];
    ["Alignment of XmtpFfiListConversationsOptions"]
        [::core::mem::align_of::<XmtpFfiListConversationsOptions>() - 8usize];
    ["Offset of field: XmtpFfiListConversationsOptions::conversation_type"]
        [::core::mem::offset_of!(XmtpFfiListConversationsOptions, conversation_type) - 0usize];
    ["Offset of field: XmtpFfiListConversationsOptions::limit"]
        [::core::mem::offset_of!(XmtpFfiListConversationsOptions, limit) - 8usize];
    ["Offset of field: XmtpFfiListConversationsOptions::created_after_ns"]
        [::core::mem::offset_of!(XmtpFfiListConversationsOptions, created_after_ns) - 16usize];
    ["Offset of field: XmtpFfiListConversationsOptions::created_before_ns"]
        [::core::mem::offset_of!(XmtpFfiListConversationsOptions, created_before_ns) - 24usize];
    ["Offset of field: XmtpFfiListConversationsOptions::last_activity_after_ns"][::core::mem::offset_of!(
        XmtpFfiListConversationsOptions,
        last_activity_after_ns
    ) - 32usize];
    ["Offset of field: XmtpFfiListConversationsOptions::last_activity_before_ns"][::core::mem::offset_of!(
        XmtpFfiListConversationsOptions,
        last_activity_before_ns
    ) - 40usize];
    ["Offset of field: XmtpFfiListConversationsOptions::consent_states"]
        [::core::mem::offset_of!(XmtpFfiListConversationsOptions, consent_states) - 48usize];
    ["Offset of field: XmtpFfiListConversationsOptions::consent_states_count"]
        [::core::mem::offset_of!(XmtpFfiListConversationsOptions, consent_states_count) - 56usize];
    ["Offset of field: XmtpFfiListConversationsOptions::order_by"]
        [::core::mem::offset_of!(XmtpFfiListConversationsOptions, order_by) - 60usize];
    ["Offset of field: XmtpFfiListConversationsOptions::include_duplicate_dms"]
        [::core::mem::offset_of!(XmtpFfiListConversationsOptions, include_duplicate_dms) - 64usize];
};
impl Default for XmtpFfiListConversationsOptions {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Options for device sync archive operations."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiArchiveOptions {
    #[doc = " Bitmask of element selections: bit 0 = Messages, bit 1 = Consent."]
    pub elements: i32,
    #[doc = " Start timestamp filter (ns). 0 = no filter."]
    pub start_ns: i64,
    #[doc = " End timestamp filter (ns). 0 = no filter."]
    pub end_ns: i64,
    #[doc = " Whether to exclude disappearing messages. 0 = include, 1 = exclude."]
    pub exclude_disappearing_messages: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiArchiveOptions"][::core::mem::size_of::<XmtpFfiArchiveOptions>() - 32usize];
    ["Alignment of XmtpFfiArchiveOptions"]
        [::core::mem::align_of::<XmtpFfiArchiveOptions>() - 8usize];
    ["Offset of field: XmtpFfiArchiveOptions::elements"]
        [::core::mem::offset_of!(XmtpFfiArchiveOptions, elements) - 0usize];
    ["Offset of field: XmtpFfiArchiveOptions::start_ns"]
        [::core::mem::offset_of!(XmtpFfiArchiveOptions, start_ns) - 8usize];
    ["Offset of field: XmtpFfiArchiveOptions::end_ns"]
        [::core::mem::offset_of!(XmtpFfiArchiveOptions, end_ns) - 16usize];
    ["Offset of field: XmtpFfiArchiveOptions::exclude_disappearing_messages"]
        [::core::mem::offset_of!(XmtpFfiArchiveOptions, exclude_disappearing_messages) - 24usize];
};
#[doc = " Callback for conversation stream events."]
pub type XmtpFnConversationCallback = ::core::option::Option<
    unsafe extern "C" fn(conversation: *mut XmtpFfiConversation, context: *mut ::core::ffi::c_void),
>;
#[doc = " Callback for message stream events."]
pub type XmtpFnMessageCallback = ::core::option::Option<
    unsafe extern "C" fn(message: *mut XmtpFfiMessage, context: *mut ::core::ffi::c_void),
>;
#[doc = " A consent record exposed to C."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiConsentRecord {
    pub entity_type: XmtpFfiConsentEntityType,
    pub state: XmtpFfiConsentState,
    #[doc = " Entity identifier string."]
    pub entity: *mut ::core::ffi::c_char,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiConsentRecord"][::core::mem::size_of::<XmtpFfiConsentRecord>() - 16usize];
    ["Alignment of XmtpFfiConsentRecord"][::core::mem::align_of::<XmtpFfiConsentRecord>() - 8usize];
    ["Offset of field: XmtpFfiConsentRecord::entity_type"]
        [::core::mem::offset_of!(XmtpFfiConsentRecord, entity_type) - 0usize];
    ["Offset of field: XmtpFfiConsentRecord::state"]
        [::core::mem::offset_of!(XmtpFfiConsentRecord, state) - 4usize];
    ["Offset of field: XmtpFfiConsentRecord::entity"]
        [::core::mem::offset_of!(XmtpFfiConsentRecord, entity) - 8usize];
};
impl Default for XmtpFfiConsentRecord {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Callback for consent stream events.\n `records` is borrowed — valid only during the callback invocation."]
pub type XmtpFnConsentCallback = ::core::option::Option<
    unsafe extern "C" fn(
        records: *const XmtpFfiConsentRecord,
        count: i32,
        context: *mut ::core::ffi::c_void,
    ),
>;
#[doc = " A preference update exposed to C."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct XmtpFfiPreferenceUpdate {
    pub kind: XmtpFfiPreferenceUpdateKind,
    #[doc = " For Consent: the consent record. For HmacKey: zeroed."]
    pub consent: XmtpFfiConsentRecord,
    #[doc = " For HmacKey: the key bytes. For Consent: null/0."]
    pub hmac_key: *mut u8,
    pub hmac_key_len: i32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of XmtpFfiPreferenceUpdate"]
        [::core::mem::size_of::<XmtpFfiPreferenceUpdate>() - 40usize];
    ["Alignment of XmtpFfiPreferenceUpdate"]
        [::core::mem::align_of::<XmtpFfiPreferenceUpdate>() - 8usize];
    ["Offset of field: XmtpFfiPreferenceUpdate::kind"]
        [::core::mem::offset_of!(XmtpFfiPreferenceUpdate, kind) - 0usize];
    ["Offset of field: XmtpFfiPreferenceUpdate::consent"]
        [::core::mem::offset_of!(XmtpFfiPreferenceUpdate, consent) - 8usize];
    ["Offset of field: XmtpFfiPreferenceUpdate::hmac_key"]
        [::core::mem::offset_of!(XmtpFfiPreferenceUpdate, hmac_key) - 24usize];
    ["Offset of field: XmtpFfiPreferenceUpdate::hmac_key_len"]
        [::core::mem::offset_of!(XmtpFfiPreferenceUpdate, hmac_key_len) - 32usize];
};
impl Default for XmtpFfiPreferenceUpdate {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Callback for preference stream events.\n `updates` is borrowed — valid only during the callback invocation."]
pub type XmtpFnPreferenceCallback = ::core::option::Option<
    unsafe extern "C" fn(
        updates: *const XmtpFfiPreferenceUpdate,
        count: i32,
        context: *mut ::core::ffi::c_void,
    ),
>;
#[doc = " Callback for message deletion stream events.\n `message_id` is a borrowed hex string — valid only during the callback."]
pub type XmtpFnMessageDeletionCallback = ::core::option::Option<
    unsafe extern "C" fn(message_id: *const ::core::ffi::c_char, context: *mut ::core::ffi::c_void),
>;
unsafe extern "C" {
    #[doc = " Get the length of the last error message (including NUL terminator).\n Returns 0 if no error."]
    pub fn xmtp_last_error_length() -> i32;
}
unsafe extern "C" {
    #[doc = " Copy the last error message into `buf`. Returns bytes written (excluding NUL),\n or -1 if `buf` is null or too small."]
    pub fn xmtp_last_error_message(buf: *mut ::core::ffi::c_char, buf_len: i32) -> i32;
}
unsafe extern "C" {
    #[doc = " Free a string previously returned by this library."]
    pub fn xmtp_free_string(s: *mut ::core::ffi::c_char);
}
unsafe extern "C" {
    #[doc = " Free a byte buffer previously returned by this library."]
    pub fn xmtp_free_bytes(ptr: *mut u8, len: i32);
}
unsafe extern "C" {
    #[doc = " Free a string array returned by this library."]
    pub fn xmtp_free_string_array(arr: *mut *mut ::core::ffi::c_char, count: i32);
}
unsafe extern "C" {
    #[doc = " Initialize the tracing logger. Call at most once. `level` is a C string like\n \"debug\", \"info\", \"warn\", \"error\", or \"off\". Pass null for default (\"info\").\n Returns 0 on success."]
    pub fn xmtp_init_logger(level: *const ::core::ffi::c_char) -> i32;
}
unsafe extern "C" {
    #[doc = " Create a new XMTP client. Caller must free with [`xmtp_client_free`]."]
    pub fn xmtp_client_create(
        opts: *const XmtpFfiClientOptions,
        out: *mut *mut XmtpFfiClient,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_client_free(ptr: *mut XmtpFfiClient);
}
unsafe extern "C" {
    #[doc = " Get the client's inbox ID. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_client_inbox_id(client: *const XmtpFfiClient) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get the client's installation ID (hex). Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_client_installation_id(client: *const XmtpFfiClient) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Check if the client identity is registered. Returns 1 = yes, 0 = no, -1 = error."]
    pub fn xmtp_client_is_registered(client: *const XmtpFfiClient) -> i32;
}
unsafe extern "C" {
    #[doc = " Register the client identity with an optional signature request.\n Pass null for `sig_req` if no external signature is needed."]
    pub fn xmtp_client_register_identity(
        client: *const XmtpFfiClient,
        sig_req: *const XmtpFfiSignatureRequest,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Check which identifiers can receive messages.\n `identifiers` is an array of C strings, `kinds` is a parallel array of identifier kinds.\n Results are written to `out_results` (1 = can message, 0 = cannot)."]
    pub fn xmtp_client_can_message(
        client: *const XmtpFfiClient,
        identifiers: *const *const ::core::ffi::c_char,
        kinds: *const i32,
        count: i32,
        out_results: *mut i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Release the database connection pool."]
    pub fn xmtp_client_release_db_connection(client: *const XmtpFfiClient) -> i32;
}
unsafe extern "C" {
    #[doc = " Reconnect to the database."]
    pub fn xmtp_client_reconnect_db(client: *const XmtpFfiClient) -> i32;
}
unsafe extern "C" {
    #[doc = " Set consent states for multiple entities.\n `entity_types`: 0 = GroupId, 1 = InboxId.\n `states`: 0 = Unknown, 1 = Allowed, 2 = Denied."]
    pub fn xmtp_client_set_consent_states(
        client: *const XmtpFfiClient,
        entity_types: *const i32,
        states: *const i32,
        entities: *const *const ::core::ffi::c_char,
        count: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get consent state for a single entity. Result written to `out_state`."]
    pub fn xmtp_client_get_consent_state(
        client: *const XmtpFfiClient,
        entity_type: i32,
        entity: *const ::core::ffi::c_char,
        out_state: *mut i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the inbox state for this client as a single-element list.\n Caller must free with [`xmtp_inbox_state_list_free`]."]
    pub fn xmtp_client_inbox_state(
        client: *const XmtpFfiClient,
        refresh: i32,
        out: *mut *mut XmtpFfiInboxStateList,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the client's installation ID as raw bytes.\n Writes length to `out_len`. Caller must free with [`xmtp_free_bytes`]."]
    pub fn xmtp_client_installation_id_bytes(
        client: *const XmtpFfiClient,
        out_len: *mut i32,
    ) -> *mut u8;
}
unsafe extern "C" {
    #[doc = " Verify a signature produced by `xmtp_client_sign_with_installation_key`.\n Returns 0 on success (valid), -1 on error (invalid or bad args)."]
    pub fn xmtp_client_verify_signed_with_installation_key(
        client: *const XmtpFfiClient,
        text: *const ::core::ffi::c_char,
        signature_bytes: *const u8,
        signature_len: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get a message by its hex-encoded ID. Caller must free with [`xmtp_message_free`]."]
    pub fn xmtp_client_get_message_by_id(
        client: *const XmtpFfiClient,
        message_id_hex: *const ::core::ffi::c_char,
        out: *mut *mut XmtpFfiMessage,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Delete a message by its hex-encoded ID. Returns the number of deleted rows."]
    pub fn xmtp_client_delete_message_by_id(
        client: *const XmtpFfiClient,
        message_id_hex: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the libxmtp version string. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_libxmtp_version() -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get MLS API call statistics. Writes to `out`."]
    pub fn xmtp_client_api_statistics(
        client: *const XmtpFfiClient,
        out: *mut XmtpFfiApiStats,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get identity API call statistics. Writes to `out`."]
    pub fn xmtp_client_api_identity_statistics(
        client: *const XmtpFfiClient,
        out: *mut XmtpFfiIdentityStats,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get aggregate statistics as a debug string. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_client_api_aggregate_statistics(
        client: *const XmtpFfiClient,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Clear all API call statistics."]
    pub fn xmtp_client_clear_all_statistics(client: *const XmtpFfiClient) -> i32;
}
unsafe extern "C" {
    #[doc = " Look up an inbox ID by account identifier using the client's connection.\n `identifier_kind`: 0 = Ethereum, 1 = Passkey.\n Returns null if not found. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_client_get_inbox_id_by_identifier(
        client: *const XmtpFfiClient,
        identifier: *const ::core::ffi::c_char,
        identifier_kind: i32,
        out: *mut *mut ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Fetch inbox states for multiple inbox IDs.\n `inbox_ids` is a null-terminated array of C strings with `count` elements.\n Returns an opaque `FfiInboxStateList` via `out`. Caller must free with [`xmtp_inbox_state_list_free`]."]
    pub fn xmtp_client_fetch_inbox_states(
        client: *const XmtpFfiClient,
        inbox_ids: *const *const ::core::ffi::c_char,
        count: i32,
        refresh_from_network: i32,
        out: *mut *mut XmtpFfiInboxStateList,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_inbox_state_list_len(list: *const XmtpFfiInboxStateList) -> i32;
}
unsafe extern "C" {
    #[doc = " Get inbox ID at index. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_inbox_state_inbox_id(
        list: *const XmtpFfiInboxStateList,
        index: i32,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get recovery identifier at index. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_inbox_state_recovery_identifier(
        list: *const XmtpFfiInboxStateList,
        index: i32,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get identifiers array at index. Returns a borrowed pointer; do NOT free."]
    pub fn xmtp_inbox_state_identifiers(
        list: *const XmtpFfiInboxStateList,
        index: i32,
        out_count: *mut i32,
    ) -> *const *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get installation IDs (hex) at index. Returns a borrowed pointer; do NOT free."]
    pub fn xmtp_inbox_state_installation_ids(
        list: *const XmtpFfiInboxStateList,
        index: i32,
        out_count: *mut i32,
    ) -> *const *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Free an inbox state list."]
    pub fn xmtp_inbox_state_list_free(list: *mut XmtpFfiInboxStateList);
}
unsafe extern "C" {
    #[doc = " Create a new gateway auth handle. Caller must free with [`xmtp_auth_handle_free`]."]
    pub fn xmtp_auth_handle_create(out: *mut *mut XmtpFfiAuthHandle) -> i32;
}
unsafe extern "C" {
    #[doc = " Set a credential on an auth handle.\n `name` is an optional HTTP header name (null = \"authorization\").\n `value` is the header value (required).\n `expires_at_seconds` is the Unix timestamp when the credential expires."]
    pub fn xmtp_auth_handle_set(
        handle: *const XmtpFfiAuthHandle,
        name: *const ::core::ffi::c_char,
        value: *const ::core::ffi::c_char,
        expires_at_seconds: i64,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the unique ID of an auth handle."]
    pub fn xmtp_auth_handle_id(handle: *const XmtpFfiAuthHandle) -> usize;
}
unsafe extern "C" {
    pub fn xmtp_auth_handle_free(ptr: *mut XmtpFfiAuthHandle);
}
unsafe extern "C" {
    #[doc = " Fetch the number of identity updates for multiple inbox IDs.\n Caller must free the result with [`xmtp_inbox_update_count_list_free`]."]
    pub fn xmtp_client_fetch_inbox_updates_count(
        client: *const XmtpFfiClient,
        inbox_ids: *const *const ::core::ffi::c_char,
        inbox_ids_count: i32,
        refresh: i32,
        out: *mut *mut XmtpFfiInboxUpdateCountList,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Fetch the number of identity updates for the client's own inbox."]
    pub fn xmtp_client_fetch_own_inbox_updates_count(
        client: *const XmtpFfiClient,
        refresh: i32,
        out: *mut u32,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_inbox_update_count_list_len(list: *const XmtpFfiInboxUpdateCountList) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_inbox_update_count_list_get(
        list: *const XmtpFfiInboxUpdateCountList,
        index: i32,
    ) -> *const XmtpFfiInboxUpdateCount;
}
unsafe extern "C" {
    #[doc = " Free an inbox update count list."]
    pub fn xmtp_inbox_update_count_list_free(list: *mut XmtpFfiInboxUpdateCountList);
}
unsafe extern "C" {
    #[doc = " Fetch key package statuses for a list of installation IDs (hex-encoded).\n Caller must free with [`xmtp_key_package_status_list_free`]."]
    pub fn xmtp_client_fetch_key_package_statuses(
        client: *const XmtpFfiClient,
        installation_ids: *const *const ::core::ffi::c_char,
        installation_ids_count: i32,
        out: *mut *mut XmtpFfiKeyPackageStatusList,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_key_package_status_list_len(list: *const XmtpFfiKeyPackageStatusList) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_key_package_status_list_get(
        list: *const XmtpFfiKeyPackageStatusList,
        index: i32,
    ) -> *const XmtpFfiKeyPackageStatus;
}
unsafe extern "C" {
    #[doc = " Free a key package status list."]
    pub fn xmtp_key_package_status_list_free(list: *mut XmtpFfiKeyPackageStatusList);
}
unsafe extern "C" {
    #[doc = " Get the account identifier string used to create this client.\n Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_client_account_identifier(client: *const XmtpFfiClient)
    -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get the app version string set during client creation.\n Returns null if no app version was set. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_client_app_version(client: *const XmtpFfiClient) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    pub fn xmtp_conversation_free(ptr: *mut XmtpFfiConversation);
}
unsafe extern "C" {
    #[doc = " Get the conversation's hex-encoded group ID. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_conversation_id(conv: *const XmtpFfiConversation) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get the conversation created-at timestamp in nanoseconds."]
    pub fn xmtp_conversation_created_at_ns(conv: *const XmtpFfiConversation) -> i64;
}
unsafe extern "C" {
    #[doc = " Get the conversation type. Returns `FfiConversationType` value, or -1 on error."]
    pub fn xmtp_conversation_type(conv: *const XmtpFfiConversation) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the DM peer's inbox ID. Caller must free with [`xmtp_free_string`].\n Returns null if not a DM or on error."]
    pub fn xmtp_conversation_dm_peer_inbox_id(
        conv: *const XmtpFfiConversation,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Sync this conversation with the network."]
    pub fn xmtp_conversation_sync(conv: *const XmtpFfiConversation) -> i32;
}
unsafe extern "C" {
    #[doc = " Send raw encoded content bytes. Returns the message ID (hex) via `out_id`.\n Caller must free `out_id` with [`xmtp_free_string`].\n Pass null for `opts` to use defaults (should_push = true)."]
    pub fn xmtp_conversation_send(
        conv: *const XmtpFfiConversation,
        content_bytes: *const u8,
        content_len: i32,
        opts: *const XmtpFfiSendOpts,
        out_id: *mut *mut ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Send raw encoded content bytes optimistically (returns immediately, publishes in background).\n Returns the message ID (hex) via `out_id`. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_conversation_send_optimistic(
        conv: *const XmtpFfiConversation,
        content_bytes: *const u8,
        content_len: i32,
        opts: *const XmtpFfiSendOpts,
        out_id: *mut *mut ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Publish all queued (unpublished) messages in this conversation."]
    pub fn xmtp_conversation_publish_messages(conv: *const XmtpFfiConversation) -> i32;
}
unsafe extern "C" {
    #[doc = " Prepare a message for later publishing (optimistic send workflow).\n Stores the message locally without publishing. Returns message ID (hex) via `out_id`.\n Caller must free `out_id` with [`xmtp_free_string`]."]
    pub fn xmtp_conversation_prepare_message(
        conv: *const XmtpFfiConversation,
        content_bytes: *const u8,
        content_len: i32,
        should_push: i32,
        out_id: *mut *mut ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Publish a previously prepared message by its hex-encoded ID."]
    pub fn xmtp_conversation_publish_stored_message(
        conv: *const XmtpFfiConversation,
        message_id_hex: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " List messages in this conversation. Caller must free with [`xmtp_message_list_free`]."]
    pub fn xmtp_conversation_list_messages(
        conv: *const XmtpFfiConversation,
        opts: *const XmtpFfiListMessagesOptions,
        out: *mut *mut XmtpFfiMessageList,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Count messages matching the given filter options.\n Pass null for `opts` to count all messages."]
    pub fn xmtp_conversation_count_messages(
        conv: *const XmtpFfiConversation,
        opts: *const XmtpFfiListMessagesOptions,
    ) -> i64;
}
unsafe extern "C" {
    pub fn xmtp_message_list_len(list: *const XmtpFfiMessageList) -> i32;
}
unsafe extern "C" {
    #[doc = " Get message ID (hex) at index. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_message_id(list: *const XmtpFfiMessageList, index: i32)
    -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get sender inbox ID at index. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_message_sender_inbox_id(
        list: *const XmtpFfiMessageList,
        index: i32,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get sent-at timestamp (ns) at index."]
    pub fn xmtp_message_sent_at_ns(list: *const XmtpFfiMessageList, index: i32) -> i64;
}
unsafe extern "C" {
    #[doc = " Get message kind at index: 0=Application, 1=MembershipChange, -1=error."]
    pub fn xmtp_message_kind(list: *const XmtpFfiMessageList, index: i32) -> i32;
}
unsafe extern "C" {
    #[doc = " Get delivery status at index: 0=Unpublished, 1=Published, 2=Failed, -1=error."]
    pub fn xmtp_message_delivery_status(list: *const XmtpFfiMessageList, index: i32) -> i32;
}
unsafe extern "C" {
    #[doc = " Get raw decrypted content bytes at index. Writes length to `out_len`.\n The returned pointer is borrowed from the list — do NOT free it."]
    pub fn xmtp_message_content_bytes(
        list: *const XmtpFfiMessageList,
        index: i32,
        out_len: *mut i32,
    ) -> *const u8;
}
unsafe extern "C" {
    pub fn xmtp_message_list_free(ptr: *mut XmtpFfiMessageList);
}
unsafe extern "C" {
    pub fn xmtp_message_free(ptr: *mut XmtpFfiMessage);
}
unsafe extern "C" {
    #[doc = " Get the message ID (hex) from a single message handle.\n Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_single_message_id(msg: *const XmtpFfiMessage) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get the group ID (hex) from a single message handle.\n Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_single_message_group_id(msg: *const XmtpFfiMessage) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get the sender inbox ID from a single message handle.\n Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_single_message_sender_inbox_id(
        msg: *const XmtpFfiMessage,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get the sent-at timestamp (ns) from a single message handle."]
    pub fn xmtp_single_message_sent_at_ns(msg: *const XmtpFfiMessage) -> i64;
}
unsafe extern "C" {
    #[doc = " Get raw content bytes from a single message handle.\n The returned pointer is borrowed — valid only while the message handle is alive."]
    pub fn xmtp_single_message_content_bytes(
        msg: *const XmtpFfiMessage,
        out_len: *mut i32,
    ) -> *const u8;
}
unsafe extern "C" {
    #[doc = " List group members. Caller must free with [`xmtp_group_member_list_free`]."]
    pub fn xmtp_conversation_list_members(
        conv: *const XmtpFfiConversation,
        out: *mut *mut XmtpFfiGroupMemberList,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_group_member_list_len(list: *const XmtpFfiGroupMemberList) -> i32;
}
unsafe extern "C" {
    #[doc = " Get member inbox ID at index. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_group_member_inbox_id(
        list: *const XmtpFfiGroupMemberList,
        index: i32,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get member permission level at index: 0=Member, 1=Admin, 2=SuperAdmin, -1=error."]
    pub fn xmtp_group_member_permission_level(
        list: *const XmtpFfiGroupMemberList,
        index: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get member consent state at index: 0=Unknown, 1=Allowed, 2=Denied, -1=error."]
    pub fn xmtp_group_member_consent_state(list: *const XmtpFfiGroupMemberList, index: i32) -> i32;
}
unsafe extern "C" {
    #[doc = " Get member account identifiers at index.\n Returns a borrowed pointer to the internal string array. Do NOT free individual strings.\n Use `out_count` to get the number of identifiers."]
    pub fn xmtp_group_member_account_identifiers(
        list: *const XmtpFfiGroupMemberList,
        index: i32,
        out_count: *mut i32,
    ) -> *const *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get member installation IDs (hex) at index.\n Returns a borrowed pointer to the internal string array."]
    pub fn xmtp_group_member_installation_ids(
        list: *const XmtpFfiGroupMemberList,
        index: i32,
        out_count: *mut i32,
    ) -> *const *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Free a group member list."]
    pub fn xmtp_group_member_list_free(list: *mut XmtpFfiGroupMemberList);
}
unsafe extern "C" {
    #[doc = " Add members by inbox IDs."]
    pub fn xmtp_conversation_add_members(
        conv: *const XmtpFfiConversation,
        inbox_ids: *const *const ::core::ffi::c_char,
        count: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Remove members by inbox IDs."]
    pub fn xmtp_conversation_remove_members(
        conv: *const XmtpFfiConversation,
        inbox_ids: *const *const ::core::ffi::c_char,
        count: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Leave the group."]
    pub fn xmtp_conversation_leave(conv: *const XmtpFfiConversation) -> i32;
}
unsafe extern "C" {
    #[doc = " Add/remove admin or super admin. `action`: 0=AddAdmin, 1=RemoveAdmin, 2=AddSuperAdmin, 3=RemoveSuperAdmin."]
    pub fn xmtp_conversation_update_admin_list(
        conv: *const XmtpFfiConversation,
        inbox_id: *const ::core::ffi::c_char,
        action: i32,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_conversation_group_name(
        conv: *const XmtpFfiConversation,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    pub fn xmtp_conversation_update_group_name(
        conv: *const XmtpFfiConversation,
        value: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_conversation_group_description(
        conv: *const XmtpFfiConversation,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    pub fn xmtp_conversation_update_group_description(
        conv: *const XmtpFfiConversation,
        value: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_conversation_group_image_url(
        conv: *const XmtpFfiConversation,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    pub fn xmtp_conversation_update_group_image_url(
        conv: *const XmtpFfiConversation,
        value: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get conversation consent state. Writes to `out_state` (0=Unknown, 1=Allowed, 2=Denied)."]
    pub fn xmtp_conversation_consent_state(
        conv: *const XmtpFfiConversation,
        out_state: *mut i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Update conversation consent state."]
    pub fn xmtp_conversation_update_consent_state(
        conv: *const XmtpFfiConversation,
        state: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Update a permission policy on this conversation.\n `update_type`: 1=AddMember, 2=RemoveMember, 3=AddAdmin, 4=RemoveAdmin, 5=UpdateMetadata.\n `policy`: 1=Allow, 2=Deny, 3=AdminOnly, 4=SuperAdminOnly.\n `metadata_field_name`: Only used when update_type=5 (e.g. \"group_name\"). Pass null otherwise."]
    pub fn xmtp_conversation_update_permission_policy(
        conv: *const XmtpFfiConversation,
        update_type: i32,
        policy: i32,
        metadata_field_name: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Check if the conversation is active. Returns 1=active, 0=inactive, -1=error."]
    pub fn xmtp_conversation_is_active(conv: *const XmtpFfiConversation) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the membership state of the current user in this conversation.\n 0=Allowed, 1=Rejected, 2=Pending, 3=Restored, 4=PendingRemove, -1=error."]
    pub fn xmtp_conversation_membership_state(conv: *const XmtpFfiConversation) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_conversation_added_by_inbox_id(
        conv: *const XmtpFfiConversation,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    pub fn xmtp_conversation_list_admins(
        conv: *const XmtpFfiConversation,
        out_count: *mut i32,
    ) -> *mut *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    pub fn xmtp_conversation_list_super_admins(
        conv: *const XmtpFfiConversation,
        out_count: *mut i32,
    ) -> *mut *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    pub fn xmtp_conversation_is_admin(
        conv: *const XmtpFfiConversation,
        inbox_id: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_conversation_is_super_admin(
        conv: *const XmtpFfiConversation,
        inbox_id: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Add members by external identifiers (address/passkey).\n `identifiers` and `kinds` are parallel arrays of length `count`."]
    pub fn xmtp_conversation_add_members_by_identity(
        conv: *const XmtpFfiConversation,
        identifiers: *const *const ::core::ffi::c_char,
        kinds: *const i32,
        count: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Remove members by external identifiers (address/passkey)."]
    pub fn xmtp_conversation_remove_members_by_identity(
        conv: *const XmtpFfiConversation,
        identifiers: *const *const ::core::ffi::c_char,
        kinds: *const i32,
        count: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Update the message disappearing settings for this conversation."]
    pub fn xmtp_conversation_update_disappearing_settings(
        conv: *const XmtpFfiConversation,
        settings: *const XmtpFfiDisappearingSettings,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Remove (disable) message disappearing settings for this conversation."]
    pub fn xmtp_conversation_remove_disappearing_settings(conv: *const XmtpFfiConversation) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the current message disappearing settings.\n Returns 0 on success (writes to `out`), -1 if not set or on error."]
    pub fn xmtp_conversation_disappearing_settings(
        conv: *const XmtpFfiConversation,
        out: *mut XmtpFfiDisappearingSettings,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Check if message disappearing is enabled.\n Returns 1=enabled, 0=disabled, -1=error."]
    pub fn xmtp_conversation_is_disappearing_enabled(conv: *const XmtpFfiConversation) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_conversation_app_data(conv: *const XmtpFfiConversation)
    -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    pub fn xmtp_conversation_update_app_data(
        conv: *const XmtpFfiConversation,
        value: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Find duplicate DM conversations for this DM.\n Returns a conversation list. Caller must free with [`xmtp_conversation_list_free`]."]
    pub fn xmtp_conversation_duplicate_dms(
        conv: *const XmtpFfiConversation,
        out: *mut *mut XmtpFfiConversationList,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Check if the conversation is paused for a version upgrade.\n Writes the version string to `out` if paused, or null if not paused.\n Caller must free `out` with [`xmtp_free_string`].\n Returns 0 on success, -1 on error."]
    pub fn xmtp_conversation_paused_for_version(
        conv: *const XmtpFfiConversation,
        out: *mut *mut ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get debug info for this conversation.\n Caller must free string fields with [`xmtp_free_string`]."]
    pub fn xmtp_conversation_debug_info(
        conv: *const XmtpFfiConversation,
        out: *mut XmtpFfiConversationDebugInfo,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Free a conversation debug info struct (its string fields and cursor array)."]
    pub fn xmtp_conversation_debug_info_free(info: *mut XmtpFfiConversationDebugInfo);
}
unsafe extern "C" {
    #[doc = " Get HMAC keys for this conversation (including duplicate DMs).\n Returns a map via `out`. Caller must free with [`xmtp_hmac_key_map_free`]."]
    pub fn xmtp_conversation_hmac_keys(
        conv: *const XmtpFfiConversation,
        out: *mut *mut XmtpFfiHmacKeyMap,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the number of entries in an HMAC key map."]
    pub fn xmtp_hmac_key_map_len(map: *const XmtpFfiHmacKeyMap) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the group ID (hex) at index. Returns a borrowed pointer; do NOT free."]
    pub fn xmtp_hmac_key_map_group_id(
        map: *const XmtpFfiHmacKeyMap,
        index: i32,
    ) -> *const ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get the HMAC keys at index. Writes count to `out_count`.\n Returns a borrowed pointer to the key array; do NOT free individual keys."]
    pub fn xmtp_hmac_key_map_keys(
        map: *const XmtpFfiHmacKeyMap,
        index: i32,
        out_count: *mut i32,
    ) -> *const XmtpFfiHmacKey;
}
unsafe extern "C" {
    #[doc = " Process a raw group message received via push notification.\n Returns a list of stored messages. Caller must free with [`xmtp_message_list_free`]."]
    pub fn xmtp_conversation_process_streamed_group_message(
        conversation: *const XmtpFfiConversation,
        envelope_bytes: *const u8,
        envelope_bytes_len: i32,
        out: *mut *mut XmtpFfiMessageList,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the full group metadata (creator inbox ID + conversation type).\n Caller must free with [`xmtp_group_metadata_free`]."]
    pub fn xmtp_conversation_group_metadata(
        conversation: *const XmtpFfiConversation,
        out: *mut *mut XmtpFfiGroupMetadata,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Free a group metadata struct."]
    pub fn xmtp_group_metadata_free(meta: *mut XmtpFfiGroupMetadata);
}
unsafe extern "C" {
    #[doc = " Get the group permissions (policy type + full policy set).\n Caller must free with [`xmtp_group_permissions_free`]."]
    pub fn xmtp_conversation_group_permissions(
        conversation: *const XmtpFfiConversation,
        out: *mut *mut XmtpFfiGroupPermissions,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_group_permissions_free(ptr: *mut XmtpFfiGroupPermissions);
}
unsafe extern "C" {
    #[doc = " List enriched (decoded) messages for a conversation.\n Fetches both enriched metadata and raw content bytes in a single call.\n Caller must free with [`xmtp_enriched_message_list_free`]."]
    pub fn xmtp_conversation_list_enriched_messages(
        conversation: *const XmtpFfiConversation,
        opts: *const XmtpFfiListMessagesOptions,
        out: *mut *mut XmtpFfiEnrichedMessageList,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_enriched_message_list_len(list: *const XmtpFfiEnrichedMessageList) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_enriched_message_list_get(
        list: *const XmtpFfiEnrichedMessageList,
        index: i32,
    ) -> *const XmtpFfiEnrichedMessage;
}
unsafe extern "C" {
    #[doc = " Free an enriched message list (including owned strings and content bytes)."]
    pub fn xmtp_enriched_message_list_free(list: *mut XmtpFfiEnrichedMessageList);
}
unsafe extern "C" {
    #[doc = " Get per-inbox last read times for a conversation.\n Caller must free with [`xmtp_last_read_time_list_free`]."]
    pub fn xmtp_conversation_last_read_times(
        conversation: *const XmtpFfiConversation,
        out: *mut *mut XmtpFfiLastReadTimeList,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_last_read_time_list_len(list: *const XmtpFfiLastReadTimeList) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_last_read_time_list_get(
        list: *const XmtpFfiLastReadTimeList,
        index: i32,
    ) -> *const XmtpFfiLastReadTimeEntry;
}
unsafe extern "C" {
    pub fn xmtp_last_read_time_list_free(list: *mut XmtpFfiLastReadTimeList);
}
unsafe extern "C" {
    #[doc = " Free an HMAC key map (including all owned data)."]
    pub fn xmtp_hmac_key_map_free(map: *mut XmtpFfiHmacKeyMap);
}
unsafe extern "C" {
    #[doc = " Create a new group conversation, optionally adding members by inbox ID.\n Pass null/0 for `member_inbox_ids`/`member_count` to create an empty group.\n Caller must free result with [`xmtp_conversation_free`]."]
    pub fn xmtp_client_create_group(
        client: *const XmtpFfiClient,
        opts: *const XmtpFfiCreateGroupOptions,
        member_inbox_ids: *const *const ::core::ffi::c_char,
        member_count: i32,
        out: *mut *mut XmtpFfiConversation,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Create a new group, adding members by identity (address/passkey).\n `identifiers` and `kinds` are parallel arrays of length `count`.\n Caller must free result with [`xmtp_conversation_free`]."]
    pub fn xmtp_client_create_group_by_identity(
        client: *const XmtpFfiClient,
        opts: *const XmtpFfiCreateGroupOptions,
        identifiers: *const *const ::core::ffi::c_char,
        kinds: *const i32,
        count: i32,
        out: *mut *mut XmtpFfiConversation,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Find or create a DM by identifier. Caller must free result with [`xmtp_conversation_free`]."]
    pub fn xmtp_client_create_dm(
        client: *const XmtpFfiClient,
        identifier: *const ::core::ffi::c_char,
        identifier_kind: i32,
        disappear_from_ns: i64,
        disappear_in_ns: i64,
        out: *mut *mut XmtpFfiConversation,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Find or create a DM by inbox ID. Caller must free result with [`xmtp_conversation_free`]."]
    pub fn xmtp_client_find_dm_by_inbox_id(
        client: *const XmtpFfiClient,
        inbox_id: *const ::core::ffi::c_char,
        out: *mut *mut XmtpFfiConversation,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Create a DM by target inbox ID. Caller must free result with [`xmtp_conversation_free`]."]
    pub fn xmtp_client_create_dm_by_inbox_id(
        client: *const XmtpFfiClient,
        inbox_id: *const ::core::ffi::c_char,
        disappear_from_ns: i64,
        disappear_in_ns: i64,
        out: *mut *mut XmtpFfiConversation,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get a conversation by hex-encoded group ID.\n Caller must free result with [`xmtp_conversation_free`]."]
    pub fn xmtp_client_get_conversation_by_id(
        client: *const XmtpFfiClient,
        hex_id: *const ::core::ffi::c_char,
        out: *mut *mut XmtpFfiConversation,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " List conversations. Caller must free result with [`xmtp_conversation_list_free`]."]
    pub fn xmtp_client_list_conversations(
        client: *const XmtpFfiClient,
        opts: *const XmtpFfiListConversationsOptions,
        out: *mut *mut XmtpFfiConversationList,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_conversation_list_len(list: *const XmtpFfiConversationList) -> i32;
}
unsafe extern "C" {
    #[doc = " Get a conversation from a list by index. Caller must free with [`xmtp_conversation_free`]."]
    pub fn xmtp_conversation_list_get(
        list: *const XmtpFfiConversationList,
        index: i32,
        out: *mut *mut XmtpFfiConversation,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_conversation_list_free(ptr: *mut XmtpFfiConversationList);
}
unsafe extern "C" {
    #[doc = " Get the sent_at_ns of the last message for a conversation list item.\n Returns 0 if no last message exists, or -1 on error."]
    pub fn xmtp_conversation_list_last_message_sent_at_ns(
        list: *const XmtpFfiConversationList,
        index: i32,
    ) -> i64;
}
unsafe extern "C" {
    #[doc = " Get the last message for a conversation list item as an opaque FfiMessage handle.\n Returns 0 on success (writes to `out`), -1 on error or if no last message exists.\n Caller must free with `xmtp_message_free`."]
    pub fn xmtp_conversation_list_last_message(
        list: *const XmtpFfiConversationList,
        index: i32,
        out: *mut *mut XmtpFfiMessage,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the commit log fork status for a conversation list item.\n Returns -1=unknown/error, 0=not forked, 1=forked."]
    pub fn xmtp_conversation_list_is_commit_log_forked(
        list: *const XmtpFfiConversationList,
        index: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Sync welcomes (process new group invitations)."]
    pub fn xmtp_client_sync_welcomes(client: *const XmtpFfiClient) -> i32;
}
unsafe extern "C" {
    #[doc = " Sync all conversations, optionally filtering by consent states.\n `consent_states` is a parallel array of consent state values (0=Unknown, 1=Allowed, 2=Denied).\n Pass null and 0 to sync all."]
    pub fn xmtp_client_sync_all(
        client: *const XmtpFfiClient,
        consent_states: *const i32,
        consent_states_count: i32,
        out_synced: *mut i32,
        out_eligible: *mut i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Sync preferences (device sync groups only)."]
    pub fn xmtp_client_sync_preferences(
        client: *const XmtpFfiClient,
        out_synced: *mut i32,
        out_eligible: *mut i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get HMAC keys for all conversations (including duplicate DMs).\n Returns a map via `out`. Caller must free with [`xmtp_hmac_key_map_free`]."]
    pub fn xmtp_client_hmac_keys(
        client: *const XmtpFfiClient,
        out: *mut *mut XmtpFfiHmacKeyMap,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Process a raw welcome message received via push notification.\n Returns a list of conversation handles. Caller must free with [`xmtp_conversation_list_free`]."]
    pub fn xmtp_client_process_streamed_welcome_message(
        client: *const XmtpFfiClient,
        envelope_bytes: *const u8,
        envelope_bytes_len: i32,
        out: *mut *mut XmtpFfiConversationList,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get an enriched (decoded) message by its hex-encoded ID.\n Caller must free with [`xmtp_enriched_message_list_free`] (single-item list)."]
    pub fn xmtp_client_get_enriched_message_by_id(
        client: *const XmtpFfiClient,
        message_id: *const ::core::ffi::c_char,
        out: *mut *mut XmtpFfiEnrichedMessageList,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Create a group without syncing members (optimistic / offline-capable).\n Caller must free with [`xmtp_conversation_free`]."]
    pub fn xmtp_client_create_group_optimistic(
        client: *const XmtpFfiClient,
        opts: *const XmtpFfiCreateGroupOptions,
        out: *mut *mut XmtpFfiConversation,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Send a device sync request to retrieve records from another installation."]
    pub fn xmtp_device_sync_send_request(
        client: *const XmtpFfiClient,
        opts: *const XmtpFfiArchiveOptions,
        server_url: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Send a sync archive to the sync group with the given pin."]
    pub fn xmtp_device_sync_send_archive(
        client: *const XmtpFfiClient,
        opts: *const XmtpFfiArchiveOptions,
        server_url: *const ::core::ffi::c_char,
        pin: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Process a sync archive matching the given pin.\n Pass null for `pin` to process the latest archive."]
    pub fn xmtp_device_sync_process_archive(
        client: *const XmtpFfiClient,
        pin: *const ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " List archives available for import in the sync group.\n `days_cutoff` limits how far back to look.\n Caller must free with [`xmtp_available_archive_list_free`]."]
    pub fn xmtp_device_sync_list_available_archives(
        client: *const XmtpFfiClient,
        days_cutoff: i64,
        out: *mut *mut XmtpFfiAvailableArchiveList,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_available_archive_list_len(list: *const XmtpFfiAvailableArchiveList) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the pin string at index. Returns a borrowed pointer; do NOT free."]
    pub fn xmtp_available_archive_pin(
        list: *const XmtpFfiAvailableArchiveList,
        index: i32,
    ) -> *const ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Get the exported_at_ns at index."]
    pub fn xmtp_available_archive_exported_at_ns(
        list: *const XmtpFfiAvailableArchiveList,
        index: i32,
    ) -> i64;
}
unsafe extern "C" {
    #[doc = " Free an available archive list."]
    pub fn xmtp_available_archive_list_free(list: *mut XmtpFfiAvailableArchiveList);
}
unsafe extern "C" {
    #[doc = " Export an archive to a local file.\n `key` must be at least 32 bytes (encryption key)."]
    pub fn xmtp_device_sync_create_archive(
        client: *const XmtpFfiClient,
        path: *const ::core::ffi::c_char,
        opts: *const XmtpFfiArchiveOptions,
        key: *const u8,
        key_len: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Import a previously exported archive from a file.\n `key` must be at least 32 bytes (encryption key)."]
    pub fn xmtp_device_sync_import_archive(
        client: *const XmtpFfiClient,
        path: *const ::core::ffi::c_char,
        key: *const u8,
        key_len: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Read metadata from an archive file without loading its full contents.\n `out_elements` is a bitmask: bit 0 = Messages, bit 1 = Consent.\n `out_start_ns` / `out_end_ns` are 0 if not set. All output pointers are nullable."]
    pub fn xmtp_device_sync_archive_metadata(
        path: *const ::core::ffi::c_char,
        key: *const u8,
        key_len: i32,
        out_version: *mut u16,
        out_exported_at_ns: *mut i64,
        out_elements: *mut i32,
        out_start_ns: *mut i64,
        out_end_ns: *mut i64,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Manually sync all device sync groups.\n Writes the number of synced/eligible groups to the output pointers."]
    pub fn xmtp_device_sync_sync_all(
        client: *const XmtpFfiClient,
        out_synced: *mut i32,
        out_eligible: *mut i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Generate an inbox ID from an identifier. Caller must free with [`xmtp_free_string`].\n `nonce` defaults to 1 if 0 is passed."]
    pub fn xmtp_generate_inbox_id(
        identifier: *const ::core::ffi::c_char,
        identifier_kind: i32,
        nonce: u64,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Check whether an installation (by its public key bytes) belongs to an inbox.\n Returns 1 = authorized, 0 = not authorized. Sets last error on failure."]
    pub fn xmtp_is_installation_authorized(
        api_url: *const ::core::ffi::c_char,
        is_secure: i32,
        inbox_id: *const ::core::ffi::c_char,
        installation_id: *const u8,
        installation_id_len: i32,
        out: *mut i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Check whether an Ethereum address belongs to an inbox.\n Returns 1 = authorized, 0 = not authorized. Sets last error on failure."]
    pub fn xmtp_is_address_authorized(
        api_url: *const ::core::ffi::c_char,
        is_secure: i32,
        inbox_id: *const ::core::ffi::c_char,
        address: *const ::core::ffi::c_char,
        out: *mut i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the inbox ID for an identifier by querying the network.\n `api_url` is the gRPC host, `is_secure` controls TLS.\n Writes the inbox ID to `out` (caller must free with [`xmtp_free_string`]).\n Writes null to `out` if no inbox ID is found."]
    pub fn xmtp_get_inbox_id_for_identifier(
        api_url: *const ::core::ffi::c_char,
        is_secure: i32,
        identifier: *const ::core::ffi::c_char,
        identifier_kind: i32,
        out: *mut *mut ::core::ffi::c_char,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Create an inbox registration signature request (if needed).\n Returns null via `out` if no signature is needed.\n Caller must free with [`xmtp_signature_request_free`]."]
    pub fn xmtp_client_create_inbox_signature_request(
        client: *const XmtpFfiClient,
        out: *mut *mut XmtpFfiSignatureRequest,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Create a signature request to add a new identifier.\n Caller must free with [`xmtp_signature_request_free`]."]
    pub fn xmtp_client_add_identifier_signature_request(
        client: *const XmtpFfiClient,
        identifier: *const ::core::ffi::c_char,
        identifier_kind: i32,
        out: *mut *mut XmtpFfiSignatureRequest,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Create a signature request to revoke an identifier.\n Caller must free with [`xmtp_signature_request_free`]."]
    pub fn xmtp_client_revoke_identifier_signature_request(
        client: *const XmtpFfiClient,
        identifier: *const ::core::ffi::c_char,
        identifier_kind: i32,
        out: *mut *mut XmtpFfiSignatureRequest,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Create a signature request to revoke all other installations.\n Returns null via `out` if there are no other installations.\n Caller must free with [`xmtp_signature_request_free`]."]
    pub fn xmtp_client_revoke_all_other_installations(
        client: *const XmtpFfiClient,
        out: *mut *mut XmtpFfiSignatureRequest,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Get the human-readable signature text. Caller must free with [`xmtp_free_string`]."]
    pub fn xmtp_signature_request_text(
        req: *const XmtpFfiSignatureRequest,
    ) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
    #[doc = " Add an ECDSA signature to the request."]
    pub fn xmtp_signature_request_add_ecdsa(
        req: *const XmtpFfiSignatureRequest,
        signature_bytes: *const u8,
        signature_len: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Add a passkey signature to the request.\n All four byte arrays are required and must not be null."]
    pub fn xmtp_signature_request_add_passkey(
        req: *const XmtpFfiSignatureRequest,
        public_key: *const u8,
        public_key_len: i32,
        signature: *const u8,
        signature_len: i32,
        authenticator_data: *const u8,
        authenticator_data_len: i32,
        client_data_json: *const u8,
        client_data_json_len: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Add a smart contract wallet (SCW) signature to the request.\n `account_address` is the EVM account address (hex string).\n `chain_id` is the EVM chain ID (e.g. 1 for mainnet).\n `block_number` is optional; pass 0 to omit."]
    pub fn xmtp_signature_request_add_scw(
        req: *const XmtpFfiSignatureRequest,
        account_address: *const ::core::ffi::c_char,
        signature_bytes: *const u8,
        signature_len: i32,
        chain_id: u64,
        block_number: u64,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Apply a signature request to the client."]
    pub fn xmtp_client_apply_signature_request(
        client: *const XmtpFfiClient,
        req: *const XmtpFfiSignatureRequest,
    ) -> i32;
}
unsafe extern "C" {
    pub fn xmtp_signature_request_free(ptr: *mut XmtpFfiSignatureRequest);
}
unsafe extern "C" {
    #[doc = " Create a signature request to revoke specific installations by their IDs.\n `installation_ids` is an array of byte arrays, each `id_len` bytes long.\n Caller must free with [`xmtp_signature_request_free`]."]
    pub fn xmtp_client_revoke_installations_signature_request(
        client: *const XmtpFfiClient,
        installation_ids: *const *const u8,
        id_lengths: *const i32,
        count: i32,
        out: *mut *mut XmtpFfiSignatureRequest,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Create a signature request to change the recovery identifier.\n Caller must free with [`xmtp_signature_request_free`]."]
    pub fn xmtp_client_change_recovery_identifier_signature_request(
        client: *const XmtpFfiClient,
        new_identifier: *const ::core::ffi::c_char,
        identifier_kind: i32,
        out: *mut *mut XmtpFfiSignatureRequest,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Sign text with the client's installation key.\n Writes signature bytes to `out` and length to `out_len`.\n Caller must free `out` with [`xmtp_free_bytes`]."]
    pub fn xmtp_client_sign_with_installation_key(
        client: *const XmtpFfiClient,
        text: *const ::core::ffi::c_char,
        out: *mut *mut u8,
        out_len: *mut i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Verify a signature produced by `sign_with_installation_key` using an\n arbitrary public key. Does not require a client handle.\n `signature_bytes` must be exactly 64 bytes, `public_key` must be exactly 32 bytes."]
    pub fn xmtp_verify_signed_with_public_key(
        signature_text: *const ::core::ffi::c_char,
        signature_bytes: *const u8,
        signature_len: i32,
        public_key: *const u8,
        public_key_len: i32,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Stream new conversations. Callback receives owned `*mut FfiConversation` (caller must free).\n `on_close(error, ctx)`: null error = normal close; non-null = borrowed error string.\n Caller must end with `xmtp_stream_end` and free with `xmtp_stream_free`."]
    pub fn xmtp_stream_conversations(
        client: *const XmtpFfiClient,
        conversation_type: i32,
        callback: XmtpFnConversationCallback,
        on_close: ::core::option::Option<
            unsafe extern "C" fn(arg1: *const ::core::ffi::c_char, arg2: *mut ::core::ffi::c_void),
        >,
        context: *mut ::core::ffi::c_void,
        out: *mut *mut XmtpFfiStreamHandle,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Stream all messages across conversations. Callback receives owned `*mut FfiMessage`.\n `consent_states` / `consent_states_count`: optional filter (null/0 = all)."]
    pub fn xmtp_stream_all_messages(
        client: *const XmtpFfiClient,
        conversation_type: i32,
        consent_states: *const i32,
        consent_states_count: i32,
        callback: XmtpFnMessageCallback,
        on_close: ::core::option::Option<
            unsafe extern "C" fn(arg1: *const ::core::ffi::c_char, arg2: *mut ::core::ffi::c_void),
        >,
        context: *mut ::core::ffi::c_void,
        out: *mut *mut XmtpFfiStreamHandle,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Stream messages for a single conversation. Callback receives owned `*mut FfiMessage`."]
    pub fn xmtp_conversation_stream_messages(
        conv: *const XmtpFfiConversation,
        callback: XmtpFnMessageCallback,
        on_close: ::core::option::Option<
            unsafe extern "C" fn(arg1: *const ::core::ffi::c_char, arg2: *mut ::core::ffi::c_void),
        >,
        context: *mut ::core::ffi::c_void,
        out: *mut *mut XmtpFfiStreamHandle,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Stream consent state changes. Callback receives a borrowed array of consent records\n (`*const FfiConsentRecord`) — valid only during the callback invocation."]
    pub fn xmtp_stream_consent(
        client: *const XmtpFfiClient,
        callback: XmtpFnConsentCallback,
        on_close: ::core::option::Option<
            unsafe extern "C" fn(arg1: *const ::core::ffi::c_char, arg2: *mut ::core::ffi::c_void),
        >,
        context: *mut ::core::ffi::c_void,
        out: *mut *mut XmtpFfiStreamHandle,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Stream preference updates (consent changes + HMAC key rotations).\n Callback receives a borrowed array (`*const FfiPreferenceUpdate`) — valid only during callback."]
    pub fn xmtp_stream_preferences(
        client: *const XmtpFfiClient,
        callback: XmtpFnPreferenceCallback,
        on_close: ::core::option::Option<
            unsafe extern "C" fn(arg1: *const ::core::ffi::c_char, arg2: *mut ::core::ffi::c_void),
        >,
        context: *mut ::core::ffi::c_void,
        out: *mut *mut XmtpFfiStreamHandle,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Stream message deletion events. Callback receives a borrowed hex message ID\n (`*const c_char`) — valid only during the callback invocation.\n Now includes `on_close` for API consistency with other stream functions."]
    pub fn xmtp_stream_message_deletions(
        client: *const XmtpFfiClient,
        callback: XmtpFnMessageDeletionCallback,
        on_close: ::core::option::Option<
            unsafe extern "C" fn(arg1: *const ::core::ffi::c_char, arg2: *mut ::core::ffi::c_void),
        >,
        context: *mut ::core::ffi::c_void,
        out: *mut *mut XmtpFfiStreamHandle,
    ) -> i32;
}
unsafe extern "C" {
    #[doc = " Signal a stream to stop. Does NOT free the handle — call `xmtp_stream_free` afterwards.\n Safe to call multiple times."]
    pub fn xmtp_stream_end(handle: *const XmtpFfiStreamHandle);
}
unsafe extern "C" {
    #[doc = " Check if a stream has finished. Returns 1 if closed, 0 if active."]
    pub fn xmtp_stream_is_closed(handle: *const XmtpFfiStreamHandle) -> i32;
}
unsafe extern "C" {
    #[doc = " Free a stream handle. Must be called after `xmtp_stream_end`.\n Calling this on an active (non-ended) stream will also end it."]
    pub fn xmtp_stream_free(handle: *mut XmtpFfiStreamHandle);
}