ProverProvider
React context provider that initializes the proving client for ZK proof generation.
Usage
import { ProverProvider } from "@succinctlabs/react-native-zcam1/proving";
function App() {
return (
<ProverProvider settings={{ production: false }}>
{/* Your app */}
</ProverProvider>
);
}Props
settings (required)
- Type:
Settings
Configuration for the proving client.
type Settings = {
production: boolean; // false for dev, true for production
privateKey?: string; // SP1 prover network private key (optional)
certChain?: SelfSignedCertChain | ExistingCertChain; // Certificate chain (optional)
proverNetworkMode?: ProverNetworkMode; // Prover network mode (optional, defaults to Mainnet)
}production(boolean, required) -falsefor development,truefor production App Attest environmentprivateKey(string, optional) - SP1 prover network private key. If not provided, uses a mock provercertChain(SelfSignedCertChain | ExistingCertChain, optional) - Certificate chain for C2PA signing. If not provided, generates self-signed certificateproverNetworkMode(ProverNetworkMode, optional) - Selects the prover network:Mainnet(auction-based) orReserved(reserved capacity). Defaults toMainnet
See Settings type reference for details.
onFulfilled
- Type:
(requestId: string, photoPath: string, proof: ArrayBuffer, provingClient:ProvingClient) => void - Optional
Callback when a proof request is fulfilled.
onUnfulfillable
- Type:
(requestId: string) => void - Optional
Callback when a proof request cannot be fulfilled.
Example
import { ProverProvider } from "@succinctlabs/react-native-zcam1/proving";
import { FileSystem, Dirs } from "react-native-file-access";
function App() {
const handleProofReady = async (
requestId: string,
photoPath: string,
proof: ArrayBuffer,
provingClient: ProvingClient
) => {
// Automatically embed the proof when ready
const provenPath = await provingClient.embedProof(photoPath, proof);
// Save to permanent storage
const destPath = `${Dirs.DocumentDir}/proven/${Date.now()}.jpg`;
await FileSystem.cp(provenPath, destPath);
console.log("Proof embedded and saved:", destPath);
};
const handleUnfulfillable = (requestId: string) => {
console.error("Proof generation failed for:", requestId);
};
return (
<ProverProvider
settings={{ production: false }}
onFulfilled={handleProofReady}
onUnfulfillable={handleUnfulfillable}
>
<Navigation />
</ProverProvider>
);
}Notes
- Wrap your app at the root level to make the proving client available throughout
- The provider automatically polls for proof completion when using callbacks
- If
privateKeyis not provided, uses a mock prover for development - If
certChainis not provided, generates a self-signed certificate - Access the proving client via
useProver()hook