Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

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)

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)
}
Field Details:
  • production (boolean, required) - false for development, true for production App Attest environment
  • privateKey (string, optional) - SP1 prover network private key. If not provided, uses a mock prover
  • certChain (SelfSignedCertChain | ExistingCertChain, optional) - Certificate chain for C2PA signing. If not provided, generates self-signed certificate
  • proverNetworkMode (ProverNetworkMode, optional) - Selects the prover network: Mainnet (auction-based) or Reserved (reserved capacity). Defaults to Mainnet

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 privateKey is not provided, uses a mock prover for development
  • If certChain is not provided, generates a self-signed certificate
  • Access the proving client via useProver() hook