Install the ZK-ID SDK via npm. Skip this step for browser-only testing.
Request a signed credential from the issuing authority. For this demo, we'll use test data.
import { Issuer } from '@zk-id/sdk';
const issuer = new Issuer(privateKey);
const credential = await issuer.issueCredential({
birthYear: 1990,
nationality: 840,
userId: 'user-123'
});
Prove you're 18+ without revealing your exact birth year. This happens entirely in your
browser.
🔒
Privacy Guarantee: Your birth year stays in your browser. Only the proof
is sent to the server.
import { Prover } from '@zk-id/sdk';
const prover = new Prover();
const proof = await prover.generateAgeProof({
credential,
minAge: 18,
challenge: await fetchChallenge()
});
The server verifies the proof without learning your private data.
Waiting for verification...
import { Verifier } from '@zk-id/sdk';
const verifier = new Verifier(publicKey);
const result = await verifier.verifyAge({
proof,
minAge: 18,
credentialHash
});
if (result.verified) {
console.log('User is 18+');
}
🎉
Congratulations!
You've successfully generated and verified a zero-knowledge proof. Ready to integrate
ZK-ID into your application?