@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/ProofportSDK.d.ts +2 -4
- package/dist/index.esm.js +34 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +34 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -20
- package/dist/index.mjs.map +1 -1
- package/dist/offChainVerifier.d.ts +15 -13
- package/package.json +4 -8
package/dist/ProofportSDK.d.ts
CHANGED
|
@@ -538,10 +538,8 @@ export declare class ProofportSDK {
|
|
|
538
538
|
* chain's own opinion: use {@link verifyResponseOnChain} when the answer has
|
|
539
539
|
* to be one a contract will agree with.
|
|
540
540
|
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
* verification keys are not portable across bb releases, so a different build
|
|
544
|
-
* rejects valid proofs.
|
|
541
|
+
* Needs no setup: the verifier ships with this SDK. It is loaded on first
|
|
542
|
+
* use, so a caller who only verifies on-chain never pays for it.
|
|
545
543
|
*
|
|
546
544
|
* @param response - Proof response from the relay
|
|
547
545
|
* @param options - Optional verification key (skips the fetch) and timeout
|
package/dist/index.esm.js
CHANGED
|
@@ -4443,19 +4443,22 @@ function getCircuitSupportStatus(circuit) {
|
|
|
4443
4443
|
* (through mopro's native Barretenberg); it was only the JavaScript side that
|
|
4444
4444
|
* had no such thing.
|
|
4445
4445
|
*
|
|
4446
|
-
* HOW IT WORKS.
|
|
4447
|
-
*
|
|
4446
|
+
* HOW IT WORKS. Proofs here are made with `--oracle_hash keccak` and ZK on, so
|
|
4447
|
+
* the matching check is `acirVerifyUltraKeccakZkHonk(proof, vk)`. Two things
|
|
4448
4448
|
* have to line up:
|
|
4449
4449
|
*
|
|
4450
|
-
* The version.
|
|
4451
|
-
*
|
|
4452
|
-
*
|
|
4453
|
-
*
|
|
4450
|
+
* The version. `@aztec/bb.js@1.0.0-nightly.20250723` is the WASM build of the
|
|
4451
|
+
* same bb the circuits are compiled with. Versions are not interchangeable:
|
|
4452
|
+
* measured on the Korea Mobile ID age circuit, the pinned bb writes a 16256-
|
|
4453
|
+
* byte proof where bb 1.2.0 writes 16224 for the identical circuit and
|
|
4454
|
+
* witness — and the verification key comes out the SAME either way, so the
|
|
4455
|
+
* key cannot warn you. A mismatch shows up only as verification failing.
|
|
4454
4456
|
*
|
|
4455
|
-
* The
|
|
4456
|
-
*
|
|
4457
|
-
*
|
|
4458
|
-
*
|
|
4457
|
+
* The flavour. There are four verify entry points and picking the wrong one
|
|
4458
|
+
* is not a polite false. `acirVerifyUltraZKHonk` (poseidon) answers false for
|
|
4459
|
+
* a perfectly good proof, and `acirVerifyUltraKeccakHonk` — keccak without ZK
|
|
4460
|
+
* — TRAPS the WebAssembly with a bare "unreachable", which looks exactly like
|
|
4461
|
+
* a corrupt proof, a mismatched key, or a missing SRS.
|
|
4459
4462
|
*
|
|
4460
4463
|
* THE PROOF ARRIVES IN TWO PIECES. The mobile app splits what Barretenberg
|
|
4461
4464
|
* produced into `proof` and `publicInputs` before sending it, because the
|
|
@@ -4552,9 +4555,8 @@ async function fetchVerificationKey(circuit, timeoutMs) {
|
|
|
4552
4555
|
/**
|
|
4553
4556
|
* Verify a proof off-chain, against its verification key.
|
|
4554
4557
|
*
|
|
4555
|
-
* Needs
|
|
4556
|
-
*
|
|
4557
|
-
* it installed says so plainly rather than surfacing as a module-not-found.
|
|
4558
|
+
* Needs no setup from the caller: the verifier ships with this SDK and is
|
|
4559
|
+
* loaded on first use.
|
|
4558
4560
|
*
|
|
4559
4561
|
* @param circuit - Canonical circuit identifier
|
|
4560
4562
|
* @param proof - Proof bytes as hex, WITHOUT public inputs (as the relay sends it)
|
|
@@ -4574,15 +4576,29 @@ async function fetchVerificationKey(circuit, timeoutMs) {
|
|
|
4574
4576
|
*/
|
|
4575
4577
|
async function verifyProofOffChain(circuit, proof, publicInputs, options = {}) {
|
|
4576
4578
|
const timeoutMs = options.timeoutMs ?? 30000;
|
|
4579
|
+
// A REQUIRED dependency, loaded lazily.
|
|
4580
|
+
//
|
|
4581
|
+
// It was briefly an optional peer dependency, on the reasoning that the WASM
|
|
4582
|
+
// is 16MB and most callers verify on-chain. That was wrong: it would have
|
|
4583
|
+
// meant a customer calling this method got an error telling them to install
|
|
4584
|
+
// something, and "works with zero customer configuration" is the SDK's rule.
|
|
4585
|
+
// A caller should never have to know this is implemented with Barretenberg.
|
|
4586
|
+
//
|
|
4587
|
+
// The dynamic import is what keeps the cost off everyone else — a bundler
|
|
4588
|
+
// splits it out, and a caller who never verifies off-chain never loads it.
|
|
4577
4589
|
let bb;
|
|
4578
4590
|
try {
|
|
4579
4591
|
bb = await import('@aztec/bb.js');
|
|
4580
4592
|
}
|
|
4581
|
-
catch {
|
|
4593
|
+
catch (error) {
|
|
4594
|
+
// Reaching here means the install is broken, not that something is missing
|
|
4595
|
+
// by design. Say so, rather than sending the caller off to install a
|
|
4596
|
+
// package they should never have had to hear about.
|
|
4582
4597
|
return {
|
|
4583
4598
|
valid: false,
|
|
4584
|
-
error: '
|
|
4585
|
-
'
|
|
4599
|
+
error: 'Could not load the proof verifier (@aztec/bb.js), which ships with this ' +
|
|
4600
|
+
'SDK. This usually means a broken or partial install — try reinstalling ' +
|
|
4601
|
+
`@zkproofport-app/sdk. Underlying error: ${error instanceof Error ? error.message : String(error)}`,
|
|
4586
4602
|
};
|
|
4587
4603
|
}
|
|
4588
4604
|
let api;
|
|
@@ -5294,10 +5310,8 @@ class ProofportSDK {
|
|
|
5294
5310
|
* chain's own opinion: use {@link verifyResponseOnChain} when the answer has
|
|
5295
5311
|
* to be one a contract will agree with.
|
|
5296
5312
|
*
|
|
5297
|
-
*
|
|
5298
|
-
*
|
|
5299
|
-
* verification keys are not portable across bb releases, so a different build
|
|
5300
|
-
* rejects valid proofs.
|
|
5313
|
+
* Needs no setup: the verifier ships with this SDK. It is loaded on first
|
|
5314
|
+
* use, so a caller who only verifies on-chain never pays for it.
|
|
5301
5315
|
*
|
|
5302
5316
|
* @param response - Proof response from the relay
|
|
5303
5317
|
* @param options - Optional verification key (skips the fetch) and timeout
|