verifyProof
Verifies the cryptographic zero-knowledge proof embedded in the C2PA manifest. Checks the validity and integrity of the ZK proof.
Usage
import { VerifiableFile } from "@succinctlabs/zcam1-verify";
const verifiable = new VerifiableFile(file);
const appId = "TEAM_ID.com.example.app";
const result = await verifiable.verifyProof(appId);Parameters
appId (required)
- Type:
string
The app identifier used during initCapture().
- iOS:
TEAM_ID.BUNDLE_ID(e.g.,'NLS5R4YCGX.com.example.myapp') - Android: The app package name (e.g.,
'com.example.myapp')
Returns
ResultAsync<boolean, Error> - true if the proof is valid, false otherwise.
Example
import { VerifiableFile } from "@succinctlabs/zcam1-verify";
const input = document.querySelector<HTMLInputElement>("#file-input")!;
input.addEventListener("change", async () => {
const file = input.files?.[0];
if (!file) return;
const verifiable = new VerifiableFile(file);
const appId = "TEAM_ID.com.example.app";
const result = await verifiable.verifyProof(appId);
if (result.isOk() && result.value) {
console.log("Zero-knowledge proof verified!");
} else {
console.log("Proof verification failed");
}
});Notes
- Requires the file to have been proven using the Prove SDK
- The
appIdparameter must match the value used duringinitCapture() - Verifies the Groth16 proof using the embedded verification key hash
- Public inputs include the file hash, app ID, and Apple root certificate