@succinctlabs/react-native-zcam1 0.2.5 → 0.2.7
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 +144 -10
- package/Zcam1Sdk.podspec +1 -4
- package/cpp/generated/zcam1_c2pa_utils.cpp +2910 -3365
- package/cpp/generated/zcam1_c2pa_utils.hpp +130 -352
- package/cpp/generated/zcam1_certs_utils.cpp +1266 -1064
- package/cpp/generated/zcam1_certs_utils.hpp +37 -57
- package/cpp/generated/zcam1_verify_utils.cpp +1307 -1120
- package/cpp/generated/zcam1_verify_utils.hpp +39 -64
- package/cpp/proving/generated/zcam1_proving_utils.cpp +2619 -2917
- package/cpp/proving/generated/zcam1_proving_utils.hpp +102 -260
- package/ios/Zcam1Camera.swift +140 -53
- package/ios/Zcam1CameraFilmStyle.swift +106 -0
- package/lib/module/camera.js +2 -11
- package/lib/module/camera.js.map +1 -1
- package/lib/module/capture.js +2 -2
- package/lib/module/capture.js.map +1 -1
- package/lib/module/common.js +1 -1
- package/lib/module/common.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/picker.js +2 -1
- package/lib/module/picker.js.map +1 -1
- package/lib/module/proving/prove.js +4 -4
- package/lib/module/proving/prove.js.map +1 -1
- package/lib/module/utils.js +7 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/src/camera.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/picker.d.ts.map +1 -1
- package/lib/typescript/src/proving/prove.d.ts +1 -1
- package/lib/typescript/src/proving/prove.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +4 -0
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/camera.tsx +2 -13
- package/src/capture.tsx +2 -2
- package/src/common.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/picker.tsx +2 -1
- package/src/proving/prove.tsx +5 -5
- package/src/utils.ts +7 -0
package/README.md
CHANGED
|
@@ -1,15 +1,76 @@
|
|
|
1
|
-
#
|
|
1
|
+
# react-native-zcam1
|
|
2
2
|
|
|
3
3
|
React Native SDK for capturing, signing, verifying, and proving media authenticity on iOS using C2PA manifests and zero-knowledge proofs.
|
|
4
4
|
|
|
5
|
+
**Platform:** iOS (Android coming soon)
|
|
6
|
+
|
|
7
|
+
**Full API Reference:** [zcam-sdk.succinct.xyz](https://zcam-sdk.succinct.xyz/)
|
|
8
|
+
|
|
9
|
+
## What It Does
|
|
10
|
+
|
|
11
|
+
ZCAM1 turns any iOS app into a provenance-aware camera. Photos and videos captured through the SDK are:
|
|
12
|
+
|
|
13
|
+
1. **Signed at capture time** with a [C2PA](https://c2pa.org/) manifest containing device metadata, camera settings, and Apple App Attest bindings
|
|
14
|
+
2. **Optionally proven** via zero-knowledge proofs (Groth16 via SP1) that cryptographically guarantee the photo was taken on a genuine iOS device — without revealing the device identity
|
|
15
|
+
3. **Verifiable** by anyone — on-device, in the browser, or on a server — using the companion `@succinctlabs/zcam1-verify` package
|
|
16
|
+
|
|
5
17
|
## Features
|
|
6
18
|
|
|
7
19
|
- **Authenticated capture** — Camera component backed by AVFoundation with Secure Enclave key management and App Attest device binding
|
|
8
20
|
- **C2PA signing** — Industry-standard content provenance manifests embedded at capture time
|
|
9
|
-
- **Verification** — Verify C2PA manifests and App Attest bindings
|
|
21
|
+
- **Verification** — Verify C2PA manifests and App Attest bindings on-device
|
|
10
22
|
- **Zero-knowledge proofs** — Optional proving module to cryptographically guarantee authenticity (Groth16 via SP1)
|
|
11
23
|
- **Image picker** — Gallery and private folder browser with authenticity badges
|
|
12
|
-
- **Film styles** — Built-in and customizable GPU-accelerated filters
|
|
24
|
+
- **Film styles** — Built-in and customizable GPU-accelerated filters (mellow, nostalgic, B&W)
|
|
25
|
+
- **Video capture** — Record videos with the same C2PA signing pipeline
|
|
26
|
+
|
|
27
|
+
## Architecture
|
|
28
|
+
|
|
29
|
+
### Packages
|
|
30
|
+
|
|
31
|
+
| Package | npm | Purpose |
|
|
32
|
+
|---------|-----|---------|
|
|
33
|
+
| `@succinctlabs/react-native-zcam1` | This package | React Native SDK — capture, sign, verify, pick |
|
|
34
|
+
| `@succinctlabs/react-native-zcam1/proving` | Sub-export | Optional proving module — ZK proof generation |
|
|
35
|
+
| `@succinctlabs/zcam1-verify` | Separate package | Browser + Node.js verification SDK |
|
|
36
|
+
|
|
37
|
+
### How It Works
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
┌─────────────────────────────────────────────────────────┐
|
|
41
|
+
│ React Native App │
|
|
42
|
+
│ │
|
|
43
|
+
│ initCapture() ─► ZCamera ─► takePhoto() ─► ZPhoto │
|
|
44
|
+
│ │ │ │
|
|
45
|
+
│ │ C2PA manifest with │
|
|
46
|
+
│ │ succinct.bindings │
|
|
47
|
+
│ │ │ │
|
|
48
|
+
│ │ ┌────────────┴──────────┐ │
|
|
49
|
+
│ │ │ (optional) Prove │ │
|
|
50
|
+
│ │ │ ProverProvider │ │
|
|
51
|
+
│ │ │ waitAndEmbedProof() │ │
|
|
52
|
+
│ │ │ │ │ │
|
|
53
|
+
│ │ │ C2PA manifest with │ │
|
|
54
|
+
│ │ │ succinct.proof │ │
|
|
55
|
+
│ │ └───────────────────────┘ │
|
|
56
|
+
│ │ │
|
|
57
|
+
│ VerifiableFile ─► verifyBindings() / verifyProof() │
|
|
58
|
+
└─────────────────────────────────────────────────────────┘
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Rust + Native Bindings
|
|
62
|
+
|
|
63
|
+
The cryptographic core is written in Rust and compiled to native code via [uniffi-bindgen-react-native](https://github.com/nicolo-ribaudo/uniffi-bindgen-react-native). The Rust crates handle:
|
|
64
|
+
|
|
65
|
+
- **C2PA manifest creation and parsing** (`c2pa-utils`) — built on the [c2pa-rs](https://github.com/contentauth/c2pa-rs) library
|
|
66
|
+
- **Certificate generation** (`certs-utils`) — X.509/P-256 certificate chain building
|
|
67
|
+
- **Proof verification** (`verify-utils`) — SP1 Groth16 proof verification
|
|
68
|
+
- **Proof generation** (`proving-utils`) — SP1 proof requests to the Succinct prover network
|
|
69
|
+
|
|
70
|
+
Native iOS integration uses:
|
|
71
|
+
- **Secure Enclave** for content signing keys (via `@pagopa/io-react-native-crypto`)
|
|
72
|
+
- **App Attest** for device binding (via `@pagopa/io-react-native-integrity`)
|
|
73
|
+
- **AVFoundation** for camera capture (custom Swift TurboModule)
|
|
13
74
|
|
|
14
75
|
## Installation
|
|
15
76
|
|
|
@@ -17,31 +78,47 @@ React Native SDK for capturing, signing, verifying, and proving media authentici
|
|
|
17
78
|
npm install @succinctlabs/react-native-zcam1
|
|
18
79
|
```
|
|
19
80
|
|
|
81
|
+
### Prerequisites
|
|
82
|
+
|
|
83
|
+
- iOS 16+
|
|
84
|
+
- React Native 0.81+ with New Architecture enabled
|
|
85
|
+
- React 19+
|
|
86
|
+
- Rust toolchain with iOS targets:
|
|
87
|
+
```sh
|
|
88
|
+
rustup target add aarch64-apple-ios aarch64-apple-ios-sim
|
|
89
|
+
```
|
|
90
|
+
- Xcode with Metal Toolchain:
|
|
91
|
+
```sh
|
|
92
|
+
xcodebuild -downloadComponent MetalToolchain
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
> **Note:** Rust bindings are compiled during `npm install`. This is expected to take several minutes on the first install.
|
|
96
|
+
|
|
20
97
|
### iOS setup
|
|
21
98
|
|
|
22
99
|
```sh
|
|
23
|
-
pod install
|
|
100
|
+
cd ios && pod install
|
|
24
101
|
```
|
|
25
102
|
|
|
26
|
-
|
|
103
|
+
### Enabling the proving module
|
|
27
104
|
|
|
28
|
-
The proving module is optional and ships as a separate native framework. To enable it
|
|
105
|
+
The proving module is optional and ships as a separate native framework. To enable it:
|
|
29
106
|
|
|
107
|
+
**Option 1 — Podfile.properties.json:**
|
|
30
108
|
```json
|
|
31
109
|
{
|
|
32
110
|
"zcam1EnableProving": true
|
|
33
111
|
}
|
|
34
112
|
```
|
|
35
113
|
|
|
36
|
-
|
|
37
|
-
|
|
114
|
+
**Option 2 — Environment variable:**
|
|
38
115
|
```sh
|
|
39
116
|
ZCAM1_ENABLE_PROVING=1 pod install
|
|
40
117
|
```
|
|
41
118
|
|
|
42
|
-
|
|
43
|
-
|
|
119
|
+
**Option 3 — Expo config plugin:**
|
|
44
120
|
```ts
|
|
121
|
+
// app.config.ts
|
|
45
122
|
export default {
|
|
46
123
|
plugins: [
|
|
47
124
|
["@succinctlabs/react-native-zcam1/app.plugin.js", { enableProving: true }]
|
|
@@ -49,12 +126,69 @@ export default {
|
|
|
49
126
|
};
|
|
50
127
|
```
|
|
51
128
|
|
|
129
|
+
## Quick Start
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import { useEffect, useRef, useState } from "react";
|
|
133
|
+
import { Button, View } from "react-native";
|
|
134
|
+
import { initCapture, ZCamera, CaptureInfo } from "@succinctlabs/react-native-zcam1";
|
|
135
|
+
|
|
136
|
+
export function CaptureScreen() {
|
|
137
|
+
const camera = useRef<ZCamera>(null);
|
|
138
|
+
const [captureInfo, setCaptureInfo] = useState<CaptureInfo>();
|
|
139
|
+
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
initCapture({
|
|
142
|
+
appId: "YOUR_TEAM_ID.your.bundle.id",
|
|
143
|
+
production: false,
|
|
144
|
+
}).then(setCaptureInfo);
|
|
145
|
+
}, []);
|
|
146
|
+
|
|
147
|
+
const handleCapture = async () => {
|
|
148
|
+
const photo = await camera.current?.takePhoto();
|
|
149
|
+
if (photo) {
|
|
150
|
+
// photo.path contains a C2PA-signed JPEG with succinct.bindings
|
|
151
|
+
console.log("Signed photo at:", photo.path);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
if (!captureInfo) return null;
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<View style={{ flex: 1 }}>
|
|
159
|
+
<ZCamera ref={camera} captureInfo={captureInfo} style={{ flex: 1 }} />
|
|
160
|
+
<Button title="Capture" onPress={handleCapture} />
|
|
161
|
+
</View>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
See the [Quickstart Guide](https://zcam-sdk.succinct.xyz//getting-started/quickstart) for a complete capture → prove → verify flow.
|
|
167
|
+
|
|
168
|
+
## Troubleshooting
|
|
169
|
+
|
|
170
|
+
### Uniffi cache error
|
|
171
|
+
|
|
172
|
+
If you see `FFI function ... has a checksum mismatch` or `method_manifesteditor_... is not a function`, clean the cache:
|
|
173
|
+
|
|
174
|
+
```sh
|
|
175
|
+
cd react-native-zcam1 && npm run clean
|
|
176
|
+
# Then reinstall and rebuild
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### RP ID mismatch
|
|
180
|
+
|
|
181
|
+
If you see "RP ID mismatch", the `appId` passed to `initCapture()` is incorrect. It must be `TEAM_ID.BUNDLE_ID` — for example, `NLS5R4YCGX.com.example.myapp`.
|
|
182
|
+
|
|
183
|
+
To find your Team ID: open Keychain Access → find "Apple Development" certificate → the Team ID is the "Organizational unit" under "Subject name".
|
|
184
|
+
|
|
52
185
|
## Requirements
|
|
53
186
|
|
|
54
187
|
- iOS 16+
|
|
55
188
|
- React Native 0.81+
|
|
56
189
|
- React 19+
|
|
57
190
|
- New Architecture enabled
|
|
191
|
+
- Physical device required for App Attest (simulator uses mock attestations for development)
|
|
58
192
|
|
|
59
193
|
## License
|
|
60
194
|
|
package/Zcam1Sdk.podspec
CHANGED
|
@@ -74,20 +74,17 @@ Pod::Spec.new do |s|
|
|
|
74
74
|
# Proving framework download command, only included when proving is enabled.
|
|
75
75
|
# Injected as a shell snippet into prepare_command via Ruby interpolation.
|
|
76
76
|
download_proving_cmd = enable_proving ? <<~SHELL
|
|
77
|
-
PROVING_MARKER=".xcframework-proving-version"
|
|
78
77
|
if [ ! -d "Zcam1ProvingFramework.xcframework" ]; then
|
|
79
78
|
echo "Downloading Zcam1ProvingFramework.xcframework v#{version}..."
|
|
80
79
|
curl -L "#{base_url}/Zcam1ProvingFramework.xcframework.zip" -o Zcam1ProvingFramework.xcframework.zip
|
|
81
80
|
unzip -q Zcam1ProvingFramework.xcframework.zip
|
|
82
81
|
rm Zcam1ProvingFramework.xcframework.zip
|
|
83
|
-
|
|
84
|
-
elif [ -f "$PROVING_MARKER" ] && [ "$(cat $PROVING_MARKER)" != "#{version}" ]; then
|
|
82
|
+
elif [ -f "$MARKER" ] && [ "$(cat $MARKER)" != "#{version}" ]; then
|
|
85
83
|
echo "Updating Zcam1ProvingFramework.xcframework to v#{version}..."
|
|
86
84
|
rm -rf Zcam1ProvingFramework.xcframework
|
|
87
85
|
curl -L "#{base_url}/Zcam1ProvingFramework.xcframework.zip" -o Zcam1ProvingFramework.xcframework.zip
|
|
88
86
|
unzip -q Zcam1ProvingFramework.xcframework.zip
|
|
89
87
|
rm Zcam1ProvingFramework.xcframework.zip
|
|
90
|
-
echo "#{version}" > "$PROVING_MARKER"
|
|
91
88
|
fi
|
|
92
89
|
SHELL
|
|
93
90
|
: ""
|