@prosopo/procaptcha-frictionless 2.11.11 → 2.12.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 +9 -9
- package/.turbo/turbo-build$colon$tsc.log +27 -27
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +78 -0
- package/dist/cjs/customDetectBot.cjs +6 -16
- package/dist/customDetectBot.d.ts.map +1 -1
- package/dist/customDetectBot.js +7 -17
- package/dist/customDetectBot.js.map +1 -1
- package/dist/tests/customDetectBotSimd.test.js +8 -13
- package/dist/tests/customDetectBotSimd.test.js.map +1 -1
- package/package.json +9 -10
- package/src/customDetectBot.ts +18 -24
- package/src/tests/customDetectBotSimd.test.ts +8 -14
- package/tsconfig.cjs.json +0 -3
- package/tsconfig.json +0 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.12.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: .
|
|
@@ -10,14 +10,14 @@ ViteCommonJSConfig: .
|
|
|
10
10
|
'/home/runner/work/captcha/captcha/packages/locale/tsconfig.json',
|
|
11
11
|
'/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
|
|
12
12
|
'/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
|
|
13
|
-
'/home/runner/work/captcha/captcha/packages/load-balancer/tsconfig.json',
|
|
14
|
-
'/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
|
|
15
|
-
'/home/runner/work/captcha/captcha/packages/logger/tsconfig.json',
|
|
16
13
|
'/home/runner/work/captcha/captcha/packages/procaptcha-pow/tsconfig.json',
|
|
17
14
|
'/home/runner/work/captcha/captcha/packages/api/tsconfig.json',
|
|
15
|
+
'/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
|
|
16
|
+
'/home/runner/work/captcha/captcha/packages/logger/tsconfig.json',
|
|
18
17
|
'/home/runner/work/captcha/captcha/packages/fingerprint/tsconfig.json',
|
|
19
18
|
'/home/runner/work/captcha/captcha/packages/fingerprintjs/tsconfig.json',
|
|
20
19
|
'/home/runner/work/captcha/captcha/packages/procaptcha-common/tsconfig.json',
|
|
20
|
+
'/home/runner/work/captcha/captcha/packages/load-balancer/tsconfig.json',
|
|
21
21
|
'/home/runner/work/captcha/captcha/packages/widget-skeleton/tsconfig.json',
|
|
22
22
|
'/home/runner/work/captcha/captcha/packages/account/tsconfig.json',
|
|
23
23
|
'/home/runner/work/captcha/captcha/packages/keyring/tsconfig.json',
|
|
@@ -34,14 +34,14 @@ ViteCommonJSConfig: .
|
|
|
34
34
|
'@prosopo/locale',
|
|
35
35
|
'@prosopo/util',
|
|
36
36
|
'@prosopo/util-crypto',
|
|
37
|
-
'@prosopo/load-balancer',
|
|
38
|
-
'@prosopo/common',
|
|
39
|
-
'@prosopo/logger',
|
|
40
37
|
'@prosopo/procaptcha-pow',
|
|
41
38
|
'@prosopo/api',
|
|
39
|
+
'@prosopo/common',
|
|
40
|
+
'@prosopo/logger',
|
|
42
41
|
'@prosopo/fingerprint',
|
|
43
42
|
'@prosopo/fingerprintjs',
|
|
44
43
|
'@prosopo/procaptcha-common',
|
|
44
|
+
'@prosopo/load-balancer',
|
|
45
45
|
'@prosopo/widget-skeleton',
|
|
46
46
|
'@prosopo/account',
|
|
47
47
|
'@prosopo/keyring',
|
|
@@ -60,6 +60,6 @@ Build end
|
|
|
60
60
|
rendering chunks...
|
|
61
61
|
[2mdist/cjs/[22m[36mindex.cjs [39m[1m[2m0.24 kB[22m[1m[22m
|
|
62
62
|
[2mdist/cjs/[22m[36mdetectorLoader.cjs [39m[1m[2m1.37 kB[22m[1m[22m
|
|
63
|
-
[2mdist/cjs/[22m[36mcustomDetectBot.cjs [39m[1m[2m3.
|
|
63
|
+
[2mdist/cjs/[22m[36mcustomDetectBot.cjs [39m[1m[2m3.05 kB[22m[1m[22m
|
|
64
64
|
[2mdist/cjs/[22m[36mProcaptchaFrictionless.cjs [39m[1m[2m7.98 kB[22m[1m[22m
|
|
65
|
-
[32m✓ built in
|
|
65
|
+
[32m✓ built in 155ms[39m
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.12.0 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
7:02:54 PM - 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
11
|
* ../detector/tsconfig.json
|
|
12
|
+
* ../api/tsconfig.json
|
|
12
13
|
* ../logger/tsconfig.json
|
|
13
14
|
* ../common/tsconfig.json
|
|
14
|
-
* ../load-balancer/tsconfig.json
|
|
15
|
-
* ../api/tsconfig.json
|
|
16
15
|
* ../fingerprintjs/tsconfig.json
|
|
17
16
|
* ../fingerprint/tsconfig.json
|
|
17
|
+
* ../load-balancer/tsconfig.json
|
|
18
18
|
* ../widget-skeleton/tsconfig.json
|
|
19
19
|
* ../keyring/tsconfig.json
|
|
20
20
|
* ../account/tsconfig.json
|
|
@@ -26,49 +26,49 @@
|
|
|
26
26
|
* ../procaptcha-react/tsconfig.json
|
|
27
27
|
* tsconfig.json
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
7:02:54 PM - 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
30
|
|
|
31
|
-
|
|
31
|
+
7:02:54 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
7:02:54 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/version.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
7:02:54 PM - 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
36
|
|
|
37
|
-
|
|
37
|
+
7:02:54 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/procaptcha/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
7:02:54 PM - Project '../detector/tsconfig.json' is up to date because newest input '../detector/src/index.js' is older than output '../detector/tsconfig.tsbuildinfo'
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
7:02:54 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
7:02:54 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
7:02:54 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/index.ts' is older than output '../common/tsconfig.tsbuildinfo'
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
7:02:54 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
7:02:54 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
7:02:54 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/balancer.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
7:02:54 PM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/constants.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
7:02:54 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/pair/decode.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
7:02:54 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/workers/cryptoWorker.ts' is older than output '../account/tsconfig.tsbuildinfo'
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
7:02:54 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/reactComponents/Honeypot.tsx' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
7:02:54 PM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/index.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
7:02:54 PM - Project '../procaptcha-puzzle/tsconfig.json' is up to date because newest input '../procaptcha-puzzle/src/index.ts' is older than output '../procaptcha-puzzle/tsconfig.tsbuildinfo'
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
7:02:54 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/dataset.unit.test.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
7:02:54 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/Manager.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
7:02:54 PM - 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'
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
7:02:54 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
7:02:54 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
|
|
74
74
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.12.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.12.0 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
@@ -14,14 +14,14 @@ ViteEsmConfig: .
|
|
|
14
14
|
'/home/runner/work/captcha/captcha/packages/locale/tsconfig.json',
|
|
15
15
|
'/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
|
|
16
16
|
'/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
|
|
17
|
-
'/home/runner/work/captcha/captcha/packages/load-balancer/tsconfig.json',
|
|
18
|
-
'/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
|
|
19
|
-
'/home/runner/work/captcha/captcha/packages/logger/tsconfig.json',
|
|
20
17
|
'/home/runner/work/captcha/captcha/packages/procaptcha-pow/tsconfig.json',
|
|
21
18
|
'/home/runner/work/captcha/captcha/packages/api/tsconfig.json',
|
|
19
|
+
'/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
|
|
20
|
+
'/home/runner/work/captcha/captcha/packages/logger/tsconfig.json',
|
|
22
21
|
'/home/runner/work/captcha/captcha/packages/fingerprint/tsconfig.json',
|
|
23
22
|
'/home/runner/work/captcha/captcha/packages/fingerprintjs/tsconfig.json',
|
|
24
23
|
'/home/runner/work/captcha/captcha/packages/procaptcha-common/tsconfig.json',
|
|
24
|
+
'/home/runner/work/captcha/captcha/packages/load-balancer/tsconfig.json',
|
|
25
25
|
'/home/runner/work/captcha/captcha/packages/widget-skeleton/tsconfig.json',
|
|
26
26
|
'/home/runner/work/captcha/captcha/packages/account/tsconfig.json',
|
|
27
27
|
'/home/runner/work/captcha/captcha/packages/keyring/tsconfig.json',
|
|
@@ -38,14 +38,14 @@ ViteEsmConfig: .
|
|
|
38
38
|
'@prosopo/locale',
|
|
39
39
|
'@prosopo/util',
|
|
40
40
|
'@prosopo/util-crypto',
|
|
41
|
-
'@prosopo/load-balancer',
|
|
42
|
-
'@prosopo/common',
|
|
43
|
-
'@prosopo/logger',
|
|
44
41
|
'@prosopo/procaptcha-pow',
|
|
45
42
|
'@prosopo/api',
|
|
43
|
+
'@prosopo/common',
|
|
44
|
+
'@prosopo/logger',
|
|
46
45
|
'@prosopo/fingerprint',
|
|
47
46
|
'@prosopo/fingerprintjs',
|
|
48
47
|
'@prosopo/procaptcha-common',
|
|
48
|
+
'@prosopo/load-balancer',
|
|
49
49
|
'@prosopo/widget-skeleton',
|
|
50
50
|
'@prosopo/account',
|
|
51
51
|
'@prosopo/keyring',
|
|
@@ -63,6 +63,6 @@ Build end
|
|
|
63
63
|
rendering chunks...
|
|
64
64
|
[2mdist/[22m[36mindex.js [39m[1m[2m0.11 kB[22m[1m[22m
|
|
65
65
|
[2mdist/[22m[36mdetectorLoader.js [39m[1m[2m0.11 kB[22m[1m[22m
|
|
66
|
-
[2mdist/[22m[36mcustomDetectBot.js [39m[1m[
|
|
66
|
+
[2mdist/[22m[36mcustomDetectBot.js [39m[1m[2m2.87 kB[22m[1m[22m
|
|
67
67
|
[2mdist/[22m[36mProcaptchaFrictionless.js [39m[1m[2m6.59 kB[22m[1m[22m
|
|
68
|
-
[32m✓ built in
|
|
68
|
+
[32m✓ built in 168ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
# @prosopo/procaptcha-frictionless
|
|
2
2
|
|
|
3
|
+
## 2.12.0
|
|
4
|
+
### Minor Changes
|
|
5
|
+
|
|
6
|
+
- 12cd0a6: Replace client-side weighted-random provider selection with static DNS endpoints.
|
|
7
|
+
|
|
8
|
+
- Removed the `providerSelectEntropy` field from `DetectorResult`, `Session`, the
|
|
9
|
+
Mongoose `SessionRecordSchema` (including its standalone index), and every
|
|
10
|
+
call-site that threaded it through frictionless / image / pow / puzzle flows.
|
|
11
|
+
- Removed `FrictionlessManager.hostVerified` and its decision-machine call site
|
|
12
|
+
— there's nothing to verify when the DNS layer picks the host.
|
|
13
|
+
- `getRandomActiveProvider(env)` now returns the per-environment static DNS
|
|
14
|
+
endpoint (`pronode.prosopo.io` family) instead of fetching the provider list
|
|
15
|
+
and weighted-selecting. The entropy parameter is gone.
|
|
16
|
+
- `getProcaptchaRandomActiveProvider` is now a thin re-export so widget packages
|
|
17
|
+
keep importing from `procaptcha-common`.
|
|
18
|
+
- `FrontendProvider.datasetId` is dropped; `CaptchaRequestBody.datasetId` is
|
|
19
|
+
optional. The server falls back to its own most-recently-uploaded dataset
|
|
20
|
+
(`env.datasetId`, populated from `db.getMostRecentDatasetId()` at startup) —
|
|
21
|
+
clients can't pin a dataset under DNS routing because they don't know which
|
|
22
|
+
pronode they'll hit.
|
|
23
|
+
- Removed dead `setProviderLoader` / `prefetchProviders` / `selectWeightedProvider`
|
|
24
|
+
plumbing from `@prosopo/load-balancer`. The server's cacheFile-based loader
|
|
25
|
+
setup in `startProviderApi` goes with them.
|
|
26
|
+
- `getRandomActiveProvider` now hits `/healthz` on the global hostname once per
|
|
27
|
+
page load, reads the responding pronode's identity from the JSON body, and
|
|
28
|
+
pins subsequent captcha calls to that pronode (`https://pronodeN.prosopo.io`)
|
|
29
|
+
so session creation and submission land on the same backend. Falls back to
|
|
30
|
+
the dual-stack global hostname when `/healthz` is unreachable.
|
|
31
|
+
- `/healthz` now returns `{ ok: true, host: <pronode-identity> }` instead of
|
|
32
|
+
`"OK"` to support the above pinning.
|
|
33
|
+
- CORS preflight is now cached for 24h (`maxAge: 86400`) — previously the
|
|
34
|
+
browser refired an OPTIONS preflight before every captcha call because
|
|
35
|
+
the custom `Prosopo-Site-Key` / `Prosopo-User` headers make the request
|
|
36
|
+
non-simple and the default `maxAge` is 5s.
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- 12cd0a6: Add ipv4-only / ipv6-only provider DNS routing via `data-ipv4` / `data-ipv6`.
|
|
41
|
+
|
|
42
|
+
Dapps that need to pin captcha traffic to a single IP stack can now do so:
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<div class="procaptcha" data-sitekey="..." data-ipv4="true"></div>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
What happens under the hood:
|
|
49
|
+
|
|
50
|
+
- The widget reads `data-ipv4` / `data-ipv6` (or the matching `ipv4` / `ipv6`
|
|
51
|
+
booleans on `ProcaptchaRenderOptions` / explicit `render(...)`) and threads
|
|
52
|
+
them through `ProcaptchaConfigSchema`.
|
|
53
|
+
- `pickIpMode(config)` resolves them into an `IpMode` (`"ipv4"` / `"ipv6"` /
|
|
54
|
+
`undefined`); `ipv4` wins if both are set.
|
|
55
|
+
- The frictionless / image / pow / puzzle managers pass the `IpMode` into
|
|
56
|
+
`getProcaptchaRandomActiveProvider`, which calls `/healthz` on the matching
|
|
57
|
+
single-stack global hostname (`ipv4.pronode.prosopo.io` or
|
|
58
|
+
`ipv6.pronode.prosopo.io`) and pins subsequent captcha calls to
|
|
59
|
+
`ipv4.pronodeN.prosopo.io` / `ipv6.pronodeN.prosopo.io`. The dual-stack
|
|
60
|
+
cache and the single-stack caches are kept separate.
|
|
61
|
+
- `convertHostedProvider` now accepts an optional `IpMode` and, when set,
|
|
62
|
+
selects the matching `ipv4` / `ipv6` sub-object from the provider-list JSON.
|
|
63
|
+
Top-level `ipv4` / `ipv6` keys are skipped by default so existing dual-stack
|
|
64
|
+
callers keep working.
|
|
65
|
+
- New helpers in `@prosopo/load-balancer`: `IpMode`, `stripIpModeLabel`,
|
|
66
|
+
`getProviderHostname`.
|
|
67
|
+
|
|
68
|
+
Coordinated with the matching `captcha-private` change that publishes the
|
|
69
|
+
`ipv4` / `ipv6` sub-objects to S3.
|
|
70
|
+
- Updated dependencies [12cd0a6]
|
|
71
|
+
- Updated dependencies [005b817]
|
|
72
|
+
- Updated dependencies [12cd0a6]
|
|
73
|
+
- @prosopo/procaptcha-common@2.11.0
|
|
74
|
+
- @prosopo/detector@3.5.0
|
|
75
|
+
- @prosopo/api@3.5.5
|
|
76
|
+
- @prosopo/types@4.8.0
|
|
77
|
+
- @prosopo/procaptcha-react@2.9.78
|
|
78
|
+
- @prosopo/procaptcha-pow@2.10.5
|
|
79
|
+
- @prosopo/procaptcha-puzzle@2.10.20
|
|
80
|
+
|
|
3
81
|
## 2.11.11
|
|
4
82
|
### Patch Changes
|
|
5
83
|
|
|
@@ -2,17 +2,8 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const api = require("@prosopo/api");
|
|
4
4
|
const common = require("@prosopo/common");
|
|
5
|
-
const loadBalancer = require("@prosopo/load-balancer");
|
|
6
5
|
const procaptchaCommon = require("@prosopo/procaptcha-common");
|
|
7
|
-
const types = require("@prosopo/types");
|
|
8
6
|
const detectorLoader = require("./detectorLoader.cjs");
|
|
9
|
-
if (typeof window !== "undefined") {
|
|
10
|
-
const envHint = typeof process !== "undefined" ? process.env?.PROSOPO_DEFAULT_ENVIRONMENT : void 0;
|
|
11
|
-
const parsedEnv = types.EnvironmentTypesSchema.safeParse(envHint);
|
|
12
|
-
if (parsedEnv.success) {
|
|
13
|
-
loadBalancer.prefetchProviders(parsedEnv.data).catch(() => void 0);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
7
|
const withTimeout = async (promise, ms) => {
|
|
17
8
|
let timeoutId;
|
|
18
9
|
const timeoutPromise = new Promise((_, reject) => {
|
|
@@ -36,13 +27,12 @@ const withTimeout = async (promise, ms) => {
|
|
|
36
27
|
const customDetectBot = async (config, container, restartFn) => {
|
|
37
28
|
const [ExtClass, detect] = await Promise.all([
|
|
38
29
|
procaptchaCommon.ExtensionLoader(config.web2),
|
|
39
|
-
detectorLoader.DetectorLoader()
|
|
40
|
-
loadBalancer.prefetchProviders(config.defaultEnvironment)
|
|
30
|
+
detectorLoader.DetectorLoader()
|
|
41
31
|
]);
|
|
42
32
|
const ext = new ExtClass();
|
|
43
33
|
const detectionResult = await detect(
|
|
44
34
|
config.defaultEnvironment,
|
|
45
|
-
|
|
35
|
+
async () => procaptchaCommon.getProcaptchaRandomActiveProvider(config.defaultEnvironment),
|
|
46
36
|
container,
|
|
47
37
|
restartFn,
|
|
48
38
|
() => ext.getAccount(config)
|
|
@@ -51,10 +41,10 @@ const customDetectBot = async (config, container, restartFn) => {
|
|
|
51
41
|
if (!config.account.address) {
|
|
52
42
|
throw new common.ProsopoEnvError("GENERAL.SITE_KEY_MISSING");
|
|
53
43
|
}
|
|
54
|
-
const provider =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
const provider = await procaptchaCommon.getProcaptchaRandomActiveProvider(
|
|
45
|
+
config.defaultEnvironment,
|
|
46
|
+
procaptchaCommon.pickIpMode(config)
|
|
47
|
+
);
|
|
58
48
|
const providerApi = new api.ProviderApi(
|
|
59
49
|
provider.provider.url,
|
|
60
50
|
config.account.address
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACX,oBAAoB,EAEpB,MAAM,gBAAgB,CAAC;AAIxB,eAAO,MAAM,WAAW,GAAU,CAAC,WACzB,OAAO,CAAC,CAAC,CAAC,MACf,MAAM,KACR,OAAO,CAAC,CAAC,CAoBX,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,oBAkGtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/customDetectBot.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { ProviderApi } from "@prosopo/api";
|
|
2
2
|
import { ProsopoEnvError } from "@prosopo/common";
|
|
3
|
-
import {
|
|
4
|
-
import { ExtensionLoader } from "@prosopo/procaptcha-common";
|
|
5
|
-
import { EnvironmentTypesSchema } from "@prosopo/types";
|
|
3
|
+
import { ExtensionLoader, getProcaptchaRandomActiveProvider, pickIpMode } from "@prosopo/procaptcha-common";
|
|
6
4
|
import { DetectorLoader } from "./detectorLoader.js";
|
|
7
|
-
if (typeof window !== "undefined") {
|
|
8
|
-
const envHint = typeof process !== "undefined" ? process.env?.PROSOPO_DEFAULT_ENVIRONMENT : void 0;
|
|
9
|
-
const parsedEnv = EnvironmentTypesSchema.safeParse(envHint);
|
|
10
|
-
if (parsedEnv.success) {
|
|
11
|
-
prefetchProviders(parsedEnv.data).catch(() => void 0);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
5
|
const withTimeout = async (promise, ms) => {
|
|
15
6
|
let timeoutId;
|
|
16
7
|
const timeoutPromise = new Promise((_, reject) => {
|
|
@@ -34,13 +25,12 @@ const withTimeout = async (promise, ms) => {
|
|
|
34
25
|
const customDetectBot = async (config, container, restartFn) => {
|
|
35
26
|
const [ExtClass, detect] = await Promise.all([
|
|
36
27
|
ExtensionLoader(config.web2),
|
|
37
|
-
DetectorLoader()
|
|
38
|
-
prefetchProviders(config.defaultEnvironment)
|
|
28
|
+
DetectorLoader()
|
|
39
29
|
]);
|
|
40
30
|
const ext = new ExtClass();
|
|
41
31
|
const detectionResult = await detect(
|
|
42
32
|
config.defaultEnvironment,
|
|
43
|
-
|
|
33
|
+
async () => getProcaptchaRandomActiveProvider(config.defaultEnvironment),
|
|
44
34
|
container,
|
|
45
35
|
restartFn,
|
|
46
36
|
() => ext.getAccount(config)
|
|
@@ -49,10 +39,10 @@ const customDetectBot = async (config, container, restartFn) => {
|
|
|
49
39
|
if (!config.account.address) {
|
|
50
40
|
throw new ProsopoEnvError("GENERAL.SITE_KEY_MISSING");
|
|
51
41
|
}
|
|
52
|
-
const provider =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
const provider = await getProcaptchaRandomActiveProvider(
|
|
43
|
+
config.defaultEnvironment,
|
|
44
|
+
pickIpMode(config)
|
|
45
|
+
);
|
|
56
46
|
const providerApi = new ProviderApi(
|
|
57
47
|
provider.provider.url,
|
|
58
48
|
config.account.address
|
|
@@ -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,
|
|
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;AAMpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC/B,OAAmB,EACnB,EAAU,EACG,EAAE;IACf,IAAI,SAAqC,CAAC;IAC1C,MAAM,cAAc,GAAG,IAAI,OAAO,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W,EAAE,WAAW;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,EAAE,EAAE,OAAO,CAAC,EAAE;QAEd,kBAAkB,EAAE,eAAe,CAAC,YAAY;QAChD,kBAAkB,EAAE,eAAe,CAAC,YAAY;QAChD,kBAAkB,EAAE,eAAe,CAAC,YAAY;QAChD,gBAAgB,EAAE,eAAe,CAAC,eAAe;QACjD,qBAAqB,EAAE,eAAe,CAAC,qBAAqB;QAC5D,kBAAkB,EAAE,eAAe,CAAC,kBAAkB;QACtD,eAAe,EAAE,eAAe,CAAC,eAAe;KAChD,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
2
|
const mocks = vi.hoisted(() => ({
|
|
3
3
|
getFrictionlessCaptcha: vi.fn(),
|
|
4
|
-
|
|
5
|
-
prefetchProviders: vi.fn(async () => undefined),
|
|
4
|
+
getProcaptchaRandomActiveProvider: vi.fn(),
|
|
6
5
|
detect: vi.fn(),
|
|
7
6
|
}));
|
|
8
7
|
vi.mock("@prosopo/api", () => ({
|
|
@@ -10,10 +9,6 @@ vi.mock("@prosopo/api", () => ({
|
|
|
10
9
|
getFrictionlessCaptcha: mocks.getFrictionlessCaptcha,
|
|
11
10
|
})),
|
|
12
11
|
}));
|
|
13
|
-
vi.mock("@prosopo/load-balancer", () => ({
|
|
14
|
-
getRandomActiveProvider: mocks.getRandomActiveProvider,
|
|
15
|
-
prefetchProviders: mocks.prefetchProviders,
|
|
16
|
-
}));
|
|
17
12
|
vi.mock("@prosopo/procaptcha-common", () => ({
|
|
18
13
|
ExtensionLoader: vi.fn(async () => {
|
|
19
14
|
return class FakeExtension {
|
|
@@ -24,6 +19,8 @@ vi.mock("@prosopo/procaptcha-common", () => ({
|
|
|
24
19
|
}
|
|
25
20
|
};
|
|
26
21
|
}),
|
|
22
|
+
getProcaptchaRandomActiveProvider: mocks.getProcaptchaRandomActiveProvider,
|
|
23
|
+
pickIpMode: vi.fn(() => undefined),
|
|
27
24
|
}));
|
|
28
25
|
vi.mock("../detectorLoader.js", () => ({
|
|
29
26
|
DetectorLoader: vi.fn(async () => mocks.detect),
|
|
@@ -39,10 +36,6 @@ const makeDetectionResult = (getSimdReadings) => ({
|
|
|
39
36
|
token: "TOKEN",
|
|
40
37
|
encryptHeadHash: "HASH",
|
|
41
38
|
userAccount: { account: { address: "5FakeUserAccountAddress" } },
|
|
42
|
-
provider: {
|
|
43
|
-
provider: { url: "https://provider.test" },
|
|
44
|
-
providerAccount: "5Provider",
|
|
45
|
-
},
|
|
46
39
|
getSimdReadings,
|
|
47
40
|
mouseTracker: undefined,
|
|
48
41
|
touchTracker: undefined,
|
|
@@ -55,10 +48,12 @@ const captchaResponse = {
|
|
|
55
48
|
};
|
|
56
49
|
beforeEach(() => {
|
|
57
50
|
mocks.getFrictionlessCaptcha.mockReset();
|
|
58
|
-
mocks.
|
|
59
|
-
mocks.prefetchProviders.mockReset();
|
|
51
|
+
mocks.getProcaptchaRandomActiveProvider.mockReset();
|
|
60
52
|
mocks.detect.mockReset();
|
|
61
|
-
mocks.
|
|
53
|
+
mocks.getProcaptchaRandomActiveProvider.mockResolvedValue({
|
|
54
|
+
providerAccount: "dns-routed",
|
|
55
|
+
provider: { url: "https://provider.test" },
|
|
56
|
+
});
|
|
62
57
|
mocks.getFrictionlessCaptcha.mockResolvedValue(captchaResponse);
|
|
63
58
|
});
|
|
64
59
|
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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|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/procaptcha-frictionless",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,22 +30,21 @@
|
|
|
30
30
|
},
|
|
31
31
|
"browserslist": ["> 0.5%, last 2 versions, not dead"],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@prosopo/api": "3.5.
|
|
33
|
+
"@prosopo/api": "3.5.5",
|
|
34
34
|
"@prosopo/common": "3.1.40",
|
|
35
|
-
"@prosopo/detector": "3.
|
|
36
|
-
"@prosopo/load-balancer": "2.9.21",
|
|
35
|
+
"@prosopo/detector": "3.5.0",
|
|
37
36
|
"@prosopo/locale": "3.2.5",
|
|
38
|
-
"@prosopo/procaptcha-common": "2.
|
|
39
|
-
"@prosopo/procaptcha-pow": "2.10.
|
|
40
|
-
"@prosopo/procaptcha-puzzle": "2.10.
|
|
41
|
-
"@prosopo/procaptcha-react": "2.9.
|
|
42
|
-
"@prosopo/types": "4.
|
|
37
|
+
"@prosopo/procaptcha-common": "2.11.0",
|
|
38
|
+
"@prosopo/procaptcha-pow": "2.10.5",
|
|
39
|
+
"@prosopo/procaptcha-puzzle": "2.10.20",
|
|
40
|
+
"@prosopo/procaptcha-react": "2.9.78",
|
|
41
|
+
"@prosopo/types": "4.8.0",
|
|
43
42
|
"@prosopo/widget-skeleton": "2.8.3",
|
|
44
43
|
"dotenv": "16.4.5",
|
|
45
44
|
"react": "18.3.1"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"@prosopo/config": "3.3.
|
|
47
|
+
"@prosopo/config": "3.3.3",
|
|
49
48
|
"@types/node": "22.10.2",
|
|
50
49
|
"@vitest/coverage-v8": "3.2.4",
|
|
51
50
|
"concurrently": "9.0.1",
|
package/src/customDetectBot.ts
CHANGED
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
import { ProviderApi } from "@prosopo/api";
|
|
16
16
|
import { ProsopoEnvError } from "@prosopo/common";
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import { EnvironmentTypesSchema } from "@prosopo/types";
|
|
18
|
+
ExtensionLoader,
|
|
19
|
+
getProcaptchaRandomActiveProvider,
|
|
20
|
+
pickIpMode,
|
|
21
|
+
} from "@prosopo/procaptcha-common";
|
|
23
22
|
import type {
|
|
24
23
|
BotDetectionFunction,
|
|
25
24
|
ProcaptchaClientConfigOutput,
|
|
@@ -27,17 +26,6 @@ import type {
|
|
|
27
26
|
import type { BotDetectionFunctionResult } from "@prosopo/types";
|
|
28
27
|
import { DetectorLoader } from "./detectorLoader.js";
|
|
29
28
|
|
|
30
|
-
if (typeof window !== "undefined") {
|
|
31
|
-
const envHint =
|
|
32
|
-
typeof process !== "undefined"
|
|
33
|
-
? process.env?.PROSOPO_DEFAULT_ENVIRONMENT
|
|
34
|
-
: undefined;
|
|
35
|
-
const parsedEnv = EnvironmentTypesSchema.safeParse(envHint);
|
|
36
|
-
if (parsedEnv.success) {
|
|
37
|
-
prefetchProviders(parsedEnv.data).catch(() => undefined);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
29
|
export const withTimeout = async <T>(
|
|
42
30
|
promise: Promise<T>,
|
|
43
31
|
ms: number,
|
|
@@ -71,13 +59,17 @@ const customDetectBot: BotDetectionFunction = async (
|
|
|
71
59
|
const [ExtClass, detect] = await Promise.all([
|
|
72
60
|
ExtensionLoader(config.web2),
|
|
73
61
|
DetectorLoader(),
|
|
74
|
-
prefetchProviders(config.defaultEnvironment),
|
|
75
62
|
]);
|
|
76
63
|
const ext = new ExtClass();
|
|
77
64
|
|
|
65
|
+
// The detector bundle still expects the legacy 5-arg signature
|
|
66
|
+
// `(env, randomProviderSelectorFn, container, restart, accountGenerator)`.
|
|
67
|
+
// Until the bundle is rebuilt without the provider selector, hand it a
|
|
68
|
+
// noop selector that resolves to the static DNS endpoint — the detector
|
|
69
|
+
// no longer uses the returned RandomProvider for routing.
|
|
78
70
|
const detectionResult = await detect(
|
|
79
71
|
config.defaultEnvironment,
|
|
80
|
-
|
|
72
|
+
async () => getProcaptchaRandomActiveProvider(config.defaultEnvironment),
|
|
81
73
|
container,
|
|
82
74
|
restartFn,
|
|
83
75
|
() => ext.getAccount(config),
|
|
@@ -89,12 +81,14 @@ const customDetectBot: BotDetectionFunction = async (
|
|
|
89
81
|
throw new ProsopoEnvError("GENERAL.SITE_KEY_MISSING");
|
|
90
82
|
}
|
|
91
83
|
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
// Resolve the static DNS endpoint for this env. No client-side random
|
|
85
|
+
// selection anymore — the DNS layer load-balances across the pronode fleet.
|
|
86
|
+
// `pickIpMode(config)` honours the dapp's data-ipv4 / data-ipv6 preference
|
|
87
|
+
// so frictionless and the subsequent captcha hops stay on the same stack.
|
|
88
|
+
const provider = await getProcaptchaRandomActiveProvider(
|
|
89
|
+
config.defaultEnvironment,
|
|
90
|
+
pickIpMode(config),
|
|
91
|
+
);
|
|
98
92
|
|
|
99
93
|
const providerApi = new ProviderApi(
|
|
100
94
|
provider.provider.url,
|