@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/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # `react-native-zcam1`
2
+
3
+ React Native SDK for capturing, signing, verifying, and proving media authenticity on iOS using C2PA manifests and zero-knowledge proofs.
4
+
5
+ ## Features
6
+
7
+ - **Authenticated capture** — Camera component backed by AVFoundation with Secure Enclave key management and App Attest device binding
8
+ - **C2PA signing** — Industry-standard content provenance manifests embedded at capture time
9
+ - **Verification** — Verify C2PA manifests and App Attest bindings
10
+ - **Zero-knowledge proofs** — Optional proving module to cryptographically guarantee authenticity (Groth16 via SP1)
11
+ - **Image picker** — Gallery and private folder browser with authenticity badges
12
+ - **Film styles** — Built-in and customizable GPU-accelerated filters
13
+
14
+ ## Installation
15
+
16
+ ```sh
17
+ npm install @succinctlabs/react-native-zcam1
18
+ ```
19
+
20
+ ### iOS setup
21
+
22
+ ```sh
23
+ pod install
24
+ ```
25
+
26
+ #### Enabling the proving module
27
+
28
+ The proving module is optional and ships as a separate native framework. To enable it, set the following in your `Podfile.properties.json`:
29
+
30
+ ```json
31
+ {
32
+ "zcam1EnableProving": true
33
+ }
34
+ ```
35
+
36
+ Or set the environment variable before running `pod install`:
37
+
38
+ ```sh
39
+ ZCAM1_ENABLE_PROVING=1 pod install
40
+ ```
41
+
42
+ If you are using Expo, add the config plugin to your `app.config.ts`:
43
+
44
+ ```ts
45
+ export default {
46
+ plugins: [
47
+ ["@succinctlabs/react-native-zcam1/app.plugin.js", { enableProving: true }]
48
+ ]
49
+ };
50
+ ```
51
+
52
+ ## Requirements
53
+
54
+ - iOS 16+
55
+ - React Native 0.81+
56
+ - React 19+
57
+ - New Architecture enabled
58
+
59
+ ## License
60
+
61
+ MIT
@@ -0,0 +1,157 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "Zcam1Sdk"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => min_ios_version_supported }
15
+ s.source = { :git => "https://github.com/succinctlabs/zcam1-sdk.git", :tag => "#{s.version}" }
16
+
17
+ # Proving is opt-in.
18
+ #
19
+ # Enable proving in one of these ways:
20
+ #
21
+ # 1) Environment variable (works for Expo + non-Expo):
22
+ # - ZCAM1_ENABLE_PROVING=1 pod install
23
+ # - or set ENV["ZCAM1_ENABLE_PROVING"] = "1" early in your Podfile
24
+ #
25
+ # 2) Podfile.properties.json (recommended for Expo plugins that want to avoid editing Podfile):
26
+ # - ios/Podfile.properties.json:
27
+ # { "zcam1EnableProving": true }
28
+ # or:
29
+ # { "zcam1": { "enableProving": true } }
30
+ # or:
31
+ # { "zcam1.enableProving": true }
32
+ #
33
+ zcam1_truthy = ->(v) { v == true || v.to_s == "1" || v.to_s.downcase == "true" }
34
+ enable_proving_from_env = zcam1_truthy.call(ENV["ZCAM1_ENABLE_PROVING"])
35
+
36
+ enable_proving_from_props = begin
37
+ props_path = File.join(Pod::Config.instance.installation_root.to_s, "Podfile.properties.json")
38
+ if File.exist?(props_path)
39
+ props = JSON.parse(File.read(props_path))
40
+ zcam1_truthy.call(props["ZCAM1_ENABLE_PROVING"]) ||
41
+ zcam1_truthy.call(props["enableProving"])
42
+ else
43
+ false
44
+ end
45
+ rescue
46
+ false
47
+ end
48
+
49
+ enable_proving = enable_proving_from_env || enable_proving_from_props
50
+
51
+ source_files = [
52
+ "ios/*.{h,m,mm,swift}",
53
+ "cpp/*.{hpp,cpp,c,h}",
54
+ "cpp/generated/*.{hpp,cpp,c,h}",
55
+ ]
56
+ public_header_files = ["ios/*.h"]
57
+
58
+ vendored_frameworks = ["Zcam1Framework.xcframework"]
59
+
60
+ if enable_proving
61
+ source_files += [
62
+ "ios/proving/*.{h,m,mm,swift}",
63
+ "cpp/proving/*.{hpp,cpp,c,h}",
64
+ "cpp/proving/generated/*.{hpp,cpp,c,h}",
65
+ ]
66
+ public_header_files += ["ios/proving/*.h"]
67
+
68
+ vendored_frameworks += ["Zcam1ProvingFramework.xcframework"]
69
+ end
70
+
71
+ version = package["version"]
72
+ base_url = "https://github.com/succinctlabs/zcam1-sdk/releases/download/v#{version}"
73
+
74
+ # Proving framework download command, only included when proving is enabled.
75
+ # Injected as a shell snippet into prepare_command via Ruby interpolation.
76
+ download_proving_cmd = enable_proving ? <<~SHELL
77
+ PROVING_MARKER=".xcframework-proving-version"
78
+ if [ ! -d "Zcam1ProvingFramework.xcframework" ]; then
79
+ echo "Downloading Zcam1ProvingFramework.xcframework v#{version}..."
80
+ curl -L "#{base_url}/Zcam1ProvingFramework.xcframework.zip" -o Zcam1ProvingFramework.xcframework.zip
81
+ unzip -q Zcam1ProvingFramework.xcframework.zip
82
+ rm Zcam1ProvingFramework.xcframework.zip
83
+ echo "#{version}" > "$PROVING_MARKER"
84
+ elif [ -f "$PROVING_MARKER" ] && [ "$(cat $PROVING_MARKER)" != "#{version}" ]; then
85
+ echo "Updating Zcam1ProvingFramework.xcframework to v#{version}..."
86
+ rm -rf Zcam1ProvingFramework.xcframework
87
+ curl -L "#{base_url}/Zcam1ProvingFramework.xcframework.zip" -o Zcam1ProvingFramework.xcframework.zip
88
+ unzip -q Zcam1ProvingFramework.xcframework.zip
89
+ rm Zcam1ProvingFramework.xcframework.zip
90
+ echo "#{version}" > "$PROVING_MARKER"
91
+ fi
92
+ SHELL
93
+ : ""
94
+
95
+ # Download xcframeworks from GitHub release artifacts before pod installation.
96
+ # The version marker file ensures stale frameworks are replaced on version upgrades.
97
+ # When frameworks are already present and up-to-date (Yalc, private npm), download is skipped.
98
+ s.prepare_command = <<~SHELL
99
+ MARKER=".xcframework-version"
100
+ # If the folder is absent, download from GitHub release artifacts.
101
+ # If the folder is present but the marker is absent, it came from Yalc or a private npm
102
+ # registry (which includes the frameworks directly) — skip the download.
103
+ # If the marker is present and the version differs, re-download (public npm upgrade).
104
+ if [ ! -d "Zcam1Framework.xcframework" ]; then
105
+ echo "Downloading Zcam1Framework.xcframework v#{version}..."
106
+ curl -L "#{base_url}/Zcam1Framework.xcframework.zip" -o Zcam1Framework.xcframework.zip
107
+ unzip -q Zcam1Framework.xcframework.zip
108
+ rm Zcam1Framework.xcframework.zip
109
+ echo "#{version}" > "$MARKER"
110
+ elif [ -f "$MARKER" ] && [ "$(cat $MARKER)" != "#{version}" ]; then
111
+ echo "Updating Zcam1Framework.xcframework to v#{version}..."
112
+ rm -rf Zcam1Framework.xcframework
113
+ curl -L "#{base_url}/Zcam1Framework.xcframework.zip" -o Zcam1Framework.xcframework.zip
114
+ unzip -q Zcam1Framework.xcframework.zip
115
+ rm Zcam1Framework.xcframework.zip
116
+ echo "#{version}" > "$MARKER"
117
+ fi
118
+ #{download_proving_cmd}
119
+ SHELL
120
+
121
+ s.source_files = source_files
122
+ # Only expose ObjC headers publicly (Swift can import these).
123
+ s.public_header_files = public_header_files
124
+
125
+ # Keep everything that contains C/C++ out of Swift's importer.
126
+ s.private_header_files = "cpp/**/*.h", "cpp/**/*.hpp"
127
+
128
+ s.frameworks = ["QuickLook"]
129
+ s.vendored_frameworks = vendored_frameworks
130
+ s.dependency "uniffi-bindgen-react-native", "0.29.3-1"
131
+
132
+ # Harbeth: GPU-accelerated image/video/camera filter library.
133
+ s.dependency "Harbeth", "~> 1.1"
134
+
135
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
136
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
137
+ if respond_to?(:install_modules_dependencies, true)
138
+ install_modules_dependencies(s)
139
+ else
140
+ s.dependency "React-Core"
141
+
142
+ # Don't install the dependencies when we run `pod install` in the old architecture.
143
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
144
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
145
+ s.pod_target_xcconfig = {
146
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
147
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
148
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
149
+ }
150
+ s.dependency "React-Codegen"
151
+ s.dependency "RCT-Folly"
152
+ s.dependency "RCTRequired"
153
+ s.dependency "RCTTypeSafety"
154
+ s.dependency "ReactCommon/turbomodule/core"
155
+ end
156
+ end
157
+ end
package/app.plugin.js ADDED
@@ -0,0 +1,11 @@
1
+ import ConfigPlugins from "@expo/config-plugins";
2
+ const { withPodfileProperties } = ConfigPlugins;
3
+ function withZcam1Sdk(config, props) {
4
+ const enableProving = !!(props && props.enableProving);
5
+ return withPodfileProperties(config, (config) => {
6
+ config.modResults.enableProving = enableProving ? "true" : "false";
7
+ return config;
8
+ });
9
+ }
10
+
11
+ export { withZcam1Sdk as default };