@iam-protocol/pulse-sdk 0.2.5 → 0.3.0
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 +52 -2
- package/dist/index.d.ts +52 -2
- package/dist/index.js +546 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +541 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/src/config.ts +1 -1
- package/src/extraction/kinematic.ts +171 -1
- package/src/extraction/lpc.ts +215 -0
- package/src/extraction/speaker.ts +361 -0
- package/src/hashing/simhash.ts +1 -1
- package/src/index.ts +2 -0
- package/src/pulse.ts +16 -5
- package/test/integration.test.ts +2 -2
- package/src/extraction/mfcc.ts +0 -113
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const FINGERPRINT_BITS = 256;
|
|
2
|
-
declare const DEFAULT_THRESHOLD =
|
|
2
|
+
declare const DEFAULT_THRESHOLD = 96;
|
|
3
3
|
declare const DEFAULT_MIN_DISTANCE = 3;
|
|
4
4
|
declare const MIN_CAPTURE_MS = 2000;
|
|
5
5
|
declare const MAX_CAPTURE_MS = 60000;
|
|
@@ -235,6 +235,56 @@ declare function entropy(values: number[], bins?: number): number;
|
|
|
235
235
|
declare function autocorrelation(values: number[], lag?: number): number;
|
|
236
236
|
declare function fuseFeatures(audio: number[], motion: number[], touch: number[]): number[];
|
|
237
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Speaker-dependent audio feature extraction.
|
|
240
|
+
*
|
|
241
|
+
* Extracts features that characterize HOW someone speaks (prosody, vocal physiology)
|
|
242
|
+
* rather than WHAT they say (phonetic content). These features are stable across
|
|
243
|
+
* different utterances from the same speaker.
|
|
244
|
+
*
|
|
245
|
+
* Output: 44 values
|
|
246
|
+
* F0 statistics (5) + F0 delta (4) + jitter (4) + shimmer (4) +
|
|
247
|
+
* HNR statistics (5) + formant ratios (8) + LTAS (8) + voicing ratio (1) +
|
|
248
|
+
* amplitude statistics (5)
|
|
249
|
+
*/
|
|
250
|
+
|
|
251
|
+
declare const SPEAKER_FEATURE_COUNT = 44;
|
|
252
|
+
/**
|
|
253
|
+
* Extract speaker-dependent audio features.
|
|
254
|
+
*
|
|
255
|
+
* Captures physiological vocal characteristics (F0, jitter, shimmer, HNR, formant
|
|
256
|
+
* ratios) that are stable across different utterances from the same speaker.
|
|
257
|
+
* Content-independent by design — different phrases produce similar feature values.
|
|
258
|
+
*
|
|
259
|
+
* Returns 44 values.
|
|
260
|
+
*/
|
|
261
|
+
declare function extractSpeakerFeatures(audio: AudioCapture): Promise<number[]>;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Extract kinematic features from motion (IMU) data.
|
|
265
|
+
* Computes jerk (3rd derivative) and jounce (4th derivative) of acceleration,
|
|
266
|
+
* then condenses each axis into statistics.
|
|
267
|
+
*
|
|
268
|
+
* Returns: ~54 values (6 axes × 2 derivatives × 4 stats + 6 jitter variance values)
|
|
269
|
+
*/
|
|
270
|
+
declare function extractMotionFeatures(samples: MotionSample[]): number[];
|
|
271
|
+
/**
|
|
272
|
+
* Extract kinematic features from touch data.
|
|
273
|
+
* Computes velocity and acceleration of touch coordinates,
|
|
274
|
+
* plus pressure and area statistics.
|
|
275
|
+
*
|
|
276
|
+
* Returns: ~36 values (32 base + 4 jitter variance for x, y, pressure, area)
|
|
277
|
+
*/
|
|
278
|
+
declare function extractTouchFeatures(samples: TouchSample[]): number[];
|
|
279
|
+
/**
|
|
280
|
+
* Extract mouse dynamics features as a desktop replacement for motion sensor data.
|
|
281
|
+
* Captures behavioral patterns from mouse/pointer movement that are user-specific:
|
|
282
|
+
* path curvature, speed patterns, micro-corrections, pause behavior.
|
|
283
|
+
*
|
|
284
|
+
* Returns: 54 values (matches motion feature dimension for consistent SimHash input)
|
|
285
|
+
*/
|
|
286
|
+
declare function extractMouseDynamics(samples: TouchSample[]): number[];
|
|
287
|
+
|
|
238
288
|
/** Serialized proof ready for on-chain submission */
|
|
239
289
|
interface SolanaProof {
|
|
240
290
|
proofBytes: Uint8Array;
|
|
@@ -397,4 +447,4 @@ declare function generateLissajousSequence(count?: number): {
|
|
|
397
447
|
points: Point2D[];
|
|
398
448
|
}[];
|
|
399
449
|
|
|
400
|
-
export { type AudioCapture, type CaptureOptions, type CaptureStage, type CircuitInput, DEFAULT_CAPTURE_MS, DEFAULT_MIN_DISTANCE, DEFAULT_THRESHOLD, FINGERPRINT_BITS, type FeatureVector, type FusedFeatureVector, type IdentityState, type LissajousParams, MAX_CAPTURE_MS, MIN_CAPTURE_MS, type MotionSample, PROGRAM_IDS, type PackedFingerprint, type Point2D, type ProofResult, type PulseConfig, PulseSDK, PulseSession, type SensorData, type SolanaProof, type StageState, type StatsSummary, type StoredVerificationData, type SubmissionResult, type TBH, type TemporalFingerprint, type TouchSample, type VerificationResult, autocorrelation, bigintToBytes32, computeCommitment, condense, entropy, fetchIdentityState, fuseFeatures, generateLissajousPoints, generateLissajousSequence, generatePhrase, generatePhraseSequence, generateProof, generateSalt, generateSolanaProof, generateTBH, hammingDistance, kurtosis, loadVerificationData, mean, packBits, prepareCircuitInput, randomLissajousParams, serializeProof, simhash, skewness, storeVerificationData, submitViaRelayer, submitViaWallet, toBigEndian32, variance };
|
|
450
|
+
export { type AudioCapture, type CaptureOptions, type CaptureStage, type CircuitInput, DEFAULT_CAPTURE_MS, DEFAULT_MIN_DISTANCE, DEFAULT_THRESHOLD, FINGERPRINT_BITS, type FeatureVector, type FusedFeatureVector, type IdentityState, type LissajousParams, MAX_CAPTURE_MS, MIN_CAPTURE_MS, type MotionSample, PROGRAM_IDS, type PackedFingerprint, type Point2D, type ProofResult, type PulseConfig, PulseSDK, PulseSession, SPEAKER_FEATURE_COUNT, type SensorData, type SolanaProof, type StageState, type StatsSummary, type StoredVerificationData, type SubmissionResult, type TBH, type TemporalFingerprint, type TouchSample, type VerificationResult, autocorrelation, bigintToBytes32, computeCommitment, condense, entropy, extractMotionFeatures, extractMouseDynamics, extractSpeakerFeatures, extractTouchFeatures, fetchIdentityState, fuseFeatures, generateLissajousPoints, generateLissajousSequence, generatePhrase, generatePhraseSequence, generateProof, generateSalt, generateSolanaProof, generateTBH, hammingDistance, kurtosis, loadVerificationData, mean, packBits, prepareCircuitInput, randomLissajousParams, serializeProof, simhash, skewness, storeVerificationData, submitViaRelayer, submitViaWallet, toBigEndian32, variance };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const FINGERPRINT_BITS = 256;
|
|
2
|
-
declare const DEFAULT_THRESHOLD =
|
|
2
|
+
declare const DEFAULT_THRESHOLD = 96;
|
|
3
3
|
declare const DEFAULT_MIN_DISTANCE = 3;
|
|
4
4
|
declare const MIN_CAPTURE_MS = 2000;
|
|
5
5
|
declare const MAX_CAPTURE_MS = 60000;
|
|
@@ -235,6 +235,56 @@ declare function entropy(values: number[], bins?: number): number;
|
|
|
235
235
|
declare function autocorrelation(values: number[], lag?: number): number;
|
|
236
236
|
declare function fuseFeatures(audio: number[], motion: number[], touch: number[]): number[];
|
|
237
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Speaker-dependent audio feature extraction.
|
|
240
|
+
*
|
|
241
|
+
* Extracts features that characterize HOW someone speaks (prosody, vocal physiology)
|
|
242
|
+
* rather than WHAT they say (phonetic content). These features are stable across
|
|
243
|
+
* different utterances from the same speaker.
|
|
244
|
+
*
|
|
245
|
+
* Output: 44 values
|
|
246
|
+
* F0 statistics (5) + F0 delta (4) + jitter (4) + shimmer (4) +
|
|
247
|
+
* HNR statistics (5) + formant ratios (8) + LTAS (8) + voicing ratio (1) +
|
|
248
|
+
* amplitude statistics (5)
|
|
249
|
+
*/
|
|
250
|
+
|
|
251
|
+
declare const SPEAKER_FEATURE_COUNT = 44;
|
|
252
|
+
/**
|
|
253
|
+
* Extract speaker-dependent audio features.
|
|
254
|
+
*
|
|
255
|
+
* Captures physiological vocal characteristics (F0, jitter, shimmer, HNR, formant
|
|
256
|
+
* ratios) that are stable across different utterances from the same speaker.
|
|
257
|
+
* Content-independent by design — different phrases produce similar feature values.
|
|
258
|
+
*
|
|
259
|
+
* Returns 44 values.
|
|
260
|
+
*/
|
|
261
|
+
declare function extractSpeakerFeatures(audio: AudioCapture): Promise<number[]>;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Extract kinematic features from motion (IMU) data.
|
|
265
|
+
* Computes jerk (3rd derivative) and jounce (4th derivative) of acceleration,
|
|
266
|
+
* then condenses each axis into statistics.
|
|
267
|
+
*
|
|
268
|
+
* Returns: ~54 values (6 axes × 2 derivatives × 4 stats + 6 jitter variance values)
|
|
269
|
+
*/
|
|
270
|
+
declare function extractMotionFeatures(samples: MotionSample[]): number[];
|
|
271
|
+
/**
|
|
272
|
+
* Extract kinematic features from touch data.
|
|
273
|
+
* Computes velocity and acceleration of touch coordinates,
|
|
274
|
+
* plus pressure and area statistics.
|
|
275
|
+
*
|
|
276
|
+
* Returns: ~36 values (32 base + 4 jitter variance for x, y, pressure, area)
|
|
277
|
+
*/
|
|
278
|
+
declare function extractTouchFeatures(samples: TouchSample[]): number[];
|
|
279
|
+
/**
|
|
280
|
+
* Extract mouse dynamics features as a desktop replacement for motion sensor data.
|
|
281
|
+
* Captures behavioral patterns from mouse/pointer movement that are user-specific:
|
|
282
|
+
* path curvature, speed patterns, micro-corrections, pause behavior.
|
|
283
|
+
*
|
|
284
|
+
* Returns: 54 values (matches motion feature dimension for consistent SimHash input)
|
|
285
|
+
*/
|
|
286
|
+
declare function extractMouseDynamics(samples: TouchSample[]): number[];
|
|
287
|
+
|
|
238
288
|
/** Serialized proof ready for on-chain submission */
|
|
239
289
|
interface SolanaProof {
|
|
240
290
|
proofBytes: Uint8Array;
|
|
@@ -397,4 +447,4 @@ declare function generateLissajousSequence(count?: number): {
|
|
|
397
447
|
points: Point2D[];
|
|
398
448
|
}[];
|
|
399
449
|
|
|
400
|
-
export { type AudioCapture, type CaptureOptions, type CaptureStage, type CircuitInput, DEFAULT_CAPTURE_MS, DEFAULT_MIN_DISTANCE, DEFAULT_THRESHOLD, FINGERPRINT_BITS, type FeatureVector, type FusedFeatureVector, type IdentityState, type LissajousParams, MAX_CAPTURE_MS, MIN_CAPTURE_MS, type MotionSample, PROGRAM_IDS, type PackedFingerprint, type Point2D, type ProofResult, type PulseConfig, PulseSDK, PulseSession, type SensorData, type SolanaProof, type StageState, type StatsSummary, type StoredVerificationData, type SubmissionResult, type TBH, type TemporalFingerprint, type TouchSample, type VerificationResult, autocorrelation, bigintToBytes32, computeCommitment, condense, entropy, fetchIdentityState, fuseFeatures, generateLissajousPoints, generateLissajousSequence, generatePhrase, generatePhraseSequence, generateProof, generateSalt, generateSolanaProof, generateTBH, hammingDistance, kurtosis, loadVerificationData, mean, packBits, prepareCircuitInput, randomLissajousParams, serializeProof, simhash, skewness, storeVerificationData, submitViaRelayer, submitViaWallet, toBigEndian32, variance };
|
|
450
|
+
export { type AudioCapture, type CaptureOptions, type CaptureStage, type CircuitInput, DEFAULT_CAPTURE_MS, DEFAULT_MIN_DISTANCE, DEFAULT_THRESHOLD, FINGERPRINT_BITS, type FeatureVector, type FusedFeatureVector, type IdentityState, type LissajousParams, MAX_CAPTURE_MS, MIN_CAPTURE_MS, type MotionSample, PROGRAM_IDS, type PackedFingerprint, type Point2D, type ProofResult, type PulseConfig, PulseSDK, PulseSession, SPEAKER_FEATURE_COUNT, type SensorData, type SolanaProof, type StageState, type StatsSummary, type StoredVerificationData, type SubmissionResult, type TBH, type TemporalFingerprint, type TouchSample, type VerificationResult, autocorrelation, bigintToBytes32, computeCommitment, condense, entropy, extractMotionFeatures, extractMouseDynamics, extractSpeakerFeatures, extractTouchFeatures, fetchIdentityState, fuseFeatures, generateLissajousPoints, generateLissajousSequence, generatePhrase, generatePhraseSequence, generateProof, generateSalt, generateSolanaProof, generateTBH, hammingDistance, kurtosis, loadVerificationData, mean, packBits, prepareCircuitInput, randomLissajousParams, serializeProof, simhash, skewness, storeVerificationData, submitViaRelayer, submitViaWallet, toBigEndian32, variance };
|