@zkproofport-app/sdk 0.2.13 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1581,19 +1581,22 @@ function getCircuitSupportStatus(circuit) {
1581
1581
  * (through mopro's native Barretenberg); it was only the JavaScript side that
1582
1582
  * had no such thing.
1583
1583
  *
1584
- * HOW IT WORKS. `bb` proofs are checked by `acirVerifyUltraKeccakHonk(proof,
1585
- * vk)` — the keccak variant, matching how these proofs are produced. Two things
1584
+ * HOW IT WORKS. Proofs here are made with `--oracle_hash keccak` and ZK on, so
1585
+ * the matching check is `acirVerifyUltraKeccakZkHonk(proof, vk)`. Two things
1586
1586
  * have to line up:
1587
1587
  *
1588
- * The version. The verification key format is not stable across bb releases:
1589
- * the pinned build emits a 1816-byte key where bb 0.87.0 and 1.2.0 emit 1760.
1590
- * `@aztec/bb.js@1.0.0-nightly.20250723` is the WASM build of the same bb the
1591
- * circuits were compiled with. A different one will reject valid proofs.
1588
+ * The version. `@aztec/bb.js@1.0.0-nightly.20250723` is the WASM build of the
1589
+ * same bb the circuits are compiled with. Versions are not interchangeable:
1590
+ * measured on the Korea Mobile ID age circuit, the pinned bb writes a 16256-
1591
+ * byte proof where bb 1.2.0 writes 16224 for the identical circuit and
1592
+ * witness — and the verification key comes out the SAME either way, so the
1593
+ * key cannot warn you. A mismatch shows up only as verification failing.
1592
1594
  *
1593
- * The oracle hash. Proofs are generated with `--oracle_hash keccak` so the
1594
- * Solidity verifiers can check them, so the poseidon-flavoured verify — which
1595
- * is what `BarretenbergVerifier.verifyUltraHonkProof` uses — says false for a
1596
- * perfectly good proof.
1595
+ * The flavour. There are four verify entry points and picking the wrong one
1596
+ * is not a polite false. `acirVerifyUltraZKHonk` (poseidon) answers false for
1597
+ * a perfectly good proof, and `acirVerifyUltraKeccakHonk` — keccak without ZK
1598
+ * — TRAPS the WebAssembly with a bare "unreachable", which looks exactly like
1599
+ * a corrupt proof, a mismatched key, or a missing SRS.
1597
1600
  *
1598
1601
  * THE PROOF ARRIVES IN TWO PIECES. The mobile app splits what Barretenberg
1599
1602
  * produced into `proof` and `publicInputs` before sending it, because the
@@ -1690,9 +1693,8 @@ async function fetchVerificationKey(circuit, timeoutMs) {
1690
1693
  /**
1691
1694
  * Verify a proof off-chain, against its verification key.
1692
1695
  *
1693
- * Needs `@aztec/bb.js` at the pinned version. It is an optional peer dependency
1694
- * — the WASM is large and most callers verify on-chain — so the failure to have
1695
- * it installed says so plainly rather than surfacing as a module-not-found.
1696
+ * Needs no setup from the caller: the verifier ships with this SDK and is
1697
+ * loaded on first use.
1696
1698
  *
1697
1699
  * @param circuit - Canonical circuit identifier
1698
1700
  * @param proof - Proof bytes as hex, WITHOUT public inputs (as the relay sends it)
@@ -1712,15 +1714,29 @@ async function fetchVerificationKey(circuit, timeoutMs) {
1712
1714
  */
1713
1715
  async function verifyProofOffChain(circuit, proof, publicInputs, options = {}) {
1714
1716
  const timeoutMs = options.timeoutMs ?? 30000;
1717
+ // A REQUIRED dependency, loaded lazily.
1718
+ //
1719
+ // It was briefly an optional peer dependency, on the reasoning that the WASM
1720
+ // is 16MB and most callers verify on-chain. That was wrong: it would have
1721
+ // meant a customer calling this method got an error telling them to install
1722
+ // something, and "works with zero customer configuration" is the SDK's rule.
1723
+ // A caller should never have to know this is implemented with Barretenberg.
1724
+ //
1725
+ // The dynamic import is what keeps the cost off everyone else — a bundler
1726
+ // splits it out, and a caller who never verifies off-chain never loads it.
1715
1727
  let bb;
1716
1728
  try {
1717
1729
  bb = await import('@aztec/bb.js');
1718
1730
  }
1719
- catch {
1731
+ catch (error) {
1732
+ // Reaching here means the install is broken, not that something is missing
1733
+ // by design. Say so, rather than sending the caller off to install a
1734
+ // package they should never have had to hear about.
1720
1735
  return {
1721
1736
  valid: false,
1722
- error: 'Off-chain verification needs @aztec/bb.js. Install the pinned version: ' +
1723
- 'npm install @aztec/bb.js@1.0.0-nightly.20250723',
1737
+ error: 'Could not load the proof verifier (@aztec/bb.js), which ships with this ' +
1738
+ 'SDK. This usually means a broken or partial install — try reinstalling ' +
1739
+ `@zkproofport-app/sdk. Underlying error: ${error instanceof Error ? error.message : String(error)}`,
1724
1740
  };
1725
1741
  }
1726
1742
  let api;
@@ -2432,10 +2448,8 @@ class ProofportSDK {
2432
2448
  * chain's own opinion: use {@link verifyResponseOnChain} when the answer has
2433
2449
  * to be one a contract will agree with.
2434
2450
  *
2435
- * Requires the optional peer dependency:
2436
- * `npm install @aztec/bb.js@1.0.0-nightly.20250723`. The version is exact —
2437
- * verification keys are not portable across bb releases, so a different build
2438
- * rejects valid proofs.
2451
+ * Needs no setup: the verifier ships with this SDK. It is loaded on first
2452
+ * use, so a caller who only verifies on-chain never pays for it.
2439
2453
  *
2440
2454
  * @param response - Proof response from the relay
2441
2455
  * @param options - Optional verification key (skips the fetch) and timeout