@prosopo/procaptcha-frictionless 2.15.0 → 2.16.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.
Files changed (52) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +11 -10
  2. package/.turbo/turbo-build$colon$tsc.log +24 -24
  3. package/.turbo/turbo-build.log +13 -12
  4. package/CHANGELOG.md +73 -0
  5. package/dist/AuthenticatedBadge.d.ts +12 -0
  6. package/dist/AuthenticatedBadge.d.ts.map +1 -0
  7. package/dist/AuthenticatedBadge.js +75 -0
  8. package/dist/AuthenticatedBadge.js.map +1 -0
  9. package/dist/ProcaptchaFrictionless.d.ts.map +1 -1
  10. package/dist/ProcaptchaFrictionless.js +35 -9
  11. package/dist/ProcaptchaFrictionless.js.map +1 -1
  12. package/dist/cjs/AuthenticatedBadge.cjs +75 -0
  13. package/dist/cjs/ProcaptchaFrictionless.cjs +35 -9
  14. package/dist/cjs/customDetectBot.cjs +3 -1
  15. package/dist/cjs/detectorLoader.cjs +42 -13
  16. package/dist/cjs/sessionInvalidatedRecovery.cjs +16 -9
  17. package/dist/customDetectBot.d.ts.map +1 -1
  18. package/dist/customDetectBot.js +3 -1
  19. package/dist/customDetectBot.js.map +1 -1
  20. package/dist/detectorLoader.d.ts +2 -1
  21. package/dist/detectorLoader.d.ts.map +1 -1
  22. package/dist/detectorLoader.js +42 -13
  23. package/dist/detectorLoader.js.map +1 -1
  24. package/dist/sessionInvalidatedRecovery.d.ts +3 -1
  25. package/dist/sessionInvalidatedRecovery.d.ts.map +1 -1
  26. package/dist/sessionInvalidatedRecovery.js +16 -9
  27. package/dist/sessionInvalidatedRecovery.js.map +1 -1
  28. package/dist/tests/detectorLoader.test.d.ts +2 -0
  29. package/dist/tests/detectorLoader.test.d.ts.map +1 -0
  30. package/dist/tests/detectorLoader.test.js +67 -0
  31. package/dist/tests/detectorLoader.test.js.map +1 -0
  32. package/dist/tests/escalationHandoff.integration.test.d.ts +5 -0
  33. package/dist/tests/escalationHandoff.integration.test.d.ts.map +1 -0
  34. package/dist/tests/escalationHandoff.integration.test.js +216 -0
  35. package/dist/tests/escalationHandoff.integration.test.js.map +1 -0
  36. package/dist/tests/sessionInvalidatedRecovery.test.js +41 -21
  37. package/dist/tests/sessionInvalidatedRecovery.test.js.map +1 -1
  38. package/dist/tests/sessionInvalidatedRemint.test.d.ts +5 -0
  39. package/dist/tests/sessionInvalidatedRemint.test.d.ts.map +1 -0
  40. package/dist/tests/sessionInvalidatedRemint.test.js +150 -0
  41. package/dist/tests/sessionInvalidatedRemint.test.js.map +1 -0
  42. package/package.json +8 -8
  43. package/src/AuthenticatedBadge.tsx +141 -0
  44. package/src/ProcaptchaFrictionless.tsx +85 -16
  45. package/src/customDetectBot.ts +2 -0
  46. package/src/detectorLoader.ts +52 -12
  47. package/src/sessionInvalidatedRecovery.ts +30 -10
  48. package/src/tests/detectorLoader.test.ts +108 -0
  49. package/src/tests/escalationHandoff.integration.test.tsx +354 -0
  50. package/src/tests/sessionInvalidatedRecovery.test.ts +49 -21
  51. package/src/tests/sessionInvalidatedRemint.test.tsx +245 -0
  52. package/tsconfig.tsbuildinfo +1 -1
@@ -1,5 +1,5 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.15.0 build:cjs
2
+ > @prosopo/procaptcha-frictionless@2.16.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: .
@@ -53,15 +53,16 @@ ViteCommonJSConfig: .
53
53
  vite v8.1.5 building ssr environment for production...
54
54
  Bundle build started
55
55
  
56
- 8 modules transformed.
56
+ 9 modules transformed.
57
57
  rendering chunks...
58
58
  computing gzip size...
