@palbase/web 7.3.1 → 7.3.3
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/{chunk-53TN7KYR.js → chunk-43BGZCNU.js} +16 -4
- package/dist/chunk-43BGZCNU.js.map +1 -0
- package/dist/{chunk-CBN3PWNL.js → chunk-IRPS637F.js} +2 -2
- package/dist/{chunk-RRHJV6YD.js → chunk-XF7NM6HF.js} +3 -3
- package/dist/{chunk-RRHJV6YD.js.map → chunk-XF7NM6HF.js.map} +1 -1
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/internal.cjs +16 -4
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.js +2 -2
- package/dist/next/client.cjs +16 -4
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +2 -2
- package/dist/next/index.cjs +16 -4
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.js +3 -3
- package/dist/next/proxy.js +2 -2
- package/dist/react/index.cjs +14 -2
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-53TN7KYR.js.map +0 -1
- /package/dist/{chunk-CBN3PWNL.js.map → chunk-IRPS637F.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -86,8 +86,20 @@ function leadingZeroBits(hash) {
|
|
|
86
86
|
}
|
|
87
87
|
return bits;
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
var MAX_POW_DIFFICULTY = 24;
|
|
90
|
+
function powBudget(difficulty) {
|
|
91
|
+
return 8 * 2 ** difficulty;
|
|
92
|
+
}
|
|
93
|
+
async function solvePowChallenge(challenge, maxIterations = powBudget(challenge.difficulty), signal) {
|
|
94
|
+
if (challenge.difficulty > MAX_POW_DIFFICULTY) {
|
|
95
|
+
throw new Error(
|
|
96
|
+
`proof-of-work: refusing difficulty ${challenge.difficulty}; this client attempts at most ${MAX_POW_DIFFICULTY}, which is the highest a Palbase stack issues`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
90
99
|
for (let nonce = 0; nonce < maxIterations; nonce++) {
|
|
100
|
+
if ((nonce & 1023) === 0 && signal?.aborted) {
|
|
101
|
+
throw new DOMException("proof-of-work solve aborted", "AbortError");
|
|
102
|
+
}
|
|
91
103
|
const digest = await crypto.subtle.digest("SHA-256", encoder.encode(challenge.prefix + nonce));
|
|
92
104
|
if (leadingZeroBits(new Uint8Array(digest)) >= challenge.difficulty) {
|
|
93
105
|
return {
|
|
@@ -7956,7 +7968,7 @@ function localStorageSessionStorage(key = DEFAULT_KEY) {
|
|
|
7956
7968
|
}
|
|
7957
7969
|
|
|
7958
7970
|
// src/version.ts
|
|
7959
|
-
var VERSION = "7.3.
|
|
7971
|
+
var VERSION = "7.3.3";
|
|
7960
7972
|
|
|
7961
7973
|
// src/internal.ts
|
|
7962
7974
|
function getRuntime() {
|