@iam-protocol/pulse-sdk 0.2.0 → 0.2.1
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 +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/challenge/lissajous.ts +29 -0
- package/src/challenge/phrase.ts +34 -1
- package/src/index.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -14111,6 +14111,28 @@ function generatePhrase(wordCount = 5) {
|
|
|
14111
14111
|
}
|
|
14112
14112
|
return words.join(" ");
|
|
14113
14113
|
}
|
|
14114
|
+
function generatePhraseSequence(count = 3, wordCount = 4) {
|
|
14115
|
+
const subsetSize = Math.floor(SYLLABLES.length / count);
|
|
14116
|
+
const phrases = [];
|
|
14117
|
+
for (let p = 0; p < count; p++) {
|
|
14118
|
+
const start = p * subsetSize % SYLLABLES.length;
|
|
14119
|
+
const subset = [
|
|
14120
|
+
...SYLLABLES.slice(start, start + subsetSize),
|
|
14121
|
+
...SYLLABLES.slice(0, Math.max(0, start + subsetSize - SYLLABLES.length))
|
|
14122
|
+
];
|
|
14123
|
+
const words = [];
|
|
14124
|
+
for (let w = 0; w < wordCount; w++) {
|
|
14125
|
+
const syllableCount = 2 + Math.floor(Math.random() * 2);
|
|
14126
|
+
let word = "";
|
|
14127
|
+
for (let s = 0; s < syllableCount; s++) {
|
|
14128
|
+
word += subset[Math.floor(Math.random() * subset.length)];
|
|
14129
|
+
}
|
|
14130
|
+
words.push(word);
|
|
14131
|
+
}
|
|
14132
|
+
phrases.push(words.join(" "));
|
|
14133
|
+
}
|
|
14134
|
+
return phrases;
|
|
14135
|
+
}
|
|
14114
14136
|
|
|
14115
14137
|
// src/challenge/lissajous.ts
|
|
14116
14138
|
function randomLissajousParams() {
|
|
@@ -14141,6 +14163,33 @@ function generateLissajousPoints(params) {
|
|
|
14141
14163
|
}
|
|
14142
14164
|
return result;
|
|
14143
14165
|
}
|
|
14166
|
+
function generateLissajousSequence(count = 2) {
|
|
14167
|
+
const allRatios = [
|
|
14168
|
+
[1, 2],
|
|
14169
|
+
[2, 3],
|
|
14170
|
+
[3, 4],
|
|
14171
|
+
[3, 5],
|
|
14172
|
+
[4, 5],
|
|
14173
|
+
[1, 3],
|
|
14174
|
+
[2, 5],
|
|
14175
|
+
[5, 6],
|
|
14176
|
+
[3, 7],
|
|
14177
|
+
[4, 7]
|
|
14178
|
+
];
|
|
14179
|
+
const shuffled = [...allRatios].sort(() => Math.random() - 0.5);
|
|
14180
|
+
const sequence = [];
|
|
14181
|
+
for (let i = 0; i < count; i++) {
|
|
14182
|
+
const pair = shuffled[i % shuffled.length];
|
|
14183
|
+
const params = {
|
|
14184
|
+
a: pair[0],
|
|
14185
|
+
b: pair[1],
|
|
14186
|
+
delta: Math.PI * (0.1 + Math.random() * 0.8),
|
|
14187
|
+
points: 200
|
|
14188
|
+
};
|
|
14189
|
+
sequence.push({ params, points: generateLissajousPoints(params) });
|
|
14190
|
+
}
|
|
14191
|
+
return sequence;
|
|
14192
|
+
}
|
|
14144
14193
|
export {
|
|
14145
14194
|
DEFAULT_CAPTURE_MS,
|
|
14146
14195
|
DEFAULT_MIN_DISTANCE,
|
|
@@ -14159,7 +14208,9 @@ export {
|
|
|
14159
14208
|
fetchIdentityState,
|
|
14160
14209
|
fuseFeatures,
|
|
14161
14210
|
generateLissajousPoints,
|
|
14211
|
+
generateLissajousSequence,
|
|
14162
14212
|
generatePhrase,
|
|
14213
|
+
generatePhraseSequence,
|
|
14163
14214
|
generateProof,
|
|
14164
14215
|
generateSalt,
|
|
14165
14216
|
generateSolanaProof,
|