@palbase/web 7.3.3 → 7.3.4
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-IRPS637F.js → chunk-IVD6BP5Z.js} +2 -2
- package/dist/{chunk-XF7NM6HF.js → chunk-PYJ3CMA2.js} +3 -3
- package/dist/{chunk-XF7NM6HF.js.map → chunk-PYJ3CMA2.js.map} +1 -1
- package/dist/{chunk-43BGZCNU.js → chunk-RAP37ILS.js} +13 -3
- package/dist/chunk-RAP37ILS.js.map +1 -0
- package/dist/index.cjs +13 -3
- 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 +13 -3
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.js +2 -2
- package/dist/next/client.cjs +13 -3
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +2 -2
- package/dist/next/index.cjs +13 -3
- 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 +13 -3
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-43BGZCNU.js.map +0 -1
- /package/dist/{chunk-IRPS637F.js.map → chunk-IVD6BP5Z.js.map} +0 -0
package/dist/next/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
importNextServer
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-IVD6BP5Z.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_COOKIE_ATTRS,
|
|
6
6
|
clearedSessionCookieNames,
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
buildRuntime,
|
|
15
15
|
createBoundClient,
|
|
16
16
|
getRuntime
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-PYJ3CMA2.js";
|
|
18
18
|
import {
|
|
19
19
|
BackendError
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-RAP37ILS.js";
|
|
21
21
|
import {
|
|
22
22
|
environmentRefFromApiKey,
|
|
23
23
|
environmentRefFromPublishableApiKey
|
package/dist/next/proxy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
importNextServer
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-IVD6BP5Z.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_COOKIE_ATTRS,
|
|
6
6
|
clearedSessionCookieNames,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "../chunk-6VGKMNXO.js";
|
|
10
10
|
import {
|
|
11
11
|
BackendError
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-RAP37ILS.js";
|
|
13
13
|
import {
|
|
14
14
|
environmentRefFromPublishableApiKey
|
|
15
15
|
} from "../chunk-CFDU23TB.js";
|
package/dist/react/index.cjs
CHANGED
|
@@ -63,6 +63,7 @@ function asPowChallenge(details) {
|
|
|
63
63
|
return { id, prefix, difficulty };
|
|
64
64
|
}
|
|
65
65
|
var encoder = new TextEncoder();
|
|
66
|
+
var now = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
66
67
|
function leadingZeroBits(hash) {
|
|
67
68
|
let bits = 0;
|
|
68
69
|
for (const byte of hash) {
|
|
@@ -78,15 +79,24 @@ var MAX_POW_DIFFICULTY = 24;
|
|
|
78
79
|
function powBudget(difficulty) {
|
|
79
80
|
return 8 * 2 ** difficulty;
|
|
80
81
|
}
|
|
82
|
+
var POW_DEADLINE_MS = 12e4;
|
|
81
83
|
async function solvePowChallenge(challenge, maxIterations = powBudget(challenge.difficulty), signal) {
|
|
82
84
|
if (challenge.difficulty > MAX_POW_DIFFICULTY) {
|
|
83
85
|
throw new Error(
|
|
84
86
|
`proof-of-work: refusing difficulty ${challenge.difficulty}; this client attempts at most ${MAX_POW_DIFFICULTY}, which is the highest a Palbase stack issues`
|
|
85
87
|
);
|
|
86
88
|
}
|
|
89
|
+
const deadline = now() + POW_DEADLINE_MS;
|
|
87
90
|
for (let nonce = 0; nonce < maxIterations; nonce++) {
|
|
88
|
-
if ((nonce & 1023) === 0
|
|
89
|
-
|
|
91
|
+
if ((nonce & 1023) === 0) {
|
|
92
|
+
if (signal?.aborted) {
|
|
93
|
+
throw new DOMException("proof-of-work solve aborted", "AbortError");
|
|
94
|
+
}
|
|
95
|
+
if (now() > deadline) {
|
|
96
|
+
throw new Error(
|
|
97
|
+
`proof-of-work: gave up after ${POW_DEADLINE_MS / 1e3}s at difficulty ${challenge.difficulty} (${nonce} attempts)`
|
|
98
|
+
);
|
|
99
|
+
}
|
|
90
100
|
}
|
|
91
101
|
const digest = await crypto.subtle.digest("SHA-256", encoder.encode(challenge.prefix + nonce));
|
|
92
102
|
if (leadingZeroBits(new Uint8Array(digest)) >= challenge.difficulty) {
|
|
@@ -414,7 +424,7 @@ function applyBrowserOriginHeader(headers) {
|
|
|
414
424
|
}
|
|
415
425
|
|
|
416
426
|
// src/version.ts
|
|
417
|
-
var VERSION = "7.3.
|
|
427
|
+
var VERSION = "7.3.4";
|
|
418
428
|
|
|
419
429
|
// src/call.ts
|
|
420
430
|
async function callEndpoint(resolveRt, name, input, options) {
|