altcha-lib 1.1.0 → 1.2.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/cjs/dist/index.js CHANGED
@@ -196,7 +196,7 @@ function solveChallenge(challenge, salt, algorithm = 'SHA-256', max = 1e6, start
196
196
  */
197
197
  async function solveChallengeWorkers(workerScript, concurrency, challenge, salt, algorithm = 'SHA-256', max = 1e6, startNumber = 0) {
198
198
  const workers = [];
199
- concurrency = Math.min(1, Math.max(16, concurrency));
199
+ concurrency = Math.max(1, Math.min(16, concurrency));
200
200
  for (let i = 0; i < concurrency; i++) {
201
201
  if (typeof workerScript === 'function') {
202
202
  workers.push(workerScript());
@@ -9,8 +9,8 @@ onmessage = async (message) => {
9
9
  controller = undefined;
10
10
  }
11
11
  else if (type === 'work') {
12
- const { alg, challenge, max, salt, start } = payload || {};
13
- const result = (0, index_js_1.solveChallenge)(challenge, salt, alg, max, start);
12
+ const { algorithm, challenge, max, salt, start } = payload || {};
13
+ const result = (0, index_js_1.solveChallenge)(challenge, salt, algorithm, max, start);
14
14
  controller = result.controller;
15
15
  result.promise.then((solution) => {
16
16
  self.postMessage(solution ? { ...solution, worker: true } : solution);
package/dist/index.js CHANGED
@@ -187,7 +187,7 @@ export function solveChallenge(challenge, salt, algorithm = 'SHA-256', max = 1e6
187
187
  */
188
188
  export async function solveChallengeWorkers(workerScript, concurrency, challenge, salt, algorithm = 'SHA-256', max = 1e6, startNumber = 0) {
189
189
  const workers = [];
190
- concurrency = Math.min(1, Math.max(16, concurrency));
190
+ concurrency = Math.max(1, Math.min(16, concurrency));
191
191
  for (let i = 0; i < concurrency; i++) {
192
192
  if (typeof workerScript === 'function') {
193
193
  workers.push(workerScript());
package/dist/worker.js CHANGED
@@ -7,8 +7,8 @@ onmessage = async (message) => {
7
7
  controller = undefined;
8
8
  }
9
9
  else if (type === 'work') {
10
- const { alg, challenge, max, salt, start } = payload || {};
11
- const result = solveChallenge(challenge, salt, alg, max, start);
10
+ const { algorithm, challenge, max, salt, start } = payload || {};
11
+ const result = solveChallenge(challenge, salt, algorithm, max, start);
12
12
  controller = result.controller;
13
13
  result.promise.then((solution) => {
14
14
  self.postMessage(solution ? { ...solution, worker: true } : solution);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "altcha-lib",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "A library for creating and verifying ALTCHA challenges for Node.js, Bun and Deno.",
5
5
  "author": {
6
6
  "name": "Daniel Regeci",