@succinctlabs/react-native-zcam1 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.md +61 -0
  2. package/Zcam1Sdk.podspec +157 -0
  3. package/app.plugin.js +11 -0
  4. package/cpp/generated/zcam1_c2pa_utils.cpp +4091 -0
  5. package/cpp/generated/zcam1_c2pa_utils.hpp +367 -0
  6. package/cpp/generated/zcam1_certs_utils.cpp +1799 -0
  7. package/cpp/generated/zcam1_certs_utils.hpp +72 -0
  8. package/cpp/generated/zcam1_verify_utils.cpp +1857 -0
  9. package/cpp/generated/zcam1_verify_utils.hpp +79 -0
  10. package/cpp/proving/generated/zcam1_proving_utils.cpp +3661 -0
  11. package/cpp/proving/generated/zcam1_proving_utils.hpp +275 -0
  12. package/cpp/proving/zcam1-proving.cpp +16 -0
  13. package/cpp/proving/zcam1-proving.h +15 -0
  14. package/cpp/zcam1-sdk.cpp +20 -0
  15. package/cpp/zcam1-sdk.h +15 -0
  16. package/ios/Zcam1Camera.swift +2945 -0
  17. package/ios/Zcam1CameraFilmStyle.swift +191 -0
  18. package/ios/Zcam1CameraViewManager.m +86 -0
  19. package/ios/Zcam1Capture.h +13 -0
  20. package/ios/Zcam1Capture.mm +500 -0
  21. package/ios/Zcam1DepthData.swift +417 -0
  22. package/ios/Zcam1Sdk.h +16 -0
  23. package/ios/Zcam1Sdk.mm +66 -0
  24. package/ios/proving/Zcam1Proving.h +16 -0
  25. package/ios/proving/Zcam1Proving.mm +66 -0
  26. package/lib/module/NativeZcam1Capture.js +12 -0
  27. package/lib/module/NativeZcam1Capture.js.map +1 -0
  28. package/lib/module/NativeZcam1Sdk.js +7 -0
  29. package/lib/module/NativeZcam1Sdk.js.map +1 -0
  30. package/lib/module/bindings.js +51 -0
  31. package/lib/module/bindings.js.map +1 -0
  32. package/lib/module/camera.js +522 -0
  33. package/lib/module/camera.js.map +1 -0
  34. package/lib/module/capture.js +120 -0
  35. package/lib/module/capture.js.map +1 -0
  36. package/lib/module/common.js +35 -0
  37. package/lib/module/common.js.map +1 -0
  38. package/lib/module/generated/zcam1_c2pa_utils-ffi.js +43 -0
  39. package/lib/module/generated/zcam1_c2pa_utils-ffi.js.map +1 -0
  40. package/lib/module/generated/zcam1_c2pa_utils.js +1202 -0
  41. package/lib/module/generated/zcam1_c2pa_utils.js.map +1 -0
  42. package/lib/module/generated/zcam1_certs_utils-ffi.js +43 -0
  43. package/lib/module/generated/zcam1_certs_utils-ffi.js.map +1 -0
  44. package/lib/module/generated/zcam1_certs_utils.js +399 -0
  45. package/lib/module/generated/zcam1_certs_utils.js.map +1 -0
  46. package/lib/module/generated/zcam1_proving_utils-ffi.js +43 -0
  47. package/lib/module/generated/zcam1_proving_utils-ffi.js.map +1 -0
  48. package/lib/module/generated/zcam1_proving_utils.js +515 -0
  49. package/lib/module/generated/zcam1_proving_utils.js.map +1 -0
  50. package/lib/module/generated/zcam1_verify_utils-ffi.js +43 -0
  51. package/lib/module/generated/zcam1_verify_utils-ffi.js.map +1 -0
  52. package/lib/module/generated/zcam1_verify_utils.js +252 -0
  53. package/lib/module/generated/zcam1_verify_utils.js.map +1 -0
  54. package/lib/module/index.js +31 -0
  55. package/lib/module/index.js.map +1 -0
  56. package/lib/module/package.json +1 -0
  57. package/lib/module/picker.js +222 -0
  58. package/lib/module/picker.js.map +1 -0
  59. package/lib/module/proving/NativeZcam1Proving.js +7 -0
  60. package/lib/module/proving/NativeZcam1Proving.js.map +1 -0
  61. package/lib/module/proving/bindings.js +46 -0
  62. package/lib/module/proving/bindings.js.map +1 -0
  63. package/lib/module/proving/index.js +5 -0
  64. package/lib/module/proving/index.js.map +1 -0
  65. package/lib/module/proving/prove.js +346 -0
  66. package/lib/module/proving/prove.js.map +1 -0
  67. package/lib/module/utils.js +27 -0
  68. package/lib/module/utils.js.map +1 -0
  69. package/lib/module/verify.js +82 -0
  70. package/lib/module/verify.js.map +1 -0
  71. package/lib/typescript/package.json +1 -0
  72. package/lib/typescript/src/NativeZcam1Capture.d.ts +280 -0
  73. package/lib/typescript/src/NativeZcam1Capture.d.ts.map +1 -0
  74. package/lib/typescript/src/NativeZcam1Sdk.d.ts +8 -0
  75. package/lib/typescript/src/NativeZcam1Sdk.d.ts.map +1 -0
  76. package/lib/typescript/src/bindings.d.ts +14 -0
  77. package/lib/typescript/src/bindings.d.ts.map +1 -0
  78. package/lib/typescript/src/camera.d.ts +300 -0
  79. package/lib/typescript/src/camera.d.ts.map +1 -0
  80. package/lib/typescript/src/capture.d.ts +59 -0
  81. package/lib/typescript/src/capture.d.ts.map +1 -0
  82. package/lib/typescript/src/common.d.ts +10 -0
  83. package/lib/typescript/src/common.d.ts.map +1 -0
  84. package/lib/typescript/src/generated/zcam1_c2pa_utils-ffi.d.ts +175 -0
  85. package/lib/typescript/src/generated/zcam1_c2pa_utils-ffi.d.ts.map +1 -0
  86. package/lib/typescript/src/generated/zcam1_c2pa_utils.d.ts +811 -0
  87. package/lib/typescript/src/generated/zcam1_c2pa_utils.d.ts.map +1 -0
  88. package/lib/typescript/src/generated/zcam1_certs_utils-ffi.d.ts +82 -0
  89. package/lib/typescript/src/generated/zcam1_certs_utils-ffi.d.ts.map +1 -0
  90. package/lib/typescript/src/generated/zcam1_certs_utils.d.ts +413 -0
  91. package/lib/typescript/src/generated/zcam1_certs_utils.d.ts.map +1 -0
  92. package/lib/typescript/src/generated/zcam1_proving_utils-ffi.d.ts +153 -0
  93. package/lib/typescript/src/generated/zcam1_proving_utils-ffi.d.ts.map +1 -0
  94. package/lib/typescript/src/generated/zcam1_proving_utils.d.ts +321 -0
  95. package/lib/typescript/src/generated/zcam1_proving_utils.d.ts.map +1 -0
  96. package/lib/typescript/src/generated/zcam1_verify_utils-ffi.d.ts +84 -0
  97. package/lib/typescript/src/generated/zcam1_verify_utils-ffi.d.ts.map +1 -0
  98. package/lib/typescript/src/generated/zcam1_verify_utils.d.ts +286 -0
  99. package/lib/typescript/src/generated/zcam1_verify_utils.d.ts.map +1 -0
  100. package/lib/typescript/src/index.d.ts +29 -0
  101. package/lib/typescript/src/index.d.ts.map +1 -0
  102. package/lib/typescript/src/picker.d.ts +103 -0
  103. package/lib/typescript/src/picker.d.ts.map +1 -0
  104. package/lib/typescript/src/proving/NativeZcam1Proving.d.ts +8 -0
  105. package/lib/typescript/src/proving/NativeZcam1Proving.d.ts.map +1 -0
  106. package/lib/typescript/src/proving/bindings.d.ts +8 -0
  107. package/lib/typescript/src/proving/bindings.d.ts.map +1 -0
  108. package/lib/typescript/src/proving/index.d.ts +3 -0
  109. package/lib/typescript/src/proving/index.d.ts.map +1 -0
  110. package/lib/typescript/src/proving/prove.d.ts +74 -0
  111. package/lib/typescript/src/proving/prove.d.ts.map +1 -0
  112. package/lib/typescript/src/utils.d.ts +2 -0
  113. package/lib/typescript/src/utils.d.ts.map +1 -0
  114. package/lib/typescript/src/verify.d.ts +45 -0
  115. package/lib/typescript/src/verify.d.ts.map +1 -0
  116. package/package.json +118 -0
  117. package/src/NativeZcam1Capture.ts +335 -0
  118. package/src/NativeZcam1Sdk.ts +10 -0
  119. package/src/bindings.tsx +49 -0
  120. package/src/camera.tsx +705 -0
  121. package/src/capture.tsx +165 -0
  122. package/src/common.tsx +46 -0
  123. package/src/generated/zcam1_c2pa_utils-ffi.ts +456 -0
  124. package/src/generated/zcam1_c2pa_utils.ts +1866 -0
  125. package/src/generated/zcam1_certs_utils-ffi.ts +187 -0
  126. package/src/generated/zcam1_certs_utils.ts +549 -0
  127. package/src/generated/zcam1_proving_utils-ffi.ts +374 -0
  128. package/src/generated/zcam1_proving_utils.ts +804 -0
  129. package/src/generated/zcam1_verify_utils-ffi.ts +196 -0
  130. package/src/generated/zcam1_verify_utils.ts +372 -0
  131. package/src/index.ts +73 -0
  132. package/src/picker.tsx +342 -0
  133. package/src/proving/NativeZcam1Proving.ts +10 -0
  134. package/src/proving/bindings.tsx +50 -0
  135. package/src/proving/index.ts +8 -0
  136. package/src/proving/prove.tsx +492 -0
  137. package/src/utils.ts +38 -0
  138. package/src/verify.tsx +119 -0
  139. package/turbo.json +27 -0
