@iam-protocol/pulse-sdk 0.3.7 → 0.3.8

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.mjs CHANGED
@@ -1438,12 +1438,24 @@ async function processSensorData(sensorData, config, wallet, connection) {
1438
1438
  error: "wasmUrl and zkeyUrl must be configured for re-verification proof generation"
1439
1439
  };
1440
1440
  }
1441
- const { proof, publicSignals } = await generateProof(
1442
- circuitInput,
1443
- wasmPath,
1444
- zkeyPath
1445
- );
1446
- solanaProof = serializeProof(proof, publicSignals);
1441
+ try {
1442
+ const { proof, publicSignals } = await generateProof(
1443
+ circuitInput,
1444
+ wasmPath,
1445
+ zkeyPath
1446
+ );
1447
+ solanaProof = serializeProof(proof, publicSignals);
1448
+ } catch (proofErr) {
1449
+ const audioNZ = features.slice(0, 44).filter((v) => v !== 0).length;
1450
+ const motionNZ = features.slice(44, 98).filter((v) => v !== 0).length;
1451
+ const touchNZ = features.slice(98, 134).filter((v) => v !== 0).length;
1452
+ return {
1453
+ success: false,
1454
+ commitment: tbh.commitmentBytes,
1455
+ isFirstVerification: false,
1456
+ error: `Proof failed (distance=${distance}, audio=${audioNZ}/44, motion=${motionNZ}/54, touch=${touchNZ}/36): ${proofErr?.message ?? proofErr}`
1457
+ };
1458
+ }
1447
1459
  }
1448
1460
  let submission;
1449
1461
  if (wallet && connection) {