@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.d.mts CHANGED
@@ -13,6 +13,7 @@ interface PulseConfig {
13
13
  cluster: "devnet" | "mainnet-beta" | "localnet";
14
14
  rpcEndpoint?: string;
15
15
  relayerUrl?: string;
16
+ relayerApiKey?: string;
16
17
  zkeyUrl?: string;
17
18
  wasmUrl?: string;
18
19
  threshold?: number;
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ interface PulseConfig {
13
13
  cluster: "devnet" | "mainnet-beta" | "localnet";
14
14
  rpcEndpoint?: string;
15
15
  relayerUrl?: string;
16
+ relayerApiKey?: string;
16
17
  zkeyUrl?: string;
17
18
  wasmUrl?: string;
18
19
  threshold?: number;
package/dist/index.js CHANGED
@@ -13855,7 +13855,32 @@ function extractFeatures(data) {
13855
13855
  const touchFeatures = extractTouchFeatures(data.touch);
13856
13856
  return fuseFeatures(audioFeatures, motionFeatures, touchFeatures);
13857
13857
  }
13858
+ var MIN_AUDIO_SAMPLES = 16e3;
13859
+ var MIN_MOTION_SAMPLES = 10;
13860
+ var MIN_TOUCH_SAMPLES = 10;
13858
13861
  async function processSensorData(sensorData, config, wallet, connection) {
13862
+ const audioSamples = sensorData.audio?.samples.length ?? 0;
13863
+ const motionSamples = sensorData.motion.length;
13864
+ const touchSamples = sensorData.touch.length;
13865
+ const hasAudio = audioSamples >= MIN_AUDIO_SAMPLES;
13866
+ const hasMotion = motionSamples >= MIN_MOTION_SAMPLES;
13867
+ const hasTouch = touchSamples >= MIN_TOUCH_SAMPLES;
13868
+ if (!hasAudio && !hasMotion && !hasTouch) {
13869
+ return {
13870
+ success: false,
13871
+ commitment: new Uint8Array(32),
13872
+ isFirstVerification: true,
13873
+ error: "Insufficient behavioral data. Please speak the phrase and trace the curve during capture."
13874
+ };
13875
+ }
13876
+ if (!hasAudio) {
13877
+ return {
13878
+ success: false,
13879
+ commitment: new Uint8Array(32),
13880
+ isFirstVerification: true,
13881
+ error: "No voice data detected. Please speak the phrase clearly during capture."
13882
+ };
13883
+ }
13859
13884
  const features = extractFeatures(sensorData);
13860
13885
  const fingerprint = simhash(features);
13861
13886
  const tbh = await generateTBH(fingerprint);
@@ -13902,7 +13927,7 @@ async function processSensorData(sensorData, config, wallet, connection) {
13902
13927
  submission = await submitViaRelayer(
13903
13928
  solanaProof ?? { proofBytes: new Uint8Array(0), publicInputs: [] },
13904
13929
  tbh.commitmentBytes,
13905
- { relayerUrl: config.relayerUrl, isFirstVerification }
13930
+ { relayerUrl: config.relayerUrl, apiKey: config.relayerApiKey, isFirstVerification }
13906
13931
  );
13907
13932
  } else {
13908
13933
  return {