@iam-protocol/pulse-sdk 0.3.7 → 0.3.9
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 +22 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/pulse.ts +24 -7
package/dist/index.mjs
CHANGED
|
@@ -1438,12 +1438,28 @@ 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
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
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
|
+
const rawAudio = sensorData.audio?.samples.length ?? 0;
|
|
1453
|
+
const rawMotion = sensorData.motion.length;
|
|
1454
|
+
const rawTouch = sensorData.touch.length;
|
|
1455
|
+
const sig = features.slice(0, 3).map((v) => v.toFixed(4)).join(",");
|
|
1456
|
+
return {
|
|
1457
|
+
success: false,
|
|
1458
|
+
commitment: tbh.commitmentBytes,
|
|
1459
|
+
isFirstVerification: false,
|
|
1460
|
+
error: `Proof failed (dist=${distance}, feat=${audioNZ}/${motionNZ}/${touchNZ}, raw=${rawAudio}/${rawMotion}/${rawTouch}, sig=${sig}): ${proofErr?.message ?? proofErr}`
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1447
1463
|
}
|
|
1448
1464
|
let submission;
|
|
1449
1465
|
if (wallet && connection) {
|