@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,804 @@
1
+ // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
2
+ // Trust me, you don't want to mess with it!
3
+ import nativeModule, {
4
+ type UniffiRustFutureContinuationCallback,
5
+ type UniffiForeignFuture,
6
+ type UniffiForeignFutureStructU8,
7
+ type UniffiForeignFutureCompleteU8,
8
+ type UniffiForeignFutureStructI8,
9
+ type UniffiForeignFutureCompleteI8,
10
+ type UniffiForeignFutureStructU16,
11
+ type UniffiForeignFutureCompleteU16,
12
+ type UniffiForeignFutureStructI16,
13
+ type UniffiForeignFutureCompleteI16,
14
+ type UniffiForeignFutureStructU32,
15
+ type UniffiForeignFutureCompleteU32,
16
+ type UniffiForeignFutureStructI32,
17
+ type UniffiForeignFutureCompleteI32,
18
+ type UniffiForeignFutureStructU64,
19
+ type UniffiForeignFutureCompleteU64,
20
+ type UniffiForeignFutureStructI64,
21
+ type UniffiForeignFutureCompleteI64,
22
+ type UniffiForeignFutureStructF32,
23
+ type UniffiForeignFutureCompleteF32,
24
+ type UniffiForeignFutureStructF64,
25
+ type UniffiForeignFutureCompleteF64,
26
+ type UniffiForeignFutureStructPointer,
27
+ type UniffiForeignFutureCompletePointer,
28
+ type UniffiForeignFutureStructRustBuffer,
29
+ type UniffiForeignFutureCompleteRustBuffer,
30
+ type UniffiForeignFutureStructVoid,
31
+ type UniffiForeignFutureCompleteVoid,
32
+ type UniffiVTableCallbackInterfaceInitialized,
33
+ } from "./zcam1_proving_utils-ffi";
34
+ import {
35
+ type FfiConverter,
36
+ type UniffiByteArray,
37
+ type UniffiHandle,
38
+ type UniffiObjectFactory,
39
+ type UniffiReferenceHolder,
40
+ type UniffiRustArcPtr,
41
+ type UniffiRustCallStatus,
42
+ type UnsafeMutableRawPointer,
43
+ AbstractFfiConverterByteArray,
44
+ FfiConverterArrayBuffer,
45
+ FfiConverterBool,
46
+ FfiConverterCallback,
47
+ FfiConverterInt32,
48
+ FfiConverterObject,
49
+ FfiConverterOptional,
50
+ FfiConverterUInt64,
51
+ RustBuffer,
52
+ UniffiAbstractObject,
53
+ UniffiError,
54
+ UniffiInternalError,
55
+ UniffiResult,
56
+ UniffiRustCaller,
57
+ destructorGuardSymbol,
58
+ pointerLiteralSymbol,
59
+ uniffiCreateFfiConverterString,
60
+ uniffiCreateRecord,
61
+ uniffiRustCallAsync,
62
+ uniffiTraitInterfaceCall,
63
+ uniffiTypeNameSymbol,
64
+ variantOrdinalSymbol,
65
+ } from "uniffi-bindgen-react-native";
66
+
67
+ // Get converters from the other files, if any.
68
+ const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
69
+
70
+ const uniffiIsDebug =
71
+ // @ts-ignore -- The process global might not be defined
72
+ typeof process !== "object" ||
73
+ // @ts-ignore -- The process global might not be defined
74
+ process?.env?.NODE_ENV !== "production" ||
75
+ false;
76
+ // Public interface members begin here.
77
+
78
+ export interface Initialized {
79
+ initialized(): void;
80
+ }
81
+
82
+ // Put the implementation in a struct so we don't pollute the top-level namespace
83
+ const uniffiCallbackInterfaceInitialized: {
84
+ vtable: UniffiVTableCallbackInterfaceInitialized;
85
+ register: () => void;
86
+ } = {
87
+ // Create the VTable using a series of closures.
88
+ // ts automatically converts these into C callback functions.
89
+ vtable: {
90
+ initialized: (uniffiHandle: bigint) => {
91
+ const uniffiMakeCall = (): void => {
92
+ const jsCallback = FfiConverterTypeInitialized.lift(uniffiHandle);
93
+ return jsCallback.initialized();
94
+ };
95
+ const uniffiResult = UniffiResult.ready<void>();
96
+ const uniffiHandleSuccess = (obj: any) => {};
97
+ const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {
98
+ UniffiResult.writeError(uniffiResult, code, errBuf);
99
+ };
100
+ uniffiTraitInterfaceCall(
101
+ /*makeCall:*/ uniffiMakeCall,
102
+ /*handleSuccess:*/ uniffiHandleSuccess,
103
+ /*handleError:*/ uniffiHandleError,
104
+ /*lowerString:*/ FfiConverterString.lower,
105
+ );
106
+ return uniffiResult;
107
+ },
108
+ uniffiFree: (uniffiHandle: UniffiHandle): void => {
109
+ // Initialized: this will throw a stale handle error if the handle isn't found.
110
+ FfiConverterTypeInitialized.drop(uniffiHandle);
111
+ },
112
+ },
113
+ register: () => {
114
+ nativeModule().ubrn_uniffi_zcam1_proving_utils_fn_init_callback_vtable_initialized(
115
+ uniffiCallbackInterfaceInitialized.vtable,
116
+ );
117
+ },
118
+ };
119
+
120
+ // FfiConverter protocol for callback interfaces
121
+ const FfiConverterTypeInitialized = new FfiConverterCallback<Initialized>();
122
+
123
+ export type IosProofRequestInputs = {
124
+ appAttestProduction: boolean;
125
+ };
126
+
127
+ /**
128
+ * Generated factory for {@link IosProofRequestInputs} record objects.
129
+ */
130
+ export const IosProofRequestInputs = (() => {
131
+ const defaults = () => ({});
132
+ const create = (() => {
133
+ return uniffiCreateRecord<IosProofRequestInputs, ReturnType<typeof defaults>>(defaults);
134
+ })();
135
+ return Object.freeze({
136
+ /**
137
+ * Create a frozen instance of {@link IosProofRequestInputs}, with defaults specified
138
+ * in Rust, in the {@link zcam1_proving_utils} crate.
139
+ */
140
+ create,
141
+
142
+ /**
143
+ * Create a frozen instance of {@link IosProofRequestInputs}, with defaults specified
144
+ * in Rust, in the {@link zcam1_proving_utils} crate.
145
+ */
146
+ new: create,
147
+
148
+ /**
149
+ * Defaults specified in the {@link zcam1_proving_utils} crate.
150
+ */
151
+ defaults: () => Object.freeze(defaults()) as Partial<IosProofRequestInputs>,
152
+ });
153
+ })();
154
+
155
+ const FfiConverterTypeIosProofRequestInputs = (() => {
156
+ type TypeName = IosProofRequestInputs;
157
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
158
+ read(from: RustBuffer): TypeName {
159
+ return {
160
+ appAttestProduction: FfiConverterBool.read(from),
161
+ };
162
+ }
163
+ write(value: TypeName, into: RustBuffer): void {
164
+ FfiConverterBool.write(value.appAttestProduction, into);
165
+ }
166
+ allocationSize(value: TypeName): number {
167
+ return FfiConverterBool.allocationSize(value.appAttestProduction);
168
+ }
169
+ }
170
+ return new FFIConverter();
171
+ })();
172
+
173
+ export type ProofRequestStatus = {
174
+ fulfillmentStatus: FulfillmentStatus;
175
+ proof: ArrayBuffer | undefined;
176
+ };
177
+
178
+ /**
179
+ * Generated factory for {@link ProofRequestStatus} record objects.
180
+ */
181
+ export const ProofRequestStatus = (() => {
182
+ const defaults = () => ({});
183
+ const create = (() => {
184
+ return uniffiCreateRecord<ProofRequestStatus, ReturnType<typeof defaults>>(defaults);
185
+ })();
186
+ return Object.freeze({
187
+ /**
188
+ * Create a frozen instance of {@link ProofRequestStatus}, with defaults specified
189
+ * in Rust, in the {@link zcam1_proving_utils} crate.
190
+ */
191
+ create,
192
+
193
+ /**
194
+ * Create a frozen instance of {@link ProofRequestStatus}, with defaults specified
195
+ * in Rust, in the {@link zcam1_proving_utils} crate.
196
+ */
197
+ new: create,
198
+
199
+ /**
200
+ * Defaults specified in the {@link zcam1_proving_utils} crate.
201
+ */
202
+ defaults: () => Object.freeze(defaults()) as Partial<ProofRequestStatus>,
203
+ });
204
+ })();
205
+
206
+ const FfiConverterTypeProofRequestStatus = (() => {
207
+ type TypeName = ProofRequestStatus;
208
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
209
+ read(from: RustBuffer): TypeName {
210
+ return {
211
+ fulfillmentStatus: FfiConverterTypeFulfillmentStatus.read(from),
212
+ proof: FfiConverterOptionalArrayBuffer.read(from),
213
+ };
214
+ }
215
+ write(value: TypeName, into: RustBuffer): void {
216
+ FfiConverterTypeFulfillmentStatus.write(value.fulfillmentStatus, into);
217
+ FfiConverterOptionalArrayBuffer.write(value.proof, into);
218
+ }
219
+ allocationSize(value: TypeName): number {
220
+ return (
221
+ FfiConverterTypeFulfillmentStatus.allocationSize(value.fulfillmentStatus) +
222
+ FfiConverterOptionalArrayBuffer.allocationSize(value.proof)
223
+ );
224
+ }
225
+ }
226
+ return new FFIConverter();
227
+ })();
228
+
229
+ const stringConverter = {
230
+ stringToBytes: (s: string) =>
231
+ uniffiCaller.rustCall((status) =>
232
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(s, status),
233
+ ),
234
+ bytesToString: (ab: UniffiByteArray) =>
235
+ uniffiCaller.rustCall((status) =>
236
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(ab, status),
237
+ ),
238
+ stringByteLength: (s: string) =>
239
+ uniffiCaller.rustCall((status) =>
240
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(s, status),
241
+ ),
242
+ };
243
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
244
+
245
+ // Flat error type: Exception
246
+ export enum Exception_Tags {
247
+ ProverNotInitialized = "ProverNotInitialized",
248
+ FailedToParseProofRequestId = "FailedToParseProofRequestId",
249
+ Io = "Io",
250
+ Sp1 = "Sp1",
251
+ }
252
+ export const Exception = (() => {
253
+ class ProverNotInitialized extends UniffiError {
254
+ /**
255
+ * @private
256
+ * This field is private and should not be used.
257
+ */
258
+ readonly [uniffiTypeNameSymbol]: string = "Exception";
259
+ /**
260
+ * @private
261
+ * This field is private and should not be used.
262
+ */
263
+ readonly [variantOrdinalSymbol] = 1;
264
+
265
+ public readonly tag = Exception_Tags.ProverNotInitialized;
266
+
267
+ constructor(message: string) {
268
+ super("Exception", "ProverNotInitialized", message);
269
+ }
270
+
271
+ static instanceOf(e: any): e is ProverNotInitialized {
272
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 1;
273
+ }
274
+ }
275
+ class FailedToParseProofRequestId extends UniffiError {
276
+ /**
277
+ * @private
278
+ * This field is private and should not be used.
279
+ */
280
+ readonly [uniffiTypeNameSymbol]: string = "Exception";
281
+ /**
282
+ * @private
283
+ * This field is private and should not be used.
284
+ */
285
+ readonly [variantOrdinalSymbol] = 2;
286
+
287
+ public readonly tag = Exception_Tags.FailedToParseProofRequestId;
288
+
289
+ constructor(message: string) {
290
+ super("Exception", "FailedToParseProofRequestId", message);
291
+ }
292
+
293
+ static instanceOf(e: any): e is FailedToParseProofRequestId {
294
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 2;
295
+ }
296
+ }
297
+ class Io extends UniffiError {
298
+ /**
299
+ * @private
300
+ * This field is private and should not be used.
301
+ */
302
+ readonly [uniffiTypeNameSymbol]: string = "Exception";
303
+ /**
304
+ * @private
305
+ * This field is private and should not be used.
306
+ */
307
+ readonly [variantOrdinalSymbol] = 3;
308
+
309
+ public readonly tag = Exception_Tags.Io;
310
+
311
+ constructor(message: string) {
312
+ super("Exception", "Io", message);
313
+ }
314
+
315
+ static instanceOf(e: any): e is Io {
316
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 3;
317
+ }
318
+ }
319
+ class Sp1 extends UniffiError {
320
+ /**
321
+ * @private
322
+ * This field is private and should not be used.
323
+ */
324
+ readonly [uniffiTypeNameSymbol]: string = "Exception";
325
+ /**
326
+ * @private
327
+ * This field is private and should not be used.
328
+ */
329
+ readonly [variantOrdinalSymbol] = 4;
330
+
331
+ public readonly tag = Exception_Tags.Sp1;
332
+
333
+ constructor(message: string) {
334
+ super("Exception", "Sp1", message);
335
+ }
336
+
337
+ static instanceOf(e: any): e is Sp1 {
338
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 4;
339
+ }
340
+ }
341
+
342
+ // Utility function which does not rely on instanceof.
343
+ function instanceOf(e: any): e is Exception {
344
+ return (e as any)[uniffiTypeNameSymbol] === "Exception";
345
+ }
346
+ return {
347
+ ProverNotInitialized,
348
+ FailedToParseProofRequestId,
349
+ Io,
350
+ Sp1,
351
+ instanceOf,
352
+ };
353
+ })();
354
+
355
+ // Union type for Exception error type.
356
+
357
+ export type Exception = InstanceType<
358
+ (typeof Exception)[keyof Omit<typeof Exception, "instanceOf">]
359
+ >;
360
+
361
+ const FfiConverterTypeError = (() => {
362
+ const intConverter = FfiConverterInt32;
363
+ type TypeName = Exception;
364
+ class FfiConverter extends AbstractFfiConverterByteArray<TypeName> {
365
+ read(from: RustBuffer): TypeName {
366
+ switch (intConverter.read(from)) {
367
+ case 1:
368
+ return new Exception.ProverNotInitialized(FfiConverterString.read(from));
369
+
370
+ case 2:
371
+ return new Exception.FailedToParseProofRequestId(FfiConverterString.read(from));
372
+
373
+ case 3:
374
+ return new Exception.Io(FfiConverterString.read(from));
375
+
376
+ case 4:
377
+ return new Exception.Sp1(FfiConverterString.read(from));
378
+
379
+ default:
380
+ throw new UniffiInternalError.UnexpectedEnumCase();
381
+ }
382
+ }
383
+ write(value: TypeName, into: RustBuffer): void {
384
+ const obj = value as any;
385
+ const index = obj[variantOrdinalSymbol] as number;
386
+ intConverter.write(index, into);
387
+ }
388
+ allocationSize(value: TypeName): number {
389
+ return intConverter.allocationSize(0);
390
+ }
391
+ }
392
+ return new FfiConverter();
393
+ })();
394
+
395
+ export enum FulfillmentStatus {
396
+ UnspecifiedFulfillmentStatus,
397
+ Requested,
398
+ Assigned,
399
+ Fulfilled,
400
+ Unfulfillable,
401
+ }
402
+
403
+ const FfiConverterTypeFulfillmentStatus = (() => {
404
+ const ordinalConverter = FfiConverterInt32;
405
+ type TypeName = FulfillmentStatus;
406
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
407
+ read(from: RustBuffer): TypeName {
408
+ switch (ordinalConverter.read(from)) {
409
+ case 1:
410
+ return FulfillmentStatus.UnspecifiedFulfillmentStatus;
411
+ case 2:
412
+ return FulfillmentStatus.Requested;
413
+ case 3:
414
+ return FulfillmentStatus.Assigned;
415
+ case 4:
416
+ return FulfillmentStatus.Fulfilled;
417
+ case 5:
418
+ return FulfillmentStatus.Unfulfillable;
419
+ default:
420
+ throw new UniffiInternalError.UnexpectedEnumCase();
421
+ }
422
+ }
423
+ write(value: TypeName, into: RustBuffer): void {
424
+ switch (value) {
425
+ case FulfillmentStatus.UnspecifiedFulfillmentStatus:
426
+ return ordinalConverter.write(1, into);
427
+ case FulfillmentStatus.Requested:
428
+ return ordinalConverter.write(2, into);
429
+ case FulfillmentStatus.Assigned:
430
+ return ordinalConverter.write(3, into);
431
+ case FulfillmentStatus.Fulfilled:
432
+ return ordinalConverter.write(4, into);
433
+ case FulfillmentStatus.Unfulfillable:
434
+ return ordinalConverter.write(5, into);
435
+ }
436
+ }
437
+ allocationSize(value: TypeName): number {
438
+ return ordinalConverter.allocationSize(0);
439
+ }
440
+ }
441
+ return new FFIConverter();
442
+ })();
443
+
444
+ /**
445
+ * Selects which prover network to connect to.
446
+ */
447
+ export enum ProverNetworkMode {
448
+ /**
449
+ * Mainnet network using auction-based proving.
450
+ */
451
+ Mainnet,
452
+ /**
453
+ * Reserved capacity network for hosted/reserved proving.
454
+ */
455
+ Reserved,
456
+ }
457
+
458
+ const FfiConverterTypeProverNetworkMode = (() => {
459
+ const ordinalConverter = FfiConverterInt32;
460
+ type TypeName = ProverNetworkMode;
461
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
462
+ read(from: RustBuffer): TypeName {
463
+ switch (ordinalConverter.read(from)) {
464
+ case 1:
465
+ return ProverNetworkMode.Mainnet;
466
+ case 2:
467
+ return ProverNetworkMode.Reserved;
468
+ default:
469
+ throw new UniffiInternalError.UnexpectedEnumCase();
470
+ }
471
+ }
472
+ write(value: TypeName, into: RustBuffer): void {
473
+ switch (value) {
474
+ case ProverNetworkMode.Mainnet:
475
+ return ordinalConverter.write(1, into);
476
+ case ProverNetworkMode.Reserved:
477
+ return ordinalConverter.write(2, into);
478
+ }
479
+ }
480
+ allocationSize(value: TypeName): number {
481
+ return ordinalConverter.allocationSize(0);
482
+ }
483
+ }
484
+ return new FFIConverter();
485
+ })();
486
+
487
+ export interface IosProvingClientInterface {
488
+ getProofStatus(
489
+ requestId: string,
490
+ asyncOpts_?: { signal: AbortSignal },
491
+ ) /*throws*/ : Promise<ProofRequestStatus>;
492
+ requestProof(
493
+ filePath: string,
494
+ format: string,
495
+ inputs: IosProofRequestInputs,
496
+ asyncOpts_?: { signal: AbortSignal },
497
+ ) /*throws*/ : Promise<string>;
498
+ vkHash() /*throws*/ : string;
499
+ }
500
+
501
+ export class IosProvingClient extends UniffiAbstractObject implements IosProvingClientInterface {
502
+ readonly [uniffiTypeNameSymbol] = "IosProvingClient";
503
+ readonly [destructorGuardSymbol]: UniffiRustArcPtr;
504
+ readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer;
505
+ constructor(
506
+ privateKey: string,
507
+ callback: Initialized | undefined = undefined,
508
+ networkMode: ProverNetworkMode | undefined,
509
+ ) {
510
+ super();
511
+ const pointer = uniffiCaller.rustCall(
512
+ /*caller:*/ (callStatus) => {
513
+ return nativeModule().ubrn_uniffi_zcam1_proving_utils_fn_constructor_iosprovingclient_new(
514
+ FfiConverterString.lower(privateKey),
515
+ FfiConverterOptionalTypeInitialized.lower(callback),
516
+ FfiConverterOptionalTypeProverNetworkMode.lower(networkMode),
517
+ callStatus,
518
+ );
519
+ },
520
+ /*liftString:*/ FfiConverterString.lift,
521
+ );
522
+ this[pointerLiteralSymbol] = pointer;
523
+ this[destructorGuardSymbol] = uniffiTypeIosProvingClientObjectFactory.bless(pointer);
524
+ }
525
+
526
+ public static mock(callback: Initialized | undefined = undefined): IosProvingClientInterface {
527
+ return FfiConverterTypeIosProvingClient.lift(
528
+ uniffiCaller.rustCall(
529
+ /*caller:*/ (callStatus) => {
530
+ return nativeModule().ubrn_uniffi_zcam1_proving_utils_fn_constructor_iosprovingclient_mock(
531
+ FfiConverterOptionalTypeInitialized.lower(callback),
532
+ callStatus,
533
+ );
534
+ },
535
+ /*liftString:*/ FfiConverterString.lift,
536
+ ),
537
+ );
538
+ }
539
+
540
+ public async getProofStatus(
541
+ requestId: string,
542
+ asyncOpts_?: { signal: AbortSignal },
543
+ ): Promise<ProofRequestStatus> /*throws*/ {
544
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
545
+ try {
546
+ return await uniffiRustCallAsync(
547
+ /*rustCaller:*/ uniffiCaller,
548
+ /*rustFutureFunc:*/ () => {
549
+ return nativeModule().ubrn_uniffi_zcam1_proving_utils_fn_method_iosprovingclient_get_proof_status(
550
+ uniffiTypeIosProvingClientObjectFactory.clonePointer(this),
551
+ FfiConverterString.lower(requestId),
552
+ );
553
+ },
554
+ /*pollFunc:*/ nativeModule().ubrn_ffi_zcam1_proving_utils_rust_future_poll_rust_buffer,
555
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_zcam1_proving_utils_rust_future_cancel_rust_buffer,
556
+ /*completeFunc:*/ nativeModule()
557
+ .ubrn_ffi_zcam1_proving_utils_rust_future_complete_rust_buffer,
558
+ /*freeFunc:*/ nativeModule().ubrn_ffi_zcam1_proving_utils_rust_future_free_rust_buffer,
559
+ /*liftFunc:*/ FfiConverterTypeProofRequestStatus.lift.bind(
560
+ FfiConverterTypeProofRequestStatus,
561
+ ),
562
+ /*liftString:*/ FfiConverterString.lift,
563
+ /*asyncOpts:*/ asyncOpts_,
564
+ /*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError),
565
+ );
566
+ } catch (__error: any) {
567
+ if (uniffiIsDebug && __error instanceof Error) {
568
+ __error.stack = __stack;
569
+ }
570
+ throw __error;
571
+ }
572
+ }
573
+
574
+ public async requestProof(
575
+ filePath: string,
576
+ format: string,
577
+ inputs: IosProofRequestInputs,
578
+ asyncOpts_?: { signal: AbortSignal },
579
+ ): Promise<string> /*throws*/ {
580
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
581
+ try {
582
+ return await uniffiRustCallAsync(
583
+ /*rustCaller:*/ uniffiCaller,
584
+ /*rustFutureFunc:*/ () => {
585
+ return nativeModule().ubrn_uniffi_zcam1_proving_utils_fn_method_iosprovingclient_request_proof(
586
+ uniffiTypeIosProvingClientObjectFactory.clonePointer(this),
587
+ FfiConverterString.lower(filePath),
588
+ FfiConverterString.lower(format),
589
+ FfiConverterTypeIosProofRequestInputs.lower(inputs),
590
+ );
591
+ },
592
+ /*pollFunc:*/ nativeModule().ubrn_ffi_zcam1_proving_utils_rust_future_poll_rust_buffer,
593
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_zcam1_proving_utils_rust_future_cancel_rust_buffer,
594
+ /*completeFunc:*/ nativeModule()
595
+ .ubrn_ffi_zcam1_proving_utils_rust_future_complete_rust_buffer,
596
+ /*freeFunc:*/ nativeModule().ubrn_ffi_zcam1_proving_utils_rust_future_free_rust_buffer,
597
+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
598
+ /*liftString:*/ FfiConverterString.lift,
599
+ /*asyncOpts:*/ asyncOpts_,
600
+ /*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError),
601
+ );
602
+ } catch (__error: any) {
603
+ if (uniffiIsDebug && __error instanceof Error) {
604
+ __error.stack = __stack;
605
+ }
606
+ throw __error;
607
+ }
608
+ }
609
+
610
+ public vkHash(): string /*throws*/ {
611
+ return FfiConverterString.lift(
612
+ uniffiCaller.rustCallWithError(
613
+ /*liftError:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError),
614
+ /*caller:*/ (callStatus) => {
615
+ return nativeModule().ubrn_uniffi_zcam1_proving_utils_fn_method_iosprovingclient_vk_hash(
616
+ uniffiTypeIosProvingClientObjectFactory.clonePointer(this),
617
+ callStatus,
618
+ );
619
+ },
620
+ /*liftString:*/ FfiConverterString.lift,
621
+ ),
622
+ );
623
+ }
624
+
625
+ /**
626
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
627
+ */
628
+ uniffiDestroy(): void {
629
+ const ptr = (this as any)[destructorGuardSymbol];
630
+ if (ptr !== undefined) {
631
+ const pointer = uniffiTypeIosProvingClientObjectFactory.pointer(this);
632
+ uniffiTypeIosProvingClientObjectFactory.freePointer(pointer);
633
+ uniffiTypeIosProvingClientObjectFactory.unbless(ptr);
634
+ delete (this as any)[destructorGuardSymbol];
635
+ }
636
+ }
637
+
638
+ static instanceOf(obj: any): obj is IosProvingClient {
639
+ return uniffiTypeIosProvingClientObjectFactory.isConcreteType(obj);
640
+ }
641
+ }
642
+
643
+ const uniffiTypeIosProvingClientObjectFactory: UniffiObjectFactory<IosProvingClientInterface> =
644
+ (() => {
645
+ return {
646
+ create(pointer: UnsafeMutableRawPointer): IosProvingClientInterface {
647
+ const instance = Object.create(IosProvingClient.prototype);
648
+ instance[pointerLiteralSymbol] = pointer;
649
+ instance[destructorGuardSymbol] = this.bless(pointer);
650
+ instance[uniffiTypeNameSymbol] = "IosProvingClient";
651
+ return instance;
652
+ },
653
+
654
+ bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
655
+ return uniffiCaller.rustCall(
656
+ /*caller:*/ (status) =>
657
+ nativeModule().ubrn_uniffi_internal_fn_method_iosprovingclient_ffi__bless_pointer(
658
+ p,
659
+ status,
660
+ ),
661
+ /*liftString:*/ FfiConverterString.lift,
662
+ );
663
+ },
664
+
665
+ unbless(ptr: UniffiRustArcPtr) {
666
+ ptr.markDestroyed();
667
+ },
668
+
669
+ pointer(obj: IosProvingClientInterface): UnsafeMutableRawPointer {
670
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
671
+ throw new UniffiInternalError.UnexpectedNullPointer();
672
+ }
673
+ return (obj as any)[pointerLiteralSymbol];
674
+ },
675
+
676
+ clonePointer(obj: IosProvingClientInterface): UnsafeMutableRawPointer {
677
+ const pointer = this.pointer(obj);
678
+ return uniffiCaller.rustCall(
679
+ /*caller:*/ (callStatus) =>
680
+ nativeModule().ubrn_uniffi_zcam1_proving_utils_fn_clone_iosprovingclient(
681
+ pointer,
682
+ callStatus,
683
+ ),
684
+ /*liftString:*/ FfiConverterString.lift,
685
+ );
686
+ },
687
+
688
+ freePointer(pointer: UnsafeMutableRawPointer): void {
689
+ uniffiCaller.rustCall(
690
+ /*caller:*/ (callStatus) =>
691
+ nativeModule().ubrn_uniffi_zcam1_proving_utils_fn_free_iosprovingclient(
692
+ pointer,
693
+ callStatus,
694
+ ),
695
+ /*liftString:*/ FfiConverterString.lift,
696
+ );
697
+ },
698
+
699
+ isConcreteType(obj: any): obj is IosProvingClientInterface {
700
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "IosProvingClient";
701
+ },
702
+ };
703
+ })();
704
+ // FfiConverter for IosProvingClientInterface
705
+ const FfiConverterTypeIosProvingClient = new FfiConverterObject(
706
+ uniffiTypeIosProvingClientObjectFactory,
707
+ );
708
+
709
+ // FfiConverter for ArrayBuffer | undefined
710
+ const FfiConverterOptionalArrayBuffer = new FfiConverterOptional(FfiConverterArrayBuffer);
711
+
712
+ // FfiConverter for Initialized | undefined
713
+ const FfiConverterOptionalTypeInitialized = new FfiConverterOptional(FfiConverterTypeInitialized);
714
+
715
+ // FfiConverter for ProverNetworkMode | undefined
716
+ const FfiConverterOptionalTypeProverNetworkMode = new FfiConverterOptional(
717
+ FfiConverterTypeProverNetworkMode,
718
+ );
719
+
720
+ /**
721
+ * This should be called before anything else.
722
+ *
723
+ * It is likely that this is being done for you by the library's `index.ts`.
724
+ *
725
+ * It checks versions of uniffi between when the Rust scaffolding was generated
726
+ * and when the bindings were generated.
727
+ *
728
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
729
+ */
730
+ function uniffiEnsureInitialized() {
731
+ // Get the bindings contract version from our ComponentInterface
732
+ const bindingsContractVersion = 29;
733
+ // Get the scaffolding contract version by calling the into the dylib
734
+ const scaffoldingContractVersion =
735
+ nativeModule().ubrn_ffi_zcam1_proving_utils_uniffi_contract_version();
736
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
737
+ throw new UniffiInternalError.ContractVersionMismatch(
738
+ scaffoldingContractVersion,
739
+ bindingsContractVersion,
740
+ );
741
+ }
742
+ if (
743
+ nativeModule().ubrn_uniffi_zcam1_proving_utils_checksum_method_iosprovingclient_get_proof_status() !==
744
+ 21814
745
+ ) {
746
+ throw new UniffiInternalError.ApiChecksumMismatch(
747
+ "uniffi_zcam1_proving_utils_checksum_method_iosprovingclient_get_proof_status",
748
+ );
749
+ }
750
+ if (
751
+ nativeModule().ubrn_uniffi_zcam1_proving_utils_checksum_method_iosprovingclient_request_proof() !==
752
+ 27732
753
+ ) {
754
+ throw new UniffiInternalError.ApiChecksumMismatch(
755
+ "uniffi_zcam1_proving_utils_checksum_method_iosprovingclient_request_proof",
756
+ );
757
+ }
758
+ if (
759
+ nativeModule().ubrn_uniffi_zcam1_proving_utils_checksum_method_iosprovingclient_vk_hash() !==
760
+ 9850
761
+ ) {
762
+ throw new UniffiInternalError.ApiChecksumMismatch(
763
+ "uniffi_zcam1_proving_utils_checksum_method_iosprovingclient_vk_hash",
764
+ );
765
+ }
766
+ if (
767
+ nativeModule().ubrn_uniffi_zcam1_proving_utils_checksum_constructor_iosprovingclient_mock() !==
768
+ 63763
769
+ ) {
770
+ throw new UniffiInternalError.ApiChecksumMismatch(
771
+ "uniffi_zcam1_proving_utils_checksum_constructor_iosprovingclient_mock",
772
+ );
773
+ }
774
+ if (
775
+ nativeModule().ubrn_uniffi_zcam1_proving_utils_checksum_constructor_iosprovingclient_new() !==
776
+ 16631
777
+ ) {
778
+ throw new UniffiInternalError.ApiChecksumMismatch(
779
+ "uniffi_zcam1_proving_utils_checksum_constructor_iosprovingclient_new",
780
+ );
781
+ }
782
+ if (
783
+ nativeModule().ubrn_uniffi_zcam1_proving_utils_checksum_method_initialized_initialized() !==
784
+ 19597
785
+ ) {
786
+ throw new UniffiInternalError.ApiChecksumMismatch(
787
+ "uniffi_zcam1_proving_utils_checksum_method_initialized_initialized",
788
+ );
789
+ }
790
+
791
+ uniffiCallbackInterfaceInitialized.register();
792
+ }
793
+
794
+ export default Object.freeze({
795
+ initialize: uniffiEnsureInitialized,
796
+ converters: {
797
+ FfiConverterTypeError,
798
+ FfiConverterTypeFulfillmentStatus,
799
+ FfiConverterTypeIosProofRequestInputs,
800
+ FfiConverterTypeIosProvingClient,
801
+ FfiConverterTypeProofRequestStatus,
802
+ FfiConverterTypeProverNetworkMode,
803
+ },
804
+ });