@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.mjs CHANGED
@@ -1392,6 +1392,15 @@ async function processSensorData(sensorData, config, wallet, connection) {
1392
1392
  error: "No voice data detected. Please speak the phrase clearly during capture."
1393
1393
  };
1394
1394
  }
1395
+ const hasPreviousData = loadVerificationData() !== null;
1396
+ if (hasPreviousData && !hasMotion && !hasTouch) {
1397
+ return {
1398
+ success: false,
1399
+ commitment: new Uint8Array(32),
1400
+ isFirstVerification: false,
1401
+ error: "Insufficient sensor data for re-verification. Please trace the curve and allow motion access."
1402
+ };
1403
+ }
1395
1404
  const features = await extractFeatures(sensorData);
1396
1405
  const nonZero = features.filter((v) => v !== 0).length;
1397
1406
  console.log(
@@ -1634,15 +1643,6 @@ var PulseSDK = class {
1634
1643
  try {
1635
1644
  const session = this.createSession(touchElement);
1636
1645
  const stopPromises = [];
1637
- try {
1638
- await session.startAudio();
1639
- stopPromises.push(
1640
- new Promise((r) => setTimeout(r, DEFAULT_CAPTURE_MS)).then(() => session.stopAudio()).then(() => {
1641
- })
1642
- );
1643
- } catch (err) {
1644
- throw new Error(`Audio capture failed: ${err?.message ?? "microphone unavailable"}`);
1645
- }
1646
1646
  try {
1647
1647
  await session.startMotion();
1648
1648
  } catch {
@@ -1653,6 +1653,15 @@ var PulseSDK = class {
1653
1653
  })
1654
1654
  );
1655
1655
  }
1656
+ try {
1657
+ await session.startAudio();
1658
+ stopPromises.push(
1659
+ new Promise((r) => setTimeout(r, DEFAULT_CAPTURE_MS)).then(() => session.stopAudio()).then(() => {
1660
+ })
1661
+ );
1662
+ } catch (err) {
1663
+ throw new Error(`Audio capture failed: ${err?.message ?? "microphone unavailable"}`);
1664
+ }
1656
1665
  if (touchElement) {
1657
1666
  try {
1658
1667
  await session.startTouch();