59
- dist/cjs/index.cjs 0.54 kB │ gzip: 0.21 kB
60
- dist/cjs/detectorLoader.cjs 0.62 kB │ gzip: 0.40 kB
61
- dist/cjs/frictionlessResultGuard.cjs 1.55 kB │ gzip: 0.80 kB
62
- dist/cjs/sessionInvalidatedRecovery.cjs 2.35 kB │ gzip: 1.07 kB
63
- dist/cjs/detectorPrefetch.cjs 2.98 kB │ gzip: 1.35 kB
64
- dist/cjs/customDetectBot.cjs 5.55 kB │ gzip: 1.70 kB
65
- dist/cjs/ProcaptchaFrictionless.cjs 9.55 kB │ gzip: 2.59 kB
59
+ dist/cjs/index.cjs 0.54 kB │ gzip: 0.21 kB
60
+ dist/cjs/frictionlessResultGuard.cjs 1.55 kB │ gzip: 0.80 kB
61
+ dist/cjs/detectorLoader.cjs 1.65 kB │ gzip: 0.90 kB
62
+ dist/cjs/sessionInvalidatedRecovery.cjs 2.50 kB │ gzip: 1.14 kB
63
+ dist/cjs/AuthenticatedBadge.cjs 2.69 kB │ gzip: 1.08 kB
64
+ dist/cjs/detectorPrefetch.cjs 2.98 kB │ gzip: 1.35 kB
65
+ dist/cjs/customDetectBot.cjs 5.60 kB │ gzip: 1.71 kB
66
+ dist/cjs/ProcaptchaFrictionless.cjs 10.75 kB │ gzip: 2.84 kB
66
67
 
67
- ✓ built in 48ms
68
+ ✓ built in 43ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.15.0 build:tsc
2
+ > @prosopo/procaptcha-frictionless@2.16.0 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 1:15:48 PM - Projects in this build:
5
+ 11:41:16 AM - Projects in this build:
6
6
  * ../../dev/config/tsconfig.json
7
7
  * ../locale/tsconfig.json
8
8
  * ../util/tsconfig.json
@@ -25,47 +25,47 @@
25
25
  * ../procaptcha-react/tsconfig.json
26
26
  * tsconfig.json
27
27
 
28
- 1:15:48 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'
28
+ 11:41:16 AM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/vite/vite.backend.config.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
29
29
 
30
- 1:15:48 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
30
+ 11:41:16 AM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
31
31
 
32
- 1:15:48 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
32
+ 11:41:16 AM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
33
33
 
34
- 1:15:48 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'
34
+ 11:41:16 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'
35
35
 
36
- 1:15:48 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'
36
+ 11:41:16 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'
37
37
 
38
- 1:15:48 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/tests/apiHarness.ts' is older than output '../api/tsconfig.tsbuildinfo'
38
+ 11:41:16 AM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
39
39
 
40
- 1:15:48 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
40
+ 11:41:16 AM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
41
41
 
42
- 1:15:48 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/utils/batches.ts' is older than output '../common/tsconfig.tsbuildinfo'
42
+ 11:41:16 AM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
43
43
 
44
- 1:15:48 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
44
+ 11:41:16 AM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/hashing.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
45
45
 
46
- 1:15:48 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
46
+ 11:41:16 AM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
47
47
 
48
- 1:15:48 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'
48
+ 11:41:16 AM - 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'
49
49
 
50
- 1:15:48 PM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/index.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
50
+ 11:41:16 AM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/theme.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
51
51
 
52
- 1:15:48 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/keyring/keyring.test.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
52
+ 11:41:16 AM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/index.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
53
53
 
54
- 1:15:48 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/custom.d.ts' is older than output '../account/tsconfig.tsbuildinfo'
54
+ 11:41:16 AM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/custom.d.ts' is older than output '../account/tsconfig.tsbuildinfo'
55
55
 
56
- 1:15:48 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/tests/challengeSurfaceRender.unit.test.tsx' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
56
+ 11:41:16 AM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/tests/challengeSurfaceRender.unit.test.tsx' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
57
57
 
58
- 1:15:48 PM - 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'
58
+ 11:41:16 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'
59
59
 
60
- 1:15:48 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'
60
+ 11:41:16 AM - 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'
61
61
 
62
- 1:15:48 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'
62
+ 11:41:16 AM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/mocks/data/captchas.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
63
63
 
64
- 1:15:48 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/Manager.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
64
+ 11:41:16 AM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/tests/manager.unit.test.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
65
65
 
66
- 1:15:49 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'
66
+ 11:41:16 AM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/tests/captchaComponent.unit.test.tsx' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
67
67
 
68
- 1:15:49 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
68
+ 11:41:16 AM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
69
69
 
70
- 1:15:49 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
70
+ 11:41:16 AM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
71
71
 
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.15.0 build
2
+ > @prosopo/procaptcha-frictionless@2.16.0 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/procaptcha-frictionless@2.15.0 build:cross-env
6
+ > @prosopo/procaptcha-frictionless@2.16.0 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
@@ -57,16 +57,17 @@ ViteEsmConfig: .
57
57
  vite v8.1.5 building ssr environment for production...
