@prosopo/procaptcha-frictionless 2.12.23 → 2.13.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/.turbo/turbo-build$colon$cjs.log +10 -12
- package/.turbo/turbo-build$colon$tsc.log +24 -27
- package/.turbo/turbo-build.log +11 -13
- package/CHANGELOG.md +36 -0
- package/dist/cjs/customDetectBot.cjs +39 -8
- package/dist/cjs/detectorLoader.cjs +18 -2
- package/dist/customDetectBot.d.ts.map +1 -1
- package/dist/customDetectBot.js +40 -9
- package/dist/customDetectBot.js.map +1 -1
- package/dist/detectorLoader.d.ts +30 -3
- package/dist/detectorLoader.d.ts.map +1 -1
- package/dist/detectorLoader.js +18 -2
- package/dist/detectorLoader.js.map +1 -1
- package/dist/tests/customDetectBotSimd.test.js +10 -1
- package/dist/tests/customDetectBotSimd.test.js.map +1 -1
- package/package.json +9 -10
- package/src/customDetectBot.ts +113 -54
- package/src/detectorLoader.ts +65 -3
- package/src/tests/customDetectBotSimd.test.ts +11 -1
- package/tsconfig.cjs.json +0 -3
- package/tsconfig.json +0 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.13.0 build:cjs
|
|
3
3
|
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
4
|
|
|
5
5
|
ViteCommonJSConfig: .
|
|
6
6
|
{
|
|
7
7
|
tsConfigPaths: [
|
|
8
|
-
'/home/runner/work/captcha/captcha/packages/detector/tsconfig.json',
|
|
9
|
-
'/home/runner/work/captcha/captcha/packages/types/tsconfig.json',
|
|
10
8
|
'/home/runner/work/captcha/captcha/packages/locale/tsconfig.json',
|
|
11
|
-
'/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
|
|
12
|
-
'/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
|
|
13
9
|
'/home/runner/work/captcha/captcha/packages/procaptcha-pow/tsconfig.json',
|
|
14
10
|
'/home/runner/work/captcha/captcha/packages/api/tsconfig.json',
|
|
11
|
+
'/home/runner/work/captcha/captcha/packages/types/tsconfig.json',
|
|
12
|
+
'/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
|
|
13
|
+
'/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
|
|
15
14
|
'/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
|
|
16
15
|
'/home/runner/work/captcha/captcha/packages/logger/tsconfig.json',
|
|
17
16
|
'/home/runner/work/captcha/captcha/packages/fingerprint/tsconfig.json',
|
|
@@ -29,13 +28,12 @@ ViteCommonJSConfig: .
|
|
|
29
28
|
}
|
|
30
29
|
{
|
|
31
30
|
externals: [
|
|
32
|
-
'@prosopo/detector',
|
|
33
|
-
'@prosopo/types',
|
|
34
31
|
'@prosopo/locale',
|
|
35
|
-
'@prosopo/util',
|
|
36
|
-
'@prosopo/util-crypto',
|
|
37
32
|
'@prosopo/procaptcha-pow',
|
|
38
33
|
'@prosopo/api',
|
|
34
|
+
'@prosopo/types',
|
|
35
|
+
'@prosopo/util',
|
|
36
|
+
'@prosopo/util-crypto',
|
|
39
37
|
'@prosopo/common',
|
|
40
38
|
'@prosopo/logger',
|
|
41
39
|
'@prosopo/fingerprint',
|
|
@@ -58,10 +56,10 @@ Bundle build started
|
|
|
58
56
|
✓ 6 modules transformed.
|
|
59
57
|
rendering chunks...
|
|
60
58
|
computing gzip size...
|
|
61
|
-
dist/cjs/detectorLoader.cjs 0.16 kB │ gzip: 0.12 kB
|
|
62
59
|
dist/cjs/index.cjs 0.24 kB │ gzip: 0.15 kB
|
|
60
|
+
dist/cjs/detectorLoader.cjs 0.62 kB │ gzip: 0.40 kB
|
|
63
61
|
dist/cjs/sessionInvalidatedRecovery.cjs 2.07 kB │ gzip: 0.99 kB
|
|
64
|
-
dist/cjs/customDetectBot.cjs
|
|
62
|
+
dist/cjs/customDetectBot.cjs 5.06 kB │ gzip: 1.58 kB
|
|
65
63
|
dist/cjs/ProcaptchaFrictionless.cjs 7.00 kB │ gzip: 2.02 kB
|
|
66
64
|
|
|
67
|
-
[32m✓ built in
|
|
65
|
+
[32m✓ built in 59ms[39m
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.13.0 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
11:10:41 AM - Projects in this build:
|
|
6
6
|
* ../../dev/config/tsconfig.json
|
|
7
7
|
* ../locale/tsconfig.json
|
|
8
8
|
* ../util/tsconfig.json
|
|
9
9
|
* ../util-crypto/tsconfig.json
|
|
10
10
|
* ../types/tsconfig.json
|
|
11
|
-
* ../detector/tsconfig.json
|
|
12
11
|
* ../api/tsconfig.json
|
|
13
12
|
* ../logger/tsconfig.json
|
|
14
13
|
* ../common/tsconfig.json
|
|
@@ -26,49 +25,47 @@
|
|
|
26
25
|
* ../procaptcha-react/tsconfig.json
|
|
27
26
|
* tsconfig.json
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
11:10:41 AM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/webpack/webpack.config.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
11:10:41 AM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
11:10:41 AM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
11:10:41 AM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/tsconfig.tsbuildinfo'
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
11:10:41 AM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/types.test-d.ts' is older than output '../types/tsconfig.tsbuildinfo'
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
11:10:41 AM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
11:10:41 AM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
11:10:41 AM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/tests/utils/batches.unit.test.ts' is older than output '../common/tsconfig.tsbuildinfo'
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
11:10:41 AM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
11:10:41 AM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
11:10:41 AM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/tests/providers.unit.test.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
11:10:41 AM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/webComponent/createWidget.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
11:10:41 AM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/index.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
11:10:41 AM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/workers/cryptoWorker.ts' is older than output '../account/tsconfig.tsbuildinfo'
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
11:10:41 AM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/extensionLoader.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
11:10:41 AM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/tests/managerHarness.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
11:10:41 AM - Project '../procaptcha-puzzle/tsconfig.json' is up to date because newest input '../procaptcha-puzzle/src/tests/managerHarness.ts' is older than output '../procaptcha-puzzle/tsconfig.tsbuildinfo'
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
11:10:41 AM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/index.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
11:10:41 AM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/Manager.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
11:10:42 AM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/index.ts' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
11:10:42 AM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
12:36:54 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
|
|
70
|
+
11:10:42 AM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
|
|
74
71
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.13.0 build
|
|
3
3
|
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @prosopo/procaptcha-frictionless@2.
|
|
6
|
+
> @prosopo/procaptcha-frictionless@2.13.0 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
10
10
|
{
|
|
11
11
|
tsConfigPaths: [
|
|
12
|
-
'/home/runner/work/captcha/captcha/packages/detector/tsconfig.json',
|
|
13
|
-
'/home/runner/work/captcha/captcha/packages/types/tsconfig.json',
|
|
14
12
|
'/home/runner/work/captcha/captcha/packages/locale/tsconfig.json',
|
|
15
|
-
'/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
|
|
16
|
-
'/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
|
|
17
13
|
'/home/runner/work/captcha/captcha/packages/procaptcha-pow/tsconfig.json',
|
|
18
14
|
'/home/runner/work/captcha/captcha/packages/api/tsconfig.json',
|
|
15
|
+
'/home/runner/work/captcha/captcha/packages/types/tsconfig.json',
|
|
16
|
+
'/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
|
|
17
|
+
'/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
|
|
19
18
|
'/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
|
|
20
19
|
'/home/runner/work/captcha/captcha/packages/logger/tsconfig.json',
|
|
21
20
|
'/home/runner/work/captcha/captcha/packages/fingerprint/tsconfig.json',
|
|
@@ -33,13 +32,12 @@ ViteEsmConfig: .
|
|
|
33
32
|
}
|
|
34
33
|
{
|
|
35
34
|
externals: [
|
|
36
|
-
'@prosopo/detector',
|
|
37
|
-
'@prosopo/types',
|
|
38
35
|
'@prosopo/locale',
|
|
39
|
-
'@prosopo/util',
|
|
40
|
-
'@prosopo/util-crypto',
|
|
41
36
|
'@prosopo/procaptcha-pow',
|
|
42
37
|
'@prosopo/api',
|
|
38
|
+
'@prosopo/types',
|
|
39
|
+
'@prosopo/util',
|
|
40
|
+
'@prosopo/util-crypto',
|
|
43
41
|
'@prosopo/common',
|
|
44
42
|
'@prosopo/logger',
|
|
45
43
|
'@prosopo/fingerprint',
|
|
@@ -64,9 +62,9 @@ rendering chunks...
|
|
|
64
62
|
computing gzip size...
|
|
65
63
|
dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
66
64
|
dist/index.js 0.14 kB │ gzip: 0.10 kB
|
|
67
|
-
dist/detectorLoader.js 0.
|
|
65
|
+
dist/detectorLoader.js 0.60 kB │ gzip: 0.39 kB
|
|
68
66
|
dist/sessionInvalidatedRecovery.js 2.01 kB │ gzip: 0.98 kB
|
|
69
|
-
dist/customDetectBot.js
|
|
67
|
+
dist/customDetectBot.js 4.92 kB │ gzip: 1.55 kB
|
|
70
68
|
dist/ProcaptchaFrictionless.js 6.49 kB │ gzip: 1.97 kB
|
|
71
69
|
|
|
72
|
-
[32m✓ built in
|
|
70
|
+
[32m✓ built in 47ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @prosopo/procaptcha-frictionless
|
|
2
2
|
|
|
3
|
+
## 2.13.0
|
|
4
|
+
### Minor Changes
|
|
5
|
+
|
|
6
|
+
- 787017b: feat(detector): serve the detector only from per-session provider bundles; PoW fallback
|
|
7
|
+
|
|
8
|
+
The detector now lives ONLY in the provider-served, precomputed pool bundles — there is no detector bundled into the widget and no legacy detector-key pool. Each session's bundle encrypts everything it produces (bot score, SIMD readings, behavioural data) with its own RSA keypair + inner ChaCha20-Poly1305 cipher; the provider decrypts each payload with that exact bundle, resolved per session.
|
|
9
|
+
|
|
10
|
+
- `DetectorBundlePool`: loads precomputed `{id}.js`/`{id}.json` bundle pairs from disk, uniform-random per-session selection, hot-swap `replace()` for the admin push channel.
|
|
11
|
+
- The pool is ALWAYS initialised at boot (a missing/empty dir yields an empty pool), collapsing the old three states into two: bundles present ⇒ per-session serving; no bundles ⇒ always PoW.
|
|
12
|
+
- Redis short-TTL `detectorSessionId → bundleId` binding; the resolved `bundleId` is promoted onto the durable session record so later hops (SIMD attach, PoW/puzzle/image solution submit) decrypt with the same bundle.
|
|
13
|
+
- Client: removed the inlined `@prosopo/detector` runtime import (now type-only). When no provider bundle can be obtained/run, the client signals `detectorUnavailable` and the provider serves a PoW challenge.
|
|
14
|
+
- All server decrypt paths (score, SIMD readings, behavioural data) resolve the session's bundle and pass its inner cipher; the legacy key-pool brute force and its env fallback are removed from the detection paths. Decrypt failures fail closed (treated as bot ⇒ PoW).
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [787017b]
|
|
19
|
+
- Updated dependencies [787017b]
|
|
20
|
+
- Updated dependencies [787017b]
|
|
21
|
+
- Updated dependencies [6f19cde]
|
|
22
|
+
- Updated dependencies [2bc8e73]
|
|
23
|
+
- @prosopo/types@5.0.0
|
|
24
|
+
- @prosopo/api@4.0.0
|
|
25
|
+
- @prosopo/widget-skeleton@2.8.5
|
|
26
|
+
- @prosopo/procaptcha-common@2.11.20
|
|
27
|
+
- @prosopo/procaptcha-pow@2.10.27
|
|
28
|
+
- @prosopo/procaptcha-puzzle@2.10.43
|
|
29
|
+
- @prosopo/procaptcha-react@2.9.100
|
|
30
|
+
|
|
31
|
+
## 2.12.24
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- @prosopo/procaptcha-common@2.11.19
|
|
35
|
+
- @prosopo/procaptcha-pow@2.10.26
|
|
36
|
+
- @prosopo/procaptcha-puzzle@2.10.42
|
|
37
|
+
- @prosopo/procaptcha-react@2.9.99
|
|
38
|
+
|
|
3
39
|
## 2.12.23
|
|
4
40
|
### Patch Changes
|
|
5
41
|
|
|
@@ -3,6 +3,7 @@ let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
|
|
|
3
3
|
let _prosopo_api = require("@prosopo/api");
|
|
4
4
|
let _prosopo_common = require("@prosopo/common");
|
|
5
5
|
//#region src/customDetectBot.ts
|
|
6
|
+
var ASSIGN_TIMEOUT_MS = 2e3;
|
|
6
7
|
var sanitiseHref = (href) => {
|
|
7
8
|
try {
|
|
8
9
|
const u = new URL(href);
|
|
@@ -63,18 +64,48 @@ var withTimeout = async (promise, ms) => {
|
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
66
|
var customDetectBot = async (config, container, restartFn, retryContext) => {
|
|
66
|
-
const ipMode = (0, _prosopo_procaptcha_common.pickIpMode)(config);
|
|
67
|
-
(0, _prosopo_procaptcha_common.getProcaptchaRandomActiveProvider)(config.defaultEnvironment).catch(() => void 0);
|
|
68
|
-
if (ipMode !== void 0) (0, _prosopo_procaptcha_common.getProcaptchaRandomActiveProvider)(config.defaultEnvironment, ipMode, retryContext).catch(() => void 0);
|
|
69
|
-
const [ExtClass, detect] = await Promise.all([(0, _prosopo_procaptcha_common.ExtensionLoader)(config.web2), require_detectorLoader.DetectorLoader()]);
|
|
70
|
-
const ext = new ExtClass();
|
|
71
|
-
const detectionResult = await detect(config.defaultEnvironment, async () => (0, _prosopo_procaptcha_common.getProcaptchaRandomActiveProvider)(config.defaultEnvironment), container, restartFn, () => ext.getAccount(config));
|
|
72
|
-
const userAccount = detectionResult.userAccount;
|
|
73
67
|
if (!config.account.address) throw new _prosopo_common.ProsopoEnvError("GENERAL.SITE_KEY_MISSING");
|
|
68
|
+
const ipMode = (0, _prosopo_procaptcha_common.pickIpMode)(config);
|
|
69
|
+
const extClassPromise = (0, _prosopo_procaptcha_common.ExtensionLoader)(config.web2);
|
|
74
70
|
const provider = await (0, _prosopo_procaptcha_common.getProcaptchaRandomActiveProvider)(config.defaultEnvironment, ipMode, retryContext);
|
|
75
71
|
const providerApi = new _prosopo_api.ProviderApi(provider.provider.url, config.account.address);
|
|
72
|
+
let detectorSessionId;
|
|
73
|
+
let providerDetect;
|
|
74
|
+
try {
|
|
75
|
+
const assigned = await withTimeout(providerApi.assignDetectorBundle(config.account.address), ASSIGN_TIMEOUT_MS);
|
|
76
|
+
if (assigned.useProviderBundle && assigned.detectorScript) {
|
|
77
|
+
detectorSessionId = assigned.detectorSessionId;
|
|
78
|
+
providerDetect = await withTimeout(require_detectorLoader.DetectorLoaderFromScript(assigned.detectorScript), ASSIGN_TIMEOUT_MS);
|
|
79
|
+
}
|
|
80
|
+
} catch {}
|
|
81
|
+
const ext = new (await extClassPromise)();
|
|
82
|
+
if (providerDetect === void 0) {
|
|
83
|
+
const userAccount = await ext.getAccount(config);
|
|
84
|
+
const { currentUrl: fallbackUrl, iframeUrl: fallbackIframeUrl } = getCurrentPageUrls();
|
|
85
|
+
const powCaptcha = await withTimeout(providerApi.getFrictionlessCaptcha(void 0, void 0, config.account.address, userAccount.account.address, config.mode, void 0, void 0, true, fallbackUrl, fallbackIframeUrl), 1e4);
|
|
86
|
+
if (powCaptcha.dns_url) try {
|
|
87
|
+
fetch(powCaptcha.dns_url, {
|
|
88
|
+
method: "GET",
|
|
89
|
+
mode: "no-cors",
|
|
90
|
+
credentials: "omit",
|
|
91
|
+
keepalive: true,
|
|
92
|
+
cache: "no-store"
|
|
93
|
+
}).catch(() => void 0);
|
|
94
|
+
} catch {}
|
|
95
|
+
return {
|
|
96
|
+
captchaType: powCaptcha.captchaType,
|
|
97
|
+
sessionId: powCaptcha.sessionId,
|
|
98
|
+
provider,
|
|
99
|
+
status: powCaptcha.status,
|
|
100
|
+
userAccount,
|
|
101
|
+
error: powCaptcha.error,
|
|
102
|
+
hp: powCaptcha.hp
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const detectionResult = await providerDetect(container, restartFn, () => ext.getAccount(config));
|
|
106
|
+
const userAccount = detectionResult.userAccount;
|
|
76
107
|
const { currentUrl, iframeUrl } = getCurrentPageUrls();
|
|
77
|
-
const captchaPromise = providerApi.getFrictionlessCaptcha(detectionResult.token, detectionResult.encryptHeadHash, config.account.address, userAccount.account.address, config.mode, void 0, currentUrl, iframeUrl);
|
|
108
|
+
const captchaPromise = providerApi.getFrictionlessCaptcha(detectionResult.token, detectionResult.encryptHeadHash, config.account.address, userAccount.account.address, config.mode, void 0, detectorSessionId, void 0, currentUrl, iframeUrl);
|
|
78
109
|
if (detectionResult.getSimdReadings) detectionResult.getSimdReadings(6e4).catch(() => void 0);
|
|
79
110
|
const captcha = await withTimeout(captchaPromise, 1e4);
|
|
80
111
|
if (captcha.dns_url) try {
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
//#region src/detectorLoader.ts
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Loads a detector from a provider-served obfuscated ESM string (the per-session
|
|
4
|
+
* pool bundle). Evaluated via a blob URL — the served module is self-contained
|
|
5
|
+
* (no imports), so dynamic `import()` of the blob yields its default export.
|
|
6
|
+
*/
|
|
7
|
+
var DetectorLoaderFromScript = async (script) => {
|
|
8
|
+
const blob = new Blob([script], { type: "text/javascript" });
|
|
9
|
+
const url = URL.createObjectURL(blob);
|
|
10
|
+
try {
|
|
11
|
+
return (await import(
|
|
12
|
+
/* @vite-ignore */
|
|
13
|
+
url
|
|
14
|
+
)).default;
|
|
15
|
+
} finally {
|
|
16
|
+
URL.revokeObjectURL(url);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
3
19
|
//#endregion
|
|
4
|
-
exports.
|
|
20
|
+
exports.DetectorLoaderFromScript = DetectorLoaderFromScript;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACX,oBAAoB,EAGpB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACX,oBAAoB,EAGpB,MAAM,gBAAgB,CAAC;AAoFxB,eAAO,MAAM,WAAW,GAAU,CAAC,WACzB,OAAO,CAAC,CAAC,CAAC,MACf,MAAM,KACR,OAAO,CAAC,CAAC,CAoBX,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,oBA2LtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/customDetectBot.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DetectorLoaderFromScript } from "./detectorLoader.js";
|
|
2
2
|
import { ExtensionLoader, getProcaptchaRandomActiveProvider, pickIpMode } from "@prosopo/procaptcha-common";
|
|
3
3
|
import { ProviderApi } from "@prosopo/api";
|
|
4
4
|
import { ProsopoEnvError } from "@prosopo/common";
|
|
5
5
|
//#region src/customDetectBot.ts
|
|
6
|
+
var ASSIGN_TIMEOUT_MS = 2e3;
|
|
6
7
|
var sanitiseHref = (href) => {
|
|
7
8
|
try {
|
|
8
9
|
const u = new URL(href);
|
|
@@ -63,18 +64,48 @@ var withTimeout = async (promise, ms) => {
|
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
66
|
var customDetectBot = async (config, container, restartFn, retryContext) => {
|
|
66
|
-
const ipMode = pickIpMode(config);
|
|
67
|
-
getProcaptchaRandomActiveProvider(config.defaultEnvironment).catch(() => void 0);
|
|
68
|
-
if (ipMode !== void 0) getProcaptchaRandomActiveProvider(config.defaultEnvironment, ipMode, retryContext).catch(() => void 0);
|
|
69
|
-
const [ExtClass, detect] = await Promise.all([ExtensionLoader(config.web2), DetectorLoader()]);
|
|
70
|
-
const ext = new ExtClass();
|
|
71
|
-
const detectionResult = await detect(config.defaultEnvironment, async () => getProcaptchaRandomActiveProvider(config.defaultEnvironment), container, restartFn, () => ext.getAccount(config));
|
|
72
|
-
const userAccount = detectionResult.userAccount;
|
|
73
67
|
if (!config.account.address) throw new ProsopoEnvError("GENERAL.SITE_KEY_MISSING");
|
|
68
|
+
const ipMode = pickIpMode(config);
|
|
69
|
+
const extClassPromise = ExtensionLoader(config.web2);
|
|
74
70
|
const provider = await getProcaptchaRandomActiveProvider(config.defaultEnvironment, ipMode, retryContext);
|
|
75
71
|
const providerApi = new ProviderApi(provider.provider.url, config.account.address);
|
|
72
|
+
let detectorSessionId;
|
|
73
|
+
let providerDetect;
|
|
74
|
+
try {
|
|
75
|
+
const assigned = await withTimeout(providerApi.assignDetectorBundle(config.account.address), ASSIGN_TIMEOUT_MS);
|
|
76
|
+
if (assigned.useProviderBundle && assigned.detectorScript) {
|
|
77
|
+
detectorSessionId = assigned.detectorSessionId;
|
|
78
|
+
providerDetect = await withTimeout(DetectorLoaderFromScript(assigned.detectorScript), ASSIGN_TIMEOUT_MS);
|
|
79
|
+
}
|
|
80
|
+
} catch {}
|
|
81
|
+
const ext = new (await extClassPromise)();
|
|
82
|
+
if (providerDetect === void 0) {
|
|
83
|
+
const userAccount = await ext.getAccount(config);
|
|
84
|
+
const { currentUrl: fallbackUrl, iframeUrl: fallbackIframeUrl } = getCurrentPageUrls();
|
|
85
|
+
const powCaptcha = await withTimeout(providerApi.getFrictionlessCaptcha(void 0, void 0, config.account.address, userAccount.account.address, config.mode, void 0, void 0, true, fallbackUrl, fallbackIframeUrl), 1e4);
|
|
86
|
+
if (powCaptcha.dns_url) try {
|
|
87
|
+
fetch(powCaptcha.dns_url, {
|
|
88
|
+
method: "GET",
|
|
89
|
+
mode: "no-cors",
|
|
90
|
+
credentials: "omit",
|
|
91
|
+
keepalive: true,
|
|
92
|
+
cache: "no-store"
|
|
93
|
+
}).catch(() => void 0);
|
|
94
|
+
} catch {}
|
|
95
|
+
return {
|
|
96
|
+
captchaType: powCaptcha.captchaType,
|
|
97
|
+
sessionId: powCaptcha.sessionId,
|
|
98
|
+
provider,
|
|
99
|
+
status: powCaptcha.status,
|
|
100
|
+
userAccount,
|
|
101
|
+
error: powCaptcha.error,
|
|
102
|
+
hp: powCaptcha.hp
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const detectionResult = await providerDetect(container, restartFn, () => ext.getAccount(config));
|
|
106
|
+
const userAccount = detectionResult.userAccount;
|
|
76
107
|
const { currentUrl, iframeUrl } = getCurrentPageUrls();
|
|
77
|
-
const captchaPromise = providerApi.getFrictionlessCaptcha(detectionResult.token, detectionResult.encryptHeadHash, config.account.address, userAccount.account.address, config.mode, void 0, currentUrl, iframeUrl);
|
|
108
|
+
const captchaPromise = providerApi.getFrictionlessCaptcha(detectionResult.token, detectionResult.encryptHeadHash, config.account.address, userAccount.account.address, config.mode, void 0, detectorSessionId, void 0, currentUrl, iframeUrl);
|
|
78
109
|
if (detectionResult.getSimdReadings) detectionResult.getSimdReadings(6e4).catch(() => void 0);
|
|
79
110
|
const captcha = await withTimeout(captchaPromise, 1e4);
|
|
80
111
|
if (captcha.dns_url) try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customDetectBot.js","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACN,eAAe,EACf,iCAAiC,EACjC,UAAU,GACV,MAAM,4BAA4B,CAAC;AAOpC,OAAO,
|
|
1
|
+
{"version":3,"file":"customDetectBot.js","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACN,eAAe,EACf,iCAAiC,EACjC,UAAU,GACV,MAAM,4BAA4B,CAAC;AAOpC,OAAO,EACN,wBAAwB,GAExB,MAAM,qBAAqB,CAAC;AAM7B,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAqB/B,MAAM,YAAY,GAAG,CAAC,IAAY,EAAsB,EAAE;IAC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kBAAkB,EAAE,eAAe,CAAC,kBAAkB;QACtD,eAAe,EAAE,eAAe,CAAC,eAAe;KAChD,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/detectorLoader.d.ts
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
type
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import type { Account, BehavioralData, ClickEventPoint, MouseMovementPoint, PackedBehavioralData, TouchEventPoint } from "@prosopo/types";
|
|
2
|
+
export type DetectorType = (container: HTMLElement | undefined, restart: () => void, accountGenerator: () => Promise<Account>) => Promise<{
|
|
3
|
+
token: string;
|
|
4
|
+
shadowDomCleanup: () => void;
|
|
5
|
+
encryptHeadHash: string;
|
|
6
|
+
mouseTracker?: {
|
|
7
|
+
start: () => void;
|
|
8
|
+
stop: () => void;
|
|
9
|
+
getData: () => MouseMovementPoint[];
|
|
10
|
+
clear: () => void;
|
|
11
|
+
};
|
|
12
|
+
touchTracker?: {
|
|
13
|
+
start: () => void;
|
|
14
|
+
stop: () => void;
|
|
15
|
+
getData: () => TouchEventPoint[];
|
|
16
|
+
clear: () => void;
|
|
17
|
+
};
|
|
18
|
+
clickTracker?: {
|
|
19
|
+
start: () => void;
|
|
20
|
+
stop: () => void;
|
|
21
|
+
getData: () => ClickEventPoint[];
|
|
22
|
+
clear: () => void;
|
|
23
|
+
};
|
|
24
|
+
hasTouchSupport?: string;
|
|
25
|
+
encryptBehavioralData?: (data: string) => Promise<string>;
|
|
26
|
+
packBehavioralData?: (behavioralData: BehavioralData) => PackedBehavioralData;
|
|
27
|
+
getSimdReadings?: (timeoutMs?: number) => Promise<string | undefined>;
|
|
28
|
+
userAccount: Account;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const DetectorLoaderFromScript: (script: string) => Promise<DetectorType>;
|
|
4
31
|
//# sourceMappingURL=detectorLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detectorLoader.d.ts","sourceRoot":"","sources":["../src/detectorLoader.ts"],"names":[],"mappings":"AAcA,KAAK,YAAY,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"detectorLoader.d.ts","sourceRoot":"","sources":["../src/detectorLoader.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACX,OAAO,EACP,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,MAAM,gBAAgB,CAAC;AAOxB,MAAM,MAAM,YAAY,GAAG,CAC1B,SAAS,EAAE,WAAW,GAAG,SAAS,EAClC,OAAO,EAAE,MAAM,IAAI,EACnB,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,KACpC,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE;QACd,KAAK,EAAE,MAAM,IAAI,CAAC;QAClB,IAAI,EAAE,MAAM,IAAI,CAAC;QACjB,OAAO,EAAE,MAAM,kBAAkB,EAAE,CAAC;QACpC,KAAK,EAAE,MAAM,IAAI,CAAC;KAClB,CAAC;IACF,YAAY,CAAC,EAAE;QACd,KAAK,EAAE,MAAM,IAAI,CAAC;QAClB,IAAI,EAAE,MAAM,IAAI,CAAC;QACjB,OAAO,EAAE,MAAM,eAAe,EAAE,CAAC;QACjC,KAAK,EAAE,MAAM,IAAI,CAAC;KAClB,CAAC;IACF,YAAY,CAAC,EAAE;QACd,KAAK,EAAE,MAAM,IAAI,CAAC;QAClB,IAAI,EAAE,MAAM,IAAI,CAAC;QACjB,OAAO,EAAE,MAAM,eAAe,EAAE,CAAC;QACjC,KAAK,EAAE,MAAM,IAAI,CAAC;KAClB,CAAC;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,kBAAkB,CAAC,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,oBAAoB,CAAC;IAC9E,eAAe,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACtE,WAAW,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AAOH,eAAO,MAAM,wBAAwB,WAC5B,MAAM,KACZ,OAAO,CAAC,YAAY,CAWtB,CAAC"}
|
package/dist/detectorLoader.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
//#region src/detectorLoader.ts
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Loads a detector from a provider-served obfuscated ESM string (the per-session
|
|
4
|
+
* pool bundle). Evaluated via a blob URL — the served module is self-contained
|
|
5
|
+
* (no imports), so dynamic `import()` of the blob yields its default export.
|
|
6
|
+
*/
|
|
7
|
+
var DetectorLoaderFromScript = async (script) => {
|
|
8
|
+
const blob = new Blob([script], { type: "text/javascript" });
|
|
9
|
+
const url = URL.createObjectURL(blob);
|
|
10
|
+
try {
|
|
11
|
+
return (await import(
|
|
12
|
+
/* @vite-ignore */
|
|
13
|
+
url
|
|
14
|
+
)).default;
|
|
15
|
+
} finally {
|
|
16
|
+
URL.revokeObjectURL(url);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
3
19
|
//#endregion
|
|
4
|
-
export {
|
|
20
|
+
export { DetectorLoaderFromScript };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detectorLoader.js","sourceRoot":"","sources":["../src/detectorLoader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"detectorLoader.js","sourceRoot":"","sources":["../src/detectorLoader.ts"],"names":[],"mappings":"AAkEA,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAC5C,MAAc,EACU,EAAE;IAC1B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC;QACJ,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAoB,GAAG,CAAC,CAEhD,CAAC;QACF,OAAO,GAAG,CAAC,OAAO,CAAC;IACpB,CAAC;YAAS,CAAC;QACV,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC,CAAC"}
|
|
@@ -2,12 +2,14 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
2
2
|
const mocks = vi.hoisted(() => ({
|
|
3
3
|
getFrictionlessCaptcha: vi.fn(),
|
|
4
4
|
getProcaptchaRandomActiveProvider: vi.fn(),
|
|
5
|
+
assignDetectorBundle: vi.fn(),
|
|
5
6
|
detect: vi.fn(),
|
|
6
7
|
}));
|
|
7
8
|
vi.mock("@prosopo/api", () => ({
|
|
8
9
|
ProviderApi: vi.fn(function () {
|
|
9
10
|
return {
|
|
10
11
|
getFrictionlessCaptcha: mocks.getFrictionlessCaptcha,
|
|
12
|
+
assignDetectorBundle: mocks.assignDetectorBundle,
|
|
11
13
|
};
|
|
12
14
|
}),
|
|
13
15
|
}));
|
|
@@ -25,7 +27,7 @@ vi.mock("@prosopo/procaptcha-common", () => ({
|
|
|
25
27
|
pickIpMode: vi.fn(() => undefined),
|
|
26
28
|
}));
|
|
27
29
|
vi.mock("../detectorLoader.js", () => ({
|
|
28
|
-
|
|
30
|
+
DetectorLoaderFromScript: vi.fn(async () => mocks.detect),
|
|
29
31
|
}));
|
|
30
32
|
import customDetectBot from "../customDetectBot.js";
|
|
31
33
|
const baseConfig = {
|
|
@@ -51,11 +53,18 @@ const captchaResponse = {
|
|
|
51
53
|
beforeEach(() => {
|
|
52
54
|
mocks.getFrictionlessCaptcha.mockReset();
|
|
53
55
|
mocks.getProcaptchaRandomActiveProvider.mockReset();
|
|
56
|
+
mocks.assignDetectorBundle.mockReset();
|
|
54
57
|
mocks.detect.mockReset();
|
|
55
58
|
mocks.getProcaptchaRandomActiveProvider.mockResolvedValue({
|
|
56
59
|
providerAccount: "dns-routed",
|
|
57
60
|
provider: { url: "https://provider.test" },
|
|
58
61
|
});
|
|
62
|
+
mocks.assignDetectorBundle.mockResolvedValue({
|
|
63
|
+
useProviderBundle: true,
|
|
64
|
+
detectorSessionId: "det-1",
|
|
65
|
+
detectorScript: "SELF_CONTAINED_ESM",
|
|
66
|
+
status: "ok",
|
|
67
|
+
});
|
|
59
68
|
mocks.getFrictionlessCaptcha.mockResolvedValue(captchaResponse);
|
|
60
69
|
});
|
|
61
70
|
describe("customDetectBot SIMD deferral", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customDetectBotSimd.test.js","sourceRoot":"","sources":["../../src/tests/customDetectBotSimd.test.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAI9D,MAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/B,sBAAsB,EAAE,EAAE,CAAC,EAAE,EAAE;IAC/B,iCAAiC,EAAE,EAAE,CAAC,EAAE,EAAE;IAC1C,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE;CACf,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAI9B,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC;QAClB,OAAO;YACN,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;
|
|
1
|
+
{"version":3,"file":"customDetectBotSimd.test.js","sourceRoot":"","sources":["../../src/tests/customDetectBotSimd.test.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,E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CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/procaptcha-frictionless",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,21 +30,20 @@
|
|
|
30
30
|
},
|
|
31
31
|
"browserslist": ["> 0.5%, last 2 versions, not dead"],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@prosopo/api": "
|
|
33
|
+
"@prosopo/api": "4.0.0",
|
|
34
34
|
"@prosopo/common": "3.1.48",
|
|
35
|
-
"@prosopo/detector": "3.5.14",
|
|
36
35
|
"@prosopo/locale": "3.2.8",
|
|
37
|
-
"@prosopo/procaptcha-common": "2.11.
|
|
38
|
-
"@prosopo/procaptcha-pow": "2.10.
|
|
39
|
-
"@prosopo/procaptcha-puzzle": "2.10.
|
|
40
|
-
"@prosopo/procaptcha-react": "2.9.
|
|
41
|
-
"@prosopo/types": "
|
|
42
|
-
"@prosopo/widget-skeleton": "2.8.
|
|
36
|
+
"@prosopo/procaptcha-common": "2.11.20",
|
|
37
|
+
"@prosopo/procaptcha-pow": "2.10.27",
|
|
38
|
+
"@prosopo/procaptcha-puzzle": "2.10.43",
|
|
39
|
+
"@prosopo/procaptcha-react": "2.9.100",
|
|
40
|
+
"@prosopo/types": "5.0.0",
|
|
41
|
+
"@prosopo/widget-skeleton": "2.8.5",
|
|
43
42
|
"dotenv": "16.4.5",
|
|
44
43
|
"react": "18.3.1"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
|
-
"@prosopo/config": "3.3.
|
|
46
|
+
"@prosopo/config": "3.3.6",
|
|
48
47
|
"@types/node": "22.10.2",
|
|
49
48
|
"@vitest/coverage-v8": "4.1.10",
|
|
50
49
|
"concurrently": "9.0.1",
|