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

VerifiableFile

Class for verifying C2PA manifests and ZK proofs in photos. Extracts the manifest on construction and provides methods to verify bindings, proofs, and retrieve metadata.

Usage

import { VerifiableFile } from '@succinctlabs/react-native-zcam1';
 
const verifiable = new VerifiableFile(photoPath);
 
// Verify hardware-backed bindings (App Attest)
const bindingsValid = verifiable.verifyBindings(false);
 
// Verify zero-knowledge proof
const proofValid = verifiable.verifyProof('TEAM_ID.com.example.app');
 
// Get capture metadata
const metadata = verifiable.captureMetadata();

Constructor

new VerifiableFile(path)

Creates a VerifiableFile instance by extracting the C2PA manifest from the file.

path (required)

  • Type: string

Path to the file to verify.

Methods

verifyBindings(appAttestProduction)

Verifies the hardware-backed bindings in the C2PA manifest. See verifyBindings.

verifyProof(appId)

Verifies the zero-knowledge proof in the C2PA manifest. See verifyProof.

dataHash()

Gets the content hash from the C2PA manifest. See dataHash.

captureMetadata()

Gets the capture metadata from the C2PA manifest. See captureMetadata.

Example

import { useState } from 'react';
import { View, Button, Text, StyleSheet } from 'react-native';
import { VerifiableFile } from '@succinctlabs/react-native-zcam1';
import { launchImageLibrary } from 'react-native-image-picker';
 
function VerificationScreen() {
  const [result, setResult] = useState<string>('');
 
  const verifyPhoto = async () => {
    const response = await launchImageLibrary({ mediaType: 'photo' });
    const uri = response.assets?.[0]?.uri;
    
    if (!uri) return;
 
    try {
      const verifiable = new VerifiableFile(uri);
      
      const bindingsValid = verifiable.verifyBindings(false);
      const proofValid = verifiable.verifyProof(process.env.EXPO_PUBLIC_APP_ID!);
      const metadata = verifiable.captureMetadata();
      
      if (bindingsValid && proofValid) {
        setResult(`✓ Verified!\nCaptured: ${metadata?.when}`);
      } else {
        setResult('✗ Verification failed');
      }
    } catch (error: any) {
      setResult(`Error: ${error.message}`);
    }
  };
 
  return (
    <View style={styles.container}>
      <Button title="Select & Verify Photo" onPress={verifyPhoto} />
      {result && <Text style={styles.result}>{result}</Text>}
    </View>
  );
}

Notes