58
58
  Bundle build started
59
59
  
60
- 8 modules transformed.
60
+ 9 modules transformed.
61
61
  rendering chunks...
62
62
  computing gzip size...
63
- dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
64
- dist/index.js 0.32 kB │ gzip: 0.15 kB
65
- dist/detectorLoader.js 0.60 kB │ gzip: 0.39 kB
66
- dist/frictionlessResultGuard.js 1.48 kB │ gzip: 0.80 kB
67
- dist/sessionInvalidatedRecovery.js 2.26 kB │ gzip: 1.05 kB
68
- dist/detectorPrefetch.js 2.86 kB │ gzip: 1.32 kB
69
- dist/customDetectBot.js 5.37 kB │ gzip: 1.67 kB
70
- dist/ProcaptchaFrictionless.js 8.89 kB │ gzip: 2.55 kB
63
+ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
64
+ dist/index.js 0.32 kB │ gzip: 0.15 kB
65
+ dist/frictionlessResultGuard.js 1.48 kB │ gzip: 0.80 kB
66
+ dist/detectorLoader.js 1.63 kB │ gzip: 0.90 kB
67
+ dist/AuthenticatedBadge.js 2.28 kB │ gzip: 1.04 kB
68
+ dist/sessionInvalidatedRecovery.js 2.41 kB │ gzip: 1.13 kB
69
+ dist/detectorPrefetch.js 2.86 kB │ gzip: 1.32 kB
70
+ dist/customDetectBot.js 5.42 kB │ gzip: 1.68 kB
71
+ dist/ProcaptchaFrictionless.js 10.01 kB │ gzip: 2.80 kB
71
72
 
72
- ✓ built in 61ms
73
+ ✓ built in 42ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,78 @@
1
1
  # @prosopo/procaptcha-frictionless
2
2
 