@@ -0,0 +1,1799 @@
1
+ // This file was autogenerated by some hot garbage in the
2
+ // `uniffi-bindgen-react-native` crate. Trust me, you don't want to mess with
3
+ // it!
4
+ #include "zcam1_certs_utils.hpp"
5
+
6
+ #include "UniffiJsiTypes.h"
7
+ #include <iostream>
8
+ #include <map>
9
+ #include <stdexcept>
10
+ #include <thread>
11
+ #include <utility>
12
+
13
+ namespace react = facebook::react;
14
+ namespace jsi = facebook::jsi;
15
+
16
+ // Calling into Rust.
17
+ extern "C" {
18
+ typedef void (*UniffiRustFutureContinuationCallback)(uint64_t data,
19
+ int8_t poll_result);
20
+ typedef void (*UniffiForeignFutureFree)(uint64_t handle);
21
+ typedef void (*UniffiCallbackInterfaceFree)(uint64_t handle);
22
+ typedef struct UniffiForeignFuture {
23
+ uint64_t handle;
24
+ UniffiForeignFutureFree free;
25
+ } UniffiForeignFuture;
26
+ typedef struct UniffiForeignFutureStructU8 {
27
+ uint8_t return_value;
28
+ RustCallStatus call_status;
29
+ } UniffiForeignFutureStructU8;
30
+ typedef void (*UniffiForeignFutureCompleteU8)(
31
+ uint64_t callback_data, UniffiForeignFutureStructU8 result);
32
+ typedef struct UniffiForeignFutureStructI8 {
33
+ int8_t return_value;
34
+ RustCallStatus call_status;
35
+ } UniffiForeignFutureStructI8;
36
+ typedef void (*UniffiForeignFutureCompleteI8)(
37
+ uint64_t callback_data, UniffiForeignFutureStructI8 result);
38
+ typedef struct UniffiForeignFutureStructU16 {
39
+ uint16_t return_value;
40
+ RustCallStatus call_status;
41
+ } UniffiForeignFutureStructU16;
42
+ typedef void (*UniffiForeignFutureCompleteU16)(
43
+ uint64_t callback_data, UniffiForeignFutureStructU16 result);
44
+ typedef struct UniffiForeignFutureStructI16 {
45
+ int16_t return_value;
46
+ RustCallStatus call_status;
47
+ } UniffiForeignFutureStructI16;
48
+ typedef void (*UniffiForeignFutureCompleteI16)(
49
+ uint64_t callback_data, UniffiForeignFutureStructI16 result);
50
+ typedef struct UniffiForeignFutureStructU32 {
51
+ uint32_t return_value;
52
+ RustCallStatus call_status;
53
+ } UniffiForeignFutureStructU32;
54
+ typedef void (*UniffiForeignFutureCompleteU32)(
55
+ uint64_t callback_data, UniffiForeignFutureStructU32 result);
56
+ typedef struct UniffiForeignFutureStructI32 {
57
+ int32_t return_value;
58
+ RustCallStatus call_status;
59
+ } UniffiForeignFutureStructI32;
60
+ typedef void (*UniffiForeignFutureCompleteI32)(
61
+ uint64_t callback_data, UniffiForeignFutureStructI32 result);
62
+ typedef struct UniffiForeignFutureStructU64 {
63
+ uint64_t return_value;
64
+ RustCallStatus call_status;
65
+ } UniffiForeignFutureStructU64;
66
+ typedef void (*UniffiForeignFutureCompleteU64)(
67
+ uint64_t callback_data, UniffiForeignFutureStructU64 result);
68
+ typedef struct UniffiForeignFutureStructI64 {
69
+ int64_t return_value;
70
+ RustCallStatus call_status;
71
+ } UniffiForeignFutureStructI64;
72
+ typedef void (*UniffiForeignFutureCompleteI64)(
73
+ uint64_t callback_data, UniffiForeignFutureStructI64 result);
74
+ typedef struct UniffiForeignFutureStructF32 {
75
+ float return_value;
76
+ RustCallStatus call_status;
77
+ } UniffiForeignFutureStructF32;
78
+ typedef void (*UniffiForeignFutureCompleteF32)(
79
+ uint64_t callback_data, UniffiForeignFutureStructF32 result);
80
+ typedef struct UniffiForeignFutureStructF64 {
81
+ double return_value;
82
+ RustCallStatus call_status;
83
+ } UniffiForeignFutureStructF64;
84
+ typedef void (*UniffiForeignFutureCompleteF64)(
85
+ uint64_t callback_data, UniffiForeignFutureStructF64 result);
86
+ typedef struct UniffiForeignFutureStructPointer {
87
+ void *return_value;
88
+ RustCallStatus call_status;
89
+ } UniffiForeignFutureStructPointer;
90
+ typedef void (*UniffiForeignFutureCompletePointer)(
91
+ uint64_t callback_data, UniffiForeignFutureStructPointer result);
92
+ typedef struct UniffiForeignFutureStructRustBuffer {
93
+ RustBuffer return_value;
94
+ RustCallStatus call_status;
95
+ } UniffiForeignFutureStructRustBuffer;
96
+ typedef void (*UniffiForeignFutureCompleteRustBuffer)(
97
+ uint64_t callback_data, UniffiForeignFutureStructRustBuffer result);
98
+ typedef struct UniffiForeignFutureStructVoid {
99
+ RustCallStatus call_status;
100
+ } UniffiForeignFutureStructVoid;
101
+ typedef void (*UniffiForeignFutureCompleteVoid)(
102
+ uint64_t callback_data, UniffiForeignFutureStructVoid result);
103
+ RustBuffer uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate(
104
+ RustBuffer leaf_jwk, RustBuffer cert_chain_params,
105
+ RustCallStatus *uniffi_out_err);
106
+ RustBuffer
107
+ ffi_zcam1_certs_utils_rustbuffer_alloc(uint64_t size,
108
+ RustCallStatus *uniffi_out_err);
109
+ RustBuffer
110
+ ffi_zcam1_certs_utils_rustbuffer_from_bytes(ForeignBytes bytes,
111
+ RustCallStatus *uniffi_out_err);
112
+ void ffi_zcam1_certs_utils_rustbuffer_free(RustBuffer buf,
113
+ RustCallStatus *uniffi_out_err);
114
+ RustBuffer
115
+ ffi_zcam1_certs_utils_rustbuffer_reserve(RustBuffer buf, uint64_t additional,
116
+ RustCallStatus *uniffi_out_err);
117
+ void ffi_zcam1_certs_utils_rust_future_poll_u8(
118
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
119
+ /*handle*/ uint64_t callback_data);
120
+ void ffi_zcam1_certs_utils_rust_future_cancel_u8(
121
+ /*handle*/ uint64_t handle);
122
+ void ffi_zcam1_certs_utils_rust_future_free_u8(
123
+ /*handle*/ uint64_t handle);
124
+ uint8_t ffi_zcam1_certs_utils_rust_future_complete_u8(
125
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
126
+ void ffi_zcam1_certs_utils_rust_future_poll_i8(
127
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
128
+ /*handle*/ uint64_t callback_data);
129
+ void ffi_zcam1_certs_utils_rust_future_cancel_i8(
130
+ /*handle*/ uint64_t handle);
131
+ void ffi_zcam1_certs_utils_rust_future_free_i8(
132
+ /*handle*/ uint64_t handle);
133
+ int8_t ffi_zcam1_certs_utils_rust_future_complete_i8(
134
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
135
+ void ffi_zcam1_certs_utils_rust_future_poll_u16(
136
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
137
+ /*handle*/ uint64_t callback_data);
138
+ void ffi_zcam1_certs_utils_rust_future_cancel_u16(
139
+ /*handle*/ uint64_t handle);
140
+ void ffi_zcam1_certs_utils_rust_future_free_u16(
141
+ /*handle*/ uint64_t handle);
142
+ uint16_t ffi_zcam1_certs_utils_rust_future_complete_u16(
143
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
144
+ void ffi_zcam1_certs_utils_rust_future_poll_i16(
145
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
146
+ /*handle*/ uint64_t callback_data);
147
+ void ffi_zcam1_certs_utils_rust_future_cancel_i16(
148
+ /*handle*/ uint64_t handle);
149
+ void ffi_zcam1_certs_utils_rust_future_free_i16(
150
+ /*handle*/ uint64_t handle);
151
+ int16_t ffi_zcam1_certs_utils_rust_future_complete_i16(
152
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
153
+ void ffi_zcam1_certs_utils_rust_future_poll_u32(
154
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
155
+ /*handle*/ uint64_t callback_data);
156
+ void ffi_zcam1_certs_utils_rust_future_cancel_u32(
157
+ /*handle*/ uint64_t handle);
158
+ void ffi_zcam1_certs_utils_rust_future_free_u32(
159
+ /*handle*/ uint64_t handle);
160
+ uint32_t ffi_zcam1_certs_utils_rust_future_complete_u32(
161
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
162
+ void ffi_zcam1_certs_utils_rust_future_poll_i32(
163
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
164
+ /*handle*/ uint64_t callback_data);
165
+ void ffi_zcam1_certs_utils_rust_future_cancel_i32(
166
+ /*handle*/ uint64_t handle);
167
+ void ffi_zcam1_certs_utils_rust_future_free_i32(
168
+ /*handle*/ uint64_t handle);
169
+ int32_t ffi_zcam1_certs_utils_rust_future_complete_i32(
170
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
171
+ void ffi_zcam1_certs_utils_rust_future_poll_u64(
172
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
173
+ /*handle*/ uint64_t callback_data);
174
+ void ffi_zcam1_certs_utils_rust_future_cancel_u64(
175
+ /*handle*/ uint64_t handle);
176
+ void ffi_zcam1_certs_utils_rust_future_free_u64(
177
+ /*handle*/ uint64_t handle);
178
+ uint64_t ffi_zcam1_certs_utils_rust_future_complete_u64(
179
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
180
+ void ffi_zcam1_certs_utils_rust_future_poll_i64(
181
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
182
+ /*handle*/ uint64_t callback_data);
183
+ void ffi_zcam1_certs_utils_rust_future_cancel_i64(
184
+ /*handle*/ uint64_t handle);
185
+ void ffi_zcam1_certs_utils_rust_future_free_i64(
186
+ /*handle*/ uint64_t handle);
187
+ int64_t ffi_zcam1_certs_utils_rust_future_complete_i64(
188
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
189
+ void ffi_zcam1_certs_utils_rust_future_poll_f32(
190
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
191
+ /*handle*/ uint64_t callback_data);
192
+ void ffi_zcam1_certs_utils_rust_future_cancel_f32(
193
+ /*handle*/ uint64_t handle);
194
+ void ffi_zcam1_certs_utils_rust_future_free_f32(
195
+ /*handle*/ uint64_t handle);
196
+ float ffi_zcam1_certs_utils_rust_future_complete_f32(
197
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
198
+ void ffi_zcam1_certs_utils_rust_future_poll_f64(
199
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
200
+ /*handle*/ uint64_t callback_data);
201
+ void ffi_zcam1_certs_utils_rust_future_cancel_f64(
202
+ /*handle*/ uint64_t handle);
203
+ void ffi_zcam1_certs_utils_rust_future_free_f64(
204
+ /*handle*/ uint64_t handle);
205
+ double ffi_zcam1_certs_utils_rust_future_complete_f64(
206
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
207
+ void ffi_zcam1_certs_utils_rust_future_poll_pointer(
208
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
209
+ /*handle*/ uint64_t callback_data);
210
+ void ffi_zcam1_certs_utils_rust_future_cancel_pointer(
211
+ /*handle*/ uint64_t handle);
212
+ void ffi_zcam1_certs_utils_rust_future_free_pointer(
213
+ /*handle*/ uint64_t handle);
214
+ void *ffi_zcam1_certs_utils_rust_future_complete_pointer(
215
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
216
+ void ffi_zcam1_certs_utils_rust_future_poll_rust_buffer(
217
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
218
+ /*handle*/ uint64_t callback_data);
219
+ void ffi_zcam1_certs_utils_rust_future_cancel_rust_buffer(
220
+ /*handle*/ uint64_t handle);
221
+ void ffi_zcam1_certs_utils_rust_future_free_rust_buffer(
222
+ /*handle*/ uint64_t handle);
223
+ RustBuffer ffi_zcam1_certs_utils_rust_future_complete_rust_buffer(
224
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
225
+ void ffi_zcam1_certs_utils_rust_future_poll_void(
226
+ /*handle*/ uint64_t handle, UniffiRustFutureContinuationCallback callback,
227
+ /*handle*/ uint64_t callback_data);
228
+ void ffi_zcam1_certs_utils_rust_future_cancel_void(
229
+ /*handle*/ uint64_t handle);
230
+ void ffi_zcam1_certs_utils_rust_future_free_void(
231
+ /*handle*/ uint64_t handle);
232
+ void ffi_zcam1_certs_utils_rust_future_complete_void(
233
+ /*handle*/ uint64_t handle, RustCallStatus *uniffi_out_err);
234
+ uint16_t uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate();
235
+ uint32_t ffi_zcam1_certs_utils_uniffi_contract_version();
236
+ }
237
+
238
+ namespace uniffi::zcam1_certs_utils {
239
+ template <typename T> struct Bridging;
240
+
241
+ using namespace facebook;
242
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
243
+
244
+ template <typename T> struct Bridging<ReferenceHolder<T>> {
245
+ static jsi::Value jsNew(jsi::Runtime &rt) {
246
+ auto holder = jsi::Object(rt);
247
+ return holder;
248
+ }
249
+ static T fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
250
+ const jsi::Value &value) {
251
+ auto obj = value.asObject(rt);
252
+ if (obj.hasProperty(rt, "pointee")) {
253
+ auto pointee = obj.getProperty(rt, "pointee");
254
+ return uniffi::zcam1_certs_utils::Bridging<T>::fromJs(rt, callInvoker,
255
+ pointee);
256
+ }
257
+ throw jsi::JSError(rt,
258
+ "Expected ReferenceHolder to have a pointee property. "
259
+ "This is likely a bug in uniffi-bindgen-react-native");
260
+ }
261
+ };
262
+ } // namespace uniffi::zcam1_certs_utils
263
+ namespace uniffi::zcam1_certs_utils {
264
+ using namespace facebook;
265
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
266
+
267
+ template <> struct Bridging<RustBuffer> {
268
+ static RustBuffer rustbuffer_alloc(int32_t size) {
269
+ RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
270
+ return ffi_zcam1_certs_utils_rustbuffer_alloc(size, &status);
271
+ }
272
+
273
+ static void rustbuffer_free(RustBuffer buf) {
274
+ RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
275
+ ffi_zcam1_certs_utils_rustbuffer_free(buf, &status);
276
+ }
277
+
278
+ static RustBuffer rustbuffer_from_bytes(ForeignBytes bytes) {
279
+ RustCallStatus status = {UNIFFI_CALL_STATUS_OK};
280
+ return ffi_zcam1_certs_utils_rustbuffer_from_bytes(bytes, &status);
281
+ }
282
+
283
+ static RustBuffer fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
284
+ const jsi::Value &value) {
285
+ try {
286
+ auto buffer =
287
+ uniffi_jsi::Bridging<jsi::ArrayBuffer>::value_to_arraybuffer(rt,
288
+ value);
289
+ auto bytes = ForeignBytes{
290
+ .len = static_cast<int32_t>(buffer.length(rt)),
291
+ .data = buffer.data(rt),
292
+ };
293
+
294
+ // This buffer is constructed from foreign bytes. Rust scaffolding copies
295
+ // the bytes, to make the RustBuffer.
296
+ auto buf = rustbuffer_from_bytes(bytes);
297
+ // Once it leaves this function, the buffer is immediately passed back
298
+ // into Rust, where it's used to deserialize into the Rust versions of the
299
+ // arguments. At that point, the copy is destroyed.
300
+ return buf;
301
+ } catch (const std::logic_error &e) {
302
+ throw jsi::JSError(rt, e.what());
303
+ }
304
+ }
305
+
306
+ static jsi::Value toJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker>,
307
+ RustBuffer buf) {
308
+ // We need to make a copy of the bytes from Rust's memory space into
309
+ // Javascripts memory space. We need to do this because the two languages
310
+ // manages memory very differently: a garbage collector needs to track all
311
+ // the memory at runtime, Rust is doing it all closer to compile time.
312
+ uint8_t *bytes = new uint8_t[buf.len];
313
+ std::memcpy(bytes, buf.data, buf.len);
314
+
315
+ // Construct an ArrayBuffer with copy of the bytes from the RustBuffer.
316
+ auto payload = std::make_shared<uniffi_jsi::CMutableBuffer>(
317
+ uniffi_jsi::CMutableBuffer((uint8_t *)bytes, buf.len));
318
+ auto arrayBuffer = jsi::ArrayBuffer(rt, payload);
319
+
320
+ // Once we have a Javascript version, we no longer need the Rust version, so
321
+ // we can call into Rust to tell it it's okay to free that memory.
322
+ rustbuffer_free(buf);
323
+
324
+ // Finally, return the ArrayBuffer.
325
+ return uniffi_jsi::Bridging<jsi::ArrayBuffer>::arraybuffer_to_value(
326
+ rt, arrayBuffer);
327
+ ;
328
+ }
329
+ };
330
+
331
+ } // namespace uniffi::zcam1_certs_utils
332
+
333
+ namespace uniffi::zcam1_certs_utils {
334
+ using namespace facebook;
335
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
336
+
337
+ template <> struct Bridging<RustCallStatus> {
338
+ static jsi::Value jsSuccess(jsi::Runtime &rt) {
339
+ auto statusObject = jsi::Object(rt);
340
+ statusObject.setProperty(rt, "code", jsi::Value(rt, UNIFFI_CALL_STATUS_OK));
341
+ return statusObject;
342
+ }
343
+ static RustCallStatus rustSuccess(jsi::Runtime &rt) {
344
+ return {UNIFFI_CALL_STATUS_OK};
345
+ }
346
+ static void copyIntoJs(jsi::Runtime &rt,
347
+ std::shared_ptr<CallInvoker> callInvoker,
348
+ const RustCallStatus status,
349
+ const jsi::Value &jsStatus) {
350
+ auto statusObject = jsStatus.asObject(rt);
351
+ if (status.error_buf.data != nullptr) {
352
+ auto rbuf = Bridging<RustBuffer>::toJs(rt, callInvoker, status.error_buf);
353
+ statusObject.setProperty(rt, "errorBuf", rbuf);
354
+ }
355
+ if (status.code != UNIFFI_CALL_STATUS_OK) {
356
+ auto code =
357
+ uniffi_jsi::Bridging<uint8_t>::toJs(rt, callInvoker, status.code);
358
+ statusObject.setProperty(rt, "code", code);
359
+ }
360
+ }
361
+
362
+ static RustCallStatus fromJs(jsi::Runtime &rt,
363
+ std::shared_ptr<CallInvoker> invoker,
364
+ const jsi::Value &jsStatus) {
365
+ RustCallStatus status;
366
+ auto statusObject = jsStatus.asObject(rt);
367
+ if (statusObject.hasProperty(rt, "errorBuf")) {
368
+ auto rbuf = statusObject.getProperty(rt, "errorBuf");
369
+ status.error_buf = Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
370
+ }
371
+ if (statusObject.hasProperty(rt, "code")) {
372
+ auto code = statusObject.getProperty(rt, "code");
373
+ status.code = uniffi_jsi::Bridging<uint8_t>::fromJs(rt, invoker, code);
374
+ }
375
+ return status;
376
+ }
377
+
378
+ static void copyFromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> invoker,
379
+ const jsi::Value &jsStatus, RustCallStatus *status) {
380
+ auto statusObject = jsStatus.asObject(rt);
381
+ if (statusObject.hasProperty(rt, "errorBuf")) {
382
+ auto rbuf = statusObject.getProperty(rt, "errorBuf");
383
+ status->error_buf = Bridging<RustBuffer>::fromJs(rt, invoker, rbuf);
384
+ }
385
+ if (statusObject.hasProperty(rt, "code")) {
386
+ auto code = statusObject.getProperty(rt, "code");
387
+ status->code = uniffi_jsi::Bridging<uint8_t>::fromJs(rt, invoker, code);
388
+ }
389
+ }
390
+ };
391
+
392
+ } // namespace uniffi::zcam1_certs_utils
393
+ // In other uniffi bindings, it is assumed that the foreign language holds on
394
+ // to the vtable, which the Rust just gets a pointer to.
395
+ // Here, we need to hold on to them, but also be able to clear them at just the
396
+ // right time so we can support hot-reloading.
397
+ namespace uniffi::zcam1_certs_utils::registry {
398
+ template <typename T> class VTableHolder {
399
+ public:
400
+ T vtable;
401
+ VTableHolder(T v) : vtable(v) {}
402
+ };
403
+
404
+ // Mutex to bind the storage and setting of vtable together.
405
+ // We declare it here, but the lock is taken by callers of the putTable
406
+ // method who are also sending a pointer to Rust.
407
+ static std::mutex vtableMutex;
408
+
409
+ // Registry to hold all vtables so they persist even when JS objects are GC'd.
410
+ // The only reason this exists is to prevent a dangling pointer in the
411
+ // Rust machinery: i.e. we don't need to access or write to this registry
412
+ // after startup.
413
+ // Registry to hold all vtables so they persist even when JS objects are GC'd.
414
+ // Maps string identifiers to vtable holders using type erasure
415
+ static std::unordered_map<std::string, std::shared_ptr<void>> vtableRegistry;
416
+
417
+ // Add a vtable to the registry with an identifier
418
+ template <typename T>
419
+ static T *putTable(std::string_view identifier, T vtable) {
420
+ auto holder = std::make_shared<VTableHolder<T>>(vtable);
421
+ // Store the raw pointer to the vtable before type erasure
422
+ T *rawPtr = &(holder->vtable);
423
+ // Store the holder using type erasure with the string identifier
424
+ vtableRegistry[std::string(identifier)] = std::shared_ptr<void>(holder);
425
+ return rawPtr;
426
+ }
427
+
428
+ // Clear the registry.
429
+ //
430
+ // Conceptually, this is called after teardown of the module (i.e. after
431
+ // teardown of the jsi::Runtime). However, because Rust is dropping callbacks
432
+ // because the Runtime is being torn down, we must keep the registry intact
433
+ // until after the runtime goes away.
434
+ //
435
+ // Therefore, in practice we should call this when the next runtime is
436
+ // being stood up.
437
+ static void clearRegistry() {
438
+ std::lock_guard<std::mutex> lock(vtableMutex);
439
+ vtableRegistry.clear();
440
+ }
441
+ } // namespace uniffi::zcam1_certs_utils::registry
442
+
443
+ // This calls into Rust.
444
+ // Implementation of callback function calling from Rust to JS
445
+ // RustFutureContinuationCallback
446
+
447
+ // Callback function:
448
+ // uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback::UniffiRustFutureContinuationCallback
449
+ //
450
+ // We have the following constraints:
451
+ // - we need to pass a function pointer to Rust.
452
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
453
+ // - function pointers can't store state, so we can't use a lamda.
454
+ //
455
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
456
+ // function calls the lambda, which itself calls the `body` which then calls
457
+ // into JS.
458
+ //
459
+ // We then give the `callback` function pointer to Rust which will call the
460
+ // lambda sometime in the future.
461
+ namespace uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback {
462
+ using namespace facebook;
463
+
464
+ // We need to store a lambda in a global so we can call it from
465
+ // a function pointer. The function pointer is passed to Rust.
466
+ static std::function<void(uint64_t, int8_t)> rsLambda = nullptr;
467
+
468
+ // This is the main body of the callback. It's called from the lambda,
469
+ // which itself is called from the callback function which is passed to Rust.
470
+ static void body(jsi::Runtime &rt,
471
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
472
+ std::shared_ptr<jsi::Value> callbackValue, uint64_t rs_data,
473
+ int8_t rs_pollResult) {
474
+
475
+ // Convert the arguments from Rust, into jsi::Values.
476
+ // We'll use the Bridging class to do this…
477
+ auto js_data = uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_data);
478
+ auto js_pollResult =
479
+ uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, rs_pollResult);
480
+
481
+ // Now we are ready to call the callback.
482
+ // We are already on the JS thread, because this `body` function was
483
+ // invoked from the CallInvoker.
484
+ try {
485
+ // Getting the callback function
486
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
487
+ auto uniffiResult = cb.call(rt, js_data, js_pollResult);
488
+
489
+ } catch (const jsi::JSError &error) {
490
+ std::cout << "Error in callback UniffiRustFutureContinuationCallback: "
491
+ << error.what() << std::endl;
492
+ throw error;
493
+ }
494
+ }
495
+
496
+ static void callback(uint64_t rs_data, int8_t rs_pollResult) {
497
+ // If the runtime has shutdown, then there is no point in trying to
498
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
499
+ //
500
+ // Answer: the module destructor calls into callback `cleanup` method,
501
+ // which nulls out the rsLamda.
502
+ //
503
+ // If rsLamda is null, then there is no runtime to call into.
504
+ if (rsLambda == nullptr) {
505
+ // This only occurs when destructors are calling into Rust free/drop,
506
+ // which causes the JS callback to be dropped.
507
+ return;
508
+ }
509
+
510
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
511
+ // are all in the lambda.
512
+ rsLambda(rs_data, rs_pollResult);
513
+ }
514
+
515
+ static UniffiRustFutureContinuationCallback
516
+ makeCallbackFunction( // uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback
517
+ jsi::Runtime &rt,
518
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
519
+ const jsi::Value &value) {
520
+ if (rsLambda != nullptr) {
521
+ // `makeCallbackFunction` is called in two circumstances:
522
+ //
523
+ // 1. at startup, when initializing callback interface vtables.
524
+ // 2. when polling futures. This happens at least once per future that is
525
+ // exposed to Javascript. We know that this is always the same function,
526
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
527
+ //
528
+ // We can therefore return the callback function without making anything
529
+ // new if we've been initialized already.
530
+ return callback;
531
+ }
532
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
533
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
534
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_data,
535
+ int8_t rs_pollResult) {
536
+ // We immediately make a lambda which will do the work of transforming the
537
+ // arguments into JSI values and calling the callback.
538
+ uniffi_runtime::UniffiCallFunc jsLambda =
539
+ [callInvoker, callbackValue, rs_data,
540
+ rs_pollResult](jsi::Runtime &rt) mutable {
541
+ body(rt, callInvoker, callbackValue, rs_data, rs_pollResult);
542
+ };
543
+ // We'll then call that lambda from the callInvoker which will
544
+ // look after calling it on the correct thread.
545
+
546
+ callInvoker->invokeNonBlocking(rt, jsLambda);
547
+ };
548
+ return callback;
549
+ }
550
+
551
+ // This method is called from the destructor of NativeZcam1CertsUtils, which
552
+ // only happens when the jsi::Runtime is being destroyed.
553
+ static void cleanup() {
554
+ // The lambda holds a reference to the the Runtime, so when this is nulled
555
+ // out, then the pointer will no longer be left dangling.
556
+ rsLambda = nullptr;
557
+ }
558
+ } // namespace uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback
559
+ // Implementation of callback function calling from JS to Rust
560
+ // ForeignFutureFree, passed from Rust to JS as part of async callbacks.
561
+ namespace uniffi::zcam1_certs_utils {
562
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
563
+
564
+ template <> struct Bridging<UniffiForeignFutureFree> {
565
+ static jsi::Value toJs(jsi::Runtime &rt,
566
+ std::shared_ptr<CallInvoker> callInvoker,
567
+ UniffiForeignFutureFree rsCallback) {
568
+ return jsi::Function::createFromHostFunction(
569
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureFree"), 1,
570
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
571
+ const jsi::Value *arguments,
572
+ size_t count) -> jsi::Value {
573
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
574
+ rsCallback);
575
+ });
576
+ }
577
+
578
+ static jsi::Value intoRust(jsi::Runtime &rt,
579
+ std::shared_ptr<CallInvoker> callInvoker,
580
+ const jsi::Value &thisValue,
581
+ const jsi::Value *args, size_t count,
582
+ UniffiForeignFutureFree func) {
583
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
584
+ // then call the rs_callback with those arguments.
585
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]));
586
+
587
+ return jsi::Value::undefined();
588
+ }
589
+ };
590
+ } // namespace uniffi::zcam1_certs_utils
591
+ // Implementation of free callback function CallbackInterfaceFree
592
+
593
+ // Callback function:
594
+ // uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free::UniffiCallbackInterfaceFree
595
+ //
596
+ // We have the following constraints:
597
+ // - we need to pass a function pointer to Rust.
598
+ // - we need a jsi::Runtime and jsi::Function to call into JS.
599
+ // - function pointers can't store state, so we can't use a lamda.
600
+ //
601
+ // For this, we store a lambda as a global, as `rsLambda`. The `callback`
602
+ // function calls the lambda, which itself calls the `body` which then calls
603
+ // into JS.
604
+ //
605
+ // We then give the `callback` function pointer to Rust which will call the
606
+ // lambda sometime in the future.
607
+ namespace uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free {
608
+ using namespace facebook;
609
+
610
+ // We need to store a lambda in a global so we can call it from
611
+ // a function pointer. The function pointer is passed to Rust.
612
+ static std::function<void(uint64_t)> rsLambda = nullptr;
613
+
614
+ // This is the main body of the callback. It's called from the lambda,
615
+ // which itself is called from the callback function which is passed to Rust.
616
+ static void body(jsi::Runtime &rt,
617
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
618
+ std::shared_ptr<jsi::Value> callbackValue,
619
+ uint64_t rs_handle) {
620
+
621
+ // Convert the arguments from Rust, into jsi::Values.
622
+ // We'll use the Bridging class to do this…
623
+ auto js_handle =
624
+ uniffi_jsi::Bridging<uint64_t>::toJs(rt, callInvoker, rs_handle);
625
+
626
+ // Now we are ready to call the callback.
627
+ // We are already on the JS thread, because this `body` function was
628
+ // invoked from the CallInvoker.
629
+ try {
630
+ // Getting the callback function
631
+ auto cb = callbackValue->asObject(rt).asFunction(rt);
632
+ auto uniffiResult = cb.call(rt, js_handle);
633
+
634
+ } catch (const jsi::JSError &error) {
635
+ std::cout << "Error in callback UniffiCallbackInterfaceFree: "
636
+ << error.what() << std::endl;
637
+ throw error;
638
+ }
639
+ }
640
+
641
+ static void callback(uint64_t rs_handle) {
642
+ // If the runtime has shutdown, then there is no point in trying to
643
+ // call into Javascript. BUT how do we tell if the runtime has shutdown?
644
+ //
645
+ // Answer: the module destructor calls into callback `cleanup` method,
646
+ // which nulls out the rsLamda.
647
+ //
648
+ // If rsLamda is null, then there is no runtime to call into.
649
+ if (rsLambda == nullptr) {
650
+ // This only occurs when destructors are calling into Rust free/drop,
651
+ // which causes the JS callback to be dropped.
652
+ return;
653
+ }
654
+
655
+ // The runtime, the actual callback jsi::funtion, and the callInvoker
656
+ // are all in the lambda.
657
+ rsLambda(rs_handle);
658
+ }
659
+
660
+ static UniffiCallbackInterfaceFree
661
+ makeCallbackFunction( // uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free
662
+ jsi::Runtime &rt,
663
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker,
664
+ const jsi::Value &value) {
665
+ if (rsLambda != nullptr) {
666
+ // `makeCallbackFunction` is called in two circumstances:
667
+ //
668
+ // 1. at startup, when initializing callback interface vtables.
669
+ // 2. when polling futures. This happens at least once per future that is
670
+ // exposed to Javascript. We know that this is always the same function,
671
+ // `uniffiFutureContinuationCallback` in `async-rust-calls.ts`.
672
+ //
673
+ // We can therefore return the callback function without making anything
674
+ // new if we've been initialized already.
675
+ return callback;
676
+ }
677
+ auto callbackFunction = value.asObject(rt).asFunction(rt);
678
+ auto callbackValue = std::make_shared<jsi::Value>(rt, callbackFunction);
679
+ rsLambda = [&rt, callInvoker, callbackValue](uint64_t rs_handle) {
680
+ // We immediately make a lambda which will do the work of transforming the
681
+ // arguments into JSI values and calling the callback.
682
+ uniffi_runtime::UniffiCallFunc jsLambda =
683
+ [callInvoker, callbackValue, rs_handle](jsi::Runtime &rt) mutable {
684
+ body(rt, callInvoker, callbackValue, rs_handle);
685
+ };
686
+ // We'll then call that lambda from the callInvoker which will
687
+ // look after calling it on the correct thread.
688
+
689
+ callInvoker->invokeNonBlocking(rt, jsLambda);
690
+ };
691
+ return callback;
692
+ }
693
+
694
+ // This method is called from the destructor of NativeZcam1CertsUtils, which
695
+ // only happens when the jsi::Runtime is being destroyed.
696
+ static void cleanup() {
697
+ // The lambda holds a reference to the the Runtime, so when this is nulled
698
+ // out, then the pointer will no longer be left dangling.
699
+ rsLambda = nullptr;
700
+ }
701
+ } // namespace uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free
702
+ namespace uniffi::zcam1_certs_utils {
703
+ using namespace facebook;
704
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
705
+
706
+ template <> struct Bridging<UniffiForeignFuture> {
707
+ static UniffiForeignFuture fromJs(jsi::Runtime &rt,
708
+ std::shared_ptr<CallInvoker> callInvoker,
709
+ const jsi::Value &jsValue) {
710
+ // Check if the input is an object
711
+ if (!jsValue.isObject()) {
712
+ throw jsi::JSError(rt, "Expected an object for UniffiForeignFuture");
713
+ }
714
+
715
+ // Get the object from the jsi::Value
716
+ auto jsObject = jsValue.getObject(rt);
717
+
718
+ // Create the vtable struct
719
+ UniffiForeignFuture rsObject;
720
+
721
+ // Create the vtable from the js callbacks.
722
+ rsObject.handle = uniffi_jsi::Bridging<uint64_t>::fromJs(
723
+ rt, callInvoker, jsObject.getProperty(rt, "handle"));
724
+ rsObject.free = uniffi::zcam1_certs_utils::st::foreignfuture::
725
+ foreignfuture::free::makeCallbackFunction(
726
+ rt, callInvoker, jsObject.getProperty(rt, "free"));
727
+
728
+ return rsObject;
729
+ }
730
+ };
731
+
732
+ } // namespace uniffi::zcam1_certs_utils
733
+ namespace uniffi::zcam1_certs_utils {
734
+ using namespace facebook;
735
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
736
+
737
+ template <> struct Bridging<UniffiForeignFutureStructU8> {
738
+ static UniffiForeignFutureStructU8
739
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
740
+ const jsi::Value &jsValue) {
741
+ // Check if the input is an object
742
+ if (!jsValue.isObject()) {
743
+ throw jsi::JSError(rt,
744
+ "Expected an object for UniffiForeignFutureStructU8");
745
+ }
746
+
747
+ // Get the object from the jsi::Value
748
+ auto jsObject = jsValue.getObject(rt);
749
+
750
+ // Create the vtable struct
751
+ UniffiForeignFutureStructU8 rsObject;
752
+
753
+ // Create the vtable from the js callbacks.
754
+ rsObject.return_value = uniffi_jsi::Bridging<uint8_t>::fromJs(
755
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
756
+ rsObject.call_status =
757
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
758
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
759
+
760
+ return rsObject;
761
+ }
762
+ };
763
+
764
+ } // namespace uniffi::zcam1_certs_utils
765
+ // Implementation of callback function calling from JS to Rust
766
+ // ForeignFutureCompleteU8, passed from Rust to JS as part of async callbacks.
767
+ namespace uniffi::zcam1_certs_utils {
768
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
769
+
770
+ template <> struct Bridging<UniffiForeignFutureCompleteU8> {
771
+ static jsi::Value toJs(jsi::Runtime &rt,
772
+ std::shared_ptr<CallInvoker> callInvoker,
773
+ UniffiForeignFutureCompleteU8 rsCallback) {
774
+ return jsi::Function::createFromHostFunction(
775
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU8"), 2,
776
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
777
+ const jsi::Value *arguments,
778
+ size_t count) -> jsi::Value {
779
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
780
+ rsCallback);
781
+ });
782
+ }
783
+
784
+ static jsi::Value intoRust(jsi::Runtime &rt,
785
+ std::shared_ptr<CallInvoker> callInvoker,
786
+ const jsi::Value &thisValue,
787
+ const jsi::Value *args, size_t count,
788
+ UniffiForeignFutureCompleteU8 func) {
789
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
790
+ // then call the rs_callback with those arguments.
791
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
792
+ uniffi::zcam1_certs_utils::Bridging<
793
+ UniffiForeignFutureStructU8>::fromJs(rt, callInvoker, args[1]));
794
+
795
+ return jsi::Value::undefined();
796
+ }
797
+ };
798
+ } // namespace uniffi::zcam1_certs_utils
799
+ namespace uniffi::zcam1_certs_utils {
800
+ using namespace facebook;
801
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
802
+
803
+ template <> struct Bridging<UniffiForeignFutureStructI8> {
804
+ static UniffiForeignFutureStructI8
805
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
806
+ const jsi::Value &jsValue) {
807
+ // Check if the input is an object
808
+ if (!jsValue.isObject()) {
809
+ throw jsi::JSError(rt,
810
+ "Expected an object for UniffiForeignFutureStructI8");
811
+ }
812
+
813
+ // Get the object from the jsi::Value
814
+ auto jsObject = jsValue.getObject(rt);
815
+
816
+ // Create the vtable struct
817
+ UniffiForeignFutureStructI8 rsObject;
818
+
819
+ // Create the vtable from the js callbacks.
820
+ rsObject.return_value = uniffi_jsi::Bridging<int8_t>::fromJs(
821
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
822
+ rsObject.call_status =
823
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
824
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
825
+
826
+ return rsObject;
827
+ }
828
+ };
829
+
830
+ } // namespace uniffi::zcam1_certs_utils
831
+ // Implementation of callback function calling from JS to Rust
832
+ // ForeignFutureCompleteI8, passed from Rust to JS as part of async callbacks.
833
+ namespace uniffi::zcam1_certs_utils {
834
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
835
+
836
+ template <> struct Bridging<UniffiForeignFutureCompleteI8> {
837
+ static jsi::Value toJs(jsi::Runtime &rt,
838
+ std::shared_ptr<CallInvoker> callInvoker,
839
+ UniffiForeignFutureCompleteI8 rsCallback) {
840
+ return jsi::Function::createFromHostFunction(
841
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI8"), 2,
842
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
843
+ const jsi::Value *arguments,
844
+ size_t count) -> jsi::Value {
845
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
846
+ rsCallback);
847
+ });
848
+ }
849
+
850
+ static jsi::Value intoRust(jsi::Runtime &rt,
851
+ std::shared_ptr<CallInvoker> callInvoker,
852
+ const jsi::Value &thisValue,
853
+ const jsi::Value *args, size_t count,
854
+ UniffiForeignFutureCompleteI8 func) {
855
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
856
+ // then call the rs_callback with those arguments.
857
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
858
+ uniffi::zcam1_certs_utils::Bridging<
859
+ UniffiForeignFutureStructI8>::fromJs(rt, callInvoker, args[1]));
860
+
861
+ return jsi::Value::undefined();
862
+ }
863
+ };
864
+ } // namespace uniffi::zcam1_certs_utils
865
+ namespace uniffi::zcam1_certs_utils {
866
+ using namespace facebook;
867
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
868
+
869
+ template <> struct Bridging<UniffiForeignFutureStructU16> {
870
+ static UniffiForeignFutureStructU16
871
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
872
+ const jsi::Value &jsValue) {
873
+ // Check if the input is an object
874
+ if (!jsValue.isObject()) {
875
+ throw jsi::JSError(rt,
876
+ "Expected an object for UniffiForeignFutureStructU16");
877
+ }
878
+
879
+ // Get the object from the jsi::Value
880
+ auto jsObject = jsValue.getObject(rt);
881
+
882
+ // Create the vtable struct
883
+ UniffiForeignFutureStructU16 rsObject;
884
+
885
+ // Create the vtable from the js callbacks.
886
+ rsObject.return_value = uniffi_jsi::Bridging<uint16_t>::fromJs(
887
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
888
+ rsObject.call_status =
889
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
890
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
891
+
892
+ return rsObject;
893
+ }
894
+ };
895
+
896
+ } // namespace uniffi::zcam1_certs_utils
897
+ // Implementation of callback function calling from JS to Rust
898
+ // ForeignFutureCompleteU16, passed from Rust to JS as part of async
899
+ // callbacks.
900
+ namespace uniffi::zcam1_certs_utils {
901
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
902
+
903
+ template <> struct Bridging<UniffiForeignFutureCompleteU16> {
904
+ static jsi::Value toJs(jsi::Runtime &rt,
905
+ std::shared_ptr<CallInvoker> callInvoker,
906
+ UniffiForeignFutureCompleteU16 rsCallback) {
907
+ return jsi::Function::createFromHostFunction(
908
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU16"), 2,
909
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
910
+ const jsi::Value *arguments,
911
+ size_t count) -> jsi::Value {
912
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
913
+ rsCallback);
914
+ });
915
+ }
916
+
917
+ static jsi::Value intoRust(jsi::Runtime &rt,
918
+ std::shared_ptr<CallInvoker> callInvoker,
919
+ const jsi::Value &thisValue,
920
+ const jsi::Value *args, size_t count,
921
+ UniffiForeignFutureCompleteU16 func) {
922
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
923
+ // then call the rs_callback with those arguments.
924
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
925
+ uniffi::zcam1_certs_utils::Bridging<
926
+ UniffiForeignFutureStructU16>::fromJs(rt, callInvoker, args[1]));
927
+
928
+ return jsi::Value::undefined();
929
+ }
930
+ };
931
+ } // namespace uniffi::zcam1_certs_utils
932
+ namespace uniffi::zcam1_certs_utils {
933
+ using namespace facebook;
934
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
935
+
936
+ template <> struct Bridging<UniffiForeignFutureStructI16> {
937
+ static UniffiForeignFutureStructI16
938
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
939
+ const jsi::Value &jsValue) {
940
+ // Check if the input is an object
941
+ if (!jsValue.isObject()) {
942
+ throw jsi::JSError(rt,
943
+ "Expected an object for UniffiForeignFutureStructI16");
944
+ }
945
+
946
+ // Get the object from the jsi::Value
947
+ auto jsObject = jsValue.getObject(rt);
948
+
949
+ // Create the vtable struct
950
+ UniffiForeignFutureStructI16 rsObject;
951
+
952
+ // Create the vtable from the js callbacks.
953
+ rsObject.return_value = uniffi_jsi::Bridging<int16_t>::fromJs(
954
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
955
+ rsObject.call_status =
956
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
957
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
958
+
959
+ return rsObject;
960
+ }
961
+ };
962
+
963
+ } // namespace uniffi::zcam1_certs_utils
964
+ // Implementation of callback function calling from JS to Rust
965
+ // ForeignFutureCompleteI16, passed from Rust to JS as part of async
966
+ // callbacks.
967
+ namespace uniffi::zcam1_certs_utils {
968
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
969
+
970
+ template <> struct Bridging<UniffiForeignFutureCompleteI16> {
971
+ static jsi::Value toJs(jsi::Runtime &rt,
972
+ std::shared_ptr<CallInvoker> callInvoker,
973
+ UniffiForeignFutureCompleteI16 rsCallback) {
974
+ return jsi::Function::createFromHostFunction(
975
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI16"), 2,
976
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
977
+ const jsi::Value *arguments,
978
+ size_t count) -> jsi::Value {
979
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
980
+ rsCallback);
981
+ });
982
+ }
983
+
984
+ static jsi::Value intoRust(jsi::Runtime &rt,
985
+ std::shared_ptr<CallInvoker> callInvoker,
986
+ const jsi::Value &thisValue,
987
+ const jsi::Value *args, size_t count,
988
+ UniffiForeignFutureCompleteI16 func) {
989
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
990
+ // then call the rs_callback with those arguments.
991
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
992
+ uniffi::zcam1_certs_utils::Bridging<
993
+ UniffiForeignFutureStructI16>::fromJs(rt, callInvoker, args[1]));
994
+
995
+ return jsi::Value::undefined();
996
+ }
997
+ };
998
+ } // namespace uniffi::zcam1_certs_utils
999
+ namespace uniffi::zcam1_certs_utils {
1000
+ using namespace facebook;
1001
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1002
+
1003
+ template <> struct Bridging<UniffiForeignFutureStructU32> {
1004
+ static UniffiForeignFutureStructU32
1005
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1006
+ const jsi::Value &jsValue) {
1007
+ // Check if the input is an object
1008
+ if (!jsValue.isObject()) {
1009
+ throw jsi::JSError(rt,
1010
+ "Expected an object for UniffiForeignFutureStructU32");
1011
+ }
1012
+
1013
+ // Get the object from the jsi::Value
1014
+ auto jsObject = jsValue.getObject(rt);
1015
+
1016
+ // Create the vtable struct
1017
+ UniffiForeignFutureStructU32 rsObject;
1018
+
1019
+ // Create the vtable from the js callbacks.
1020
+ rsObject.return_value = uniffi_jsi::Bridging<uint32_t>::fromJs(
1021
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1022
+ rsObject.call_status =
1023
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
1024
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1025
+
1026
+ return rsObject;
1027
+ }
1028
+ };
1029
+
1030
+ } // namespace uniffi::zcam1_certs_utils
1031
+ // Implementation of callback function calling from JS to Rust
1032
+ // ForeignFutureCompleteU32, passed from Rust to JS as part of async
1033
+ // callbacks.
1034
+ namespace uniffi::zcam1_certs_utils {
1035
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1036
+
1037
+ template <> struct Bridging<UniffiForeignFutureCompleteU32> {
1038
+ static jsi::Value toJs(jsi::Runtime &rt,
1039
+ std::shared_ptr<CallInvoker> callInvoker,
1040
+ UniffiForeignFutureCompleteU32 rsCallback) {
1041
+ return jsi::Function::createFromHostFunction(
1042
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU32"), 2,
1043
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1044
+ const jsi::Value *arguments,
1045
+ size_t count) -> jsi::Value {
1046
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1047
+ rsCallback);
1048
+ });
1049
+ }
1050
+
1051
+ static jsi::Value intoRust(jsi::Runtime &rt,
1052
+ std::shared_ptr<CallInvoker> callInvoker,
1053
+ const jsi::Value &thisValue,
1054
+ const jsi::Value *args, size_t count,
1055
+ UniffiForeignFutureCompleteU32 func) {
1056
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1057
+ // then call the rs_callback with those arguments.
1058
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1059
+ uniffi::zcam1_certs_utils::Bridging<
1060
+ UniffiForeignFutureStructU32>::fromJs(rt, callInvoker, args[1]));
1061
+
1062
+ return jsi::Value::undefined();
1063
+ }
1064
+ };
1065
+ } // namespace uniffi::zcam1_certs_utils
1066
+ namespace uniffi::zcam1_certs_utils {
1067
+ using namespace facebook;
1068
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1069
+
1070
+ template <> struct Bridging<UniffiForeignFutureStructI32> {
1071
+ static UniffiForeignFutureStructI32
1072
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1073
+ const jsi::Value &jsValue) {
1074
+ // Check if the input is an object
1075
+ if (!jsValue.isObject()) {
1076
+ throw jsi::JSError(rt,
1077
+ "Expected an object for UniffiForeignFutureStructI32");
1078
+ }
1079
+
1080
+ // Get the object from the jsi::Value
1081
+ auto jsObject = jsValue.getObject(rt);
1082
+
1083
+ // Create the vtable struct
1084
+ UniffiForeignFutureStructI32 rsObject;
1085
+
1086
+ // Create the vtable from the js callbacks.
1087
+ rsObject.return_value = uniffi_jsi::Bridging<int32_t>::fromJs(
1088
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1089
+ rsObject.call_status =
1090
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
1091
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1092
+
1093
+ return rsObject;
1094
+ }
1095
+ };
1096
+
1097
+ } // namespace uniffi::zcam1_certs_utils
1098
+ // Implementation of callback function calling from JS to Rust
1099
+ // ForeignFutureCompleteI32, passed from Rust to JS as part of async
1100
+ // callbacks.
1101
+ namespace uniffi::zcam1_certs_utils {
1102
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1103
+
1104
+ template <> struct Bridging<UniffiForeignFutureCompleteI32> {
1105
+ static jsi::Value toJs(jsi::Runtime &rt,
1106
+ std::shared_ptr<CallInvoker> callInvoker,
1107
+ UniffiForeignFutureCompleteI32 rsCallback) {
1108
+ return jsi::Function::createFromHostFunction(
1109
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI32"), 2,
1110
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1111
+ const jsi::Value *arguments,
1112
+ size_t count) -> jsi::Value {
1113
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1114
+ rsCallback);
1115
+ });
1116
+ }
1117
+
1118
+ static jsi::Value intoRust(jsi::Runtime &rt,
1119
+ std::shared_ptr<CallInvoker> callInvoker,
1120
+ const jsi::Value &thisValue,
1121
+ const jsi::Value *args, size_t count,
1122
+ UniffiForeignFutureCompleteI32 func) {
1123
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1124
+ // then call the rs_callback with those arguments.
1125
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1126
+ uniffi::zcam1_certs_utils::Bridging<
1127
+ UniffiForeignFutureStructI32>::fromJs(rt, callInvoker, args[1]));
1128
+
1129
+ return jsi::Value::undefined();
1130
+ }
1131
+ };
1132
+ } // namespace uniffi::zcam1_certs_utils
1133
+ namespace uniffi::zcam1_certs_utils {
1134
+ using namespace facebook;
1135
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1136
+
1137
+ template <> struct Bridging<UniffiForeignFutureStructU64> {
1138
+ static UniffiForeignFutureStructU64
1139
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1140
+ const jsi::Value &jsValue) {
1141
+ // Check if the input is an object
1142
+ if (!jsValue.isObject()) {
1143
+ throw jsi::JSError(rt,
1144
+ "Expected an object for UniffiForeignFutureStructU64");
1145
+ }
1146
+
1147
+ // Get the object from the jsi::Value
1148
+ auto jsObject = jsValue.getObject(rt);
1149
+
1150
+ // Create the vtable struct
1151
+ UniffiForeignFutureStructU64 rsObject;
1152
+
1153
+ // Create the vtable from the js callbacks.
1154
+ rsObject.return_value = uniffi_jsi::Bridging<uint64_t>::fromJs(
1155
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1156
+ rsObject.call_status =
1157
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
1158
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1159
+
1160
+ return rsObject;
1161
+ }
1162
+ };
1163
+
1164
+ } // namespace uniffi::zcam1_certs_utils
1165
+ // Implementation of callback function calling from JS to Rust
1166
+ // ForeignFutureCompleteU64, passed from Rust to JS as part of async
1167
+ // callbacks.
1168
+ namespace uniffi::zcam1_certs_utils {
1169
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1170
+
1171
+ template <> struct Bridging<UniffiForeignFutureCompleteU64> {
1172
+ static jsi::Value toJs(jsi::Runtime &rt,
1173
+ std::shared_ptr<CallInvoker> callInvoker,
1174
+ UniffiForeignFutureCompleteU64 rsCallback) {
1175
+ return jsi::Function::createFromHostFunction(
1176
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteU64"), 2,
1177
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1178
+ const jsi::Value *arguments,
1179
+ size_t count) -> jsi::Value {
1180
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1181
+ rsCallback);
1182
+ });
1183
+ }
1184
+
1185
+ static jsi::Value intoRust(jsi::Runtime &rt,
1186
+ std::shared_ptr<CallInvoker> callInvoker,
1187
+ const jsi::Value &thisValue,
1188
+ const jsi::Value *args, size_t count,
1189
+ UniffiForeignFutureCompleteU64 func) {
1190
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1191
+ // then call the rs_callback with those arguments.
1192
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1193
+ uniffi::zcam1_certs_utils::Bridging<
1194
+ UniffiForeignFutureStructU64>::fromJs(rt, callInvoker, args[1]));
1195
+
1196
+ return jsi::Value::undefined();
1197
+ }
1198
+ };
1199
+ } // namespace uniffi::zcam1_certs_utils
1200
+ namespace uniffi::zcam1_certs_utils {
1201
+ using namespace facebook;
1202
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1203
+
1204
+ template <> struct Bridging<UniffiForeignFutureStructI64> {
1205
+ static UniffiForeignFutureStructI64
1206
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1207
+ const jsi::Value &jsValue) {
1208
+ // Check if the input is an object
1209
+ if (!jsValue.isObject()) {
1210
+ throw jsi::JSError(rt,
1211
+ "Expected an object for UniffiForeignFutureStructI64");
1212
+ }
1213
+
1214
+ // Get the object from the jsi::Value
1215
+ auto jsObject = jsValue.getObject(rt);
1216
+
1217
+ // Create the vtable struct
1218
+ UniffiForeignFutureStructI64 rsObject;
1219
+
1220
+ // Create the vtable from the js callbacks.
1221
+ rsObject.return_value = uniffi_jsi::Bridging<int64_t>::fromJs(
1222
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1223
+ rsObject.call_status =
1224
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
1225
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1226
+
1227
+ return rsObject;
1228
+ }
1229
+ };
1230
+
1231
+ } // namespace uniffi::zcam1_certs_utils
1232
+ // Implementation of callback function calling from JS to Rust
1233
+ // ForeignFutureCompleteI64, passed from Rust to JS as part of async
1234
+ // callbacks.
1235
+ namespace uniffi::zcam1_certs_utils {
1236
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1237
+
1238
+ template <> struct Bridging<UniffiForeignFutureCompleteI64> {
1239
+ static jsi::Value toJs(jsi::Runtime &rt,
1240
+ std::shared_ptr<CallInvoker> callInvoker,
1241
+ UniffiForeignFutureCompleteI64 rsCallback) {
1242
+ return jsi::Function::createFromHostFunction(
1243
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteI64"), 2,
1244
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1245
+ const jsi::Value *arguments,
1246
+ size_t count) -> jsi::Value {
1247
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1248
+ rsCallback);
1249
+ });
1250
+ }
1251
+
1252
+ static jsi::Value intoRust(jsi::Runtime &rt,
1253
+ std::shared_ptr<CallInvoker> callInvoker,
1254
+ const jsi::Value &thisValue,
1255
+ const jsi::Value *args, size_t count,
1256
+ UniffiForeignFutureCompleteI64 func) {
1257
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1258
+ // then call the rs_callback with those arguments.
1259
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1260
+ uniffi::zcam1_certs_utils::Bridging<
1261
+ UniffiForeignFutureStructI64>::fromJs(rt, callInvoker, args[1]));
1262
+
1263
+ return jsi::Value::undefined();
1264
+ }
1265
+ };
1266
+ } // namespace uniffi::zcam1_certs_utils
1267
+ namespace uniffi::zcam1_certs_utils {
1268
+ using namespace facebook;
1269
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1270
+
1271
+ template <> struct Bridging<UniffiForeignFutureStructF32> {
1272
+ static UniffiForeignFutureStructF32
1273
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1274
+ const jsi::Value &jsValue) {
1275
+ // Check if the input is an object
1276
+ if (!jsValue.isObject()) {
1277
+ throw jsi::JSError(rt,
1278
+ "Expected an object for UniffiForeignFutureStructF32");
1279
+ }
1280
+
1281
+ // Get the object from the jsi::Value
1282
+ auto jsObject = jsValue.getObject(rt);
1283
+
1284
+ // Create the vtable struct
1285
+ UniffiForeignFutureStructF32 rsObject;
1286
+
1287
+ // Create the vtable from the js callbacks.
1288
+ rsObject.return_value = uniffi_jsi::Bridging<float>::fromJs(
1289
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1290
+ rsObject.call_status =
1291
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
1292
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1293
+
1294
+ return rsObject;
1295
+ }
1296
+ };
1297
+
1298
+ } // namespace uniffi::zcam1_certs_utils
1299
+ // Implementation of callback function calling from JS to Rust
1300
+ // ForeignFutureCompleteF32, passed from Rust to JS as part of async
1301
+ // callbacks.
1302
+ namespace uniffi::zcam1_certs_utils {
1303
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1304
+
1305
+ template <> struct Bridging<UniffiForeignFutureCompleteF32> {
1306
+ static jsi::Value toJs(jsi::Runtime &rt,
1307
+ std::shared_ptr<CallInvoker> callInvoker,
1308
+ UniffiForeignFutureCompleteF32 rsCallback) {
1309
+ return jsi::Function::createFromHostFunction(
1310
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF32"), 2,
1311
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1312
+ const jsi::Value *arguments,
1313
+ size_t count) -> jsi::Value {
1314
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1315
+ rsCallback);
1316
+ });
1317
+ }
1318
+
1319
+ static jsi::Value intoRust(jsi::Runtime &rt,
1320
+ std::shared_ptr<CallInvoker> callInvoker,
1321
+ const jsi::Value &thisValue,
1322
+ const jsi::Value *args, size_t count,
1323
+ UniffiForeignFutureCompleteF32 func) {
1324
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1325
+ // then call the rs_callback with those arguments.
1326
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1327
+ uniffi::zcam1_certs_utils::Bridging<
1328
+ UniffiForeignFutureStructF32>::fromJs(rt, callInvoker, args[1]));
1329
+
1330
+ return jsi::Value::undefined();
1331
+ }
1332
+ };
1333
+ } // namespace uniffi::zcam1_certs_utils
1334
+ namespace uniffi::zcam1_certs_utils {
1335
+ using namespace facebook;
1336
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1337
+
1338
+ template <> struct Bridging<UniffiForeignFutureStructF64> {
1339
+ static UniffiForeignFutureStructF64
1340
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1341
+ const jsi::Value &jsValue) {
1342
+ // Check if the input is an object
1343
+ if (!jsValue.isObject()) {
1344
+ throw jsi::JSError(rt,
1345
+ "Expected an object for UniffiForeignFutureStructF64");
1346
+ }
1347
+
1348
+ // Get the object from the jsi::Value
1349
+ auto jsObject = jsValue.getObject(rt);
1350
+
1351
+ // Create the vtable struct
1352
+ UniffiForeignFutureStructF64 rsObject;
1353
+
1354
+ // Create the vtable from the js callbacks.
1355
+ rsObject.return_value = uniffi_jsi::Bridging<double>::fromJs(
1356
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1357
+ rsObject.call_status =
1358
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
1359
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1360
+
1361
+ return rsObject;
1362
+ }
1363
+ };
1364
+
1365
+ } // namespace uniffi::zcam1_certs_utils
1366
+ // Implementation of callback function calling from JS to Rust
1367
+ // ForeignFutureCompleteF64, passed from Rust to JS as part of async
1368
+ // callbacks.
1369
+ namespace uniffi::zcam1_certs_utils {
1370
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1371
+
1372
+ template <> struct Bridging<UniffiForeignFutureCompleteF64> {
1373
+ static jsi::Value toJs(jsi::Runtime &rt,
1374
+ std::shared_ptr<CallInvoker> callInvoker,
1375
+ UniffiForeignFutureCompleteF64 rsCallback) {
1376
+ return jsi::Function::createFromHostFunction(
1377
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteF64"), 2,
1378
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1379
+ const jsi::Value *arguments,
1380
+ size_t count) -> jsi::Value {
1381
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1382
+ rsCallback);
1383
+ });
1384
+ }
1385
+
1386
+ static jsi::Value intoRust(jsi::Runtime &rt,
1387
+ std::shared_ptr<CallInvoker> callInvoker,
1388
+ const jsi::Value &thisValue,
1389
+ const jsi::Value *args, size_t count,
1390
+ UniffiForeignFutureCompleteF64 func) {
1391
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1392
+ // then call the rs_callback with those arguments.
1393
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1394
+ uniffi::zcam1_certs_utils::Bridging<
1395
+ UniffiForeignFutureStructF64>::fromJs(rt, callInvoker, args[1]));
1396
+
1397
+ return jsi::Value::undefined();
1398
+ }
1399
+ };
1400
+ } // namespace uniffi::zcam1_certs_utils
1401
+ namespace uniffi::zcam1_certs_utils {
1402
+ using namespace facebook;
1403
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1404
+
1405
+ template <> struct Bridging<UniffiForeignFutureStructPointer> {
1406
+ static UniffiForeignFutureStructPointer
1407
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1408
+ const jsi::Value &jsValue) {
1409
+ // Check if the input is an object
1410
+ if (!jsValue.isObject()) {
1411
+ throw jsi::JSError(
1412
+ rt, "Expected an object for UniffiForeignFutureStructPointer");
1413
+ }
1414
+
1415
+ // Get the object from the jsi::Value
1416
+ auto jsObject = jsValue.getObject(rt);
1417
+
1418
+ // Create the vtable struct
1419
+ UniffiForeignFutureStructPointer rsObject;
1420
+
1421
+ // Create the vtable from the js callbacks.
1422
+ rsObject.return_value = uniffi_jsi::Bridging<void *>::fromJs(
1423
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1424
+ rsObject.call_status =
1425
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
1426
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1427
+
1428
+ return rsObject;
1429
+ }
1430
+ };
1431
+
1432
+ } // namespace uniffi::zcam1_certs_utils
1433
+ // Implementation of callback function calling from JS to Rust
1434
+ // ForeignFutureCompletePointer, passed from Rust to JS as part of async
1435
+ // callbacks.
1436
+ namespace uniffi::zcam1_certs_utils {
1437
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1438
+
1439
+ template <> struct Bridging<UniffiForeignFutureCompletePointer> {
1440
+ static jsi::Value toJs(jsi::Runtime &rt,
1441
+ std::shared_ptr<CallInvoker> callInvoker,
1442
+ UniffiForeignFutureCompletePointer rsCallback) {
1443
+ return jsi::Function::createFromHostFunction(
1444
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompletePointer"), 2,
1445
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1446
+ const jsi::Value *arguments,
1447
+ size_t count) -> jsi::Value {
1448
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1449
+ rsCallback);
1450
+ });
1451
+ }
1452
+
1453
+ static jsi::Value intoRust(jsi::Runtime &rt,
1454
+ std::shared_ptr<CallInvoker> callInvoker,
1455
+ const jsi::Value &thisValue,
1456
+ const jsi::Value *args, size_t count,
1457
+ UniffiForeignFutureCompletePointer func) {
1458
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1459
+ // then call the rs_callback with those arguments.
1460
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1461
+ uniffi::zcam1_certs_utils::Bridging<
1462
+ UniffiForeignFutureStructPointer>::fromJs(rt, callInvoker,
1463
+ args[1]));
1464
+
1465
+ return jsi::Value::undefined();
1466
+ }
1467
+ };
1468
+ } // namespace uniffi::zcam1_certs_utils
1469
+ namespace uniffi::zcam1_certs_utils {
1470
+ using namespace facebook;
1471
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1472
+
1473
+ template <> struct Bridging<UniffiForeignFutureStructRustBuffer> {
1474
+ static UniffiForeignFutureStructRustBuffer
1475
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1476
+ const jsi::Value &jsValue) {
1477
+ // Check if the input is an object
1478
+ if (!jsValue.isObject()) {
1479
+ throw jsi::JSError(
1480
+ rt, "Expected an object for UniffiForeignFutureStructRustBuffer");
1481
+ }
1482
+
1483
+ // Get the object from the jsi::Value
1484
+ auto jsObject = jsValue.getObject(rt);
1485
+
1486
+ // Create the vtable struct
1487
+ UniffiForeignFutureStructRustBuffer rsObject;
1488
+
1489
+ // Create the vtable from the js callbacks.
1490
+ rsObject.return_value =
1491
+ uniffi::zcam1_certs_utils::Bridging<RustBuffer>::fromJs(
1492
+ rt, callInvoker, jsObject.getProperty(rt, "returnValue"));
1493
+ rsObject.call_status =
1494
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
1495
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1496
+
1497
+ return rsObject;
1498
+ }
1499
+ };
1500
+
1501
+ } // namespace uniffi::zcam1_certs_utils
1502
+ // Implementation of callback function calling from JS to Rust
1503
+ // ForeignFutureCompleteRustBuffer, passed from Rust to JS as part of async
1504
+ // callbacks.
1505
+ namespace uniffi::zcam1_certs_utils {
1506
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1507
+
1508
+ template <> struct Bridging<UniffiForeignFutureCompleteRustBuffer> {
1509
+ static jsi::Value toJs(jsi::Runtime &rt,
1510
+ std::shared_ptr<CallInvoker> callInvoker,
1511
+ UniffiForeignFutureCompleteRustBuffer rsCallback) {
1512
+ return jsi::Function::createFromHostFunction(
1513
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteRustBuffer"),
1514
+ 2,
1515
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1516
+ const jsi::Value *arguments,
1517
+ size_t count) -> jsi::Value {
1518
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1519
+ rsCallback);
1520
+ });
1521
+ }
1522
+
1523
+ static jsi::Value intoRust(jsi::Runtime &rt,
1524
+ std::shared_ptr<CallInvoker> callInvoker,
1525
+ const jsi::Value &thisValue,
1526
+ const jsi::Value *args, size_t count,
1527
+ UniffiForeignFutureCompleteRustBuffer func) {
1528
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1529
+ // then call the rs_callback with those arguments.
1530
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1531
+ uniffi::zcam1_certs_utils::Bridging<
1532
+ UniffiForeignFutureStructRustBuffer>::fromJs(rt, callInvoker,
1533
+ args[1]));
1534
+
1535
+ return jsi::Value::undefined();
1536
+ }
1537
+ };
1538
+ } // namespace uniffi::zcam1_certs_utils
1539
+ namespace uniffi::zcam1_certs_utils {
1540
+ using namespace facebook;
1541
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1542
+
1543
+ template <> struct Bridging<UniffiForeignFutureStructVoid> {
1544
+ static UniffiForeignFutureStructVoid
1545
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1546
+ const jsi::Value &jsValue) {
1547
+ // Check if the input is an object
1548
+ if (!jsValue.isObject()) {
1549
+ throw jsi::JSError(
1550
+ rt, "Expected an object for UniffiForeignFutureStructVoid");
1551
+ }
1552
+
1553
+ // Get the object from the jsi::Value
1554
+ auto jsObject = jsValue.getObject(rt);
1555
+
1556
+ // Create the vtable struct
1557
+ UniffiForeignFutureStructVoid rsObject;
1558
+
1559
+ // Create the vtable from the js callbacks.
1560
+ rsObject.call_status =
1561
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::fromJs(
1562
+ rt, callInvoker, jsObject.getProperty(rt, "callStatus"));
1563
+
1564
+ return rsObject;
1565
+ }
1566
+ };
1567
+
1568
+ } // namespace uniffi::zcam1_certs_utils
1569
+ // Implementation of callback function calling from JS to Rust
1570
+ // ForeignFutureCompleteVoid, passed from Rust to JS as part of async
1571
+ // callbacks.
1572
+ namespace uniffi::zcam1_certs_utils {
1573
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1574
+
1575
+ template <> struct Bridging<UniffiForeignFutureCompleteVoid> {
1576
+ static jsi::Value toJs(jsi::Runtime &rt,
1577
+ std::shared_ptr<CallInvoker> callInvoker,
1578
+ UniffiForeignFutureCompleteVoid rsCallback) {
1579
+ return jsi::Function::createFromHostFunction(
1580
+ rt, jsi::PropNameID::forAscii(rt, "--ForeignFutureCompleteVoid"), 2,
1581
+ [rsCallback, callInvoker](jsi::Runtime &rt, const jsi::Value &thisValue,
1582
+ const jsi::Value *arguments,
1583
+ size_t count) -> jsi::Value {
1584
+ return intoRust(rt, callInvoker, thisValue, arguments, count,
1585
+ rsCallback);
1586
+ });
1587
+ }
1588
+
1589
+ static jsi::Value intoRust(jsi::Runtime &rt,
1590
+ std::shared_ptr<CallInvoker> callInvoker,
1591
+ const jsi::Value &thisValue,
1592
+ const jsi::Value *args, size_t count,
1593
+ UniffiForeignFutureCompleteVoid func) {
1594
+ // Convert the arguments into the Rust, with Bridging<T>::fromJs,
1595
+ // then call the rs_callback with those arguments.
1596
+ func(uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[0]),
1597
+ uniffi::zcam1_certs_utils::Bridging<
1598
+ UniffiForeignFutureStructVoid>::fromJs(rt, callInvoker, args[1]));
1599
+
1600
+ return jsi::Value::undefined();
1601
+ }
1602
+ };
1603
+ } // namespace uniffi::zcam1_certs_utils
1604
+
1605
+ namespace uniffi::zcam1_certs_utils {
1606
+ using namespace facebook;
1607
+ using CallInvoker = uniffi_runtime::UniffiCallInvoker;
1608
+
1609
+ template <> struct Bridging<UniffiRustFutureContinuationCallback> {
1610
+ static UniffiRustFutureContinuationCallback
1611
+ fromJs(jsi::Runtime &rt, std::shared_ptr<CallInvoker> callInvoker,
1612
+ const jsi::Value &value) {
1613
+ try {
1614
+ return uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback::
1615
+ makeCallbackFunction(rt, callInvoker, value);
1616
+ } catch (const std::logic_error &e) {
1617
+ throw jsi::JSError(rt, e.what());
1618
+ }
1619
+ }
1620
+ };
1621
+
1622
+ } // namespace uniffi::zcam1_certs_utils
1623
+
1624
+ NativeZcam1CertsUtils::NativeZcam1CertsUtils(
1625
+ jsi::Runtime &rt,
1626
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> invoker)
1627
+ : callInvoker(invoker), props() {
1628
+ // Map from Javascript names to the cpp names
1629
+ props["ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"] =
1630
+ jsi::Function::createFromHostFunction(
1631
+ rt,
1632
+ jsi::PropNameID::forAscii(
1633
+ rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length"),
1634
+ 1,
1635
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
1636
+ const jsi::Value *args, size_t count) -> jsi::Value {
1637
+ return this->cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(
1638
+ rt, thisVal, args, count);
1639
+ });
1640
+ props["ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"] =
1641
+ jsi::Function::createFromHostFunction(
1642
+ rt,
1643
+ jsi::PropNameID::forAscii(
1644
+ rt, "ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer"),
1645
+ 1,
1646
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
1647
+ const jsi::Value *args, size_t count) -> jsi::Value {
1648
+ return this->cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
1649
+ rt, thisVal, args, count);
1650
+ });
1651
+ props["ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"] =
1652
+ jsi::Function::createFromHostFunction(
1653
+ rt,
1654
+ jsi::PropNameID::forAscii(
1655
+ rt, "ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string"),
1656
+ 1,
1657
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
1658
+ const jsi::Value *args, size_t count) -> jsi::Value {
1659
+ return this->cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
1660
+ rt, thisVal, args, count);
1661
+ });
1662
+ props["ubrn_uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate"] =
1663
+ jsi::Function::createFromHostFunction(
1664
+ rt,
1665
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zcam1_certs_utils_fn_func_"
1666
+ "build_self_signed_certificate"),
1667
+ 2,
1668
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
1669
+ const jsi::Value *args, size_t count) -> jsi::Value {
1670
+ return this
1671
+ ->cpp_uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate(
1672
+ rt, thisVal, args, count);
1673
+ });
1674
+ props["ubrn_uniffi_zcam1_certs_utils_checksum_func_build_self_signed_"
1675
+ "certificate"] = jsi::Function::createFromHostFunction(
1676
+ rt,
1677
+ jsi::PropNameID::forAscii(rt, "ubrn_uniffi_zcam1_certs_utils_checksum_"
1678
+ "func_build_self_signed_certificate"),
1679
+ 0,
1680
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
1681
+ const jsi::Value *args, size_t count) -> jsi::Value {
1682
+ return this
1683
+ ->cpp_uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate(
1684
+ rt, thisVal, args, count);
1685
+ });
1686
+ props["ubrn_ffi_zcam1_certs_utils_uniffi_contract_version"] =
1687
+ jsi::Function::createFromHostFunction(
1688
+ rt,
1689
+ jsi::PropNameID::forAscii(
1690
+ rt, "ubrn_ffi_zcam1_certs_utils_uniffi_contract_version"),
1691
+ 0,
1692
+ [this](jsi::Runtime &rt, const jsi::Value &thisVal,
1693
+ const jsi::Value *args, size_t count) -> jsi::Value {
1694
+ return this->cpp_ffi_zcam1_certs_utils_uniffi_contract_version(
1695
+ rt, thisVal, args, count);
1696
+ });
1697
+ }
1698
+
1699
+ void NativeZcam1CertsUtils::registerModule(
1700
+ jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> callInvoker) {
1701
+ auto invoker =
1702
+ std::make_shared<uniffi_runtime::UniffiCallInvoker>(callInvoker);
1703
+ auto tm = std::make_shared<NativeZcam1CertsUtils>(rt, invoker);
1704
+ auto obj = rt.global().createFromHostObject(rt, tm);
1705
+ rt.global().setProperty(rt, "NativeZcam1CertsUtils", obj);
1706
+ }
1707
+
1708
+ void NativeZcam1CertsUtils::unregisterModule(jsi::Runtime &rt) {
1709
+ uniffi::zcam1_certs_utils::registry::clearRegistry();
1710
+ }
1711
+
1712
+ jsi::Value NativeZcam1CertsUtils::get(jsi::Runtime &rt,
1713
+ const jsi::PropNameID &name) {
1714
+ try {
1715
+ return jsi::Value(rt, props.at(name.utf8(rt)));
1716
+ } catch (std::out_of_range &e) {
1717
+ return jsi::Value::undefined();
1718
+ }
1719
+ }
1720
+
1721
+ std::vector<jsi::PropNameID>
1722
+ NativeZcam1CertsUtils::getPropertyNames(jsi::Runtime &rt) {
1723
+ std::vector<jsi::PropNameID> rval;
1724
+ for (auto &[key, value] : props) {
1725
+ rval.push_back(jsi::PropNameID::forUtf8(rt, key));
1726
+ }
1727
+ return rval;
1728
+ }
1729
+
1730
+ void NativeZcam1CertsUtils::set(jsi::Runtime &rt, const jsi::PropNameID &name,
1731
+ const jsi::Value &value) {
1732
+ props.insert_or_assign(name.utf8(rt), &value);
1733
+ }
1734
+
1735
+ NativeZcam1CertsUtils::~NativeZcam1CertsUtils() {
1736
+ // Cleanup for callback function RustFutureContinuationCallback
1737
+ uniffi::zcam1_certs_utils::cb::rustfuturecontinuationcallback::cleanup();
1738
+ // Cleanup for "free" callback function CallbackInterfaceFree
1739
+ uniffi::zcam1_certs_utils::st::foreignfuture::foreignfuture::free::cleanup();
1740
+ }
1741
+
1742
+ // Utility functions for serialization/deserialization of strings.
1743
+ jsi::Value
1744
+ NativeZcam1CertsUtils::cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(
1745
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
1746
+ size_t count) {
1747
+ return uniffi_jsi::Bridging<std::string>::string_to_bytelength(rt, args[0]);
1748
+ }
1749
+
1750
+ jsi::Value
1751
+ NativeZcam1CertsUtils::cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
1752
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
1753
+ size_t count) {
1754
+ return uniffi_jsi::Bridging<std::string>::string_to_arraybuffer(rt, args[0]);
1755
+ }
1756
+
1757
+ jsi::Value
1758
+ NativeZcam1CertsUtils::cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
1759
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
1760
+ size_t count) {
1761
+ return uniffi_jsi::Bridging<std::string>::arraybuffer_to_string(rt, args[0]);
1762
+ }
1763
+
1764
+ // Methods calling directly into the uniffi generated C API of the Rust crate.
1765
+ jsi::Value NativeZcam1CertsUtils::
1766
+ cpp_uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate(
1767
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
1768
+ size_t count) {
1769
+ RustCallStatus status =
1770
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::rustSuccess(rt);
1771
+ auto value = uniffi_zcam1_certs_utils_fn_func_build_self_signed_certificate(
1772
+ uniffi::zcam1_certs_utils::Bridging<RustBuffer>::fromJs(rt, callInvoker,
1773
+ args[0]),
1774
+ uniffi::zcam1_certs_utils::Bridging<RustBuffer>::fromJs(rt, callInvoker,
1775
+ args[1]),
1776
+ &status);
1777
+ uniffi::zcam1_certs_utils::Bridging<RustCallStatus>::copyIntoJs(
1778
+ rt, callInvoker, status, args[count - 1]);
1779
+
1780
+ return uniffi::zcam1_certs_utils::Bridging<RustBuffer>::toJs(rt, callInvoker,
1781
+ value);
1782
+ }
1783
+ jsi::Value NativeZcam1CertsUtils::
1784
+ cpp_uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate(
1785
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
1786
+ size_t count) {
1787
+ auto value =
1788
+ uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate();
1789
+
1790
+ return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
1791
+ }
1792
+ jsi::Value
1793
+ NativeZcam1CertsUtils::cpp_ffi_zcam1_certs_utils_uniffi_contract_version(
1794
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
1795
+ size_t count) {
1796
+ auto value = ffi_zcam1_certs_utils_uniffi_contract_version();
1797
+
1798
+ return uniffi_jsi::Bridging<uint32_t>::toJs(rt, callInvoker, value);
1799
+ }