# 🧪 Usage Examples

## Example 1 — Generate and Verify Proof from Config File

This is the easiest way to use the SDK: create a `config.json` and pass it to the `generateProof()` function.

```json title="config.json"
{
  "circuitPath": "./circuits/ageVerifier/ageVerifier.circom",
  "input": {
    "birthDate": 631152000,
    "minAge": 18,
    "currentDate": 1718169600
  }
}
```

> Tip: You can find a working version of this file in `circuits/ageVerifier/config.json`.

```js title="generate.js"
const { generateProof, verifyProof } = require("zk-threshold-proof");

(async () => {
  const proof = await generateProof("./circuits/ageVerifier/config.json");
  const isValid = await verifyProof(proof);

  console.log("✅ Valid Proof?", isValid);
})();
```

---

## Example 2 — Use with Adapter (e.g. zkVerify)

You can also verify proofs using a specific blockchain adapter:

```js
const { zkVerifyAdapter } = require("zk-threshold-proof/src/adapters");

(async () => {
  const proof = await generateProof("./circuits/ageVerifier/config.json");

  const result = await zkVerifyAdapter.verify(proof, "0xVerifierContractAddress");
  console.log("zkVerify result:", result);
})();
```

> Adapters available:
>
> * `zkVerifyAdapter`
> * `polygonIdAdapter`
> * `semaphoreAdapter`

More details in the [Adapters Section](./adapters).

---

## Notes

* All proof generation happens locally.
* You can plug this into any ZK-enabled verifier or blockchain platform.
* Works out-of-the-box with Circom-compatible circuits.