3
+ ## 2.16.0
4
+ ### Minor Changes
5
+
6
+ - af267c2: Web Bot Auth verifier and an authenticated frictionless flow for pre-verified agents.
7
+
8
+ **`@prosopo/web-bot-auth`** — a new package: an RFC 9421 HTTP Message Signatures verifier built on `@noble/curves/ed25519`, with no Cloudflare dependency. It parses `Signature-Agent` in both its bare-string and dictionary forms, resolves the signer's JWKS at `/.well-known/http-message-signatures-directory` honouring the response's cache-control TTL, and verifies the Ed25519 signature over the RFC 9421 signature base.
9
+
10
+ **Provider fast path.** `/captcha/frictionless` returns `captchaType: authenticated` when a non-`deferToVerify` `AccessPolicyType.Allow` rule matches the request's user scope, and writes a session with `serverChecked: false`, `agent: true` and the issuing IP frozen for verify-time binding. Decrypt, bot score and the decision machine are all skipped. A verified `Signature-Agent` is one way to qualify — the userScope gains a `webBotAuthAgent` field, set only when signature verification succeeded so a rule scoped to a signer can never be matched by a spoofed header — but an IP CIDR, JA4, user agent, ASN or country rule qualifies the same way. A `Block` or `Restrict` on the same match set always wins, because severity outranks Allow.
11
+
12
+ **`/client/authenticated/verify`.** A separate router with mandatory IP binding — the operator must forward the client IP (`API.AUTHENTICATED_IP_REQUIRED`) and it must match the one the session was issued to (`API.AUTHENTICATED_IP_MISMATCH`), so a leaked token cannot be replayed from elsewhere. Single use is enforced through `serverChecked`, and `captchaType` is checked so an ordinary captcha token cannot be redeemed on this route. `clientSessionId` correlation goes through the same `isClientSessionMismatch` helper as pow / image / puzzle, so the authenticated path cannot drift from the others.
13
+
14
+ **Surface.** `AccessPolicyType.Allow` and `CaptchaType.authenticated`; `webBotAuthAgent` on the user scope (indexed, normalised at parse time to a lowercase scheme+host with no trailing slash); `Session.agent` / `Session.webBotAuthAgent` for the Traffic view's "pre-verified pass" filter; `submitAuthenticatedCaptchaVerify` on `ProviderApi` and the matching branch in `@prosopo/server.verifyProvider`; `AuthenticatedBadge` and a dispatch branch in `procaptcha-frictionless`.
15
+
16
+ Three fixes the new end-to-end coverage turned up, each of which broke the flow outright:
17
+
18
+ - `ipMatchesSession` compared the operator's parsed IP against the session's composite halves with `===`. A session read back from Mongo carries BSON (`Decimal128`, or `Long` on pre-migration records), not the `bigint` the type claims, so the comparison was false for every session that had been through the database — every legitimate redemption was rejected as `API.AUTHENTICATED_IP_MISMATCH`. Both halves are now normalised before comparison, and an unparseable half fails closed rather than defaulting to `0n`, so garbage still cannot match garbage.
19
+ - `serverChecked` was never written onto the authenticated session, so "never set" and "consumed" were distinguishable only by an absence. It is now written as `false` at issuance.
20
+ - `serverChecked` was missing from `SESSION_PROJECTION`. Left out, the single-use check reads `undefined` and an authenticated token verifies an unlimited number of times.
21
+
22
+ ### Patch Changes
23
+
24
+ - 6c5b82f: Fall back to a `data:` URL when `blob:` is blocked, so a CSP that permits one scheme keeps the detector.
25
+
26
+ `DetectorLoaderFromScript` imported the provider-served module text from a blob URL only. `blob:` and `data:` are gated by different CSP directives and sites commonly allow one without the other — a `script-src` of `*` matches neither, and a policy listing `data:` for scripts with `blob:` only under `worker-src` blocks the blob path outright. On such an origin the import threw, the caller fell through to its no-detector path, and the session sent no detector session id, no token and no head hash, so the provider recorded `MISSING_TOKEN` and served a challenge the session could not pass frictionlessly.
27
+
28
+ - Percent-encoding rather than base64: the module is several hundred KB and `btoa(String.fromCharCode(...bytes))` overflows the call stack at that size.
29
+ - The blob URL is revoked on every path, including when its own import fails.
30
+ - `/* webpackIgnore: true */` sits alongside `/* @vite-ignore */`. Neither is redundant — `@vite-ignore` stops Vite analysing a non-literal specifier, `webpackIgnore` stops webpack rewriting it into a context module that cannot resolve a blob or data URL at runtime.
31
+ - The import is injected as `ModuleImporter` so the fallback is testable without a real dynamic import.
32
+
33
+ Known gap, not addressed here: `removeComments` in the shared build config strips both pragmas from `dist/`, so consumers bundling this package from npm still receive a bare `import(url)`. Emitting comments would leak source comments into shipped output, so that needs a mechanism which does not rely on a comment surviving compilation.
34
+ - Updated dependencies [929d99b]
35
+ - Updated dependencies [934fa5d]
36
+ - Updated dependencies [27f525e]
37
+ - Updated dependencies [af267c2]
38
+ - @prosopo/types@5.8.0
39
+ - @prosopo/api@4.2.0
40
+ - @prosopo/procaptcha-common@2.13.1
41
+ - @prosopo/procaptcha-pow@2.12.1
42
+ - @prosopo/procaptcha-puzzle@2.12.1
43
+ - @prosopo/procaptcha-react@2.10.2
44
+
45
+ ## 2.15.1
46
+ ### Patch Changes
47
+
48
+ - 46cca63: Make the post-PoW escalation handoff idempotent.
49
+
50
+ Follow-up to the `CAPTCHA.NO_SESSION_FOUND` recovery fix: this is the other producer of the duplicate `/captcha/image` POST that fix had to recover from.
51
+
52
+ Production, 2026-09-07, the same affected user:
53
+
54
+ ```
55
+ 11:27:49.910 POST /pow/solution 200 escalation envelope returned
56
+ 11:27:50.263 POST /captcha/image 200 escalation session issued
57
+ 11:27:55.030 POST /captcha/image 400 CAPTCHA.NO_SESSION_FOUND, same session
58
+ ```
59
+
60
+ The provider mints exactly one escalation session per PoW solution and consumes it on the first challenge fetch. The PoW manager fires `onEscalate` from inside its `providerRetry`-wrapped `submit()`, so a throw anywhere after the handoff re-runs `submit()` and escalates a second time on the same envelope — mounting a second image widget against a session the first one already spent. `onEscalate` now ignores a repeat handoff for a sessionId it has already mounted; a genuinely new escalation session is still followed.
61
+
62
+ Adds `escalationHandoff.integration.test.tsx`, which drives the real `ProcaptchaFrictionless` wrapper into the real image widget and its real `Manager` with only the network stubbed. The stub enforces the provider's one-shot session contract and returns the `NO_SESSION_FOUND` envelope in the response body rather than throwing — `HttpClientBase` only throws when a failure isn't JSON, so a 400 from the provider arrives as `challenge.error`, which is what the widget's recovery path keys off.
63
+ - 9e06d72: Stop `CAPTCHA.NO_SESSION_FOUND` leaving the widget on a dead checkbox.
64
+
65
+ Users reported a checkbox reading "No session found" that never recovered, usually after pressing the image-challenge reload button. Provider logs show the shape clearly: `POST /captcha/image` returns 200 and issues a challenge, then 2-6 seconds later the *same* sessionId is POSTed again and the provider answers 400 `CAPTCHA.NO_SESSION_FOUND` — `checkAndRemoveSession` consumed the session when it issued the first challenge, so a second challenge fetch on that id can never succeed.
66
+
67
+ Three defects combined to turn that into a permanent dead end.
68
+
69
+ - **The manager re-sent a sessionId it had already spent.** `defaultState()` doesn't clear `sessionId` and `buildUpdateState` skips `undefined`, so a stale id survives `resetState()` and any path that re-enters `start()` re-sends it. `Manager` now remembers the id it exchanged for a challenge and, rather than making a request it knows the provider will reject, routes straight to the `CAPTCHA.NO_SESSION_FOUND` state the wrapper already listens for.
70
+
71
+ - **Recovery was one-shot per outer widget lifetime and had no terminal branch.** `ProcaptchaWidget` always takes the `onSessionInvalidated` branch and returns before its own `frictionlessState.restart()` fallback, and its guard ref is fresh on every re-mount because the wrapper bumps the mount key. So once the wrapper's one-shot was spent, the second failure was handled by nobody: no re-mint, no restart, no message — just a stuck checkbox. `handleSessionInvalidated` is now a bounded counter (`MAX_SESSION_INVALIDATED_RETRIES`) rather than a boolean, it reports `exhausted` to the caller, a reload press clears it (a reload mints a genuinely new session, so it shouldn't spend the budget for the old one), and exhaustion falls over visibly through `fallOverWithStyle` — which schedules the existing 10-second full restart, so there is always a way back.
72
+
73
+ - **`resetState(0)` never reset anything.** `0 || stateRef.current.attemptCount` kept the old count, so `attemptCount` accumulated across every re-mint and `start()`'s own `attemptCount >= 5` fall-over fired after five *cumulative* runs in a widget lifetime. Five successful reload presses were enough to drop the user onto the error placeholder. Now `??`, so callers passing literal `0` get the reset they asked for.
74
+ - @prosopo/procaptcha-react@2.10.1
75
+
3
76
  ## 2.15.0
