SDK — ZKP Operations

View as Markdown

Source: packages/sdk/src/zkp.ts.

SDK methodEndpoint
generateChallenge()POST /api/v1/zkp/challenge
generateZKProof(params)POST /api/v1/zkp/proofs
verifyZKProof(proof, proverDid)POST /api/v1/zkp/verify
getZKProof(proofId)GET /api/v1/zkp/proofs/{id}

Example: predicate proof

1const challenge = await client.generateZKChallenge();
2
3const { proof } = await client.generateZKProof({
4 credentialId: vc.id,
5 proverDid: 'did:adi:alice…',
6 privateKey: holderPrivateKeyB64Url,
7 credentialSubject: { age: 25, country: 'US' },
8 predicates: [
9 { attributeName: 'age', type: 'gte', value: 18 },
10 { attributeName: 'country', type: 'membership', memberSet: ['US','UK','EU'] },
11 ],
12 challenge: challenge.challenge,
13 anchorOnChain: false,
14});
15
16const verification = await verifierClient.verifyZKProof(proof, 'did:adi:alice…');
17console.log('All predicates satisfied?', verification.valid);

Important: The wallet uses this exact API on mobile (§8.4). When anchorOnChain: true, the response includes onChainHash — use it to fetch the on-chain ProofRecord from the ZKProofVerifier contract (§11.6).