@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,1866 @@
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
+ } from "./zcam1_c2pa_utils-ffi";
33
+ import {
34
+ type FfiConverter,
35
+ type UniffiByteArray,
36
+ type UniffiObjectFactory,
37
+ type UniffiRustArcPtr,
38
+ type UnsafeMutableRawPointer,
39
+ AbstractFfiConverterByteArray,
40
+ FfiConverterArrayBuffer,
41
+ FfiConverterBool,
42
+ FfiConverterInt32,
43
+ FfiConverterObject,
44
+ FfiConverterOptional,
45
+ FfiConverterUInt32,
46
+ FfiConverterUInt64,
47
+ RustBuffer,
48
+ UniffiAbstractObject,
49
+ UniffiError,
50
+ UniffiInternalError,
51
+ UniffiRustCaller,
52
+ destructorGuardSymbol,
53
+ pointerLiteralSymbol,
54
+ uniffiCreateFfiConverterString,
55
+ uniffiCreateRecord,
56
+ uniffiRustCallAsync,
57
+ uniffiTypeNameSymbol,
58
+ variantOrdinalSymbol,
59
+ } from "uniffi-bindgen-react-native";
60
+
61
+ // Get converters from the other files, if any.
62
+ const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
63
+
64
+ const uniffiIsDebug =
65
+ // @ts-ignore -- The process global might not be defined
66
+ typeof process !== "object" ||
67
+ // @ts-ignore -- The process global might not be defined
68
+ process?.env?.NODE_ENV !== "production" ||
69
+ false;
70
+ // Public interface members begin here.
71
+
72
+ export async function authenticityStatus(
73
+ path: string,
74
+ asyncOpts_?: { signal: AbortSignal },
75
+ ): Promise<AuthenticityStatus> {
76
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
77
+ try {
78
+ return await uniffiRustCallAsync(
79
+ /*rustCaller:*/ uniffiCaller,
80
+ /*rustFutureFunc:*/ () => {
81
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_func_authenticity_status(
82
+ FfiConverterString.lower(path),
83
+ );
84
+ },
85
+ /*pollFunc:*/ nativeModule().ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_rust_buffer,
86
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_rust_buffer,
87
+ /*completeFunc:*/ nativeModule().ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_rust_buffer,
88
+ /*freeFunc:*/ nativeModule().ubrn_ffi_zcam1_c2pa_utils_rust_future_free_rust_buffer,
89
+ /*liftFunc:*/ FfiConverterTypeAuthenticityStatus.lift.bind(
90
+ FfiConverterTypeAuthenticityStatus,
91
+ ),
92
+ /*liftString:*/ FfiConverterString.lift,
93
+ /*asyncOpts:*/ asyncOpts_,
94
+ );
95
+ } catch (__error: any) {
96
+ if (uniffiIsDebug && __error instanceof Error) {
97
+ __error.stack = __stack;
98
+ }
99
+ throw __error;
100
+ }
101
+ }
102
+ /**
103
+ * Compute the hash for a file.
104
+ *
105
+ * Note: the file should **not** have a C2PA manifest embedded.
106
+ */
107
+ export function computeHash(path: string): ArrayBuffer /*throws*/ {
108
+ return FfiConverterArrayBuffer.lift(
109
+ uniffiCaller.rustCallWithError(
110
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
111
+ /*caller:*/ (callStatus) => {
112
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_func_compute_hash(
113
+ FfiConverterString.lower(path),
114
+ callStatus,
115
+ );
116
+ },
117
+ /*liftString:*/ FfiConverterString.lift,
118
+ ),
119
+ );
120
+ }
121
+ export function computeHashFromBuffer(buffer: ArrayBuffer, format: string): ArrayBuffer /*throws*/ {
122
+ return FfiConverterArrayBuffer.lift(
123
+ uniffiCaller.rustCallWithError(
124
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
125
+ /*caller:*/ (callStatus) => {
126
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_func_compute_hash_from_buffer(
127
+ FfiConverterArrayBuffer.lower(buffer),
128
+ FfiConverterString.lower(format),
129
+ callStatus,
130
+ );
131
+ },
132
+ /*liftString:*/ FfiConverterString.lift,
133
+ ),
134
+ );
135
+ }
136
+ export function extractManifest(path: string): ManifestStoreInterface /*throws*/ {
137
+ return FfiConverterTypeManifestStore.lift(
138
+ uniffiCaller.rustCallWithError(
139
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
140
+ /*caller:*/ (callStatus) => {
141
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_func_extract_manifest(
142
+ FfiConverterString.lower(path),
143
+ callStatus,
144
+ );
145
+ },
146
+ /*liftString:*/ FfiConverterString.lift,
147
+ ),
148
+ );
149
+ }
150
+ /**
151
+ * Return a MIME type given a file path.
152
+ *
153
+ * This function will use the file extension to determine the MIME type.
154
+ */
155
+ export function formatFromPath(path: string): string | undefined {
156
+ return FfiConverterOptionalString.lift(
157
+ uniffiCaller.rustCall(
158
+ /*caller:*/ (callStatus) => {
159
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_func_format_from_path(
160
+ FfiConverterString.lower(path),
161
+ callStatus,
162
+ );
163
+ },
164
+ /*liftString:*/ FfiConverterString.lift,
165
+ ),
166
+ );
167
+ }
168
+
169
+ export type AuthenticityData = {
170
+ isJailBroken: boolean;
171
+ isLocationSpoofingAvailable: boolean;
172
+ };
173
+
174
+ /**
175
+ * Generated factory for {@link AuthenticityData} record objects.
176
+ */
177
+ export const AuthenticityData = (() => {
178
+ const defaults = () => ({});
179
+ const create = (() => {
180
+ return uniffiCreateRecord<AuthenticityData, ReturnType<typeof defaults>>(defaults);
181
+ })();
182
+ return Object.freeze({
183
+ /**
184
+ * Create a frozen instance of {@link AuthenticityData}, with defaults specified
185
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
186
+ */
187
+ create,
188
+
189
+ /**
190
+ * Create a frozen instance of {@link AuthenticityData}, with defaults specified
191
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
192
+ */
193
+ new: create,
194
+
195
+ /**
196
+ * Defaults specified in the {@link zcam1_c2pa_utils} crate.
197
+ */
198
+ defaults: () => Object.freeze(defaults()) as Partial<AuthenticityData>,
199
+ });
200
+ })();
201
+
202
+ const FfiConverterTypeAuthenticityData = (() => {
203
+ type TypeName = AuthenticityData;
204
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
205
+ read(from: RustBuffer): TypeName {
206
+ return {
207
+ isJailBroken: FfiConverterBool.read(from),
208
+ isLocationSpoofingAvailable: FfiConverterBool.read(from),
209
+ };
210
+ }
211
+ write(value: TypeName, into: RustBuffer): void {
212
+ FfiConverterBool.write(value.isJailBroken, into);
213
+ FfiConverterBool.write(value.isLocationSpoofingAvailable, into);
214
+ }
215
+ allocationSize(value: TypeName): number {
216
+ return (
217
+ FfiConverterBool.allocationSize(value.isJailBroken) +
218
+ FfiConverterBool.allocationSize(value.isLocationSpoofingAvailable)
219
+ );
220
+ }
221
+ }
222
+ return new FFIConverter();
223
+ })();
224
+
225
+ export type Claim = {
226
+ signature: string;
227
+ };
228
+
229
+ /**
230
+ * Generated factory for {@link Claim} record objects.
231
+ */
232
+ export const Claim = (() => {
233
+ const defaults = () => ({});
234
+ const create = (() => {
235
+ return uniffiCreateRecord<Claim, ReturnType<typeof defaults>>(defaults);
236
+ })();
237
+ return Object.freeze({
238
+ /**
239
+ * Create a frozen instance of {@link Claim}, with defaults specified
240
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
241
+ */
242
+ create,
243
+
244
+ /**
245
+ * Create a frozen instance of {@link Claim}, with defaults specified
246
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
247
+ */
248
+ new: create,
249
+
250
+ /**
251
+ * Defaults specified in the {@link zcam1_c2pa_utils} crate.
252
+ */
253
+ defaults: () => Object.freeze(defaults()) as Partial<Claim>,
254
+ });
255
+ })();
256
+
257
+ const FfiConverterTypeClaim = (() => {
258
+ type TypeName = Claim;
259
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
260
+ read(from: RustBuffer): TypeName {
261
+ return {
262
+ signature: FfiConverterString.read(from),
263
+ };
264
+ }
265
+ write(value: TypeName, into: RustBuffer): void {
266
+ FfiConverterString.write(value.signature, into);
267
+ }
268
+ allocationSize(value: TypeName): number {
269
+ return FfiConverterString.allocationSize(value.signature);
270
+ }
271
+ }
272
+ return new FFIConverter();
273
+ })();
274
+
275
+ export type DepthData = {
276
+ width: /*u32*/ number;
277
+ height: /*u32*/ number;
278
+ pixelFormat: string;
279
+ statistics: DepthDataStatistics;
280
+ accuracy: string;
281
+ };
282
+
283
+ /**
284
+ * Generated factory for {@link DepthData} record objects.
285
+ */
286
+ export const DepthData = (() => {
287
+ const defaults = () => ({});
288
+ const create = (() => {
289
+ return uniffiCreateRecord<DepthData, ReturnType<typeof defaults>>(defaults);
290
+ })();
291
+ return Object.freeze({
292
+ /**
293
+ * Create a frozen instance of {@link DepthData}, with defaults specified
294
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
295
+ */
296
+ create,
297
+
298
+ /**
299
+ * Create a frozen instance of {@link DepthData}, with defaults specified
300
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
301
+ */
302
+ new: create,
303
+
304
+ /**
305
+ * Defaults specified in the {@link zcam1_c2pa_utils} crate.
306
+ */
307
+ defaults: () => Object.freeze(defaults()) as Partial<DepthData>,
308
+ });
309
+ })();
310
+
311
+ const FfiConverterTypeDepthData = (() => {
312
+ type TypeName = DepthData;
313
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
314
+ read(from: RustBuffer): TypeName {
315
+ return {
316
+ width: FfiConverterUInt32.read(from),
317
+ height: FfiConverterUInt32.read(from),
318
+ pixelFormat: FfiConverterString.read(from),
319
+ statistics: FfiConverterTypeDepthDataStatistics.read(from),
320
+ accuracy: FfiConverterString.read(from),
321
+ };
322
+ }
323
+ write(value: TypeName, into: RustBuffer): void {
324
+ FfiConverterUInt32.write(value.width, into);
325
+ FfiConverterUInt32.write(value.height, into);
326
+ FfiConverterString.write(value.pixelFormat, into);
327
+ FfiConverterTypeDepthDataStatistics.write(value.statistics, into);
328
+ FfiConverterString.write(value.accuracy, into);
329
+ }
330
+ allocationSize(value: TypeName): number {
331
+ return (
332
+ FfiConverterUInt32.allocationSize(value.width) +
333
+ FfiConverterUInt32.allocationSize(value.height) +
334
+ FfiConverterString.allocationSize(value.pixelFormat) +
335
+ FfiConverterTypeDepthDataStatistics.allocationSize(value.statistics) +
336
+ FfiConverterString.allocationSize(value.accuracy)
337
+ );
338
+ }
339
+ }
340
+ return new FFIConverter();
341
+ })();
342
+
343
+ export type DepthDataStatistics = {
344
+ min: string;
345
+ max: string;
346
+ mean: string;
347
+ stdDev: string;
348
+ validPixelCount: /*u32*/ number;
349
+ sampleStride: /*u32*/ number;
350
+ };
351
+
352
+ /**
353
+ * Generated factory for {@link DepthDataStatistics} record objects.
354
+ */
355
+ export const DepthDataStatistics = (() => {
356
+ const defaults = () => ({});
357
+ const create = (() => {
358
+ return uniffiCreateRecord<DepthDataStatistics, ReturnType<typeof defaults>>(defaults);
359
+ })();
360
+ return Object.freeze({
361
+ /**
362
+ * Create a frozen instance of {@link DepthDataStatistics}, with defaults specified
363
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
364
+ */
365
+ create,
366
+
367
+ /**
368
+ * Create a frozen instance of {@link DepthDataStatistics}, with defaults specified
369
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
370
+ */
371
+ new: create,
372
+
373
+ /**
374
+ * Defaults specified in the {@link zcam1_c2pa_utils} crate.
375
+ */
376
+ defaults: () => Object.freeze(defaults()) as Partial<DepthDataStatistics>,
377
+ });
378
+ })();
379
+
380
+ const FfiConverterTypeDepthDataStatistics = (() => {
381
+ type TypeName = DepthDataStatistics;
382
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
383
+ read(from: RustBuffer): TypeName {
384
+ return {
385
+ min: FfiConverterString.read(from),
386
+ max: FfiConverterString.read(from),
387
+ mean: FfiConverterString.read(from),
388
+ stdDev: FfiConverterString.read(from),
389
+ validPixelCount: FfiConverterUInt32.read(from),
390
+ sampleStride: FfiConverterUInt32.read(from),
391
+ };
392
+ }
393
+ write(value: TypeName, into: RustBuffer): void {
394
+ FfiConverterString.write(value.min, into);
395
+ FfiConverterString.write(value.max, into);
396
+ FfiConverterString.write(value.mean, into);
397
+ FfiConverterString.write(value.stdDev, into);
398
+ FfiConverterUInt32.write(value.validPixelCount, into);
399
+ FfiConverterUInt32.write(value.sampleStride, into);
400
+ }
401
+ allocationSize(value: TypeName): number {
402
+ return (
403
+ FfiConverterString.allocationSize(value.min) +
404
+ FfiConverterString.allocationSize(value.max) +
405
+ FfiConverterString.allocationSize(value.mean) +
406
+ FfiConverterString.allocationSize(value.stdDev) +
407
+ FfiConverterUInt32.allocationSize(value.validPixelCount) +
408
+ FfiConverterUInt32.allocationSize(value.sampleStride)
409
+ );
410
+ }
411
+ }
412
+ return new FFIConverter();
413
+ })();
414
+
415
+ export type DeviceBindings = {
416
+ appId: string;
417
+ deviceKeyId: string;
418
+ attestation: string;
419
+ assertion: string;
420
+ };
421
+
422
+ /**
423
+ * Generated factory for {@link DeviceBindings} record objects.
424
+ */
425
+ export const DeviceBindings = (() => {
426
+ const defaults = () => ({});
427
+ const create = (() => {
428
+ return uniffiCreateRecord<DeviceBindings, ReturnType<typeof defaults>>(defaults);
429
+ })();
430
+ return Object.freeze({
431
+ /**
432
+ * Create a frozen instance of {@link DeviceBindings}, with defaults specified
433
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
434
+ */
435
+ create,
436
+
437
+ /**
438
+ * Create a frozen instance of {@link DeviceBindings}, with defaults specified
439
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
440
+ */
441
+ new: create,
442
+
443
+ /**
444
+ * Defaults specified in the {@link zcam1_c2pa_utils} crate.
445
+ */
446
+ defaults: () => Object.freeze(defaults()) as Partial<DeviceBindings>,
447
+ });
448
+ })();
449
+
450
+ const FfiConverterTypeDeviceBindings = (() => {
451
+ type TypeName = DeviceBindings;
452
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
453
+ read(from: RustBuffer): TypeName {
454
+ return {
455
+ appId: FfiConverterString.read(from),
456
+ deviceKeyId: FfiConverterString.read(from),
457
+ attestation: FfiConverterString.read(from),
458
+ assertion: FfiConverterString.read(from),
459
+ };
460
+ }
461
+ write(value: TypeName, into: RustBuffer): void {
462
+ FfiConverterString.write(value.appId, into);
463
+ FfiConverterString.write(value.deviceKeyId, into);
464
+ FfiConverterString.write(value.attestation, into);
465
+ FfiConverterString.write(value.assertion, into);
466
+ }
467
+ allocationSize(value: TypeName): number {
468
+ return (
469
+ FfiConverterString.allocationSize(value.appId) +
470
+ FfiConverterString.allocationSize(value.deviceKeyId) +
471
+ FfiConverterString.allocationSize(value.attestation) +
472
+ FfiConverterString.allocationSize(value.assertion)
473
+ );
474
+ }
475
+ }
476
+ return new FFIConverter();
477
+ })();
478
+
479
+ export type Exclusion = {
480
+ start: /*u64*/ bigint;
481
+ length: /*u64*/ bigint;
482
+ };
483
+
484
+ /**
485
+ * Generated factory for {@link Exclusion} record objects.
486
+ */
487
+ export const Exclusion = (() => {
488
+ const defaults = () => ({});
489
+ const create = (() => {
490
+ return uniffiCreateRecord<Exclusion, ReturnType<typeof defaults>>(defaults);
491
+ })();
492
+ return Object.freeze({
493
+ /**
494
+ * Create a frozen instance of {@link Exclusion}, with defaults specified
495
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
496
+ */
497
+ create,
498
+
499
+ /**
500
+ * Create a frozen instance of {@link Exclusion}, with defaults specified
501
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
502
+ */
503
+ new: create,
504
+
505
+ /**
506
+ * Defaults specified in the {@link zcam1_c2pa_utils} crate.
507
+ */
508
+ defaults: () => Object.freeze(defaults()) as Partial<Exclusion>,
509
+ });
510
+ })();
511
+
512
+ const FfiConverterTypeExclusion = (() => {
513
+ type TypeName = Exclusion;
514
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
515
+ read(from: RustBuffer): TypeName {
516
+ return {
517
+ start: FfiConverterUInt64.read(from),
518
+ length: FfiConverterUInt64.read(from),
519
+ };
520
+ }
521
+ write(value: TypeName, into: RustBuffer): void {
522
+ FfiConverterUInt64.write(value.start, into);
523
+ FfiConverterUInt64.write(value.length, into);
524
+ }
525
+ allocationSize(value: TypeName): number {
526
+ return (
527
+ FfiConverterUInt64.allocationSize(value.start) +
528
+ FfiConverterUInt64.allocationSize(value.length)
529
+ );
530
+ }
531
+ }
532
+ return new FFIConverter();
533
+ })();
534
+
535
+ /**
536
+ * Film style (filter) information captured at the time of photo/video creation.
537
+ */
538
+ export type FilmStyleInfo = {
539
+ /**
540
+ * Name of the film style (e.g. "mellow", "bw", or a custom name).
541
+ */
542
+ name: string;
543
+ /**
544
+ * Whether this is a built-in preset, an overridden preset, or a custom style.
545
+ * One of "builtin", "override", or "custom".
546
+ */
547
+ source: string;
548
+ /**
549
+ * The recipe that was applied, serialized as a JSON array of effects.
550
+ */
551
+ recipe: string;
552
+ };
553
+
554
+ /**
555
+ * Generated factory for {@link FilmStyleInfo} record objects.
556
+ */
557
+ export const FilmStyleInfo = (() => {
558
+ const defaults = () => ({});
559
+ const create = (() => {
560
+ return uniffiCreateRecord<FilmStyleInfo, ReturnType<typeof defaults>>(defaults);
561
+ })();
562
+ return Object.freeze({
563
+ /**
564
+ * Create a frozen instance of {@link FilmStyleInfo}, with defaults specified
565
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
566
+ */
567
+ create,
568
+
569
+ /**
570
+ * Create a frozen instance of {@link FilmStyleInfo}, with defaults specified
571
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
572
+ */
573
+ new: create,
574
+
575
+ /**
576
+ * Defaults specified in the {@link zcam1_c2pa_utils} crate.
577
+ */
578
+ defaults: () => Object.freeze(defaults()) as Partial<FilmStyleInfo>,
579
+ });
580
+ })();
581
+
582
+ const FfiConverterTypeFilmStyleInfo = (() => {
583
+ type TypeName = FilmStyleInfo;
584
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
585
+ read(from: RustBuffer): TypeName {
586
+ return {
587
+ name: FfiConverterString.read(from),
588
+ source: FfiConverterString.read(from),
589
+ recipe: FfiConverterString.read(from),
590
+ };
591
+ }
592
+ write(value: TypeName, into: RustBuffer): void {
593
+ FfiConverterString.write(value.name, into);
594
+ FfiConverterString.write(value.source, into);
595
+ FfiConverterString.write(value.recipe, into);
596
+ }
597
+ allocationSize(value: TypeName): number {
598
+ return (
599
+ FfiConverterString.allocationSize(value.name) +
600
+ FfiConverterString.allocationSize(value.source) +
601
+ FfiConverterString.allocationSize(value.recipe)
602
+ );
603
+ }
604
+ }
605
+ return new FFIConverter();
606
+ })();
607
+
608
+ export type PhotoMetadataInfo = {
609
+ deviceMake: string;
610
+ deviceModel: string;
611
+ softwareVersion: string;
612
+ xResolution: /*u32*/ number;
613
+ yResolution: /*u32*/ number;
614
+ orientation: /*u32*/ number;
615
+ iso: string;
616
+ exposureTime: /*u32*/ number;
617
+ depthOfField: /*u32*/ number;
618
+ focalLength: /*u32*/ number;
619
+ authenticityData: AuthenticityData;
620
+ depthData: DepthData | undefined;
621
+ filmStyle: FilmStyleInfo | undefined;
622
+ };
623
+
624
+ /**
625
+ * Generated factory for {@link PhotoMetadataInfo} record objects.
626
+ */
627
+ export const PhotoMetadataInfo = (() => {
628
+ const defaults = () => ({});
629
+ const create = (() => {
630
+ return uniffiCreateRecord<PhotoMetadataInfo, ReturnType<typeof defaults>>(defaults);
631
+ })();
632
+ return Object.freeze({
633
+ /**
634
+ * Create a frozen instance of {@link PhotoMetadataInfo}, with defaults specified
635
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
636
+ */
637
+ create,
638
+
639
+ /**
640
+ * Create a frozen instance of {@link PhotoMetadataInfo}, with defaults specified
641
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
642
+ */
643
+ new: create,
644
+
645
+ /**
646
+ * Defaults specified in the {@link zcam1_c2pa_utils} crate.
647
+ */
648
+ defaults: () => Object.freeze(defaults()) as Partial<PhotoMetadataInfo>,
649
+ });
650
+ })();
651
+
652
+ const FfiConverterTypePhotoMetadataInfo = (() => {
653
+ type TypeName = PhotoMetadataInfo;
654
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
655
+ read(from: RustBuffer): TypeName {
656
+ return {
657
+ deviceMake: FfiConverterString.read(from),
658
+ deviceModel: FfiConverterString.read(from),
659
+ softwareVersion: FfiConverterString.read(from),
660
+ xResolution: FfiConverterUInt32.read(from),
661
+ yResolution: FfiConverterUInt32.read(from),
662
+ orientation: FfiConverterUInt32.read(from),
663
+ iso: FfiConverterString.read(from),
664
+ exposureTime: FfiConverterUInt32.read(from),
665
+ depthOfField: FfiConverterUInt32.read(from),
666
+ focalLength: FfiConverterUInt32.read(from),
667
+ authenticityData: FfiConverterTypeAuthenticityData.read(from),
668
+ depthData: FfiConverterOptionalTypeDepthData.read(from),
669
+ filmStyle: FfiConverterOptionalTypeFilmStyleInfo.read(from),
670
+ };
671
+ }
672
+ write(value: TypeName, into: RustBuffer): void {
673
+ FfiConverterString.write(value.deviceMake, into);
674
+ FfiConverterString.write(value.deviceModel, into);
675
+ FfiConverterString.write(value.softwareVersion, into);
676
+ FfiConverterUInt32.write(value.xResolution, into);
677
+ FfiConverterUInt32.write(value.yResolution, into);
678
+ FfiConverterUInt32.write(value.orientation, into);
679
+ FfiConverterString.write(value.iso, into);
680
+ FfiConverterUInt32.write(value.exposureTime, into);
681
+ FfiConverterUInt32.write(value.depthOfField, into);
682
+ FfiConverterUInt32.write(value.focalLength, into);
683
+ FfiConverterTypeAuthenticityData.write(value.authenticityData, into);
684
+ FfiConverterOptionalTypeDepthData.write(value.depthData, into);
685
+ FfiConverterOptionalTypeFilmStyleInfo.write(value.filmStyle, into);
686
+ }
687
+ allocationSize(value: TypeName): number {
688
+ return (
689
+ FfiConverterString.allocationSize(value.deviceMake) +
690
+ FfiConverterString.allocationSize(value.deviceModel) +
691
+ FfiConverterString.allocationSize(value.softwareVersion) +
692
+ FfiConverterUInt32.allocationSize(value.xResolution) +
693
+ FfiConverterUInt32.allocationSize(value.yResolution) +
694
+ FfiConverterUInt32.allocationSize(value.orientation) +
695
+ FfiConverterString.allocationSize(value.iso) +
696
+ FfiConverterUInt32.allocationSize(value.exposureTime) +
697
+ FfiConverterUInt32.allocationSize(value.depthOfField) +
698
+ FfiConverterUInt32.allocationSize(value.focalLength) +
699
+ FfiConverterTypeAuthenticityData.allocationSize(value.authenticityData) +
700
+ FfiConverterOptionalTypeDepthData.allocationSize(value.depthData) +
701
+ FfiConverterOptionalTypeFilmStyleInfo.allocationSize(value.filmStyle)
702
+ );
703
+ }
704
+ }
705
+ return new FFIConverter();
706
+ })();
707
+
708
+ export type Proof = {
709
+ data: string;
710
+ vkHash: string;
711
+ };
712
+
713
+ /**
714
+ * Generated factory for {@link Proof} record objects.
715
+ */
716
+ export const Proof = (() => {
717
+ const defaults = () => ({});
718
+ const create = (() => {
719
+ return uniffiCreateRecord<Proof, ReturnType<typeof defaults>>(defaults);
720
+ })();
721
+ return Object.freeze({
722
+ /**
723
+ * Create a frozen instance of {@link Proof}, with defaults specified
724
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
725
+ */
726
+ create,
727
+
728
+ /**
729
+ * Create a frozen instance of {@link Proof}, with defaults specified
730
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
731
+ */
732
+ new: create,
733
+
734
+ /**
735
+ * Defaults specified in the {@link zcam1_c2pa_utils} crate.
736
+ */
737
+ defaults: () => Object.freeze(defaults()) as Partial<Proof>,
738
+ });
739
+ })();
740
+
741
+ const FfiConverterTypeProof = (() => {
742
+ type TypeName = Proof;
743
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
744
+ read(from: RustBuffer): TypeName {
745
+ return {
746
+ data: FfiConverterString.read(from),
747
+ vkHash: FfiConverterString.read(from),
748
+ };
749
+ }
750
+ write(value: TypeName, into: RustBuffer): void {
751
+ FfiConverterString.write(value.data, into);
752
+ FfiConverterString.write(value.vkHash, into);
753
+ }
754
+ allocationSize(value: TypeName): number {
755
+ return (
756
+ FfiConverterString.allocationSize(value.data) +
757
+ FfiConverterString.allocationSize(value.vkHash)
758
+ );
759
+ }
760
+ }
761
+ return new FFIConverter();
762
+ })();
763
+
764
+ export type VideoMetadataInfo = {
765
+ deviceMake: string;
766
+ deviceModel: string;
767
+ softwareVersion: string;
768
+ format: string;
769
+ hasAudio: boolean;
770
+ durationSeconds: /*u32*/ number;
771
+ fileSizeBytes: /*u32*/ number;
772
+ width: /*u32*/ number;
773
+ height: /*u32*/ number;
774
+ rotationDegrees: /*u32*/ number;
775
+ frameRate: /*u32*/ number;
776
+ videoCodec: string | undefined;
777
+ audioCodec: string | undefined;
778
+ audioSampleRate: /*u32*/ number | undefined;
779
+ audioChannels: /*u32*/ number | undefined;
780
+ authenticityData: AuthenticityData;
781
+ filmStyle: FilmStyleInfo | undefined;
782
+ };
783
+
784
+ /**
785
+ * Generated factory for {@link VideoMetadataInfo} record objects.
786
+ */
787
+ export const VideoMetadataInfo = (() => {
788
+ const defaults = () => ({});
789
+ const create = (() => {
790
+ return uniffiCreateRecord<VideoMetadataInfo, ReturnType<typeof defaults>>(defaults);
791
+ })();
792
+ return Object.freeze({
793
+ /**
794
+ * Create a frozen instance of {@link VideoMetadataInfo}, with defaults specified
795
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
796
+ */
797
+ create,
798
+
799
+ /**
800
+ * Create a frozen instance of {@link VideoMetadataInfo}, with defaults specified
801
+ * in Rust, in the {@link zcam1_c2pa_utils} crate.
802
+ */
803
+ new: create,
804
+
805
+ /**
806
+ * Defaults specified in the {@link zcam1_c2pa_utils} crate.
807
+ */
808
+ defaults: () => Object.freeze(defaults()) as Partial<VideoMetadataInfo>,
809
+ });
810
+ })();
811
+
812
+ const FfiConverterTypeVideoMetadataInfo = (() => {
813
+ type TypeName = VideoMetadataInfo;
814
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
815
+ read(from: RustBuffer): TypeName {
816
+ return {
817
+ deviceMake: FfiConverterString.read(from),
818
+ deviceModel: FfiConverterString.read(from),
819
+ softwareVersion: FfiConverterString.read(from),
820
+ format: FfiConverterString.read(from),
821
+ hasAudio: FfiConverterBool.read(from),
822
+ durationSeconds: FfiConverterUInt32.read(from),
823
+ fileSizeBytes: FfiConverterUInt32.read(from),
824
+ width: FfiConverterUInt32.read(from),
825
+ height: FfiConverterUInt32.read(from),
826
+ rotationDegrees: FfiConverterUInt32.read(from),
827
+ frameRate: FfiConverterUInt32.read(from),
828
+ videoCodec: FfiConverterOptionalString.read(from),
829
+ audioCodec: FfiConverterOptionalString.read(from),
830
+ audioSampleRate: FfiConverterOptionalUInt32.read(from),
831
+ audioChannels: FfiConverterOptionalUInt32.read(from),
832
+ authenticityData: FfiConverterTypeAuthenticityData.read(from),
833
+ filmStyle: FfiConverterOptionalTypeFilmStyleInfo.read(from),
834
+ };
835
+ }
836
+ write(value: TypeName, into: RustBuffer): void {
837
+ FfiConverterString.write(value.deviceMake, into);
838
+ FfiConverterString.write(value.deviceModel, into);
839
+ FfiConverterString.write(value.softwareVersion, into);
840
+ FfiConverterString.write(value.format, into);
841
+ FfiConverterBool.write(value.hasAudio, into);
842
+ FfiConverterUInt32.write(value.durationSeconds, into);
843
+ FfiConverterUInt32.write(value.fileSizeBytes, into);
844
+ FfiConverterUInt32.write(value.width, into);
845
+ FfiConverterUInt32.write(value.height, into);
846
+ FfiConverterUInt32.write(value.rotationDegrees, into);
847
+ FfiConverterUInt32.write(value.frameRate, into);
848
+ FfiConverterOptionalString.write(value.videoCodec, into);
849
+ FfiConverterOptionalString.write(value.audioCodec, into);
850
+ FfiConverterOptionalUInt32.write(value.audioSampleRate, into);
851
+ FfiConverterOptionalUInt32.write(value.audioChannels, into);
852
+ FfiConverterTypeAuthenticityData.write(value.authenticityData, into);
853
+ FfiConverterOptionalTypeFilmStyleInfo.write(value.filmStyle, into);
854
+ }
855
+ allocationSize(value: TypeName): number {
856
+ return (
857
+ FfiConverterString.allocationSize(value.deviceMake) +
858
+ FfiConverterString.allocationSize(value.deviceModel) +
859
+ FfiConverterString.allocationSize(value.softwareVersion) +
860
+ FfiConverterString.allocationSize(value.format) +
861
+ FfiConverterBool.allocationSize(value.hasAudio) +
862
+ FfiConverterUInt32.allocationSize(value.durationSeconds) +
863
+ FfiConverterUInt32.allocationSize(value.fileSizeBytes) +
864
+ FfiConverterUInt32.allocationSize(value.width) +
865
+ FfiConverterUInt32.allocationSize(value.height) +
866
+ FfiConverterUInt32.allocationSize(value.rotationDegrees) +
867
+ FfiConverterUInt32.allocationSize(value.frameRate) +
868
+ FfiConverterOptionalString.allocationSize(value.videoCodec) +
869
+ FfiConverterOptionalString.allocationSize(value.audioCodec) +
870
+ FfiConverterOptionalUInt32.allocationSize(value.audioSampleRate) +
871
+ FfiConverterOptionalUInt32.allocationSize(value.audioChannels) +
872
+ FfiConverterTypeAuthenticityData.allocationSize(value.authenticityData) +
873
+ FfiConverterOptionalTypeFilmStyleInfo.allocationSize(value.filmStyle)
874
+ );
875
+ }
876
+ }
877
+ return new FFIConverter();
878
+ })();
879
+
880
+ const stringConverter = {
881
+ stringToBytes: (s: string) =>
882
+ uniffiCaller.rustCall((status) =>
883
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(s, status),
884
+ ),
885
+ bytesToString: (ab: UniffiByteArray) =>
886
+ uniffiCaller.rustCall((status) =>
887
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(ab, status),
888
+ ),
889
+ stringByteLength: (s: string) =>
890
+ uniffiCaller.rustCall((status) =>
891
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(s, status),
892
+ ),
893
+ };
894
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
895
+
896
+ export enum AuthenticityStatus {
897
+ Unknown,
898
+ NoManifest,
899
+ InvalidManifest,
900
+ Bindings,
901
+ Proof,
902
+ }
903
+
904
+ const FfiConverterTypeAuthenticityStatus = (() => {
905
+ const ordinalConverter = FfiConverterInt32;
906
+ type TypeName = AuthenticityStatus;
907
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
908
+ read(from: RustBuffer): TypeName {
909
+ switch (ordinalConverter.read(from)) {
910
+ case 1:
911
+ return AuthenticityStatus.Unknown;
912
+ case 2:
913
+ return AuthenticityStatus.NoManifest;
914
+ case 3:
915
+ return AuthenticityStatus.InvalidManifest;
916
+ case 4:
917
+ return AuthenticityStatus.Bindings;
918
+ case 5:
919
+ return AuthenticityStatus.Proof;
920
+ default:
921
+ throw new UniffiInternalError.UnexpectedEnumCase();
922
+ }
923
+ }
924
+ write(value: TypeName, into: RustBuffer): void {
925
+ switch (value) {
926
+ case AuthenticityStatus.Unknown:
927
+ return ordinalConverter.write(1, into);
928
+ case AuthenticityStatus.NoManifest:
929
+ return ordinalConverter.write(2, into);
930
+ case AuthenticityStatus.InvalidManifest:
931
+ return ordinalConverter.write(3, into);
932
+ case AuthenticityStatus.Bindings:
933
+ return ordinalConverter.write(4, into);
934
+ case AuthenticityStatus.Proof:
935
+ return ordinalConverter.write(5, into);
936
+ }
937
+ }
938
+ allocationSize(value: TypeName): number {
939
+ return ordinalConverter.allocationSize(0);
940
+ }
941
+ }
942
+ return new FFIConverter();
943
+ })();
944
+
945
+ // Flat error type: C2paError
946
+ export enum C2paError_Tags {
947
+ C2pa = "C2pa",
948
+ Json = "Json",
949
+ Io = "Io",
950
+ Base64 = "Base64",
951
+ NoActiveManifest = "NoActiveManifest",
952
+ NoHash = "NoHash",
953
+ FormatNotSupported = "FormatNotSupported",
954
+ Poisoned = "Poisoned",
955
+ }
956
+ export const C2paError = (() => {
957
+ class C2pa extends UniffiError {
958
+ /**
959
+ * @private
960
+ * This field is private and should not be used.
961
+ */
962
+ readonly [uniffiTypeNameSymbol]: string = "C2paError";
963
+ /**
964
+ * @private
965
+ * This field is private and should not be used.
966
+ */
967
+ readonly [variantOrdinalSymbol] = 1;
968
+
969
+ public readonly tag = C2paError_Tags.C2pa;
970
+
971
+ constructor(message: string) {
972
+ super("C2paError", "C2pa", message);
973
+ }
974
+
975
+ static instanceOf(e: any): e is C2pa {
976
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 1;
977
+ }
978
+ }
979
+ class Json extends UniffiError {
980
+ /**
981
+ * @private
982
+ * This field is private and should not be used.
983
+ */
984
+ readonly [uniffiTypeNameSymbol]: string = "C2paError";
985
+ /**
986
+ * @private
987
+ * This field is private and should not be used.
988
+ */
989
+ readonly [variantOrdinalSymbol] = 2;
990
+
991
+ public readonly tag = C2paError_Tags.Json;
992
+
993
+ constructor(message: string) {
994
+ super("C2paError", "Json", message);
995
+ }
996
+
997
+ static instanceOf(e: any): e is Json {
998
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 2;
999
+ }
1000
+ }
1001
+ class Io extends UniffiError {
1002
+ /**
1003
+ * @private
1004
+ * This field is private and should not be used.
1005
+ */
1006
+ readonly [uniffiTypeNameSymbol]: string = "C2paError";
1007
+ /**
1008
+ * @private
1009
+ * This field is private and should not be used.
1010
+ */
1011
+ readonly [variantOrdinalSymbol] = 3;
1012
+
1013
+ public readonly tag = C2paError_Tags.Io;
1014
+
1015
+ constructor(message: string) {
1016
+ super("C2paError", "Io", message);
1017
+ }
1018
+
1019
+ static instanceOf(e: any): e is Io {
1020
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 3;
1021
+ }
1022
+ }
1023
+ class Base64 extends UniffiError {
1024
+ /**
1025
+ * @private
1026
+ * This field is private and should not be used.
1027
+ */
1028
+ readonly [uniffiTypeNameSymbol]: string = "C2paError";
1029
+ /**
1030
+ * @private
1031
+ * This field is private and should not be used.
1032
+ */
1033
+ readonly [variantOrdinalSymbol] = 4;
1034
+
1035
+ public readonly tag = C2paError_Tags.Base64;
1036
+
1037
+ constructor(message: string) {
1038
+ super("C2paError", "Base64", message);
1039
+ }
1040
+
1041
+ static instanceOf(e: any): e is Base64 {
1042
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 4;
1043
+ }
1044
+ }
1045
+ class NoActiveManifest extends UniffiError {
1046
+ /**
1047
+ * @private
1048
+ * This field is private and should not be used.
1049
+ */
1050
+ readonly [uniffiTypeNameSymbol]: string = "C2paError";
1051
+ /**
1052
+ * @private
1053
+ * This field is private and should not be used.
1054
+ */
1055
+ readonly [variantOrdinalSymbol] = 5;
1056
+
1057
+ public readonly tag = C2paError_Tags.NoActiveManifest;
1058
+
1059
+ constructor(message: string) {
1060
+ super("C2paError", "NoActiveManifest", message);
1061
+ }
1062
+
1063
+ static instanceOf(e: any): e is NoActiveManifest {
1064
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 5;
1065
+ }
1066
+ }
1067
+ class NoHash extends UniffiError {
1068
+ /**
1069
+ * @private
1070
+ * This field is private and should not be used.
1071
+ */
1072
+ readonly [uniffiTypeNameSymbol]: string = "C2paError";
1073
+ /**
1074
+ * @private
1075
+ * This field is private and should not be used.
1076
+ */
1077
+ readonly [variantOrdinalSymbol] = 6;
1078
+
1079
+ public readonly tag = C2paError_Tags.NoHash;
1080
+
1081
+ constructor(message: string) {
1082
+ super("C2paError", "NoHash", message);
1083
+ }
1084
+
1085
+ static instanceOf(e: any): e is NoHash {
1086
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 6;
1087
+ }
1088
+ }
1089
+ class FormatNotSupported extends UniffiError {
1090
+ /**
1091
+ * @private
1092
+ * This field is private and should not be used.
1093
+ */
1094
+ readonly [uniffiTypeNameSymbol]: string = "C2paError";
1095
+ /**
1096
+ * @private
1097
+ * This field is private and should not be used.
1098
+ */
1099
+ readonly [variantOrdinalSymbol] = 7;
1100
+
1101
+ public readonly tag = C2paError_Tags.FormatNotSupported;
1102
+
1103
+ constructor(message: string) {
1104
+ super("C2paError", "FormatNotSupported", message);
1105
+ }
1106
+
1107
+ static instanceOf(e: any): e is FormatNotSupported {
1108
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 7;
1109
+ }
1110
+ }
1111
+ class Poisoned extends UniffiError {
1112
+ /**
1113
+ * @private
1114
+ * This field is private and should not be used.
1115
+ */
1116
+ readonly [uniffiTypeNameSymbol]: string = "C2paError";
1117
+ /**
1118
+ * @private
1119
+ * This field is private and should not be used.
1120
+ */
1121
+ readonly [variantOrdinalSymbol] = 8;
1122
+
1123
+ public readonly tag = C2paError_Tags.Poisoned;
1124
+
1125
+ constructor(message: string) {
1126
+ super("C2paError", "Poisoned", message);
1127
+ }
1128
+
1129
+ static instanceOf(e: any): e is Poisoned {
1130
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 8;
1131
+ }
1132
+ }
1133
+
1134
+ // Utility function which does not rely on instanceof.
1135
+ function instanceOf(e: any): e is C2paError {
1136
+ return (e as any)[uniffiTypeNameSymbol] === "C2paError";
1137
+ }
1138
+ return {
1139
+ C2pa,
1140
+ Json,
1141
+ Io,
1142
+ Base64,
1143
+ NoActiveManifest,
1144
+ NoHash,
1145
+ FormatNotSupported,
1146
+ Poisoned,
1147
+ instanceOf,
1148
+ };
1149
+ })();
1150
+
1151
+ // Union type for C2paError error type.
1152
+
1153
+ export type C2paError = InstanceType<
1154
+ (typeof C2paError)[keyof Omit<typeof C2paError, "instanceOf">]
1155
+ >;
1156
+
1157
+ const FfiConverterTypeC2paError = (() => {
1158
+ const intConverter = FfiConverterInt32;
1159
+ type TypeName = C2paError;
1160
+ class FfiConverter extends AbstractFfiConverterByteArray<TypeName> {
1161
+ read(from: RustBuffer): TypeName {
1162
+ switch (intConverter.read(from)) {
1163
+ case 1:
1164
+ return new C2paError.C2pa(FfiConverterString.read(from));
1165
+
1166
+ case 2:
1167
+ return new C2paError.Json(FfiConverterString.read(from));
1168
+
1169
+ case 3:
1170
+ return new C2paError.Io(FfiConverterString.read(from));
1171
+
1172
+ case 4:
1173
+ return new C2paError.Base64(FfiConverterString.read(from));
1174
+
1175
+ case 5:
1176
+ return new C2paError.NoActiveManifest(FfiConverterString.read(from));
1177
+
1178
+ case 6:
1179
+ return new C2paError.NoHash(FfiConverterString.read(from));
1180
+
1181
+ case 7:
1182
+ return new C2paError.FormatNotSupported(FfiConverterString.read(from));
1183
+
1184
+ case 8:
1185
+ return new C2paError.Poisoned(FfiConverterString.read(from));
1186
+
1187
+ default:
1188
+ throw new UniffiInternalError.UnexpectedEnumCase();
1189
+ }
1190
+ }
1191
+ write(value: TypeName, into: RustBuffer): void {
1192
+ const obj = value as any;
1193
+ const index = obj[variantOrdinalSymbol] as number;
1194
+ intConverter.write(index, into);
1195
+ }
1196
+ allocationSize(value: TypeName): number {
1197
+ return intConverter.allocationSize(0);
1198
+ }
1199
+ }
1200
+ return new FfiConverter();
1201
+ })();
1202
+
1203
+ export interface ManifestInterface {
1204
+ bindings(): DeviceBindings | undefined;
1205
+ captureMetadataAction() /*throws*/ : string | undefined;
1206
+ proof(): Proof | undefined;
1207
+ }
1208
+
1209
+ export class Manifest extends UniffiAbstractObject implements ManifestInterface {
1210
+ readonly [uniffiTypeNameSymbol] = "Manifest";
1211
+ readonly [destructorGuardSymbol]: UniffiRustArcPtr;
1212
+ readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer;
1213
+ // No primary constructor declared for this class.
1214
+ private constructor(pointer: UnsafeMutableRawPointer) {
1215
+ super();
1216
+ this[pointerLiteralSymbol] = pointer;
1217
+ this[destructorGuardSymbol] = uniffiTypeManifestObjectFactory.bless(pointer);
1218
+ }
1219
+
1220
+ public bindings(): DeviceBindings | undefined {
1221
+ return FfiConverterOptionalTypeDeviceBindings.lift(
1222
+ uniffiCaller.rustCall(
1223
+ /*caller:*/ (callStatus) => {
1224
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifest_bindings(
1225
+ uniffiTypeManifestObjectFactory.clonePointer(this),
1226
+ callStatus,
1227
+ );
1228
+ },
1229
+ /*liftString:*/ FfiConverterString.lift,
1230
+ ),
1231
+ );
1232
+ }
1233
+
1234
+ public captureMetadataAction(): string | undefined /*throws*/ {
1235
+ return FfiConverterOptionalString.lift(
1236
+ uniffiCaller.rustCallWithError(
1237
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
1238
+ /*caller:*/ (callStatus) => {
1239
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifest_capture_metadata_action(
1240
+ uniffiTypeManifestObjectFactory.clonePointer(this),
1241
+ callStatus,
1242
+ );
1243
+ },
1244
+ /*liftString:*/ FfiConverterString.lift,
1245
+ ),
1246
+ );
1247
+ }
1248
+
1249
+ public proof(): Proof | undefined {
1250
+ return FfiConverterOptionalTypeProof.lift(
1251
+ uniffiCaller.rustCall(
1252
+ /*caller:*/ (callStatus) => {
1253
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifest_proof(
1254
+ uniffiTypeManifestObjectFactory.clonePointer(this),
1255
+ callStatus,
1256
+ );
1257
+ },
1258
+ /*liftString:*/ FfiConverterString.lift,
1259
+ ),
1260
+ );
1261
+ }
1262
+
1263
+ /**
1264
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1265
+ */
1266
+ uniffiDestroy(): void {
1267
+ const ptr = (this as any)[destructorGuardSymbol];
1268
+ if (ptr !== undefined) {
1269
+ const pointer = uniffiTypeManifestObjectFactory.pointer(this);
1270
+ uniffiTypeManifestObjectFactory.freePointer(pointer);
1271
+ uniffiTypeManifestObjectFactory.unbless(ptr);
1272
+ delete (this as any)[destructorGuardSymbol];
1273
+ }
1274
+ }
1275
+
1276
+ static instanceOf(obj: any): obj is Manifest {
1277
+ return uniffiTypeManifestObjectFactory.isConcreteType(obj);
1278
+ }
1279
+ }
1280
+
1281
+ const uniffiTypeManifestObjectFactory: UniffiObjectFactory<ManifestInterface> = (() => {
1282
+ return {
1283
+ create(pointer: UnsafeMutableRawPointer): ManifestInterface {
1284
+ const instance = Object.create(Manifest.prototype);
1285
+ instance[pointerLiteralSymbol] = pointer;
1286
+ instance[destructorGuardSymbol] = this.bless(pointer);
1287
+ instance[uniffiTypeNameSymbol] = "Manifest";
1288
+ return instance;
1289
+ },
1290
+
1291
+ bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
1292
+ return uniffiCaller.rustCall(
1293
+ /*caller:*/ (status) =>
1294
+ nativeModule().ubrn_uniffi_internal_fn_method_manifest_ffi__bless_pointer(p, status),
1295
+ /*liftString:*/ FfiConverterString.lift,
1296
+ );
1297
+ },
1298
+
1299
+ unbless(ptr: UniffiRustArcPtr) {
1300
+ ptr.markDestroyed();
1301
+ },
1302
+
1303
+ pointer(obj: ManifestInterface): UnsafeMutableRawPointer {
1304
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1305
+ throw new UniffiInternalError.UnexpectedNullPointer();
1306
+ }
1307
+ return (obj as any)[pointerLiteralSymbol];
1308
+ },
1309
+
1310
+ clonePointer(obj: ManifestInterface): UnsafeMutableRawPointer {
1311
+ const pointer = this.pointer(obj);
1312
+ return uniffiCaller.rustCall(
1313
+ /*caller:*/ (callStatus) =>
1314
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_clone_manifest(pointer, callStatus),
1315
+ /*liftString:*/ FfiConverterString.lift,
1316
+ );
1317
+ },
1318
+
1319
+ freePointer(pointer: UnsafeMutableRawPointer): void {
1320
+ uniffiCaller.rustCall(
1321
+ /*caller:*/ (callStatus) =>
1322
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_free_manifest(pointer, callStatus),
1323
+ /*liftString:*/ FfiConverterString.lift,
1324
+ );
1325
+ },
1326
+
1327
+ isConcreteType(obj: any): obj is ManifestInterface {
1328
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "Manifest";
1329
+ },
1330
+ };
1331
+ })();
1332
+ // FfiConverter for ManifestInterface
1333
+ const FfiConverterTypeManifest = new FfiConverterObject(uniffiTypeManifestObjectFactory);
1334
+
1335
+ export interface ManifestEditorInterface {
1336
+ addAssertion(label: string, data: string) /*throws*/ : void;
1337
+ addPhotoMetadataAction(parameters: PhotoMetadataInfo, when: string) /*throws*/ : string;
1338
+ addTitle(title: string) /*throws*/ : void;
1339
+ addVideoMetadataAction(parameters: VideoMetadataInfo, when: string) /*throws*/ : string;
1340
+ embedManifestToFile(
1341
+ destination: string,
1342
+ format: string,
1343
+ asyncOpts_?: { signal: AbortSignal },
1344
+ ) /*throws*/ : Promise<void>;
1345
+ removeAssertion(label: string) /*throws*/ : boolean;
1346
+ }
1347
+
1348
+ export class ManifestEditor extends UniffiAbstractObject implements ManifestEditorInterface {
1349
+ readonly [uniffiTypeNameSymbol] = "ManifestEditor";
1350
+ readonly [destructorGuardSymbol]: UniffiRustArcPtr;
1351
+ readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer;
1352
+ constructor(path: string, keyTag: ArrayBuffer, certs: string) {
1353
+ super();
1354
+ const pointer = uniffiCaller.rustCall(
1355
+ /*caller:*/ (callStatus) => {
1356
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_constructor_manifesteditor_new(
1357
+ FfiConverterString.lower(path),
1358
+ FfiConverterArrayBuffer.lower(keyTag),
1359
+ FfiConverterString.lower(certs),
1360
+ callStatus,
1361
+ );
1362
+ },
1363
+ /*liftString:*/ FfiConverterString.lift,
1364
+ );
1365
+ this[pointerLiteralSymbol] = pointer;
1366
+ this[destructorGuardSymbol] = uniffiTypeManifestEditorObjectFactory.bless(pointer);
1367
+ }
1368
+
1369
+ /**
1370
+ * Creates a builder from a file that is expected to contain an existing C2PA manifest.
1371
+ *
1372
+ * The metadata included in the manifest are kept.
1373
+ */
1374
+ public static fromManifest(
1375
+ path: string,
1376
+ keyTag: ArrayBuffer,
1377
+ certs: string,
1378
+ ): ManifestEditorInterface /*throws*/ {
1379
+ return FfiConverterTypeManifestEditor.lift(
1380
+ uniffiCaller.rustCallWithError(
1381
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
1382
+ /*caller:*/ (callStatus) => {
1383
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_constructor_manifesteditor_from_manifest(
1384
+ FfiConverterString.lower(path),
1385
+ FfiConverterArrayBuffer.lower(keyTag),
1386
+ FfiConverterString.lower(certs),
1387
+ callStatus,
1388
+ );
1389
+ },
1390
+ /*liftString:*/ FfiConverterString.lift,
1391
+ ),
1392
+ );
1393
+ }
1394
+
1395
+ public addAssertion(label: string, data: string): void /*throws*/ {
1396
+ uniffiCaller.rustCallWithError(
1397
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
1398
+ /*caller:*/ (callStatus) => {
1399
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_add_assertion(
1400
+ uniffiTypeManifestEditorObjectFactory.clonePointer(this),
1401
+ FfiConverterString.lower(label),
1402
+ FfiConverterString.lower(data),
1403
+ callStatus,
1404
+ );
1405
+ },
1406
+ /*liftString:*/ FfiConverterString.lift,
1407
+ );
1408
+ }
1409
+
1410
+ public addPhotoMetadataAction(parameters: PhotoMetadataInfo, when: string): string /*throws*/ {
1411
+ return FfiConverterString.lift(
1412
+ uniffiCaller.rustCallWithError(
1413
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
1414
+ /*caller:*/ (callStatus) => {
1415
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_add_photo_metadata_action(
1416
+ uniffiTypeManifestEditorObjectFactory.clonePointer(this),
1417
+ FfiConverterTypePhotoMetadataInfo.lower(parameters),
1418
+ FfiConverterString.lower(when),
1419
+ callStatus,
1420
+ );
1421
+ },
1422
+ /*liftString:*/ FfiConverterString.lift,
1423
+ ),
1424
+ );
1425
+ }
1426
+
1427
+ public addTitle(title: string): void /*throws*/ {
1428
+ uniffiCaller.rustCallWithError(
1429
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
1430
+ /*caller:*/ (callStatus) => {
1431
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_add_title(
1432
+ uniffiTypeManifestEditorObjectFactory.clonePointer(this),
1433
+ FfiConverterString.lower(title),
1434
+ callStatus,
1435
+ );
1436
+ },
1437
+ /*liftString:*/ FfiConverterString.lift,
1438
+ );
1439
+ }
1440
+
1441
+ public addVideoMetadataAction(parameters: VideoMetadataInfo, when: string): string /*throws*/ {
1442
+ return FfiConverterString.lift(
1443
+ uniffiCaller.rustCallWithError(
1444
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
1445
+ /*caller:*/ (callStatus) => {
1446
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_add_video_metadata_action(
1447
+ uniffiTypeManifestEditorObjectFactory.clonePointer(this),
1448
+ FfiConverterTypeVideoMetadataInfo.lower(parameters),
1449
+ FfiConverterString.lower(when),
1450
+ callStatus,
1451
+ );
1452
+ },
1453
+ /*liftString:*/ FfiConverterString.lift,
1454
+ ),
1455
+ );
1456
+ }
1457
+
1458
+ public async embedManifestToFile(
1459
+ destination: string,
1460
+ format: string,
1461
+ asyncOpts_?: { signal: AbortSignal },
1462
+ ): Promise<void> /*throws*/ {
1463
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1464
+ try {
1465
+ return await uniffiRustCallAsync(
1466
+ /*rustCaller:*/ uniffiCaller,
1467
+ /*rustFutureFunc:*/ () => {
1468
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_embed_manifest_to_file(
1469
+ uniffiTypeManifestEditorObjectFactory.clonePointer(this),
1470
+ FfiConverterString.lower(destination),
1471
+ FfiConverterString.lower(format),
1472
+ );
1473
+ },
1474
+ /*pollFunc:*/ nativeModule().ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_void,
1475
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_void,
1476
+ /*completeFunc:*/ nativeModule().ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_void,
1477
+ /*freeFunc:*/ nativeModule().ubrn_ffi_zcam1_c2pa_utils_rust_future_free_void,
1478
+ /*liftFunc:*/ (_v) => {},
1479
+ /*liftString:*/ FfiConverterString.lift,
1480
+ /*asyncOpts:*/ asyncOpts_,
1481
+ /*errorHandler:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
1482
+ );
1483
+ } catch (__error: any) {
1484
+ if (uniffiIsDebug && __error instanceof Error) {
1485
+ __error.stack = __stack;
1486
+ }
1487
+ throw __error;
1488
+ }
1489
+ }
1490
+
1491
+ public removeAssertion(label: string): boolean /*throws*/ {
1492
+ return FfiConverterBool.lift(
1493
+ uniffiCaller.rustCallWithError(
1494
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
1495
+ /*caller:*/ (callStatus) => {
1496
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_remove_assertion(
1497
+ uniffiTypeManifestEditorObjectFactory.clonePointer(this),
1498
+ FfiConverterString.lower(label),
1499
+ callStatus,
1500
+ );
1501
+ },
1502
+ /*liftString:*/ FfiConverterString.lift,
1503
+ ),
1504
+ );
1505
+ }
1506
+
1507
+ /**
1508
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1509
+ */
1510
+ uniffiDestroy(): void {
1511
+ const ptr = (this as any)[destructorGuardSymbol];
1512
+ if (ptr !== undefined) {
1513
+ const pointer = uniffiTypeManifestEditorObjectFactory.pointer(this);
1514
+ uniffiTypeManifestEditorObjectFactory.freePointer(pointer);
1515
+ uniffiTypeManifestEditorObjectFactory.unbless(ptr);
1516
+ delete (this as any)[destructorGuardSymbol];
1517
+ }
1518
+ }
1519
+
1520
+ static instanceOf(obj: any): obj is ManifestEditor {
1521
+ return uniffiTypeManifestEditorObjectFactory.isConcreteType(obj);
1522
+ }
1523
+ }
1524
+
1525
+ const uniffiTypeManifestEditorObjectFactory: UniffiObjectFactory<ManifestEditorInterface> = (() => {
1526
+ return {
1527
+ create(pointer: UnsafeMutableRawPointer): ManifestEditorInterface {
1528
+ const instance = Object.create(ManifestEditor.prototype);
1529
+ instance[pointerLiteralSymbol] = pointer;
1530
+ instance[destructorGuardSymbol] = this.bless(pointer);
1531
+ instance[uniffiTypeNameSymbol] = "ManifestEditor";
1532
+ return instance;
1533
+ },
1534
+
1535
+ bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
1536
+ return uniffiCaller.rustCall(
1537
+ /*caller:*/ (status) =>
1538
+ nativeModule().ubrn_uniffi_internal_fn_method_manifesteditor_ffi__bless_pointer(
1539
+ p,
1540
+ status,
1541
+ ),
1542
+ /*liftString:*/ FfiConverterString.lift,
1543
+ );
1544
+ },
1545
+
1546
+ unbless(ptr: UniffiRustArcPtr) {
1547
+ ptr.markDestroyed();
1548
+ },
1549
+
1550
+ pointer(obj: ManifestEditorInterface): UnsafeMutableRawPointer {
1551
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1552
+ throw new UniffiInternalError.UnexpectedNullPointer();
1553
+ }
1554
+ return (obj as any)[pointerLiteralSymbol];
1555
+ },
1556
+
1557
+ clonePointer(obj: ManifestEditorInterface): UnsafeMutableRawPointer {
1558
+ const pointer = this.pointer(obj);
1559
+ return uniffiCaller.rustCall(
1560
+ /*caller:*/ (callStatus) =>
1561
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_clone_manifesteditor(pointer, callStatus),
1562
+ /*liftString:*/ FfiConverterString.lift,
1563
+ );
1564
+ },
1565
+
1566
+ freePointer(pointer: UnsafeMutableRawPointer): void {
1567
+ uniffiCaller.rustCall(
1568
+ /*caller:*/ (callStatus) =>
1569
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_free_manifesteditor(pointer, callStatus),
1570
+ /*liftString:*/ FfiConverterString.lift,
1571
+ );
1572
+ },
1573
+
1574
+ isConcreteType(obj: any): obj is ManifestEditorInterface {
1575
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "ManifestEditor";
1576
+ },
1577
+ };
1578
+ })();
1579
+ // FfiConverter for ManifestEditorInterface
1580
+ const FfiConverterTypeManifestEditor = new FfiConverterObject(
1581
+ uniffiTypeManifestEditorObjectFactory,
1582
+ );
1583
+
1584
+ export interface ManifestStoreInterface {
1585
+ activeManifest() /*throws*/ : ManifestInterface;
1586
+ }
1587
+
1588
+ export class ManifestStore extends UniffiAbstractObject implements ManifestStoreInterface {
1589
+ readonly [uniffiTypeNameSymbol] = "ManifestStore";
1590
+ readonly [destructorGuardSymbol]: UniffiRustArcPtr;
1591
+ readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer;
1592
+ // No primary constructor declared for this class.
1593
+ private constructor(pointer: UnsafeMutableRawPointer) {
1594
+ super();
1595
+ this[pointerLiteralSymbol] = pointer;
1596
+ this[destructorGuardSymbol] = uniffiTypeManifestStoreObjectFactory.bless(pointer);
1597
+ }
1598
+
1599
+ public activeManifest(): ManifestInterface /*throws*/ {
1600
+ return FfiConverterTypeManifest.lift(
1601
+ uniffiCaller.rustCallWithError(
1602
+ /*liftError:*/ FfiConverterTypeC2paError.lift.bind(FfiConverterTypeC2paError),
1603
+ /*caller:*/ (callStatus) => {
1604
+ return nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifeststore_active_manifest(
1605
+ uniffiTypeManifestStoreObjectFactory.clonePointer(this),
1606
+ callStatus,
1607
+ );
1608
+ },
1609
+ /*liftString:*/ FfiConverterString.lift,
1610
+ ),
1611
+ );
1612
+ }
1613
+
1614
+ /**
1615
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1616
+ */
1617
+ uniffiDestroy(): void {
1618
+ const ptr = (this as any)[destructorGuardSymbol];
1619
+ if (ptr !== undefined) {
1620
+ const pointer = uniffiTypeManifestStoreObjectFactory.pointer(this);
1621
+ uniffiTypeManifestStoreObjectFactory.freePointer(pointer);
1622
+ uniffiTypeManifestStoreObjectFactory.unbless(ptr);
1623
+ delete (this as any)[destructorGuardSymbol];
1624
+ }
1625
+ }
1626
+
1627
+ static instanceOf(obj: any): obj is ManifestStore {
1628
+ return uniffiTypeManifestStoreObjectFactory.isConcreteType(obj);
1629
+ }
1630
+ }
1631
+
1632
+ const uniffiTypeManifestStoreObjectFactory: UniffiObjectFactory<ManifestStoreInterface> = (() => {
1633
+ return {
1634
+ create(pointer: UnsafeMutableRawPointer): ManifestStoreInterface {
1635
+ const instance = Object.create(ManifestStore.prototype);
1636
+ instance[pointerLiteralSymbol] = pointer;
1637
+ instance[destructorGuardSymbol] = this.bless(pointer);
1638
+ instance[uniffiTypeNameSymbol] = "ManifestStore";
1639
+ return instance;
1640
+ },
1641
+
1642
+ bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
1643
+ return uniffiCaller.rustCall(
1644
+ /*caller:*/ (status) =>
1645
+ nativeModule().ubrn_uniffi_internal_fn_method_manifeststore_ffi__bless_pointer(p, status),
1646
+ /*liftString:*/ FfiConverterString.lift,
1647
+ );
1648
+ },
1649
+
1650
+ unbless(ptr: UniffiRustArcPtr) {
1651
+ ptr.markDestroyed();
1652
+ },
1653
+
1654
+ pointer(obj: ManifestStoreInterface): UnsafeMutableRawPointer {
1655
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1656
+ throw new UniffiInternalError.UnexpectedNullPointer();
1657
+ }
1658
+ return (obj as any)[pointerLiteralSymbol];
1659
+ },
1660
+
1661
+ clonePointer(obj: ManifestStoreInterface): UnsafeMutableRawPointer {
1662
+ const pointer = this.pointer(obj);
1663
+ return uniffiCaller.rustCall(
1664
+ /*caller:*/ (callStatus) =>
1665
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_clone_manifeststore(pointer, callStatus),
1666
+ /*liftString:*/ FfiConverterString.lift,
1667
+ );
1668
+ },
1669
+
1670
+ freePointer(pointer: UnsafeMutableRawPointer): void {
1671
+ uniffiCaller.rustCall(
1672
+ /*caller:*/ (callStatus) =>
1673
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_fn_free_manifeststore(pointer, callStatus),
1674
+ /*liftString:*/ FfiConverterString.lift,
1675
+ );
1676
+ },
1677
+
1678
+ isConcreteType(obj: any): obj is ManifestStoreInterface {
1679
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "ManifestStore";
1680
+ },
1681
+ };
1682
+ })();
1683
+ // FfiConverter for ManifestStoreInterface
1684
+ const FfiConverterTypeManifestStore = new FfiConverterObject(uniffiTypeManifestStoreObjectFactory);
1685
+
1686
+ // FfiConverter for DepthData | undefined
1687
+ const FfiConverterOptionalTypeDepthData = new FfiConverterOptional(FfiConverterTypeDepthData);
1688
+
1689
+ // FfiConverter for DeviceBindings | undefined
1690
+ const FfiConverterOptionalTypeDeviceBindings = new FfiConverterOptional(
1691
+ FfiConverterTypeDeviceBindings,
1692
+ );
1693
+
1694
+ // FfiConverter for FilmStyleInfo | undefined
1695
+ const FfiConverterOptionalTypeFilmStyleInfo = new FfiConverterOptional(
1696
+ FfiConverterTypeFilmStyleInfo,
1697
+ );
1698
+
1699
+ // FfiConverter for Proof | undefined
1700
+ const FfiConverterOptionalTypeProof = new FfiConverterOptional(FfiConverterTypeProof);
1701
+
1702
+ // FfiConverter for string | undefined
1703
+ const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
1704
+
1705
+ // FfiConverter for /*u32*/number | undefined
1706
+ const FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32);
1707
+
1708
+ /**
1709
+ * This should be called before anything else.
1710
+ *
1711
+ * It is likely that this is being done for you by the library's `index.ts`.
1712
+ *
1713
+ * It checks versions of uniffi between when the Rust scaffolding was generated
1714
+ * and when the bindings were generated.
1715
+ *
1716
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
1717
+ */
1718
+ function uniffiEnsureInitialized() {
1719
+ // Get the bindings contract version from our ComponentInterface
1720
+ const bindingsContractVersion = 29;
1721
+ // Get the scaffolding contract version by calling the into the dylib
1722
+ const scaffoldingContractVersion =
1723
+ nativeModule().ubrn_ffi_zcam1_c2pa_utils_uniffi_contract_version();
1724
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
1725
+ throw new UniffiInternalError.ContractVersionMismatch(
1726
+ scaffoldingContractVersion,
1727
+ bindingsContractVersion,
1728
+ );
1729
+ }
1730
+ if (nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_func_authenticity_status() !== 16408) {
1731
+ throw new UniffiInternalError.ApiChecksumMismatch(
1732
+ "uniffi_zcam1_c2pa_utils_checksum_func_authenticity_status",
1733
+ );
1734
+ }
1735
+ if (nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_func_compute_hash() !== 19539) {
1736
+ throw new UniffiInternalError.ApiChecksumMismatch(
1737
+ "uniffi_zcam1_c2pa_utils_checksum_func_compute_hash",
1738
+ );
1739
+ }
1740
+ if (
1741
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_func_compute_hash_from_buffer() !== 10723
1742
+ ) {
1743
+ throw new UniffiInternalError.ApiChecksumMismatch(
1744
+ "uniffi_zcam1_c2pa_utils_checksum_func_compute_hash_from_buffer",
1745
+ );
1746
+ }
1747
+ if (nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_func_extract_manifest() !== 13636) {
1748
+ throw new UniffiInternalError.ApiChecksumMismatch(
1749
+ "uniffi_zcam1_c2pa_utils_checksum_func_extract_manifest",
1750
+ );
1751
+ }
1752
+ if (nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_func_format_from_path() !== 30877) {
1753
+ throw new UniffiInternalError.ApiChecksumMismatch(
1754
+ "uniffi_zcam1_c2pa_utils_checksum_func_format_from_path",
1755
+ );
1756
+ }
1757
+ if (nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifest_bindings() !== 48636) {
1758
+ throw new UniffiInternalError.ApiChecksumMismatch(
1759
+ "uniffi_zcam1_c2pa_utils_checksum_method_manifest_bindings",
1760
+ );
1761
+ }
1762
+ if (
1763
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifest_capture_metadata_action() !==
1764
+ 58322
1765
+ ) {
1766
+ throw new UniffiInternalError.ApiChecksumMismatch(
1767
+ "uniffi_zcam1_c2pa_utils_checksum_method_manifest_capture_metadata_action",
1768
+ );
1769
+ }
1770
+ if (nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifest_proof() !== 61561) {
1771
+ throw new UniffiInternalError.ApiChecksumMismatch(
1772
+ "uniffi_zcam1_c2pa_utils_checksum_method_manifest_proof",
1773
+ );
1774
+ }
1775
+ if (
1776
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_assertion() !==
1777
+ 1861
1778
+ ) {
1779
+ throw new UniffiInternalError.ApiChecksumMismatch(
1780
+ "uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_assertion",
1781
+ );
1782
+ }
1783
+ if (
1784
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_photo_metadata_action() !==
1785
+ 29229
1786
+ ) {
1787
+ throw new UniffiInternalError.ApiChecksumMismatch(
1788
+ "uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_photo_metadata_action",
1789
+ );
1790
+ }
1791
+ if (
1792
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_title() !== 41603
1793
+ ) {
1794
+ throw new UniffiInternalError.ApiChecksumMismatch(
1795
+ "uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_title",
1796
+ );
1797
+ }
1798
+ if (
1799
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_video_metadata_action() !==
1800
+ 1551
1801
+ ) {
1802
+ throw new UniffiInternalError.ApiChecksumMismatch(
1803
+ "uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_video_metadata_action",
1804
+ );
1805
+ }
1806
+ if (
1807
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_embed_manifest_to_file() !==
1808
+ 51702
1809
+ ) {
1810
+ throw new UniffiInternalError.ApiChecksumMismatch(
1811
+ "uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_embed_manifest_to_file",
1812
+ );
1813
+ }
1814
+ if (
1815
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_remove_assertion() !==
1816
+ 9530
1817
+ ) {
1818
+ throw new UniffiInternalError.ApiChecksumMismatch(
1819
+ "uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_remove_assertion",
1820
+ );
1821
+ }
1822
+ if (
1823
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifeststore_active_manifest() !==
1824
+ 39667
1825
+ ) {
1826
+ throw new UniffiInternalError.ApiChecksumMismatch(
1827
+ "uniffi_zcam1_c2pa_utils_checksum_method_manifeststore_active_manifest",
1828
+ );
1829
+ }
1830
+ if (
1831
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_constructor_manifesteditor_from_manifest() !==
1832
+ 16267
1833
+ ) {
1834
+ throw new UniffiInternalError.ApiChecksumMismatch(
1835
+ "uniffi_zcam1_c2pa_utils_checksum_constructor_manifesteditor_from_manifest",
1836
+ );
1837
+ }
1838
+ if (
1839
+ nativeModule().ubrn_uniffi_zcam1_c2pa_utils_checksum_constructor_manifesteditor_new() !== 9414
1840
+ ) {
1841
+ throw new UniffiInternalError.ApiChecksumMismatch(
1842
+ "uniffi_zcam1_c2pa_utils_checksum_constructor_manifesteditor_new",
1843
+ );
1844
+ }
1845
+ }
1846
+
1847
+ export default Object.freeze({
1848
+ initialize: uniffiEnsureInitialized,
1849
+ converters: {
1850
+ FfiConverterTypeAuthenticityData,
1851
+ FfiConverterTypeAuthenticityStatus,
1852
+ FfiConverterTypeC2paError,
1853
+ FfiConverterTypeClaim,
1854
+ FfiConverterTypeDepthData,
1855
+ FfiConverterTypeDepthDataStatistics,
1856
+ FfiConverterTypeDeviceBindings,
1857
+ FfiConverterTypeExclusion,
1858
+ FfiConverterTypeFilmStyleInfo,
1859
+ FfiConverterTypeManifest,
1860
+ FfiConverterTypeManifestEditor,
1861
+ FfiConverterTypeManifestStore,
1862
+ FfiConverterTypePhotoMetadataInfo,
1863
+ FfiConverterTypeProof,
1864
+ FfiConverterTypeVideoMetadataInfo,
1865
+ },
1866
+ });