@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,196 @@
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
+
4
+ import {
5
+ type StructuralEquality as UniffiStructuralEquality,
6
+ type UniffiForeignFuture as RuntimeUniffiForeignFuture,
7
+ type UniffiRustCallStatus,
8
+ type UniffiRustArcPtr,
9
+ type UniffiRustFutureContinuationCallback as RuntimeUniffiRustFutureContinuationCallback,
10
+ type UniffiResult,
11
+ } from "uniffi-bindgen-react-native";
12
+
13
+ interface NativeModuleInterface {
14
+ ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(
15
+ string: string,
16
+ uniffi_out_err: UniffiRustCallStatus,
17
+ ): number;
18
+ ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
19
+ string: string,
20
+ uniffi_out_err: UniffiRustCallStatus,
21
+ ): Uint8Array;
22
+ ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
23
+ buffer: Uint8Array,
24
+ uniffi_out_err: UniffiRustCallStatus,
25
+ ): string;
26
+ ubrn_uniffi_zcam1_verify_utils_fn_func_verify_bindings_from_manifest(
27
+ bindings: Uint8Array,
28
+ normalizedMetadata: Uint8Array,
29
+ photoHash: Uint8Array,
30
+ production: number,
31
+ uniffi_out_err: UniffiRustCallStatus,
32
+ ): number;
33
+ ubrn_uniffi_zcam1_verify_utils_fn_func_verify_groth16(
34
+ proof: Uint8Array,
35
+ publicInputs: Uint8Array,
36
+ sp1VkHash: Uint8Array,
37
+ uniffi_out_err: UniffiRustCallStatus,
38
+ ): number;
39
+ ubrn_uniffi_zcam1_verify_utils_checksum_func_verify_bindings_from_manifest(): number;
40
+ ubrn_uniffi_zcam1_verify_utils_checksum_func_verify_groth16(): number;
41
+ ubrn_ffi_zcam1_verify_utils_uniffi_contract_version(): number;
42
+ }
43
+
44
+ // Casting globalThis to any allows us to look for `NativeZcam1VerifyUtils`
45
+ // if it was added via JSI.
46
+ //
47
+ // We use a getter here rather than simply `globalThis.NativeZcam1VerifyUtils` so that
48
+ // if/when the startup sequence isn't just so, an empty value isn't inadvertantly cached.
49
+ const getter: () => NativeModuleInterface = () => (globalThis as any).NativeZcam1VerifyUtils;
50
+ export default getter;
51
+
52
+ // Structs and function types for calling back into Typescript from Rust.
53
+ export type UniffiRustFutureContinuationCallback = (data: bigint, pollResult: number) => void;
54
+ type UniffiForeignFutureFree = (handle: bigint) => void;
55
+ type UniffiCallbackInterfaceFree = (handle: bigint) => void;
56
+ export type UniffiForeignFuture = {
57
+ handle: bigint;
58
+ free: UniffiForeignFutureFree;
59
+ };
60
+ export type UniffiForeignFutureStructU8 = {
61
+ returnValue: number;
62
+ callStatus: UniffiRustCallStatus;
63
+ };
64
+ export type UniffiForeignFutureCompleteU8 = (
65
+ callbackData: bigint,
66
+ result: UniffiForeignFutureStructU8,
67
+ ) => void;
68
+ export type UniffiForeignFutureStructI8 = {
69
+ returnValue: number;
70
+ callStatus: UniffiRustCallStatus;
71
+ };
72
+ export type UniffiForeignFutureCompleteI8 = (
73
+ callbackData: bigint,
74
+ result: UniffiForeignFutureStructI8,
75
+ ) => void;
76
+ export type UniffiForeignFutureStructU16 = {
77
+ returnValue: number;
78
+ callStatus: UniffiRustCallStatus;
79
+ };
80
+ export type UniffiForeignFutureCompleteU16 = (
81
+ callbackData: bigint,
82
+ result: UniffiForeignFutureStructU16,
83
+ ) => void;
84
+ export type UniffiForeignFutureStructI16 = {
85
+ returnValue: number;
86
+ callStatus: UniffiRustCallStatus;
87
+ };
88
+ export type UniffiForeignFutureCompleteI16 = (
89
+ callbackData: bigint,
90
+ result: UniffiForeignFutureStructI16,
91
+ ) => void;
92
+ export type UniffiForeignFutureStructU32 = {
93
+ returnValue: number;
94
+ callStatus: UniffiRustCallStatus;
95
+ };
96
+ export type UniffiForeignFutureCompleteU32 = (
97
+ callbackData: bigint,
98
+ result: UniffiForeignFutureStructU32,
99
+ ) => void;
100
+ export type UniffiForeignFutureStructI32 = {
101
+ returnValue: number;
102
+ callStatus: UniffiRustCallStatus;
103
+ };
104
+ export type UniffiForeignFutureCompleteI32 = (
105
+ callbackData: bigint,
106
+ result: UniffiForeignFutureStructI32,
107
+ ) => void;
108
+ export type UniffiForeignFutureStructU64 = {
109
+ returnValue: bigint;
110
+ callStatus: UniffiRustCallStatus;
111
+ };
112
+ export type UniffiForeignFutureCompleteU64 = (
113
+ callbackData: bigint,
114
+ result: UniffiForeignFutureStructU64,
115
+ ) => void;
116
+ export type UniffiForeignFutureStructI64 = {
117
+ returnValue: bigint;
118
+ callStatus: UniffiRustCallStatus;
119
+ };
120
+ export type UniffiForeignFutureCompleteI64 = (
121
+ callbackData: bigint,
122
+ result: UniffiForeignFutureStructI64,
123
+ ) => void;
124
+ export type UniffiForeignFutureStructF32 = {
125
+ returnValue: number;
126
+ callStatus: UniffiRustCallStatus;
127
+ };
128
+ export type UniffiForeignFutureCompleteF32 = (
129
+ callbackData: bigint,
130
+ result: UniffiForeignFutureStructF32,
131
+ ) => void;
132
+ export type UniffiForeignFutureStructF64 = {
133
+ returnValue: number;
134
+ callStatus: UniffiRustCallStatus;
135
+ };
136
+ export type UniffiForeignFutureCompleteF64 = (
137
+ callbackData: bigint,
138
+ result: UniffiForeignFutureStructF64,
139
+ ) => void;
140
+ export type UniffiForeignFutureStructPointer = {
141
+ returnValue: bigint;
142
+ callStatus: UniffiRustCallStatus;
143
+ };
144
+ export type UniffiForeignFutureCompletePointer = (
145
+ callbackData: bigint,
146
+ result: UniffiForeignFutureStructPointer,
147
+ ) => void;
148
+ export type UniffiForeignFutureStructRustBuffer = {
149
+ returnValue: Uint8Array;
150
+ callStatus: UniffiRustCallStatus;
151
+ };
152
+ export type UniffiForeignFutureCompleteRustBuffer = (
153
+ callbackData: bigint,
154
+ result: UniffiForeignFutureStructRustBuffer,
155
+ ) => void;
156
+ export type UniffiForeignFutureStructVoid = {
157
+ callStatus: UniffiRustCallStatus;
158
+ };
159
+ export type UniffiForeignFutureCompleteVoid = (
160
+ callbackData: bigint,
161
+ result: UniffiForeignFutureStructVoid,
162
+ ) => void;
163
+
164
+ // UniffiRustFutureContinuationCallback is generated as part of the component interface's
165
+ // ffi_definitions. However, we need it in the runtime.
166
+ // We could:
167
+ // (a) do some complicated template logic to ensure the declaration is not generated here (possible)
168
+ // (b) import the generated declaration into the runtime (m a y b e) or…
169
+ // (c) generate the declaration anyway, and use a different declaration in the runtime.
170
+ //
171
+ // We chose (c) here as the simplest. In addition, we perform a compile time check that
172
+ // the two versions of `UniffiRustFutureContinuationCallback` are structurally equivalent.
173
+ //
174
+ // If you see the error:
175
+ // ```
176
+ // Type 'true' is not assignable to type 'false'.(2322)
177
+ // ```
178
+ // Then a new version of uniffi has changed the signature of the callback. Most likely, code in
179
+ // `typescript/src/async-rust-call.ts` will need to be changed.
180
+ //
181
+ // If you see the error:
182
+ // ```
183
+ // Cannot find name 'UniffiRustFutureContinuationCallback'. Did you mean 'RuntimeUniffiRustFutureContinuationCallback'?(2552)
184
+ // ```
185
+ // then you may not be using callbacks or promises, and uniffi is now not generating Futures and callbacks.
186
+ // You should not generate this if that is the case.
187
+ //
188
+ // ('You' being the bindings generator maintainer).
189
+ const isRustFutureContinuationCallbackTypeCompatible: UniffiStructuralEquality<
190
+ RuntimeUniffiRustFutureContinuationCallback,
191
+ UniffiRustFutureContinuationCallback
192
+ > = true;
193
+ const isUniffiForeignFutureTypeCompatible: UniffiStructuralEquality<
194
+ RuntimeUniffiForeignFuture,
195
+ UniffiForeignFuture
196
+ > = true;
@@ -0,0 +1,372 @@
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_verify_utils-ffi";
33
+ import { type DeviceBindings } from "./zcam1_c2pa_utils";
34
+ import {
35
+ type UniffiByteArray,
36
+ AbstractFfiConverterByteArray,
37
+ FfiConverterArrayBuffer,
38
+ FfiConverterBool,
39
+ FfiConverterInt32,
40
+ RustBuffer,
41
+ UniffiError,
42
+ UniffiInternalError,
43
+ UniffiRustCaller,
44
+ uniffiCreateFfiConverterString,
45
+ uniffiTypeNameSymbol,
46
+ variantOrdinalSymbol,
47
+ } from "uniffi-bindgen-react-native";
48
+
49
+ // Get converters from the other files, if any.
50
+ import uniffiZcam1C2paUtilsModule from "./zcam1_c2pa_utils";
51
+ const { FfiConverterTypeDeviceBindings } = uniffiZcam1C2paUtilsModule.converters;
52
+ const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
53
+
54
+ const uniffiIsDebug =
55
+ // @ts-ignore -- The process global might not be defined
56
+ typeof process !== "object" ||
57
+ // @ts-ignore -- The process global might not be defined
58
+ process?.env?.NODE_ENV !== "production" ||
59
+ false;
60
+ // Public interface members begin here.
61
+
62
+ export function verifyBindingsFromManifest(
63
+ bindings: DeviceBindings,
64
+ normalizedMetadata: string,
65
+ photoHash: ArrayBuffer,
66
+ production: boolean,
67
+ ): boolean /*throws*/ {
68
+ return FfiConverterBool.lift(
69
+ uniffiCaller.rustCallWithError(
70
+ /*liftError:*/ FfiConverterTypeVerifyError.lift.bind(FfiConverterTypeVerifyError),
71
+ /*caller:*/ (callStatus) => {
72
+ return nativeModule().ubrn_uniffi_zcam1_verify_utils_fn_func_verify_bindings_from_manifest(
73
+ FfiConverterTypeDeviceBindings.lower(bindings),
74
+ FfiConverterString.lower(normalizedMetadata),
75
+ FfiConverterArrayBuffer.lower(photoHash),
76
+ FfiConverterBool.lower(production),
77
+ callStatus,
78
+ );
79
+ },
80
+ /*liftString:*/ FfiConverterString.lift,
81
+ ),
82
+ );
83
+ }
84
+ /**
85
+ * Wrapper around [`sp1_verifier::Groth16Verifier::verify`].
86
+ *
87
+ * We hardcode the Groth16 VK bytes to only verify SP1 proofs.
88
+ */
89
+ export function verifyGroth16(
90
+ proof: ArrayBuffer,
91
+ publicInputs: ArrayBuffer,
92
+ sp1VkHash: string,
93
+ ): boolean /*throws*/ {
94
+ return FfiConverterBool.lift(
95
+ uniffiCaller.rustCallWithError(
96
+ /*liftError:*/ FfiConverterTypeVerifyError.lift.bind(FfiConverterTypeVerifyError),
97
+ /*caller:*/ (callStatus) => {
98
+ return nativeModule().ubrn_uniffi_zcam1_verify_utils_fn_func_verify_groth16(
99
+ FfiConverterArrayBuffer.lower(proof),
100
+ FfiConverterArrayBuffer.lower(publicInputs),
101
+ FfiConverterString.lower(sp1VkHash),
102
+ callStatus,
103
+ );
104
+ },
105
+ /*liftString:*/ FfiConverterString.lift,
106
+ ),
107
+ );
108
+ }
109
+
110
+ const stringConverter = {
111
+ stringToBytes: (s: string) =>
112
+ uniffiCaller.rustCall((status) =>
113
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(s, status),
114
+ ),
115
+ bytesToString: (ab: UniffiByteArray) =>
116
+ uniffiCaller.rustCall((status) =>
117
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(ab, status),
118
+ ),
119
+ stringByteLength: (s: string) =>
120
+ uniffiCaller.rustCall((status) =>
121
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(s, status),
122
+ ),
123
+ };
124
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
125
+
126
+ // Flat error type: VerifyError
127
+ export enum VerifyError_Tags {
128
+ C2pa = "C2pa",
129
+ AppAttest = "AppAttest",
130
+ Base64 = "Base64",
131
+ Io = "Io",
132
+ Groth16 = "Groth16",
133
+ ProofNotFound = "ProofNotFound",
134
+ }
135
+ export const VerifyError = (() => {
136
+ class C2pa extends UniffiError {
137
+ /**
138
+ * @private
139
+ * This field is private and should not be used.
140
+ */
141
+ readonly [uniffiTypeNameSymbol]: string = "VerifyError";
142
+ /**
143
+ * @private
144
+ * This field is private and should not be used.
145
+ */
146
+ readonly [variantOrdinalSymbol] = 1;
147
+
148
+ public readonly tag = VerifyError_Tags.C2pa;
149
+
150
+ constructor(message: string) {
151
+ super("VerifyError", "C2pa", message);
152
+ }
153
+
154
+ static instanceOf(e: any): e is C2pa {
155
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 1;
156
+ }
157
+ }
158
+ class AppAttest extends UniffiError {
159
+ /**
160
+ * @private
161
+ * This field is private and should not be used.
162
+ */
163
+ readonly [uniffiTypeNameSymbol]: string = "VerifyError";
164
+ /**
165
+ * @private
166
+ * This field is private and should not be used.
167
+ */
168
+ readonly [variantOrdinalSymbol] = 2;
169
+
170
+ public readonly tag = VerifyError_Tags.AppAttest;
171
+
172
+ constructor(message: string) {
173
+ super("VerifyError", "AppAttest", message);
174
+ }
175
+
176
+ static instanceOf(e: any): e is AppAttest {
177
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 2;
178
+ }
179
+ }
180
+ class Base64 extends UniffiError {
181
+ /**
182
+ * @private
183
+ * This field is private and should not be used.
184
+ */
185
+ readonly [uniffiTypeNameSymbol]: string = "VerifyError";
186
+ /**
187
+ * @private
188
+ * This field is private and should not be used.
189
+ */
190
+ readonly [variantOrdinalSymbol] = 3;
191
+
192
+ public readonly tag = VerifyError_Tags.Base64;
193
+
194
+ constructor(message: string) {
195
+ super("VerifyError", "Base64", message);
196
+ }
197
+
198
+ static instanceOf(e: any): e is Base64 {
199
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 3;
200
+ }
201
+ }
202
+ class Io extends UniffiError {
203
+ /**
204
+ * @private
205
+ * This field is private and should not be used.
206
+ */
207
+ readonly [uniffiTypeNameSymbol]: string = "VerifyError";
208
+ /**
209
+ * @private
210
+ * This field is private and should not be used.
211
+ */
212
+ readonly [variantOrdinalSymbol] = 4;
213
+
214
+ public readonly tag = VerifyError_Tags.Io;
215
+
216
+ constructor(message: string) {
217
+ super("VerifyError", "Io", message);
218
+ }
219
+
220
+ static instanceOf(e: any): e is Io {
221
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 4;
222
+ }
223
+ }
224
+ class Groth16 extends UniffiError {
225
+ /**
226
+ * @private
227
+ * This field is private and should not be used.
228
+ */
229
+ readonly [uniffiTypeNameSymbol]: string = "VerifyError";
230
+ /**
231
+ * @private
232
+ * This field is private and should not be used.
233
+ */
234
+ readonly [variantOrdinalSymbol] = 5;
235
+
236
+ public readonly tag = VerifyError_Tags.Groth16;
237
+
238
+ constructor(message: string) {
239
+ super("VerifyError", "Groth16", message);
240
+ }
241
+
242
+ static instanceOf(e: any): e is Groth16 {
243
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 5;
244
+ }
245
+ }
246
+ class ProofNotFound extends UniffiError {
247
+ /**
248
+ * @private
249
+ * This field is private and should not be used.
250
+ */
251
+ readonly [uniffiTypeNameSymbol]: string = "VerifyError";
252
+ /**
253
+ * @private
254
+ * This field is private and should not be used.
255
+ */
256
+ readonly [variantOrdinalSymbol] = 6;
257
+
258
+ public readonly tag = VerifyError_Tags.ProofNotFound;
259
+
260
+ constructor(message: string) {
261
+ super("VerifyError", "ProofNotFound", message);
262
+ }
263
+
264
+ static instanceOf(e: any): e is ProofNotFound {
265
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 6;
266
+ }
267
+ }
268
+
269
+ // Utility function which does not rely on instanceof.
270
+ function instanceOf(e: any): e is VerifyError {
271
+ return (e as any)[uniffiTypeNameSymbol] === "VerifyError";
272
+ }
273
+ return {
274
+ C2pa,
275
+ AppAttest,
276
+ Base64,
277
+ Io,
278
+ Groth16,
279
+ ProofNotFound,
280
+ instanceOf,
281
+ };
282
+ })();
283
+
284
+ // Union type for VerifyError error type.
285
+
286
+ export type VerifyError = InstanceType<
287
+ (typeof VerifyError)[keyof Omit<typeof VerifyError, "instanceOf">]
288
+ >;
289
+
290
+ const FfiConverterTypeVerifyError = (() => {
291
+ const intConverter = FfiConverterInt32;
292
+ type TypeName = VerifyError;
293
+ class FfiConverter extends AbstractFfiConverterByteArray<TypeName> {
294
+ read(from: RustBuffer): TypeName {
295
+ switch (intConverter.read(from)) {
296
+ case 1:
297
+ return new VerifyError.C2pa(FfiConverterString.read(from));
298
+
299
+ case 2:
300
+ return new VerifyError.AppAttest(FfiConverterString.read(from));
301
+
302
+ case 3:
303
+ return new VerifyError.Base64(FfiConverterString.read(from));
304
+
305
+ case 4:
306
+ return new VerifyError.Io(FfiConverterString.read(from));
307
+
308
+ case 5:
309
+ return new VerifyError.Groth16(FfiConverterString.read(from));
310
+
311
+ case 6:
312
+ return new VerifyError.ProofNotFound(FfiConverterString.read(from));
313
+
314
+ default:
315
+ throw new UniffiInternalError.UnexpectedEnumCase();
316
+ }
317
+ }
318
+ write(value: TypeName, into: RustBuffer): void {
319
+ const obj = value as any;
320
+ const index = obj[variantOrdinalSymbol] as number;
321
+ intConverter.write(index, into);
322
+ }
323
+ allocationSize(value: TypeName): number {
324
+ return intConverter.allocationSize(0);
325
+ }
326
+ }
327
+ return new FfiConverter();
328
+ })();
329
+
330
+ /**
331
+ * This should be called before anything else.
332
+ *
333
+ * It is likely that this is being done for you by the library's `index.ts`.
334
+ *
335
+ * It checks versions of uniffi between when the Rust scaffolding was generated
336
+ * and when the bindings were generated.
337
+ *
338
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
339
+ */
340
+ function uniffiEnsureInitialized() {
341
+ // Get the bindings contract version from our ComponentInterface
342
+ const bindingsContractVersion = 29;
343
+ // Get the scaffolding contract version by calling the into the dylib
344
+ const scaffoldingContractVersion =
345
+ nativeModule().ubrn_ffi_zcam1_verify_utils_uniffi_contract_version();
346
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
347
+ throw new UniffiInternalError.ContractVersionMismatch(
348
+ scaffoldingContractVersion,
349
+ bindingsContractVersion,
350
+ );
351
+ }
352
+ if (
353
+ nativeModule().ubrn_uniffi_zcam1_verify_utils_checksum_func_verify_bindings_from_manifest() !==
354
+ 62750
355
+ ) {
356
+ throw new UniffiInternalError.ApiChecksumMismatch(
357
+ "uniffi_zcam1_verify_utils_checksum_func_verify_bindings_from_manifest",
358
+ );
359
+ }
360
+ if (nativeModule().ubrn_uniffi_zcam1_verify_utils_checksum_func_verify_groth16() !== 13082) {
361
+ throw new UniffiInternalError.ApiChecksumMismatch(
362
+ "uniffi_zcam1_verify_utils_checksum_func_verify_groth16",
363
+ );
364
+ }
365
+ }
366
+
367
+ export default Object.freeze({
368
+ initialize: uniffiEnsureInitialized,
369
+ converters: {
370
+ FfiConverterTypeVerifyError,
371
+ },
372
+ });
package/src/index.ts ADDED
@@ -0,0 +1,73 @@
1
+ export type {
2
+ ManifestEditorInterface,
3
+ ManifestInterface,
4
+ ManifestStoreInterface,
5
+ } from "./bindings";
6
+ export {
7
+ AuthenticityData,
8
+ AuthenticityStatus,
9
+ authenticityStatus,
10
+ buildSelfSignedCertificate,
11
+ C2paError,
12
+ C2paError_Tags,
13
+ Claim,
14
+ computeHash,
15
+ computeHashFromBuffer,
16
+ DepthData,
17
+ DepthDataStatistics,
18
+ DeviceBindings,
19
+ Exclusion,
20
+ extractManifest,
21
+ FilmStyleInfo,
22
+ formatFromPath,
23
+ Manifest,
24
+ ManifestEditor,
25
+ ManifestStore,
26
+ PhotoMetadataInfo,
27
+ Proof,
28
+ SelfSignedCertChain,
29
+ VerifyError,
30
+ VerifyError_Tags,
31
+ VideoMetadataInfo,
32
+ } from "./bindings";
33
+
34
+ /**
35
+ * Camera component for capturing photos with secure enclave integration.
36
+ */
37
+ export type {
38
+ CameraFilmStyle,
39
+ CaptureFormat,
40
+ FilmStyleEffect,
41
+ FilmStyleRecipe,
42
+ HighlightShadowConfig,
43
+ MonochromeConfig,
44
+ TakePhotoOptions,
45
+ WhiteBalanceConfig,
46
+ ZCameraProps,
47
+ } from "./camera";
48
+ export { ZCamera } from "./camera";
49
+ export type { CaptureInfo, DeviceOrientation } from "./capture";
50
+ export { initCapture } from "./capture";
51
+
52
+ /**
53
+ * Core cryptographic key types and secure enclave utilities.
54
+ */
55
+ export type { ECKey } from "./common";
56
+ export { getContentPublicKey, getSecureEnclaveKeyId } from "./common";
57
+ export type { PhotoGallery, PrivateFolder, ZImagePickerProps } from "./picker";
58
+
59
+ /**
60
+ * Image picker and private directory utilities for secure media selection.\
61
+ */
62
+ export { privateDirectory, ZImagePicker } from "./picker";
63
+
64
+ /**
65
+ * Verification utilities for validating media authenticity and capture metadata.
66
+
67
+ */
68
+ export { type CaptureMetadata, VerifiableFile } from "./verify";
69
+
70
+ /**
71
+ * Flash mode for photo capture.
72
+ */
73
+ export { type FlashMode } from "./NativeZcam1Capture";