@prosopo/types-database 5.7.3 → 5.9.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.
@@ -1,7 +1,4 @@
1
-
2
- > @prosopo/types-database@5.7.3 build:cjs
3
- > NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
-
1
+ $ NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
5
2
  ViteCommonJSConfig: .
6
3
  {
7
4
  tsConfigPaths: [
@@ -42,10 +39,10 @@ dist/cjs/types/mongo.cjs 0.00 kB │ gzip: 0.02 kB
42
39
  dist/cjs/types/userAgent.cjs 0.00 kB │ gzip: 0.02 kB
43
40
  dist/cjs/types/bannedDomain.cjs 0.23 kB │ gzip: 0.16 kB
44
41
  dist/cjs/types/spamEmailDomain.cjs 0.25 kB │ gzip: 0.17 kB
45
- dist/cjs/types/captcha.cjs 0.99 kB │ gzip: 0.27 kB
46
- dist/cjs/types/index.cjs 2.50 kB │ gzip: 0.49 kB
47
- dist/cjs/index.cjs 2.60 kB │ gzip: 0.54 kB
48
- dist/cjs/types/client.cjs 8.29 kB │ gzip: 1.73 kB
49
- dist/cjs/types/provider.cjs 28.77 kB │ gzip: 4.51 kB
42
+ dist/cjs/types/captcha.cjs 1.49 kB │ gzip: 0.31 kB
43
+ dist/cjs/types/index.cjs 2.92 kB │ gzip: 0.53 kB
44
+ dist/cjs/index.cjs 3.03 kB │ gzip: 0.59 kB
45
+ dist/cjs/types/client.cjs 9.87 kB │ gzip: 1.96 kB
46
+ dist/cjs/types/provider.cjs 32.62 kB │ gzip: 5.18 kB
50
47
 
51
- ✓ built in 49ms
48
+ ✓ built in 37ms
@@ -1,8 +1,5 @@
1
-
2
- > @prosopo/types-database@5.7.3 build:tsc
3
- > tsc --build --verbose
4
-
5
- 12:38:40 PM - Projects in this build:
1
+ $ tsc --build --verbose
2
+ 10:11:49 AM - Projects in this build:
6
3
  * ../../dev/config/tsconfig.json
7
4
  * ../util/tsconfig.json
8
5
  * ../locale/tsconfig.json
@@ -16,29 +13,29 @@
16
13
  * ../user-access-policy/tsconfig.json
17
14
  * tsconfig.json
18
15
 
19
- 12:38:41 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'
16
+ 10:11:49 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'
20
17
 
21
- 12:38:41 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
18
+ 10:11:49 AM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/table.ts' is older than output '../util/tsconfig.tsbuildinfo'
22
19
 
23
- 12:38:41 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
20
+ 10:11:49 AM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
24
21
 
25
- 12:38:41 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
22
+ 10:11:49 AM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/logger.ts' is older than output '../logger/tsconfig.tsbuildinfo'
26
23
 
27
- 12:38:41 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'
24
+ 10:11:49 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'
28
25
 
29
- 12:38:41 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/types.test-d.ts' is older than output '../types/tsconfig.tsbuildinfo'
26
+ 10:11:49 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'
30
27
 
31
- 12:38:41 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
28
+ 10:11:49 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'
32
29
 
33
- 12:38:41 PM - Project '../api-route/tsconfig.json' is up to date because newest input '../api-route/src/apiRoutes.ts' is older than output '../api-route/tsconfig.tsbuildinfo'
30
+ 10:11:49 AM - Project '../api-route/tsconfig.json' is up to date because newest input '../api-route/src/apiRoutes.ts' is older than output '../api-route/tsconfig.tsbuildinfo'
34
31
 
35
- 12:38:41 PM - Project '../redis-client/tsconfig.json' is up to date because newest input '../redis-client/src/index.ts' is older than output '../redis-client/tsconfig.tsbuildinfo'
32
+ 10:11:49 AM - Project '../redis-client/tsconfig.json' is up to date because newest input '../redis-client/src/index.ts' is older than output '../redis-client/tsconfig.tsbuildinfo'
36
33
 
37
- 12:38:41 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
34
+ 10:11:49 AM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
38
35
 
39
- 12:38:41 PM - Project '../user-access-policy/tsconfig.json' is up to date because newest input '../user-access-policy/src/transformRule.ts' is older than output '../user-access-policy/tsconfig.tsbuildinfo'
36
+ 10:11:49 AM - Project '../user-access-policy/tsconfig.json' is up to date because newest input '../user-access-policy/src/transformRule.ts' is older than output '../user-access-policy/tsconfig.tsbuildinfo'
40
37
 
41
- 12:38:41 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
38
+ 10:11:49 AM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
42
39
 
43
- 12:38:41 PM - Building project '/home/runner/work/captcha/captcha/packages/types-database/tsconfig.json'...
40
+ 10:11:49 AM - Building project '/home/runner/work/captcha/captcha/packages/types-database/tsconfig.json'...
44
41
 
@@ -1,11 +1,5 @@
1
-
2
- > @prosopo/types-database@5.7.3 build
3
- > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
-
5
-
6
- > @prosopo/types-database@5.7.3 build:cross-env
7
- > vite build --config vite.esm.config.ts --mode production
8
-
1
+ $ pnpm run build:cross-env --mode ${NODE_ENV:-development}
2
+ $ vite build --config vite.esm.config.ts --mode production
9
3
  ViteEsmConfig: .
10
4
  {
11
5
  tsConfigPaths: [
@@ -47,10 +41,10 @@ dist/types/userAgent.js 0.01 kB │ gzip: 0.03 kB
47
41
  dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
48
42
  dist/types/bannedDomain.js 0.22 kB │ gzip: 0.17 kB
49
43
  dist/types/spamEmailDomain.js 0.23 kB │ gzip: 0.17 kB
50
- dist/types/captcha.js 0.82 kB │ gzip: 0.25 kB
51
- dist/types/index.js 1.65 kB │ gzip: 0.39 kB
52
- dist/index.js 1.72 kB │ gzip: 0.42 kB
53
- dist/types/client.js 8.12 kB │ gzip: 1.78 kB
54
- dist/types/provider.js 27.58 kB │ gzip: 4.49 kB
44
+ dist/types/captcha.js 1.24 kB │ gzip: 0.30 kB
45
+ dist/types/index.js 1.95 kB │ gzip: 0.42 kB
46
+ dist/index.js 2.03 kB │ gzip: 0.45 kB
47
+ dist/types/client.js 9.63 kB │ gzip: 2.00 kB
48
+ dist/types/provider.js 31.27 kB │ gzip: 5.17 kB
55
49
 
56
- ✓ built in 67ms
50
+ ✓ built in 47ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,130 @@
1
1
  # @prosopo/types-database
2
2
 
3
+ ## 5.9.0
4
+ ### Minor Changes
5
+
6
+ - b299a91: An audio challenge, offered only as an accessibility alternative, like reCAPTCHA's audio option. The user hears a short sequence of spoken digits and types them in.
7
+
8
+ It is off by default and needs two switches. Prosopo has to turn on the `captchaTypeFeatureFlags.audio` feature flag for the site, which the site owner cannot do, and the site owner has to set `audioAccessibilityEnabled`. When both are on, image, puzzle and icon-order challenges show a "Use audio instead" button. Pressing it swaps the visual challenge for the audio one. After a wrong answer the user stays on audio and gets a fresh clip.
9
+
10
+ Audio is never a captcha type that can be selected or routed to. A site's `captchaType`, traffic-filter categories, Restrict rules and the site-key CLI all reject it, and routing, PoW escalation and the severity tiers leave it out. The provider only serves audio against the visual session the user was already given, and only on a site with both switches on; any other audio request is refused before the session is used up, and a request without a session is always refused.
11
+
12
+ The spoken digits are synthesised by `@prosopo/audio-assets`, so there is no recorded set of clips to collect. The answer never leaves the provider, and a challenge can be submitted and verified only once, even under concurrent requests. `@prosopo/procaptcha-audio` is the widget. It and the "Use audio instead" button are built on the shared widget code in `@prosopo/procaptcha-common`, and the provider side is built on the shared interactive-captcha code that puzzle and icon-order use.
13
+
14
+ The demo playground has audio pages, and there is an end-to-end test for it.
15
+ - e13d7a8: New captcha type: `iconOrder`. The user is shown a frame of icons and a legend, and clicks the legend's icons in the order given.
16
+
17
+ Icon-order is off by default. Only Prosopo can switch it on for a site, with the `captchaTypeFeatureFlags.iconOrder` feature flag; the site owner cannot. A site without the flag is never served icon-order by any route, and the challenge endpoint refuses it. Once the flag is on, the owner can still keep icon-order out of the frictionless flow with `frictionlessTypes.iconOrder`, the same way as image and puzzle.
18
+
19
+ The answer never leaves the provider. Icon positions are stored on the challenge record, and the widget receives only the rendered frame and legend. Grading checks order as well as position, and each icon's hit radius scales with its size. Verifying a token is single-use under concurrent requests.
20
+
21
+ `@prosopo/icon-order-assets` draws the imagery, and `@prosopo/procaptcha-icon-order` is the widget. Its text is translated into every supported language.
22
+
23
+ Puzzle and icon-order now share their server code: challenge and solution handlers, the verify route, the submit and verify pipeline, and the database record methods. The widget code they have in common moves into `@prosopo/procaptcha-common`: the lazy mount wrapper, manager expiry and dispose, spent-session handling, behavioural data encryption and trusted click coordinates. Puzzle's behaviour is unchanged.
24
+
25
+ The demo playground has icon-order pages, and there is an end-to-end test for it.
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [b299a91]
30
+ - Updated dependencies [e13d7a8]
31
+ - Updated dependencies [270395d]
32
+ - @prosopo/types@5.14.0
33
+ - @prosopo/locale@3.8.0
34
+ - @prosopo/user-access-policy@3.14.16
35
+ - @prosopo/common@3.1.63
36
+
37
+ ## 5.8.0
38
+ ### Minor Changes
39
+
40
+ - 1c13037: Add `captchaTypeFeatureFlags` to site settings, starting with `puzzle`. Setting
41
+ `puzzle: false` stops a site being served the puzzle captcha by any path: its
42
+ configured `captchaType`, `frictionlessTypes`, access policies, the traffic
43
+ filter, routing machines, PoW escalation, and puzzle sessions that already
44
+ exist. A site pinned to puzzle gets an image captcha instead (or PoW if image is
45
+ also off). The field is optional and has no stored default, so sites that never
46
+ set it behave exactly as before. The flag is meant for Prosopo staff, not site
47
+ owners.
48
+ - f961dab: Store everything needed to redraw a puzzle, so the portal can show the exact challenge a user was served.
49
+
50
+ Until now a puzzle record kept the target, the origin and the accuracy required (`tolerance`), and
51
+ nothing else. The things that decide what the puzzle actually looked like — how many decoy shapes were
52
+ scattered on it, how dark they were, how big the piece was, and which background was used — were
53
+ picked per challenge and then thrown away. So you could see that someone failed by 11px and had no way
54
+ to know whether they had been handed an easy puzzle or a nasty one.
55
+
56
+ Puzzle records now carry a `render` object with all of it: the difficulty ladder level, the piece size,
57
+ the frame geometry, the five render settings, and the two 128-bit seeds that regenerate the imagery.
58
+ Given those, the portal reproduces the background and the piece byte for byte.
59
+
60
+ To make that possible the renderer had to become reproducible. `renderPuzzle` and `createBackground`
61
+ now take an optional seed and report the one they used, instead of generating one internally and
62
+ discarding it; the background pool hands out each image together with its seed. Default behaviour is
63
+ unchanged — omit the seed and you still get a fresh random one.
64
+
65
+ The ladder level is new on the session too (`puzzleLevel`), because it was computed when the puzzle
66
+ was escalated and never written down anywhere. It is absent when the ladder did not choose the
67
+ puzzle — a site-configured puzzle or a traffic-filter override has no level.
68
+
69
+ The record is patched after the imagery is produced rather than written with the rest of the record,
70
+ because the piece size and the seeds only exist once the render has run, and the target has to be
71
+ durable before it is expressed in pixels. If that patch fails it is logged and ignored: losing a
72
+ diagnostic must not cost the user their solve. Records written before this change, and any challenge
73
+ whose render threw, simply have no `render`.
74
+
75
+ **The seeds are secret.** `puzzle-assets/src/prng.ts` explains why: they regenerate the clean
76
+ background, and a clean background can be diffed against the composite to read the target position
77
+ straight off. They were previously barred from leaving the provider entirely. They may now sit on the
78
+ captcha record, and nowhere else — not in a response, not in a log, not on the session. Anything that
79
+ exposes a puzzle record to a caller has to drop `render.backgroundSeed` and `render.renderSeed`, and
80
+ must not serve them at all while the challenge is still live. The comment in `prng.ts` now says so.
81
+
82
+ Test coverage. Three guards, each confirmed to fail when the thing it protects is broken:
83
+ `renderReplay.unit.test.ts` re-renders from the stored fields and asserts the bytes match, with one
84
+ case per field asserting that changing *only* that field changes the output — so a record missing a
85
+ field cannot pass; `puzzleRenderer.unit.test.ts` replays through the same entry points the portal would
86
+ use, which catches a background paired with the wrong seed; and `schemas.test.ts` asserts every
87
+ sub-field survives a strict-mode mongoose write, since a field absent from the schema is dropped
88
+ silently and would store nothing at all.
89
+ - dcb691b: Add a refresh control to the puzzle captcha.
90
+
91
+ A user who can't solve the puzzle they were given can now ask for a different one, from a button in the puzzle's header. The replacement comes through a new frictionless session, like a wrong answer already does.
92
+
93
+ The widget tells the provider which session was refreshed (`refreshOf`). The provider then records `refreshOf`, `refreshCount` and `refreshedAfterMs` on the new session, so refresh behaviour can be scored later. After three refreshes in a row it serves an image challenge instead, with reason `PUZZLE_REFRESH_LIMIT`. It only does this if the site has image enabled. The switch only goes from puzzle to image, so a client that lies about its refreshes can only make its own challenge harder. A client that leaves the field out gets a normal session, the same as reloading the page.
94
+
95
+ The image widget's reload button now reports itself as a refresh too. That way a user who was moved onto image isn't sent back to the puzzle by their next reload.
96
+
97
+ ### Patch Changes
98
+
99
+ - dd4c27c: Store the whole-SYN fields the tcp-probe sidecar now reports.
100
+
101
+ The sidecar's handshake record grew from 80 to 104 bytes and the tail was reordered (prosopo/Protect#1167). chaddy was updated to read both layouts and to forward the new fields as their own headers (prosopo/chaddy#16, #17); this is the provider side of that, so the values have somewhere to land instead of being dropped at the middleware.
102
+
103
+ Twelve new fields on `Session`, all optional: `tcpOptsKinds`, `tcpOptsPresent`, `tcpOptsCount`, `tcpTsval`, `tcpTsecr`, `tcpFlags`, `tcpDataOffsetResv`, `tcpUrgPtr`, `ipIdent`, `ipTotalLen`, `ipFragFlags`, `ipTos`. They are surfaced on the decision-machine input the same way the existing TCP fields are, so routing and verify rules can read them.
104
+
105
+ `tcpOptsKinds` is stored decoded — the IANA kind number of each TCP option in wire order, `[2, 4, 8, 1, 3]` on an ordinary Linux SYN. The probe emits it packed into a u64, and a u64 reaches 2^64 while a JS number is exact only to 2^53, so the packed form could not be held without rounding; the rounding would land in the low bytes, which are the option kinds themselves. The array holds the same information and is queryable per position. It also replaces the old `tcpOptsOrder`, which packed 4 bits per option and so could not tell MSS from TCP Fast Open, or Window Scale from MD5, and could not represent MPTCP at all.
106
+
107
+ `tcpOptsFlags` and `tcpOptsOrder` are kept and still read. A pronode running an older chaddy still sends them, and years of rows hold them, so removing them would both lose the rollout window and break any routing rule already reading them. They go undefined on new sessions once the fleet is rolled.
108
+
109
+ `tcpTsval` and `tcpTsecr` are written only when the Timestamps option was actually on the SYN. A TSval of 0 is legal and a TSecr of 0 is expected, so neither can use zero to mean absent.
110
+
111
+ Six places named every one of these fields by hand — the middleware's copy onto the request, the session write, and four task files building the decision-machine bag. They now all go through one list, with a compile-time check that every field of `RawTlsSignals` is on it. That is not tidying: the Session projection comment in `@prosopo/types-database` records a field being missed in exactly this way, after which the rules reading it got `undefined` and silently never fired against real traffic.
112
+
113
+ Separately, the provider compose no longer defaults the sidecar to `prosopo/tcp-probe:latest`. The probe's reply is a bare fixed-size struct with no version in it, so the image tag is the only statement of which layout a host serves, and publishing `:latest` would change that on every pronode at the next pull with nobody running a deploy. The default is now the `0.1.1` both Protect inventories already pin.
114
+
115
+ Tests: the new headers all parse; a packed value above 2^53 decodes without losing its low bytes; the kind pairs the old encoding aliased stay distinct; a trailing end-of-option-list terminates the list rather than appearing in it; an all-zero packed value reads as absent rather than as an empty list; malformed and out-of-range values are ignored; the legacy header pair is still read; and a zero is kept rather than dropped, since `ipIdent` 0 and `tcpTsecr` 0 are real readings.
116
+ - Updated dependencies [1c13037]
117
+ - Updated dependencies [f961dab]
118
+ - Updated dependencies [7d57d2a]
119
+ - Updated dependencies [dcb691b]
120
+ - Updated dependencies [80b7780]
121
+ - Updated dependencies [dd4c27c]
122
+ - @prosopo/types@5.13.0
123
+ - @prosopo/locale@3.7.0
124
+ - @prosopo/common@3.1.62
125
+ - @prosopo/user-access-policy@3.14.15
126
+ - @prosopo/logger@2.1.3
127
+
3
128
  ## 5.7.3
4
129
  ### Patch Changes
5
130
 
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2022 PROSOPO LIMITED
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -5,6 +5,8 @@ const require_captcha = require("./types/captcha.cjs");
5
5
  const require_spamEmailDomain = require("./types/spamEmailDomain.cjs");
6
6
  const require_bannedDomain = require("./types/bannedDomain.cjs");
7
7
  exports.AccountSchema = require_client.AccountSchema;
8
+ exports.AudioCaptchaRecordSchema = require_provider.AudioCaptchaRecordSchema;
9
+ exports.AudioRenderSettingsSchema = require_client.AudioRenderSettingsSchema;
8
10
  exports.BannedDomainRecordSchema = require_bannedDomain.BannedDomainRecordSchema;
9
11
  exports.CaptchaRecordSchema = require_provider.CaptchaRecordSchema;
10
12
  exports.ClientContextEntropyRecordSchema = require_provider.ClientContextEntropyRecordSchema;
@@ -14,6 +16,7 @@ exports.CompositeIpAddressRecordSchemaObj = require_provider.CompositeIpAddressR
14
16
  exports.DatasetRecordSchema = require_provider.DatasetRecordSchema;
15
17
  exports.DecisionMachineArtifactRecordSchema = require_provider.DecisionMachineArtifactRecordSchema;
16
18
  exports.IPValidationRulesSchema = require_client.IPValidationRulesSchema;
19
+ exports.IconOrderCaptchaRecordSchema = require_provider.IconOrderCaptchaRecordSchema;
17
20
  exports.PoWCaptchaRecordSchema = require_provider.PoWCaptchaRecordSchema;
18
21
  exports.PuzzleCaptchaRecordSchema = require_provider.PuzzleCaptchaRecordSchema;
19
22
  exports.PuzzleRenderSettingsSchema = require_client.PuzzleRenderSettingsSchema;
@@ -23,6 +26,8 @@ exports.ScheduledTaskSchema = require_provider.ScheduledTaskSchema;
23
26
  exports.SessionRecordSchema = require_provider.SessionRecordSchema;
24
27
  exports.SolutionRecordSchema = require_provider.SolutionRecordSchema;
25
28
  exports.SpamEmailDomainRecordSchema = require_spamEmailDomain.SpamEmailDomainRecordSchema;
29
+ exports.StoredAudioCaptchaRecordSchema = require_captcha.StoredAudioCaptchaRecordSchema;
30
+ exports.StoredIconOrderCaptchaRecordSchema = require_captcha.StoredIconOrderCaptchaRecordSchema;
26
31
  exports.StoredPoWCaptchaRecordSchema = require_captcha.StoredPoWCaptchaRecordSchema;
27
32
  exports.StoredPuzzleCaptchaRecordSchema = require_captcha.StoredPuzzleCaptchaRecordSchema;
28
33
  exports.StoredSessionRecordSchema = require_captcha.StoredSessionRecordSchema;
@@ -8,7 +8,13 @@ var StoredPoWCaptchaRecordSchema = new mongoose.Schema({ ...require_provider.PoW
8
8
  StoredPoWCaptchaRecordSchema.index({ sessionId: 1 });
9
9
  var StoredPuzzleCaptchaRecordSchema = new mongoose.Schema({ ...require_provider.PuzzleCaptchaRecordSchema.obj });
10
10
  StoredPuzzleCaptchaRecordSchema.index({ sessionId: 1 });
11
+ var StoredAudioCaptchaRecordSchema = new mongoose.Schema({ ...require_provider.AudioCaptchaRecordSchema.obj });
12
+ StoredAudioCaptchaRecordSchema.index({ sessionId: 1 });
13
+ var StoredIconOrderCaptchaRecordSchema = new mongoose.Schema({ ...require_provider.IconOrderCaptchaRecordSchema.obj });
14
+ StoredIconOrderCaptchaRecordSchema.index({ sessionId: 1 });
11
15
  //#endregion
16
+ exports.StoredAudioCaptchaRecordSchema = StoredAudioCaptchaRecordSchema;
17
+ exports.StoredIconOrderCaptchaRecordSchema = StoredIconOrderCaptchaRecordSchema;
12
18
  exports.StoredPoWCaptchaRecordSchema = StoredPoWCaptchaRecordSchema;
13
19
  exports.StoredPuzzleCaptchaRecordSchema = StoredPuzzleCaptchaRecordSchema;
14
20
  exports.StoredSessionRecordSchema = StoredSessionRecordSchema;
@@ -119,6 +119,45 @@ var PuzzleRenderSettingsSchema = new mongoose.Schema({
119
119
  required: false
120
120
  }
121
121
  }, { _id: false });
122
+ var AudioRenderSettingsSchema = new mongoose.Schema({
123
+ digitCount: {
124
+ type: Number,
125
+ min: 3,
126
+ max: 8,
127
+ required: false
128
+ },
129
+ noiseSnrDb: {
130
+ type: Number,
131
+ min: 3,
132
+ max: 60,
133
+ required: false
134
+ },
135
+ babbleGain: {
136
+ type: Number,
137
+ min: 0,
138
+ max: .6,
139
+ required: false
140
+ },
141
+ babbleVoices: {
142
+ type: Number,
143
+ min: 0,
144
+ max: 4,
145
+ required: false
146
+ },
147
+ reverbMix: {
148
+ type: Number,
149
+ min: 0,
150
+ max: .6,
151
+ required: false
152
+ },
153
+ gapMs: {
154
+ type: Number,
155
+ min: 0,
156
+ max: 1500,
157
+ required: false
158
+ }
159
+ }, { _id: false });
160
+ var SELECTABLE_CAPTCHA_TYPES = Object.values(_prosopo_types.CaptchaType).filter((captchaType) => captchaType !== _prosopo_types.CaptchaType.audio);
122
161
  var TrafficCategoryPolicySchema = new mongoose.Schema({
123
162
  action: {
124
163
  type: String,
@@ -127,7 +166,7 @@ var TrafficCategoryPolicySchema = new mongoose.Schema({
127
166
  },
128
167
  captchaType: {
129
168
  type: String,
130
- enum: _prosopo_types.CaptchaType,
169
+ enum: SELECTABLE_CAPTCHA_TYPES,
131
170
  required: false
132
171
  },
133
172
  powDifficulty: {
@@ -148,15 +187,27 @@ var TrafficCategoryPolicySchema = new mongoose.Schema({
148
187
  max: _prosopo_types.MAX_PAD_BYTES,
149
188
  required: false
150
189
  },
190
+ iconOrderTolerance: {
191
+ type: Number,
192
+ required: false
193
+ },
194
+ iconOrder: {
195
+ type: mongoose.Schema.Types.Mixed,
196
+ required: false
197
+ },
151
198
  puzzle: {
152
199
  type: PuzzleRenderSettingsSchema,
153
200
  required: false
201
+ },
202
+ audio: {
203
+ type: AudioRenderSettingsSchema,
204
+ required: false
154
205
  }
155
206
  }, { _id: false });
156
207
  var UserSettingsSchema = new mongoose.Schema({
157
208
  captchaType: {
158
209
  type: String,
159
- enum: _prosopo_types.CaptchaType,
210
+ enum: SELECTABLE_CAPTCHA_TYPES,
160
211
  default: _prosopo_types.captchaTypeDefault
161
212
  },
162
213
  verifiedTimeout: {
@@ -180,10 +231,31 @@ var UserSettingsSchema = new mongoose.Schema({
180
231
  puzzle: {
181
232
  type: Boolean,
182
233
  default: true
234
+ },
235
+ iconOrder: {
236
+ type: Boolean,
237
+ default: true
183
238
  }
184
239
  }, { _id: false }),
185
240
  default: () => ({ ..._prosopo_types.frictionlessTypesDefault })
186
241
  },
242
+ captchaTypeFeatureFlags: {
243
+ type: new mongoose.Schema({
244
+ puzzle: {
245
+ type: Boolean,
246
+ required: false
247
+ },
248
+ iconOrder: {
249
+ type: Boolean,
250
+ required: false
251
+ },
252
+ audio: {
253
+ type: Boolean,
254
+ required: false
255
+ }
256
+ }, { _id: false }),
257
+ required: false
258
+ },
187
259
  powDifficulty: {
188
260
  type: Number,
189
261
  default: _prosopo_types.powDifficultyDefault
@@ -206,6 +278,14 @@ var UserSettingsSchema = new mongoose.Schema({
206
278
  type: Number,
207
279
  required: false
208
280
  },
281
+ iconOrderTolerance: {
282
+ type: Number,
283
+ required: false
284
+ },
285
+ iconOrder: {
286
+ type: mongoose.Schema.Types.Mixed,
287
+ required: false
288
+ },
209
289
  puzzleMaxDifficulty: {
210
290
  type: Number,
211
291
  min: 0,
@@ -216,6 +296,14 @@ var UserSettingsSchema = new mongoose.Schema({
216
296
  type: PuzzleRenderSettingsSchema,
217
297
  required: false
218
298
  },
299
+ audio: {
300
+ type: AudioRenderSettingsSchema,
301
+ required: false
302
+ },
303
+ audioAccessibilityEnabled: {
304
+ type: Boolean,
305
+ required: false
306
+ },
219
307
  ipValidationRules: IPValidationRulesSchema,
220
308
  domains: {
221
309
  type: [String],
@@ -393,6 +481,7 @@ var AccountSchema = new mongoose.Schema({
393
481
  captchaType: String,
394
482
  frictionlessThreshold: mongoose.Schema.Types.Mixed,
395
483
  frictionlessTypes: mongoose.Schema.Types.Mixed,
484
+ captchaTypeFeatureFlags: mongoose.Schema.Types.Mixed,
396
485
  ipValidationRules: IPValidationRulesSchema
397
486
  },
398
487
  createdAt: Number,
@@ -407,6 +496,7 @@ var TableNames = /* @__PURE__ */ function(TableNames) {
407
496
  }({});
408
497
  //#endregion
409
498
  exports.AccountSchema = AccountSchema;
499
+ exports.AudioRenderSettingsSchema = AudioRenderSettingsSchema;
410
500
  exports.IPValidationRulesSchema = IPValidationRulesSchema;
411
501
  exports.PuzzleRenderSettingsSchema = PuzzleRenderSettingsSchema;
412
502
  exports.TableNames = TableNames;