@iam-protocol/pulse-sdk 0.2.2 → 0.2.3

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
@@ -13773,7 +13773,32 @@ function extractFeatures(data) {
13773
13773
  const touchFeatures = extractTouchFeatures(data.touch);
13774
13774
  return fuseFeatures(audioFeatures, motionFeatures, touchFeatures);
13775
13775
  }
13776
+ var MIN_AUDIO_SAMPLES = 16e3;
13777
+ var MIN_MOTION_SAMPLES = 10;
13778
+ var MIN_TOUCH_SAMPLES = 10;
13776
13779
  async function processSensorData(sensorData, config, wallet, connection) {
13780
+ const audioSamples = sensorData.audio?.samples.length ?? 0;
13781
+ const motionSamples = sensorData.motion.length;
13782
+ const touchSamples = sensorData.touch.length;
13783
+ const hasAudio = audioSamples >= MIN_AUDIO_SAMPLES;
13784
+ const hasMotion = motionSamples >= MIN_MOTION_SAMPLES;
13785
+ const hasTouch = touchSamples >= MIN_TOUCH_SAMPLES;
13786
+ if (!hasAudio && !hasMotion && !hasTouch) {
13787
+ return {
13788
+ success: false,
13789
+ commitment: new Uint8Array(32),
13790
+ isFirstVerification: true,
13791
+ error: "Insufficient behavioral data. Please speak the phrase and trace the curve during capture."
13792
+ };
13793
+ }
13794
+ if (!hasAudio) {
13795
+ return {
13796
+ success: false,
13797
+ commitment: new Uint8Array(32),
13798
+ isFirstVerification: true,
13799
+ error: "No voice data detected. Please speak the phrase clearly during capture."
13800
+ };
13801
+ }
13777
13802
  const features = extractFeatures(sensorData);
13778
13803
  const fingerprint = simhash(features);
13779
13804
  const tbh = await generateTBH(fingerprint);
@@ -13820,7 +13845,7 @@ async function processSensorData(sensorData, config, wallet, connection) {
13820
13845
  submission = await submitViaRelayer(
13821
13846
  solanaProof ?? { proofBytes: new Uint8Array(0), publicInputs: [] },
13822
13847
  tbh.commitmentBytes,
13823
- { relayerUrl: config.relayerUrl, isFirstVerification }
13848
+ { relayerUrl: config.relayerUrl, apiKey: config.relayerApiKey, isFirstVerification }
13824
13849
  );
13825
13850
  } else {
13826
13851
  return {