@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
package/package.json ADDED
@@ -0,0 +1,118 @@
1
+ {
2
+ "name": "@succinctlabs/react-native-zcam1",
3
+ "version": "0.2.5",
4
+ "description": "ZCAM1 SDK",
5
+ "main": "./lib/module/index.js",
6
+ "codegenConfig": {
7
+ "name": "Zcam1SdkSpec",
8
+ "type": "modules",
9
+ "jsSrcsDir": "src"
10
+ },
11
+ "type": "module",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/succinctlabs/zcam1-sdk.git"
15
+ },
16
+ "author": "leruaa",
17
+ "license": "MIT",
18
+ "homepage": "https://github.com/succinctlabs/zcam1-sdk#readme",
19
+ "devDependencies": {
20
+ "@eslint/js": "^9.18.0",
21
+ "@react-native/babel-preset": "0.81.1",
22
+ "@types/react": "^19.1.0",
23
+ "eslint": "^9.18.0",
24
+ "eslint-config-prettier": "^10.1.8",
25
+ "eslint-plugin-react": "^7.37.5",
26
+ "eslint-plugin-react-hooks": "^7.0.1",
27
+ "eslint-plugin-simple-import-sort": "^12.1.1",
28
+ "prettier": "^3.8.1",
29
+ "react-native-builder-bob": "^0.40.17",
30
+ "typescript": "^5.9.3",
31
+ "typescript-eslint": "^8.56.0"
32
+ },
33
+ "create-react-native-library": {
34
+ "languages": "kotlin-objc",
35
+ "type": "turbo-module",
36
+ "version": "0.54.8"
37
+ },
38
+ "dependencies": {
39
+ "@noble/hashes": "^2.0.1",
40
+ "@pagopa/io-react-native-crypto": "^1.2.4",
41
+ "@pagopa/io-react-native-integrity": "^0.3.2",
42
+ "@react-native-camera-roll/camera-roll": "^7.10.2",
43
+ "@scure/base": "^2.0.0",
44
+ "@shopify/flash-list": "^2.2.0",
45
+ "jail-monkey": "^2.8.5",
46
+ "react-native-create-thumbnail": "^2.2.0",
47
+ "react-native-encrypted-storage": "^4.0.0",
48
+ "react-native-file-access": "^3.2.0",
49
+ "uniffi-bindgen-react-native": "^0.29.3-1"
50
+ },
51
+ "peerDependencies": {
52
+ "react": ">=19",
53
+ "react-native": ">=0.81"
54
+ },
55
+ "exports": {
56
+ ".": {
57
+ "source": "./src/index.ts",
58
+ "types": "./lib/typescript/src/index.d.ts",
59
+ "default": "./lib/module/index.js"
60
+ },
61
+ "./proving": {
62
+ "source": "./src/proving/index.ts",
63
+ "types": "./lib/typescript/src/proving/index.d.ts",
64
+ "default": "./lib/module/proving/index.js"
65
+ },
66
+ "./app.plugin.js": "./app.plugin.js",
67
+ "./package.json": "./package.json"
68
+ },
69
+ "types": "./lib/typescript/src/index.d.ts",
70
+ "scripts": {
71
+ "ubrn:ios": "CARGO_FEATURE_NO_NEON=1 ubrn build ios --and-generate",
72
+ "ubrn:ios:proving": "CARGO_FEATURE_NO_NEON=1 ubrn build ios --config ubrn.config.proving.yaml --and-generate",
73
+ "ubrn:android": "ubrn build android --and-generate",
74
+ "ubrn:web": "ubrn build web",
75
+ "clean": "rm -rfv cpp/ android/CMakeLists.txt android/src/main/java android/*.cpp ios/ src/generated/",
76
+ "build": "bob build",
77
+ "prepack": "npm run ubrn:ios -- --release && npm run ubrn:ios:proving -- --release && npm run build && if [ -z \"$NPM_CONFIG_REGISTRY\" ]; then mv Zcam1Framework.xcframework Zcam1Framework.xcframework.excluded && mv Zcam1ProvingFramework.xcframework Zcam1ProvingFramework.xcframework.excluded; fi",
78
+ "lint": "eslint src/",
79
+ "lint:fix": "eslint src/ --fix",
80
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
81
+ "format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
82
+ "preyalcpublish": "mv Zcam1Framework.xcframework.excluded Zcam1Framework.xcframework && mv Zcam1ProvingFramework.xcframework.excluded Zcam1ProvingFramework.xcframework",
83
+ "postyalcpublish": "mv Zcam1Framework.xcframework Zcam1Framework.xcframework.excluded && mv Zcam1ProvingFramework.xcframework Zcam1ProvingFramework.xcframework.excluded",
84
+ "postpublish": "if [ -e Zcam1Framework.xcframework.excluded ]; then mv Zcam1Framework.xcframework.excluded Zcam1Framework.xcframework; fi"
85
+ },
86
+ "files": [
87
+ "src",
88
+ "lib",
89
+ "cpp",
90
+ "ios",
91
+ "scripts",
92
+ "!**/__tests__",
93
+ "!**/__fixtures__",
94
+ "!**/__mocks__",
95
+ "*.podspec",
96
+ "Zcam1Framework.xcframework",
97
+ "Zcam1ProvingFramework.xcframework",
98
+ "app.plugin.js",
99
+ "turbo.json"
100
+ ],
101
+ "react-native-builder-bob": {
102
+ "source": "src",
103
+ "output": "lib",
104
+ "targets": [
105
+ [
106
+ "module",
107
+ {
108
+ "esm": true
109
+ }
110
+ ],
111
+ "typescript"
112
+ ]
113
+ },
114
+ "eslintIgnore": [
115
+ "node_modules/",
116
+ "lib/"
117
+ ]
118
+ }
@@ -0,0 +1,335 @@
1
+ import { type TurboModule, TurboModuleRegistry } from "react-native";
2
+
3
+ export type TakeNativePhotoFormat = "jpeg" | "dng";
4
+
5
+ export interface TakeNativePhotoOptions {
6
+ /**
7
+ * Desired output format. Defaults to "jpeg" if not provided.
8
+ */
9
+ format?: TakeNativePhotoFormat;
10
+
11
+ /**
12
+ * Optional quality hint for JPEG captures (0–1).
13
+ * Ignored for DNG.
14
+ */
15
+ quality?: number;
16
+ }
17
+
18
+ export interface TakeNativePhotoResult {
19
+ /**
20
+ * Local filesystem path to the captured image file.
21
+ * This is typically a "file://" URL or absolute path.
22
+ */
23
+ filePath: string;
24
+
25
+ /**
26
+ * The actual format of the captured file.
27
+ */
28
+ format: TakeNativePhotoFormat;
29
+
30
+ /**
31
+ * Optional metadata extracted by the native layer (EXIF, etc).
32
+ */
33
+ metadata?: { [key: string]: unknown } | null;
34
+
35
+ /**
36
+ * Depth data extracted from the captured photo (if available).
37
+ *
38
+ * This is only returned when the caller requested it via the `includeDepthData`
39
+ * parameter on `takeNativePhoto(...)`, and only on devices/capture formats that
40
+ * support depth delivery.
41
+ */
42
+ depthData?: { [key: string]: unknown } | null;
43
+ }
44
+
45
+ export type NativeVideoRecordingFormat = "mov";
46
+
47
+ export interface StartNativeVideoRecordingResult {
48
+ /**
49
+ * Indicates that recording successfully started.
50
+ */
51
+ status: "recording";
52
+
53
+ /**
54
+ * Local filesystem path to the in-progress movie file.
55
+ */
56
+ filePath: string;
57
+
58
+ /**
59
+ * Container format for the recording.
60
+ */
61
+ format: NativeVideoRecordingFormat;
62
+
63
+ /**
64
+ * Whether audio is included in this recording.
65
+ * This depends on microphone permission and native session configuration.
66
+ */
67
+ hasAudio: boolean;
68
+ }
69
+
70
+ export interface StopNativeVideoRecordingResult {
71
+ /**
72
+ * Local filesystem path to the finalized movie file.
73
+ */
74
+ filePath: string;
75
+
76
+ /**
77
+ * Container format for the recording.
78
+ */
79
+ format: NativeVideoRecordingFormat;
80
+
81
+ /**
82
+ * Whether audio is included in this recording.
83
+ */
84
+ hasAudio: boolean;
85
+
86
+ /**
87
+ * Device make (if available).
88
+ */
89
+ deviceMake: string;
90
+
91
+ /**
92
+ * Device model (if available).
93
+ */
94
+ deviceModel: string;
95
+
96
+ /**
97
+ * Software version (if available).
98
+ */
99
+ softwareVersion: string;
100
+
101
+ /**
102
+ * Duration of the recorded clip in seconds (if available).
103
+ */
104
+ durationSeconds: number;
105
+
106
+ /**
107
+ * File size in bytes (if available).
108
+ */
109
+ fileSizeBytes: number;
110
+
111
+ /**
112
+ * Video pixel width (rotation-corrected, if available).
113
+ */
114
+ width: number;
115
+
116
+ /**
117
+ * Video pixel height (rotation-corrected, if available).
118
+ */
119
+ height: number;
120
+
121
+ /**
122
+ * Rotation in degrees derived from the video track transform (if available).
123
+ * Common values: 0, 90, 180, 270.
124
+ */
125
+ rotationDegrees: number;
126
+
127
+ /**
128
+ * Nominal frame rate (fps, if available).
129
+ */
130
+ frameRate: number;
131
+
132
+ /**
133
+ * Video codec FourCC (e.g. "avc1", "hvc1") if available.
134
+ */
135
+ videoCodec?: string;
136
+
137
+ /**
138
+ * Audio codec FourCC (e.g. "aac ") if available.
139
+ */
140
+ audioCodec?: string;
141
+
142
+ /**
143
+ * Audio sample rate in Hz (if available).
144
+ */
145
+ audioSampleRate?: number;
146
+
147
+ /**
148
+ * Audio channel count (if available).
149
+ */
150
+ audioChannels?: number;
151
+ }
152
+
153
+ export type FlashMode = "off" | "on" | "auto";
154
+
155
+ export type AspectRatio = "4:3" | "16:9" | "1:1";
156
+
157
+ export type Orientation = "auto" | "portrait" | "landscape";
158
+
159
+ /**
160
+ * Physical device orientation as reported by the accelerometer.
161
+ * Unlike Orientation (which is a capture setting), this reflects the
162
+ * actual device position and is emitted via onOrientationChange events.
163
+ */
164
+ export type DeviceOrientation =
165
+ | "portrait"
166
+ | "portraitUpsideDown"
167
+ | "landscapeLeft"
168
+ | "landscapeRight";
169
+
170
+ export interface Spec extends TurboModule {
171
+ /**
172
+ * Capture a photo using the native camera stack (Swift/AVFoundation)
173
+ * without going through react-native-vision-camera.
174
+ *
175
+ * The native implementation is responsible for:
176
+ * - Handling permissions
177
+ * - Presenting a preview / capture UI as needed
178
+ * - Writing the resulting JPEG or DNG file and returning its path
179
+ *
180
+ * @param includeDepthData When true, native should request depth (+ calibration)
181
+ * data delivery for this capture (if supported). When false, native should avoid
182
+ * enabling depth delivery and `depthData` will be omitted from the result.
183
+ * @param skipPostProcessing When true, returns raw sensor output without cropping
184
+ * or rotation. Useful for developers who want to handle their own post-processing.
185
+ */
186
+ takeNativePhoto(
187
+ format: TakeNativePhotoFormat,
188
+ position: "front" | "back",
189
+ flash: FlashMode,
190
+ includeDepthData: boolean,
191
+ aspectRatio: AspectRatio,
192
+ orientation: Orientation,
193
+ skipPostProcessing: boolean,
194
+ ): Promise<TakeNativePhotoResult>;
195
+
196
+ /**
197
+ * Start recording a video using the native camera stack.
198
+ *
199
+ * The recording is written to a temporary file and continues until
200
+ * `stopNativeVideoRecording()` is called or the optional duration cap is reached.
201
+ *
202
+ * @param position Which camera to use.
203
+ * @param maxDurationSeconds Maximum recording duration in seconds. The native
204
+ * layer will automatically stop recording when this limit is reached. Pass 0
205
+ * for unlimited recording.
206
+ */
207
+ startNativeVideoRecording(
208
+ position: "front" | "back",
209
+ maxDurationSeconds: number,
210
+ ): Promise<StartNativeVideoRecordingResult>;
211
+
212
+ /**
213
+ * Stop an in-progress recording and return the finalized file path + metadata.
214
+ */
215
+ stopNativeVideoRecording(): Promise<StopNativeVideoRecordingResult>;
216
+
217
+ /**
218
+ * Set zoom factor programmatically (instant, no animation).
219
+ * For virtual devices with ultra-wide, 1.0 is ultra-wide (0.5x user-facing),
220
+ * 2.0 is wide-angle (1x user-facing), etc.
221
+ * @param factor Device zoom factor (use getMinZoom/getMaxZoom for valid range)
222
+ */
223
+ setZoom(factor: number): void;
224
+
225
+ /**
226
+ * Set zoom factor with smooth animation (recommended for pinch-to-zoom gestures).
227
+ * Uses native AVFoundation ramp for smooth transitions across lens switchover boundaries.
228
+ * @param factor Device zoom factor (use getMinZoom/getMaxZoom for valid range)
229
+ */
230
+ setZoomAnimated(factor: number): void;
231
+
232
+ /**
233
+ * Get the minimum supported zoom factor.
234
+ * For virtual devices with ultra-wide, this is 1.0 (corresponds to 0.5x user-facing).
235
+ */
236
+ getMinZoom(): Promise<number>;
237
+
238
+ /**
239
+ * Get the maximum supported zoom factor (capped at 15x for UX).
240
+ */
241
+ getMaxZoom(): Promise<number>;
242
+
243
+ /**
244
+ * Get the zoom factors where the device switches between physical lenses.
245
+ * Returns empty array for single-camera devices.
246
+ * For triple camera: typically [2.0, 6.0] meaning:
247
+ * - Below 2.0: ultra-wide lens (0.5x-1x user-facing)
248
+ * - At 2.0: switches FROM ultra-wide TO wide lens (1x user-facing)
249
+ * - At 6.0: switches FROM wide TO telephoto lens (3x user-facing)
250
+ */
251
+ getSwitchOverZoomFactors(): Promise<number[]>;
252
+
253
+ /**
254
+ * Check if the current device has an ultra-wide camera.
255
+ * This is true for builtInTripleCamera and builtInDualWideCamera (iPhone 11+, Pro models).
256
+ * This is false for builtInDualCamera (Wide + Telephoto, e.g., iPhone X/XS) and single-lens devices.
257
+ *
258
+ * Use this to correctly interpret zoom factors:
259
+ * - If hasUltraWide: minZoom (1.0) = 0.5x user-facing, switchOverFactors[0] (2.0) = 1x user-facing
260
+ * - If !hasUltraWide: minZoom (1.0) = 1x user-facing, switchOverFactors[0] (2.0) = 2x user-facing (telephoto)
261
+ */
262
+ hasUltraWideCamera(): Promise<boolean>;
263
+
264
+ /**
265
+ * Get the supported exposure compensation range in EV units.
266
+ * Returns the device's min and max exposure target bias values.
267
+ */
268
+ getExposureRange(): Promise<{ min: number; max: number }>;
269
+
270
+ /**
271
+ * Reset exposure compensation to neutral (0 EV).
272
+ */
273
+ resetExposure(): void;
274
+
275
+ /**
276
+ * Focus at a normalized point in the preview.
277
+ * Also adjusts exposure point if supported.
278
+ * @param x Normalized x coordinate (0-1, left to right)
279
+ * @param y Normalized y coordinate (0-1, top to bottom)
280
+ */
281
+ focusAtPoint(x: number, y: number): void;
282
+
283
+ /**
284
+ * Get diagnostic info about the current camera device for debugging.
285
+ * Returns device type, supported zoom range, switching behavior, and more.
286
+ * Useful for debugging zoom issues on different device configurations.
287
+ */
288
+ getDeviceDiagnostics(): Promise<{
289
+ deviceType: string;
290
+ minZoom: number;
291
+ maxZoom: number;
292
+ currentZoom: number;
293
+ switchOverFactors: number[];
294
+ switchingBehavior: number;
295
+ isVirtualDevice: boolean;
296
+ currentExposureBias: number;
297
+ minExposureBias: number;
298
+ maxExposureBias: number;
299
+ currentISO: number;
300
+ exposureDuration: number;
301
+ }>;
302
+
303
+ /**
304
+ * Check if the current camera device supports depth data capture.
305
+ * Returns true for dual/triple rear cameras and TrueDepth front camera.
306
+ * Returns false for single rear cameras (iPhone SE, 16e, Air).
307
+ */
308
+ isDepthSupported(): Promise<boolean>;
309
+
310
+ /**
311
+ * Check if enabling depth would restrict zoom on this device.
312
+ * Returns true if zoom is limited to discrete levels (min == max in all ranges).
313
+ * This typically happens on dual-camera devices (iPhone 12-16 base).
314
+ * Returns false for triple-camera devices (Pro) and TrueDepth front cameras.
315
+ */
316
+ hasDepthZoomLimitations(): Promise<boolean>;
317
+
318
+ /**
319
+ * Get zoom ranges supported when depth data delivery is enabled.
320
+ * Returns array of [min, max] pairs. If min == max, it's a discrete level.
321
+ * Empty array means no depth support or no zoom restrictions.
322
+ *
323
+ * Example for dual-camera iPhone: [[2.0, 2.0], [4.0, 4.0]] (discrete 1x and 2x only)
324
+ * Example for triple-camera iPhone: [[1.0, 6.0]] (continuous zoom supported)
325
+ */
326
+ getDepthSupportedZoomRanges(): Promise<number[][]>;
327
+
328
+ /**
329
+ * Present a native full-screen preview for any file using QLPreviewController.
330
+ * Supports images, videos, PDFs, and other common file types.
331
+ * @param filePath Absolute filesystem path to the file.
332
+ */
333
+ previewFile(filePath: string): Promise<void>;
334
+ }
335
+ export default TurboModuleRegistry.getEnforcing<Spec>("Zcam1Capture");
@@ -0,0 +1,10 @@
1
+ // Generated by uniffi-bindgen-react-native
2
+ import type { TurboModule } from 'react-native';
3
+ import { TurboModuleRegistry } from 'react-native';
4
+
5
+ export interface Spec extends TurboModule {
6
+ installRustCrate(): boolean;
7
+ cleanupRustCrate(): boolean;
8
+ }
9
+
10
+ export default TurboModuleRegistry.getEnforcing<Spec>('Zcam1Sdk');
@@ -0,0 +1,49 @@
1
+ // Generated by uniffi-bindgen-react-native
2
+ import installer from './NativeZcam1Sdk';
3
+
4
+ // Register the rust crate with Hermes
5
+ // - the boolean flag ensures this loads exactly once, even if the JS
6
+ // code is reloaded (e.g. during development with metro).
7
+ let rustInstalled = false;
8
+ if (!rustInstalled) {
9
+ installer.installRustCrate();
10
+ rustInstalled = true;
11
+ }
12
+
13
+ // Export the generated bindings to the app.
14
+ export * from './generated/zcam1_c2pa_utils';
15
+ export * from './generated/zcam1_certs_utils';
16
+ export * from './generated/zcam1_verify_utils';
17
+
18
+ // Now import the bindings so we can:
19
+ // - intialize them
20
+ // - export them as namespaced objects as the default export.
21
+ import * as zcam1_c2pa_utils from './generated/zcam1_c2pa_utils';
22
+ import * as zcam1_certs_utils from './generated/zcam1_certs_utils';
23
+ import * as zcam1_verify_utils from './generated/zcam1_verify_utils';
24
+
25
+ // Initialize the generated bindings: mostly checksums, but also callbacks.
26
+ // - the boolean flag ensures this loads exactly once, even if the JS code
27
+ // is reloaded (e.g. during development with metro).
28
+ let initialized = false;
29
+ if (!initialized) {
30
+ zcam1_c2pa_utils.default.initialize();
31
+ zcam1_certs_utils.default.initialize();
32
+ zcam1_verify_utils.default.initialize();
33
+ initialized = true;
34
+ }
35
+
36
+ // This provides parity with the index.web.ts version of this file.
37
+ // The web version relies on an asynchronous fetch, which this doesn't
38
+ // need, so we just no-op.
39
+ export async function uniffiInitAsync() {
40
+ // NOOP.
41
+ }
42
+
43
+ // Export the crates as individually namespaced objects.
44
+ export default {
45
+ zcam1_c2pa_utils,
46
+ zcam1_certs_utils,
47
+ zcam1_verify_utils,
48
+ };
49
+