@iam-protocol/pulse-sdk 0.3.5 → 0.3.6

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
@@ -1471,6 +1471,15 @@ async function processSensorData(sensorData, config, wallet, connection) {
1471
1471
  error: "No voice data detected. Please speak the phrase clearly during capture."
1472
1472
  };
1473
1473
  }
1474
+ const hasPreviousData = loadVerificationData() !== null;
1475
+ if (hasPreviousData && !hasMotion && !hasTouch) {
1476
+ return {
1477
+ success: false,
1478
+ commitment: new Uint8Array(32),
1479
+ isFirstVerification: false,
1480
+ error: "Insufficient sensor data for re-verification. Please trace the curve and allow motion access."
1481
+ };
1482
+ }
1474
1483
  const features = await extractFeatures(sensorData);
1475
1484
  const nonZero = features.filter((v) => v !== 0).length;
1476
1485
  console.log(
@@ -1713,15 +1722,6 @@ var PulseSDK = class {
1713
1722
  try {
1714
1723
  const session = this.createSession(touchElement);
1715
1724
  const stopPromises = [];
1716
- try {
1717
- await session.startAudio();
1718
- stopPromises.push(
1719
- new Promise((r) => setTimeout(r, DEFAULT_CAPTURE_MS)).then(() => session.stopAudio()).then(() => {
1720
- })
1721
- );
1722
- } catch (err) {
1723
- throw new Error(`Audio capture failed: ${err?.message ?? "microphone unavailable"}`);
1724
- }
1725
1725
  try {
1726
1726
  await session.startMotion();
1727
1727
  } catch {
@@ -1732,6 +1732,15 @@ var PulseSDK = class {
1732
1732
  })
1733
1733
  );
1734
1734
  }
1735
+ try {
1736
+ await session.startAudio();
1737
+ stopPromises.push(
1738
+ new Promise((r) => setTimeout(r, DEFAULT_CAPTURE_MS)).then(() => session.stopAudio()).then(() => {
1739
+ })
1740
+ );
1741
+ } catch (err) {
1742
+ throw new Error(`Audio capture failed: ${err?.message ?? "microphone unavailable"}`);
1743
+ }
1735
1744
  if (touchElement) {
1736
1745
  try {
1737
1746
  await session.startTouch();