@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.
- package/README.md +61 -0
- package/Zcam1Sdk.podspec +157 -0
- package/app.plugin.js +11 -0
- package/cpp/generated/zcam1_c2pa_utils.cpp +4091 -0
- package/cpp/generated/zcam1_c2pa_utils.hpp +367 -0
- package/cpp/generated/zcam1_certs_utils.cpp +1799 -0
- package/cpp/generated/zcam1_certs_utils.hpp +72 -0
- package/cpp/generated/zcam1_verify_utils.cpp +1857 -0
- package/cpp/generated/zcam1_verify_utils.hpp +79 -0
- package/cpp/proving/generated/zcam1_proving_utils.cpp +3661 -0
- package/cpp/proving/generated/zcam1_proving_utils.hpp +275 -0
- package/cpp/proving/zcam1-proving.cpp +16 -0
- package/cpp/proving/zcam1-proving.h +15 -0
- package/cpp/zcam1-sdk.cpp +20 -0
- package/cpp/zcam1-sdk.h +15 -0
- package/ios/Zcam1Camera.swift +2945 -0
- package/ios/Zcam1CameraFilmStyle.swift +191 -0
- package/ios/Zcam1CameraViewManager.m +86 -0
- package/ios/Zcam1Capture.h +13 -0
- package/ios/Zcam1Capture.mm +500 -0
- package/ios/Zcam1DepthData.swift +417 -0
- package/ios/Zcam1Sdk.h +16 -0
- package/ios/Zcam1Sdk.mm +66 -0
- package/ios/proving/Zcam1Proving.h +16 -0
- package/ios/proving/Zcam1Proving.mm +66 -0
- package/lib/module/NativeZcam1Capture.js +12 -0
- package/lib/module/NativeZcam1Capture.js.map +1 -0
- package/lib/module/NativeZcam1Sdk.js +7 -0
- package/lib/module/NativeZcam1Sdk.js.map +1 -0
- package/lib/module/bindings.js +51 -0
- package/lib/module/bindings.js.map +1 -0
- package/lib/module/camera.js +522 -0
- package/lib/module/camera.js.map +1 -0
- package/lib/module/capture.js +120 -0
- package/lib/module/capture.js.map +1 -0
- package/lib/module/common.js +35 -0
- package/lib/module/common.js.map +1 -0
- package/lib/module/generated/zcam1_c2pa_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_c2pa_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_c2pa_utils.js +1202 -0
- package/lib/module/generated/zcam1_c2pa_utils.js.map +1 -0
- package/lib/module/generated/zcam1_certs_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_certs_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_certs_utils.js +399 -0
- package/lib/module/generated/zcam1_certs_utils.js.map +1 -0
- package/lib/module/generated/zcam1_proving_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_proving_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_proving_utils.js +515 -0
- package/lib/module/generated/zcam1_proving_utils.js.map +1 -0
- package/lib/module/generated/zcam1_verify_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_verify_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_verify_utils.js +252 -0
- package/lib/module/generated/zcam1_verify_utils.js.map +1 -0
- package/lib/module/index.js +31 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/picker.js +222 -0
- package/lib/module/picker.js.map +1 -0
- package/lib/module/proving/NativeZcam1Proving.js +7 -0
- package/lib/module/proving/NativeZcam1Proving.js.map +1 -0
- package/lib/module/proving/bindings.js +46 -0
- package/lib/module/proving/bindings.js.map +1 -0
- package/lib/module/proving/index.js +5 -0
- package/lib/module/proving/index.js.map +1 -0
- package/lib/module/proving/prove.js +346 -0
- package/lib/module/proving/prove.js.map +1 -0
- package/lib/module/utils.js +27 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/verify.js +82 -0
- package/lib/module/verify.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeZcam1Capture.d.ts +280 -0
- package/lib/typescript/src/NativeZcam1Capture.d.ts.map +1 -0
- package/lib/typescript/src/NativeZcam1Sdk.d.ts +8 -0
- package/lib/typescript/src/NativeZcam1Sdk.d.ts.map +1 -0
- package/lib/typescript/src/bindings.d.ts +14 -0
- package/lib/typescript/src/bindings.d.ts.map +1 -0
- package/lib/typescript/src/camera.d.ts +300 -0
- package/lib/typescript/src/camera.d.ts.map +1 -0
- package/lib/typescript/src/capture.d.ts +59 -0
- package/lib/typescript/src/capture.d.ts.map +1 -0
- package/lib/typescript/src/common.d.ts +10 -0
- package/lib/typescript/src/common.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils-ffi.d.ts +175 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils.d.ts +811 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_certs_utils-ffi.d.ts +82 -0
- package/lib/typescript/src/generated/zcam1_certs_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_certs_utils.d.ts +413 -0
- package/lib/typescript/src/generated/zcam1_certs_utils.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_proving_utils-ffi.d.ts +153 -0
- package/lib/typescript/src/generated/zcam1_proving_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_proving_utils.d.ts +321 -0
- package/lib/typescript/src/generated/zcam1_proving_utils.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_verify_utils-ffi.d.ts +84 -0
- package/lib/typescript/src/generated/zcam1_verify_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_verify_utils.d.ts +286 -0
- package/lib/typescript/src/generated/zcam1_verify_utils.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +29 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/picker.d.ts +103 -0
- package/lib/typescript/src/picker.d.ts.map +1 -0
- package/lib/typescript/src/proving/NativeZcam1Proving.d.ts +8 -0
- package/lib/typescript/src/proving/NativeZcam1Proving.d.ts.map +1 -0
- package/lib/typescript/src/proving/bindings.d.ts +8 -0
- package/lib/typescript/src/proving/bindings.d.ts.map +1 -0
- package/lib/typescript/src/proving/index.d.ts +3 -0
- package/lib/typescript/src/proving/index.d.ts.map +1 -0
- package/lib/typescript/src/proving/prove.d.ts +74 -0
- package/lib/typescript/src/proving/prove.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +2 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/lib/typescript/src/verify.d.ts +45 -0
- package/lib/typescript/src/verify.d.ts.map +1 -0
- package/package.json +118 -0
- package/src/NativeZcam1Capture.ts +335 -0
- package/src/NativeZcam1Sdk.ts +10 -0
- package/src/bindings.tsx +49 -0
- package/src/camera.tsx +705 -0
- package/src/capture.tsx +165 -0
- package/src/common.tsx +46 -0
- package/src/generated/zcam1_c2pa_utils-ffi.ts +456 -0
- package/src/generated/zcam1_c2pa_utils.ts +1866 -0
- package/src/generated/zcam1_certs_utils-ffi.ts +187 -0
- package/src/generated/zcam1_certs_utils.ts +549 -0
- package/src/generated/zcam1_proving_utils-ffi.ts +374 -0
- package/src/generated/zcam1_proving_utils.ts +804 -0
- package/src/generated/zcam1_verify_utils-ffi.ts +196 -0
- package/src/generated/zcam1_verify_utils.ts +372 -0
- package/src/index.ts +73 -0
- package/src/picker.tsx +342 -0
- package/src/proving/NativeZcam1Proving.ts +10 -0
- package/src/proving/bindings.tsx +50 -0
- package/src/proving/index.ts +8 -0
- package/src/proving/prove.tsx +492 -0
- package/src/utils.ts +38 -0
- package/src/verify.tsx +119 -0
- 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
|
package/Zcam1Sdk.podspec
ADDED
|
@@ -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 };
|