4
77
  ### Minor Changes
5
78
 
@@ -0,0 +1,12 @@
1
+ import { type Account, type ProcaptchaCallbacks, type RandomProvider } from "@prosopo/types";
2
+ import { type FC } from "react";
3
+ export type AuthenticatedBadgeProps = {
4
+ sessionId: string;
5
+ agent?: string;
6
+ dapp: string;
7
+ userAccount: Account;
8
+ provider: RandomProvider;
9
+ callbacks: ProcaptchaCallbacks;
10
+ };
11
+ export declare const AuthenticatedBadge: FC<AuthenticatedBadgeProps>;
12
+ //# sourceMappingURL=AuthenticatedBadge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticatedBadge.d.ts","sourceRoot":"","sources":["../src/AuthenticatedBadge.tsx"],"names":[],"mappings":"AA4BA,OAAO,EACN,KAAK,OAAO,EAGZ,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAEnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,EAAqB,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,mBAAmB,CAAC;CAC/B,CAAC;AAWF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAoF1D,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { getDefaultEvents } from "@prosopo/procaptcha-common";
2
+ import { ApiParams, CaptchaType, encodeProcaptchaOutput } from "@prosopo/types";
3
+ import { useEffect, useRef } from "react";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/AuthenticatedBadge.tsx
6
+ var displayHost = (agent) => {
7
+ if (!agent) return "unknown";
8
+ try {
9
+ return new URL(agent).hostname;
10
+ } catch {
11
+ return agent;
12
+ }
13
+ };
14
+ var AuthenticatedBadge = ({ sessionId, agent, dapp, userAccount, provider, callbacks }) => {
15
+ const emittedRef = useRef(false);
16
+ useEffect(() => {
17
+ if (emittedRef.current) return;
18
+ emittedRef.current = true;
19
+ const events = getDefaultEvents(callbacks);
20
+ const token = encodeProcaptchaOutput({
21
+ [ApiParams.providerUrl]: provider.provider.url,
22
+ [ApiParams.user]: userAccount.account.address,
23
+ [ApiParams.dapp]: dapp,
24
+ [ApiParams.commitmentId]: sessionId,
25
+ [ApiParams.timestamp]: Date.now().toString(),
26
+ [ApiParams.signature]: {
27
+ [ApiParams.provider]: {},
28
+ [ApiParams.user]: {}
29
+ },
30
+ [ApiParams.captchaType]: CaptchaType.authenticated
31
+ });
32
+ events.onHuman(token);
33
+ }, [
34
+ sessionId,
35
+ dapp,
36
+ userAccount,
37
+ provider,
38
+ callbacks
39
+ ]);
40
+ return /* @__PURE__ */ jsxs("div", {
41
+ style: {
42
+ display: "inline-flex",
43
+ alignItems: "center",
44
+ gap: 8,
45
+ padding: "8px 12px",
46
+ borderRadius: 6,
47
+ background: "#eef2ff",
48
+ border: "1px solid #c7d2fe",
49
+ color: "#3730a3",
50
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
51
+ fontSize: 13,
52
+ lineHeight: 1.4
53
+ },
54
+ role: "status",
55
+ "aria-label": "Verified agent",
56
+ children: [/* @__PURE__ */ jsxs("svg", {
57
+ width: "16",
58
+ height: "16",
59
+ viewBox: "0 0 24 24",
60
+ fill: "none",
61
+ stroke: "currentColor",
62
+ strokeWidth: "2.5",
63
+ strokeLinecap: "round",
64
+ strokeLinejoin: "round",
65
+ "aria-hidden": "true",
66
+ children: [/* @__PURE__ */ jsx("title", { children: "Verified" }), /* @__PURE__ */ jsx("path", { d: "M20 6L9 17l-5-5" })]
67
+ }), /* @__PURE__ */ jsx("span", { children: agent ? /* @__PURE__ */ jsxs(Fragment, { children: [
68
+ /* @__PURE__ */ jsx("strong", { children: "Verified agent" }),
69
+ ": ",
70
+ displayHost(agent)
71
+ ] }) : /* @__PURE__ */ jsx("strong", { children: "Trusted request" }) })]
72
+ });
73
+ };
74
+ //#endregion
75
+ export { AuthenticatedBadge };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticatedBadge.js","sourceRoot":"","sources":["../src/AuthenticatedBadge.tsx"],"names":[],"mappings":";AA2BA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAEN,SAAS,EACT,WAAW,EAGX,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAW,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAWnD,MAAM,WAAW,GAAG,CAAC,KAAc,EAAU,EAAE;IAC9C,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,IAAI,CAAC;QACJ,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAgC,CAAC,EAC/D,SAAS,EACT,KAAK,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,SAAS,GACT,EAAE,EAAE;IAKJ,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAEj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C,QAAQ,gBACF,gBAAgB,aAE3B,eACC,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,MAAM,aAElB,uCAAuB,EACvB,eAAM,CAAC,EAAC,iBAAiB,GAAG,IACvB,EACN,yBACE,KAAK,CAAC,CAAC,CAAC,CACR,8BACC,8CAA+B,QAAG,WAAW,CAAC,KAAK,CAAC,IAClD,CACH,CAAC,CAAC,CAAC,CAKH,+CAAgC,CAChC,GACK,IACF,CACN,CAAC;AACH,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ProcaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAMN,KAAK,2BAA2B,EAGhC,MAAM,gBAAgB,CAAC;AAoExB,eAAO,MAAM,sBAAsB,gEAOhC,2BAA2B,gCA2X7B,CAAC"}
1
+ {"version":3,"file":"ProcaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAMN,KAAK,2BAA2B,EAGhC,MAAM,gBAAgB,CAAC;AAuExB,eAAO,MAAM,sBAAsB,gEAOhC,2BAA2B,gCA6b7B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { AuthenticatedBadge } from "./AuthenticatedBadge.js";
1
2
  import customDetectBot from "./customDetectBot.js";
2
3
  import { evaluateFrictionlessResult } from "./frictionlessResultGuard.js";
3
4
  import { consumeRetryMountProps, handleSessionInvalidated, normaliseRetryCoords } from "./sessionInvalidatedRecovery.js";
@@ -8,6 +9,7 @@ import { darkTheme, lightTheme } from "@prosopo/widget-skeleton";
8
9
  import { useEffect, useRef, useState } from "react";
9
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
11
  //#region src/ProcaptchaFrictionless.tsx
12
+ var NO_SESSION_FOUND_KEY = "CAPTCHA.NO_SESSION_FOUND";
11
13
  var ProcaptchaLoader = async () => (await import("@prosopo/procaptcha-react")).Procaptcha;
12
14
  var ProcaptchaPuzzleLoader = async () => (await import("@prosopo/procaptcha-puzzle")).ProcaptchaPuzzle;
13
15
  var ProcaptchaPowLoader = async () => (await import("@prosopo/procaptcha-pow")).ProcaptchaPow;
@@ -28,13 +30,14 @@ var renderPlaceholder = (theme, mode, errorMessage, isTranslationLoaded, transla
28
30
  };
29
31
  var defaultLoadingState = (attemptCount) => ({
30
32
  loading: false,
31
- attemptCount: attemptCount || 0
33
+ attemptCount
32
34
  });
33
35
  var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = customDetectBot, container }) => {
34
36
  const stateRef = useRef(defaultLoadingState(0));
35
37
  const events = getDefaultEvents(callbacks);
36
38
  const pendingRetryCoordsRef = useRef(null);
37
- const sessionInvalidatedFiredRef = useRef(false);
39
+ const sessionInvalidatedAttemptsRef = useRef(0);
40
+ const escalatedSessionIdsRef = useRef(/* @__PURE__ */ new Set());
38
41
  const mountCountRef = useRef(0);
39
42
  const nextMountAutoStartRef = useRef(false);
40
43
  const manualStart = config.startMode === StartModeEnum.manual;
@@ -50,7 +53,7 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
50
53
  }, [i18n, config.language]);
