@palbase/web 7.3.1 → 7.3.2

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.cts CHANGED
@@ -206,6 +206,6 @@ interface MlsGlue {
206
206
  */
207
207
  declare function initMls(): Promise<MlsGlue>;
208
208
 
209
- declare const VERSION = "7.3.1";
209
+ declare const VERSION = "7.3.2";
210
210
 
211
211
  export { VERSION, initMls };
package/dist/index.d.ts CHANGED
@@ -206,6 +206,6 @@ interface MlsGlue {
206
206
  */
207
207
  declare function initMls(): Promise<MlsGlue>;
208
208
 
209
- declare const VERSION = "7.3.1";
209
+ declare const VERSION = "7.3.2";
210
210
 
211
211
  export { VERSION, initMls };
package/dist/index.js CHANGED
@@ -11,11 +11,11 @@ import {
11
11
  localStorageSessionStorage,
12
12
  memorySessionStorage,
13
13
  pb
14
- } from "./chunk-RRHJV6YD.js";
14
+ } from "./chunk-TQAQR3OP.js";
15
15
  import {
16
16
  BackendError,
17
17
  isBackendError
18
- } from "./chunk-53TN7KYR.js";
18
+ } from "./chunk-HKZVA3I3.js";
19
19
  import "./chunk-CFDU23TB.js";
20
20
  import "./chunk-PZ5AY32C.js";
21
21
  export {
package/dist/internal.cjs CHANGED
@@ -79,7 +79,16 @@ function leadingZeroBits(hash) {
79
79
  }
80
80
  return bits;
81
81
  }
82
- async function solvePowChallenge(challenge, maxIterations = 1 << 24) {
82
+ var MAX_POW_DIFFICULTY = 24;
83
+ function powBudget(difficulty) {
84
+ return 8 * 2 ** difficulty;
85
+ }
86
+ async function solvePowChallenge(challenge, maxIterations = powBudget(challenge.difficulty)) {
87
+ if (challenge.difficulty > MAX_POW_DIFFICULTY) {
88
+ throw new Error(
89
+ `proof-of-work: refusing difficulty ${challenge.difficulty}; this client attempts at most ${MAX_POW_DIFFICULTY}, which is the highest a Palbase stack issues`
90
+ );
91
+ }
83
92
  for (let nonce = 0; nonce < maxIterations; nonce++) {
84
93
  const digest = await crypto.subtle.digest("SHA-256", encoder.encode(challenge.prefix + nonce));
85
94
  if (leadingZeroBits(new Uint8Array(digest)) >= challenge.difficulty) {
@@ -9355,7 +9364,7 @@ function defaultSessionStorage(key) {
9355
9364
  }
9356
9365
 
9357
9366
  // src/version.ts
9358
- var VERSION = "7.3.1";
9367
+ var VERSION = "7.3.2";
9359
9368
 
9360
9369
  // src/runtime.ts
9361
9370
  function buildRuntime(config) {