@waaskey/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.cjs CHANGED
@@ -2300,10 +2300,12 @@ var PrimePool = class {
2300
2300
  this.core = core;
2301
2301
  this.store = options.store ?? new MemoryPrimeStore();
2302
2302
  this.targetSize = Math.max(1, options.targetSize ?? 2);
2303
+ this.autoRefill = options.autoRefill ?? false;
2303
2304
  }
2304
2305
  core;
2305
2306
  store;
2306
2307
  targetSize;
2308
+ autoRefill;
2307
2309
  /** Per-curve in-flight refill, so concurrent calls don't over-generate. */
2308
2310
  refilling = /* @__PURE__ */ new Map();
2309
2311
  /**
@@ -2324,13 +2326,14 @@ var PrimePool = class {
2324
2326
  }
2325
2327
  /**
2326
2328
  * Claim a prime for a keygen. Returns a cached one instantly when the pool is warm; otherwise
2327
- * generates one inline (the slow fallback) so keygen never fails on an empty pool. Either way it
2328
- * kicks off a background refill so the next wallet is instant.
2329
+ * generates one inline (the slow fallback) so keygen never fails on an empty pool. Refill the
2330
+ * pool for the next wallet via {@link ensure} at idle (or opt into `autoRefill` when the core
2331
+ * is worker-backed).
2329
2332
  */
2330
2333
  async take(curve) {
2331
2334
  const cached = await this.store.take(curve);
2332
2335
  const primes = cached ?? await this.core.pregeneratePrimes(curve);
2333
- void this.ensure(curve).catch(() => void 0);
2336
+ if (this.autoRefill) void this.ensure(curve).catch(() => void 0);
2334
2337
  return primes;
2335
2338
  }
2336
2339
  };