51
54
  const [componentToRender, setComponentToRender] = useState(renderPlaceholder(config.theme, config.mode, stateRef.current.errorMessage, i18n.isInitialized, i18n.t, !manualStart, manualStart ? (event) => manualCheckboxHandlerRef.current(event) : void 0));
52
55
  const resetState = (attemptCount) => {
53
- stateRef.current = defaultLoadingState(attemptCount || stateRef.current.attemptCount);
56
+ stateRef.current = defaultLoadingState(attemptCount ?? stateRef.current.attemptCount);
54
57
  };
55
58
  const fallOverWithStyle = (errorMessage, errorKey) => {
56
59
  if (errorKey === "CAPTCHA.NO_SESSION_FOUND") setTimeout(() => {
@@ -67,20 +70,28 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
67
70
  };
68
71
  const renderForCaptchaType = async (captchaType, frictionlessState, autoStart = false, escalationCoords) => {
69
72
  const onEscalate = (next, newSessionId, coords) => {
73
+ if (escalatedSessionIdsRef.current.has(newSessionId)) return;
74
+ escalatedSessionIdsRef.current.add(newSessionId);
70
75
  renderForCaptchaType(next, {
71
76
  ...frictionlessState,
72
77
  sessionId: newSessionId
73
78
  }, true, coords);
74
79
  };
75
80
  const onSessionInvalidated = (x, y) => {
76
- const { shouldRestart } = handleSessionInvalidated(x, y, sessionInvalidatedFiredRef, pendingRetryCoordsRef);
77
- if (!shouldRestart) return;
78
- resetState(0);
79
- start();
81
+ const { shouldRestart } = handleSessionInvalidated(x, y, sessionInvalidatedAttemptsRef, pendingRetryCoordsRef);
82
+ if (shouldRestart) {
83
+ resetState(0);
84
+ start();
85
+ return;
86
+ }
87
+ const message = i18n.isInitialized ? i18n.t(NO_SESSION_FOUND_KEY) : "No session found";
88
+ events.onError(new Error(message));
89
+ fallOverWithStyle(message, NO_SESSION_FOUND_KEY);
80
90
  };
81
91
  const onReload = (x, y) => {
82
92
  pendingRetryCoordsRef.current = normaliseRetryCoords(x, y);
83
93
  nextMountAutoStartRef.current = true;
94
+ sessionInvalidatedAttemptsRef.current = 0;
84
95
  resetState(0);
85
96
  start();
86
97
  };
@@ -90,7 +101,21 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
90
101
  const startCoords = escalationCoords ?? retryStartCoords;
91
102
  mountCountRef.current += 1;
92
103
  const mountKey = mountCountRef.current;
93
- if (captchaType === CaptchaType.image) {
104
+ if (captchaType === CaptchaType.authenticated) {
105
+ if (!frictionlessState.sessionId) {
106
+ events.onError(/* @__PURE__ */ new Error("authenticated captcha response missing sessionId — provider is misbehaving"));
107
+ fallOverWithStyle();
108
+ return;
109
+ }
110
+ setComponentToRender(/* @__PURE__ */ jsx(AuthenticatedBadge, {
111
+ sessionId: frictionlessState.sessionId,
112
+ agent: frictionlessState.agent,
113
+ dapp: config.account.address ?? "",
114
+ userAccount: frictionlessState.userAccount,
115
+ provider: frictionlessState.provider,
116
+ callbacks
117
+ }));
118
+ } else if (captchaType === CaptchaType.image) {
94
119
  const Procaptcha = await ProcaptchaLoader();
95
120
  setComponentToRender(/* @__PURE__ */ jsx(Procaptcha, {
96
121
  config,
@@ -162,7 +187,8 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
162
187
  deviceCapability: result.deviceCapability,
163
188
  encryptBehavioralData: result.encryptBehavioralData,
164
189
  getSimdReadings: result.getSimdReadings,
165
- hp: result.hp
190
+ hp: result.hp,
191
+ agent: result.agent
166
192
  };
167
193
  await renderForCaptchaType(result.captchaType, frictionlessState);
168
194
  stateRef.current = {
@@ -1 +1 @@
1
- {"version":3,"file":"ProcaptchaFrictionless.js","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,WAAW,EAGX,sBAAsB,EACtB,sBAAsB,EAGtB,aAAa,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAEN,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,GACpB,MAAM,iCAAiC,CAAC;AAGzC,MAAM,gBAAgB,GAAG,KAAK,IAAI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EAAE,IACpE,MAAM,CAAC,IAAI,IAAI,EAChB,EAAE,CAAC;QACH,IAAI,gBAAgB,CAAC,OAAO,KAAK,GAAG;YAAE,OAAO;QAC7C,gBAAgB,CAAC,OAAO,GAAG,GAAG,CAAC;QAC/B,IAAI,WAAW;YAAE,OAAO;QACxB,KAAK,KAAK,EAAE,CAAC;IACd,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAE5D,OAAO,CACN,8BACC,KAAC,cAAc,IAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,GAAI,EACzD,iBAAiB,IAChB,CACH,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,75 @@
1
+ let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
2
+ let _prosopo_types = require("@prosopo/types");
3
+ let react = require("react");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/AuthenticatedBadge.tsx
6
+ var displayHost = (agent) => {
7
+ if (!agent) return "unknown";
8
+ try {
9
+ return new URL(agent).hostname;
10
+ } catch {
11
+ return agent;
12
+ }
13
+ };
14
+ var AuthenticatedBadge = ({ sessionId, agent, dapp, userAccount, provider, callbacks }) => {
15
+ const emittedRef = (0, react.useRef)(false);
16
+ (0, react.useEffect)(() => {
17
+ if (emittedRef.current) return;
18
+ emittedRef.current = true;
19
+ const events = (0, _prosopo_procaptcha_common.getDefaultEvents)(callbacks);
20
+ const token = (0, _prosopo_types.encodeProcaptchaOutput)({
21
+ [_prosopo_types.ApiParams.providerUrl]: provider.provider.url,
22
+ [_prosopo_types.ApiParams.user]: userAccount.account.address,
23
+ [_prosopo_types.ApiParams.dapp]: dapp,
24
+ [_prosopo_types.ApiParams.commitmentId]: sessionId,
25
+ [_prosopo_types.ApiParams.timestamp]: Date.now().toString(),
26
+ [_prosopo_types.ApiParams.signature]: {
27
+ [_prosopo_types.ApiParams.provider]: {},
28
+ [_prosopo_types.ApiParams.user]: {}
29
+ },
30
+ [_prosopo_types.ApiParams.captchaType]: _prosopo_types.CaptchaType.authenticated
31
+ });
32
+ events.onHuman(token);
33
+ }, [
34
+ sessionId,
35
+ dapp,
36
+ userAccount,
37
+ provider,
38
+ callbacks
39
+ ]);
40
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
41
+ style: {
42
+ display: "inline-flex",
43
+ alignItems: "center",
44
+ gap: 8,
45
+ padding: "8px 12px",
46
+ borderRadius: 6,
47
+ background: "#eef2ff",
48
+ border: "1px solid #c7d2fe",
49
+ color: "#3730a3",
50
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
51
+ fontSize: 13,
52
+ lineHeight: 1.4
53
+ },
54
+ role: "status",
55
+ "aria-label": "Verified agent",
56
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
57
+ width: "16",
58
+ height: "16",
59
+ viewBox: "0 0 24 24",
60
+ fill: "none",
61
+ stroke: "currentColor",
62
+ strokeWidth: "2.5",
63
+ strokeLinecap: "round",
64
+ strokeLinejoin: "round",
65
+ "aria-hidden": "true",
66
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("title", { children: "Verified" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M20 6L9 17l-5-5" })]
67
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: agent ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
68
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: "Verified agent" }),
69
+ ": ",
70
+ displayHost(agent)
71
+ ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: "Trusted request" }) })]
72
+ });
73
+ };
74
+ //#endregion
75
+ exports.AuthenticatedBadge = AuthenticatedBadge;