@iam-protocol/pulse-sdk 0.3.8 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iam-protocol/pulse-sdk",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "Client-side SDK for IAM Protocol — sensor capture, TBH generation, ZK proof construction",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/pulse.ts CHANGED
@@ -181,11 +181,16 @@ async function processSensorData(
181
181
  const audioNZ = features.slice(0, 44).filter((v) => v !== 0).length;
182
182
  const motionNZ = features.slice(44, 98).filter((v) => v !== 0).length;
183
183
  const touchNZ = features.slice(98, 134).filter((v) => v !== 0).length;
184
+ const rawAudio = sensorData.audio?.samples.length ?? 0;
185
+ const rawMotion = sensorData.motion.length;
186
+ const rawTouch = sensorData.touch.length;
187
+ // First 3 feature values as a fingerprint to detect identical data
188
+ const sig = features.slice(0, 3).map((v) => v.toFixed(4)).join(",");
184
189
  return {
185
190
  success: false,
186
191
  commitment: tbh.commitmentBytes,
187
192
  isFirstVerification: false,
188
- error: `Proof failed (distance=${distance}, audio=${audioNZ}/44, motion=${motionNZ}/54, touch=${touchNZ}/36): ${proofErr?.message ?? proofErr}`,
193
+ error: `Proof failed (dist=${distance}, feat=${audioNZ}/${motionNZ}/${touchNZ}, raw=${rawAudio}/${rawMotion}/${rawTouch}, sig=${sig}): ${proofErr?.message ?? proofErr}`,
189
194
  };
190
195
  }
191
196
  }