@prosopo/provider 4.15.14 → 4.15.15
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 +106 -106
- package/.turbo/turbo-build$colon$tsc.log +24 -24
- package/.turbo/turbo-build.log +107 -104
- package/CHANGELOG.md +49 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/api/admin/apiAdminRoutesProvider.js +27 -46
- package/dist/api/admin/apiClearAllCountersEndpoint.js +62 -57
- package/dist/api/admin/apiDnsEventEndpoint.js +79 -92
- package/dist/api/admin/apiGetAllDecisionMachinesEndpoint.js +43 -45
- package/dist/api/admin/apiGetDecisionMachineEndpoint.js +40 -40
- package/dist/api/admin/apiRegisterSiteKeyEndpoint.js +23 -22
- package/dist/api/admin/apiRegisterSiteKeysEndpoint.js +26 -30
- package/dist/api/admin/apiRemoveAllDecisionMachinesEndpoint.js +35 -37
- package/dist/api/admin/apiRemoveDecisionMachineEndpoint.js +40 -40
- package/dist/api/admin/apiRemoveDetectorKeyEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiRemoveDetectorKeyEndpoint.js +29 -31
- package/dist/api/admin/apiRemoveSiteKeyEndpoint.js +33 -29
- package/dist/api/admin/apiRemoveSiteKeysEndpoint.js +32 -31
- package/dist/api/admin/apiToggleMaintenanceModeEndpoint.js +43 -35
- package/dist/api/admin/apiUpdateDecisionMachineEndpoint.js +43 -63
- package/dist/api/admin/apiUpdateDetectorKeyEndpoint.js +36 -35
- package/dist/api/admin/createApiAdminRoutesProvider.js +6 -8
- package/dist/api/blacklistRequestInspector.js +285 -377
- package/dist/api/block.js +17 -30
- package/dist/api/captcha/checkSpamEmail.js +88 -98
- package/dist/api/captcha/contextAwareValidation.js +21 -15
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.js +126 -140
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/constants.js +11 -12
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.js +236 -299
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decryptSimdReadings.js +10 -13
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.js +336 -462
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/honeypotResponse.js +17 -14
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/sessionDedup.js +27 -27
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.js +42 -63
- package/dist/api/captcha/getFrictionlessCaptchaChallenge.js +2 -4
- package/dist/api/captcha/getImageCaptchaChallenge.js +136 -207
- package/dist/api/captcha/getPoWCaptchaChallenge.js +128 -198
- package/dist/api/captcha/getPuzzleCaptchaChallenge.js +132 -201
- package/dist/api/captcha/maintenanceModeResponses.js +38 -47
- package/dist/api/captcha/submitImageCaptchaSolution.js +75 -101
- package/dist/api/captcha/submitPoWCaptchaSolution.js +137 -207
- package/dist/api/captcha/submitPuzzleCaptchaSolution.js +73 -105
- package/dist/api/captcha.js +76 -58
- package/dist/api/dnsEventUrl.js +20 -22
- package/dist/api/domainMiddleware.js +104 -115
- package/dist/api/forwardVerify.js +62 -48
- package/dist/api/handshakeTimingMiddleware.js +43 -62
- package/dist/api/hardBlockVerdictCache.js +114 -117
- package/dist/api/headerCheckMiddleware.js +34 -34
- package/dist/api/ignoreMiddleware.js +13 -15
- package/dist/api/ipInfoMiddleware.js +17 -19
- package/dist/api/ja4.js +149 -188
- package/dist/api/ja4Middleware.js +39 -54
- package/dist/api/metrics.js +245 -257
- package/dist/api/public.js +52 -54
- package/dist/api/robotsMiddleware.js +10 -10
- package/dist/api/startProviderApi.js +205 -232
- package/dist/api/testSiteKey.js +16 -16
- package/dist/api/validateAddress.js +23 -21
- package/dist/api/verify.js +334 -377
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/api/admin/apiAdminRoutesProvider.cjs +40 -59
- package/dist/cjs/api/admin/apiClearAllCountersEndpoint.cjs +63 -58
- package/dist/cjs/api/admin/apiDnsEventEndpoint.cjs +82 -93
- package/dist/cjs/api/admin/apiGetAllDecisionMachinesEndpoint.cjs +46 -48
- package/dist/cjs/api/admin/apiGetDecisionMachineEndpoint.cjs +41 -41
- package/dist/cjs/api/admin/apiRegisterSiteKeyEndpoint.cjs +25 -24
- package/dist/cjs/api/admin/apiRegisterSiteKeysEndpoint.cjs +28 -32
- package/dist/cjs/api/admin/apiRemoveAllDecisionMachinesEndpoint.cjs +38 -40
- package/dist/cjs/api/admin/apiRemoveDecisionMachineEndpoint.cjs +41 -41
- package/dist/cjs/api/admin/apiRemoveDetectorKeyEndpoint.cjs +31 -33
- package/dist/cjs/api/admin/apiRemoveSiteKeyEndpoint.cjs +35 -31
- package/dist/cjs/api/admin/apiRemoveSiteKeysEndpoint.cjs +34 -33
- package/dist/cjs/api/admin/apiToggleMaintenanceModeEndpoint.cjs +45 -35
- package/dist/cjs/api/admin/apiUpdateDecisionMachineEndpoint.cjs +45 -65
- package/dist/cjs/api/admin/apiUpdateDetectorKeyEndpoint.cjs +38 -37
- package/dist/cjs/api/admin/createApiAdminRoutesProvider.cjs +7 -8
- package/dist/cjs/api/blacklistRequestInspector.cjs +288 -376
- package/dist/cjs/api/block.cjs +18 -30
- package/dist/cjs/api/captcha/checkSpamEmail.cjs +90 -100
- package/dist/cjs/api/captcha/contextAwareValidation.cjs +21 -14
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.cjs +125 -140
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/constants.cjs +10 -10
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.cjs +238 -301
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/decryptSimdReadings.cjs +9 -12
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/handler.cjs +349 -473
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/honeypotResponse.cjs +18 -14
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/sessionDedup.cjs +26 -26
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.cjs +42 -63
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge.cjs +2 -3
- package/dist/cjs/api/captcha/getImageCaptchaChallenge.cjs +138 -208
- package/dist/cjs/api/captcha/getPoWCaptchaChallenge.cjs +131 -200
- package/dist/cjs/api/captcha/getPuzzleCaptchaChallenge.cjs +135 -203
- package/dist/cjs/api/captcha/maintenanceModeResponses.cjs +38 -44
- package/dist/cjs/api/captcha/submitImageCaptchaSolution.cjs +77 -102
- package/dist/cjs/api/captcha/submitPoWCaptchaSolution.cjs +140 -209
- package/dist/cjs/api/captcha/submitPuzzleCaptchaSolution.cjs +76 -107
- package/dist/cjs/api/captcha.cjs +79 -58
- package/dist/cjs/api/dnsEventUrl.cjs +20 -21
- package/dist/cjs/api/domainMiddleware.cjs +106 -117
- package/dist/cjs/api/forwardVerify.cjs +63 -49
- package/dist/cjs/api/handshakeTimingMiddleware.cjs +43 -61
- package/dist/cjs/api/hardBlockVerdictCache.cjs +114 -114
- package/dist/cjs/api/headerCheckMiddleware.cjs +34 -34
- package/dist/cjs/api/ignoreMiddleware.cjs +12 -14
- package/dist/cjs/api/ipInfoMiddleware.cjs +16 -18
- package/dist/cjs/api/ja4.cjs +149 -187
- package/dist/cjs/api/ja4Middleware.cjs +40 -53
- package/dist/cjs/api/metrics.cjs +229 -228
- package/dist/cjs/api/public.cjs +57 -57
- package/dist/cjs/api/robotsMiddleware.cjs +9 -9
- package/dist/cjs/api/startProviderApi.cjs +219 -237
- package/dist/cjs/api/testSiteKey.cjs +15 -14
- package/dist/cjs/api/validateAddress.cjs +24 -21
- package/dist/cjs/api/verify.cjs +338 -379
- package/dist/cjs/compositeIpAddress.cjs +40 -47
- package/dist/cjs/index.cjs +65 -71
- package/dist/cjs/pairs.cjs +31 -35
- package/dist/cjs/rules/lang.cjs +10 -14
- package/dist/cjs/schedulers/captchaScheduler.cjs +26 -32
- package/dist/cjs/schedulers/getClientList.cjs +35 -33
- package/dist/cjs/schedulers/setClientEntropy.cjs +35 -33
- package/dist/cjs/schedulers/updateSpamEmailDomains.cjs +39 -43
- package/dist/cjs/services/ipComparison.cjs +122 -119
- package/dist/cjs/tasks/captchaManager.cjs +407 -486
- package/dist/cjs/tasks/client/clientTasks.cjs +347 -470
- package/dist/cjs/tasks/dataset/datasetTasks.cjs +25 -29
- package/dist/cjs/tasks/dataset/datasetTasksUtils.cjs +16 -32
- package/dist/cjs/tasks/decisionMachine/decisionMachineRunner.cjs +220 -307
- package/dist/cjs/tasks/detection/decodeBehavior.cjs +408 -317
- package/dist/cjs/tasks/detection/decodePayload.cjs +686 -468
- package/dist/cjs/tasks/detection/decodeSimd.cjs +462 -304
- package/dist/cjs/tasks/detection/getBotScore.cjs +37 -43
- package/dist/cjs/tasks/dnsEvent/enrichDnsEvent.cjs +88 -71
- package/dist/cjs/tasks/frictionless/frictionlessTasks.cjs +348 -486
- package/dist/cjs/tasks/frictionless/frictionlessTasksUtils.cjs +13 -30
- package/dist/cjs/tasks/frictionless/routingMachine.cjs +71 -55
- package/dist/cjs/tasks/imgCaptcha/imgCaptchaTasks.cjs +555 -806
- package/dist/cjs/tasks/imgCaptcha/imgCaptchaTasksUtils.cjs +22 -23
- package/dist/cjs/tasks/index.cjs +2 -4
- package/dist/cjs/tasks/powCaptcha/powTasks.cjs +491 -687
- package/dist/cjs/tasks/powCaptcha/powTasksUtils.cjs +17 -29
- package/dist/cjs/tasks/puzzleCaptcha/puzzleTasks.cjs +422 -591
- package/dist/cjs/tasks/puzzleCaptcha/puzzleTasksUtils.cjs +8 -5
- package/dist/cjs/tasks/spam/checkSpamEmail.cjs +133 -141
- package/dist/cjs/tasks/spam/checkTrafficFilter.cjs +118 -76
- package/dist/cjs/tasks/spam/evaluateEmailSpamRules.cjs +75 -84
- package/dist/cjs/tasks/spam/updateSpamEmailDomains.cjs +40 -56
- package/dist/cjs/tasks/tasks.cjs +107 -158
- package/dist/cjs/util/usageCounters.cjs +220 -211
- package/dist/cjs/util.cjs +329 -359
- package/dist/cjs/utils/devicePlatform.cjs +14 -8
- package/dist/cjs/utils/dns.cjs +68 -93
- package/dist/cjs/utils/hashUserAgent.cjs +14 -7
- package/dist/cjs/utils/hashUserIp.cjs +14 -6
- package/dist/cjs/utils/honeypot/encoders.cjs +74 -80
- package/dist/cjs/utils/honeypot/phraseBank.cjs +51 -44
- package/dist/cjs/utils/normalizeRequestIp.cjs +33 -25
- package/dist/compositeIpAddress.js +38 -46
- package/dist/index.js +12 -56
- package/dist/pairs.js +31 -37
- package/dist/rules/lang.js +11 -15
- package/dist/schedulers/captchaScheduler.js +25 -31
- package/dist/schedulers/getClientList.js +34 -32
- package/dist/schedulers/setClientEntropy.js +34 -32
- package/dist/schedulers/updateSpamEmailDomains.js +38 -42
- package/dist/services/ipComparison.js +122 -119
- package/dist/tasks/captchaManager.js +403 -483
- package/dist/tasks/client/clientTasks.js +343 -467
- package/dist/tasks/dataset/datasetTasks.js +24 -28
- package/dist/tasks/dataset/datasetTasksUtils.js +15 -31
- package/dist/tasks/decisionMachine/decisionMachineRunner.js +217 -306
- package/dist/tasks/detection/getBotScore.js +37 -43
- package/dist/tasks/dnsEvent/enrichDnsEvent.d.ts.map +1 -1
- package/dist/tasks/dnsEvent/enrichDnsEvent.js +88 -74
- package/dist/tasks/dnsEvent/enrichDnsEvent.js.map +1 -1
- package/dist/tasks/frictionless/frictionlessTasks.js +342 -479
- package/dist/tasks/frictionless/frictionlessTasksUtils.js +14 -32
- package/dist/tasks/frictionless/routingMachine.js +72 -56
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.js +550 -801
- package/dist/tasks/imgCaptcha/imgCaptchaTasksUtils.js +21 -22
- package/dist/tasks/index.js +1 -3
- package/dist/tasks/powCaptcha/powTasks.d.ts.map +1 -1
- package/dist/tasks/powCaptcha/powTasks.js +486 -682
- package/dist/tasks/powCaptcha/powTasks.js.map +1 -1
- package/dist/tasks/powCaptcha/powTasksUtils.js +15 -28
- package/dist/tasks/puzzleCaptcha/puzzleTasks.d.ts.map +1 -1
- package/dist/tasks/puzzleCaptcha/puzzleTasks.js +417 -586
- package/dist/tasks/puzzleCaptcha/puzzleTasks.js.map +1 -1
- package/dist/tasks/puzzleCaptcha/puzzleTasksUtils.js +9 -6
- package/dist/tasks/spam/checkSpamEmail.js +133 -141
- package/dist/tasks/spam/checkTrafficFilter.d.ts +1 -0
- package/dist/tasks/spam/checkTrafficFilter.d.ts.map +1 -1
- package/dist/tasks/spam/checkTrafficFilter.js +117 -77
- package/dist/tasks/spam/checkTrafficFilter.js.map +1 -1
- package/dist/tasks/spam/evaluateEmailSpamRules.js +75 -86
- package/dist/tasks/spam/updateSpamEmailDomains.js +36 -54
- package/dist/tasks/tasks.js +98 -150
- package/dist/tests/integration/api/blacklistRequestInspector.integration.test.js +4 -1
- package/dist/tests/integration/api/blacklistRequestInspector.integration.test.js.map +1 -1
- package/dist/tests/unit/api/block.unit.test.js +8 -4
- package/dist/tests/unit/api/block.unit.test.js.map +1 -1
- package/dist/tests/unit/api/captcha/maintenanceModeShortCircuit.unit.test.js +8 -6
- package/dist/tests/unit/api/captcha/maintenanceModeShortCircuit.unit.test.js.map +1 -1
- package/dist/tests/unit/api/forwardVerify.unit.test.js +3 -1
- package/dist/tests/unit/api/forwardVerify.unit.test.js.map +1 -1
- package/dist/tests/unit/api/getFrictionlessCaptchaChallenge.unit.test.js +15 -7
- package/dist/tests/unit/api/getFrictionlessCaptchaChallenge.unit.test.js.map +1 -1
- package/dist/tests/unit/schedulers/captchaScheduler.unit.test.js +24 -18
- package/dist/tests/unit/schedulers/captchaScheduler.unit.test.js.map +1 -1
- package/dist/tests/unit/schedulers/getClientList.unit.test.js +19 -13
- package/dist/tests/unit/schedulers/getClientList.unit.test.js.map +1 -1
- package/dist/tests/unit/schedulers/setClientEntropy.unit.test.js +19 -13
- package/dist/tests/unit/schedulers/setClientEntropy.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/client/clientTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/imgCaptcha/imgCaptchaTasksUtils.unit.test.js +22 -16
- package/dist/tests/unit/tasks/imgCaptcha/imgCaptchaTasksUtils.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/spam/checkTrafficFilter.unit.test.js +140 -0
- package/dist/tests/unit/tasks/spam/checkTrafficFilter.unit.test.js.map +1 -1
- package/dist/tests/unit/testUtils/mockProviderEnv.d.ts +7 -7
- package/dist/util/usageCounters.js +220 -212
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +327 -364
- package/dist/util.js.map +1 -1
- package/dist/utils/devicePlatform.js +15 -9
- package/dist/utils/dns.js +64 -77
- package/dist/utils/hashUserAgent.js +14 -7
- package/dist/utils/hashUserIp.js +14 -6
- package/dist/utils/honeypot/encoders.js +74 -80
- package/dist/utils/honeypot/phraseBank.js +49 -44
- package/dist/utils/normalizeRequestIp.js +34 -26
- package/package.json +24 -24
package/dist/cjs/api/verify.cjs
CHANGED
|
@@ -1,384 +1,343 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_metrics = require("./metrics.cjs");
|
|
3
|
+
const require_tasks = require("../tasks/tasks.cjs");
|
|
4
|
+
const require_apiToggleMaintenanceModeEndpoint = require("./admin/apiToggleMaintenanceModeEndpoint.cjs");
|
|
5
|
+
const require_testSiteKey = require("./testSiteKey.cjs");
|
|
6
|
+
const require_forwardVerify = require("./forwardVerify.cjs");
|
|
7
|
+
let _prosopo_common = require("@prosopo/common");
|
|
8
|
+
let _prosopo_types = require("@prosopo/types");
|
|
9
|
+
let _prosopo_util_crypto = require("@prosopo/util-crypto");
|
|
10
|
+
let _prosopo_api_express_router = require("@prosopo/api-express-router");
|
|
11
|
+
let express = require("express");
|
|
12
|
+
express = require_runtime.__toESM(express, 1);
|
|
13
|
+
let _prosopo_api = require("@prosopo/api");
|
|
14
|
+
//#region src/api/verify.ts
|
|
15
|
+
var deriveVerifySource = (body) => {
|
|
16
|
+
if (require_apiToggleMaintenanceModeEndpoint.getMaintenanceMode()) return "maintenance";
|
|
17
|
+
try {
|
|
18
|
+
const token = body?.token;
|
|
19
|
+
if (token) {
|
|
20
|
+
const { dapp } = (0, _prosopo_types.decodeProcaptchaOutput)(token);
|
|
21
|
+
if (require_testSiteKey.isReservedTestSiteKey(dapp)) return "test_key";
|
|
22
|
+
}
|
|
23
|
+
} catch {}
|
|
24
|
+
return "real";
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
var VERIFY_PATH_TYPE = {
|
|
27
|
+
[_prosopo_types.ClientApiPaths.VerifyImageCaptchaSolutionDapp]: _prosopo_types.CaptchaType.image,
|
|
28
|
+
[_prosopo_types.ClientApiPaths.VerifyPowCaptchaSolution]: _prosopo_types.CaptchaType.pow,
|
|
29
|
+
[_prosopo_types.ClientApiPaths.VerifyPuzzleCaptchaSolution]: _prosopo_types.CaptchaType.puzzle
|
|
30
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Returns a router connected to the database which can interact with the Proposo protocol
|
|
33
|
+
*
|
|
34
|
+
* @return {Router} - A middleware router that can interact with the Prosopo protocol
|
|
35
|
+
* @param {Environment} env - The Prosopo environment
|
|
36
|
+
*/
|
|
31
37
|
function prosopoVerifyRouter(env) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
if (!challenge) {
|
|
338
|
-
const unverifiedResponse = {
|
|
339
|
-
status: req.i18n.t("API.USER_NOT_VERIFIED"),
|
|
340
|
-
[types.ApiParams.verified]: false
|
|
341
|
-
};
|
|
342
|
-
return res.json(unverifiedResponse);
|
|
343
|
-
}
|
|
344
|
-
const dappPair = env.keyring.addFromAddress(dapp);
|
|
345
|
-
apiExpressRouter.verifySignature(dappSignature, timestamp.toString(), dappPair);
|
|
346
|
-
const { verified, score } = await tasks$1.puzzleCaptchaManager.serverVerifyPuzzleCaptchaSolution(
|
|
347
|
-
dapp,
|
|
348
|
-
challenge,
|
|
349
|
-
clientRecord.settings.verifiedTimeout,
|
|
350
|
-
env,
|
|
351
|
-
ip,
|
|
352
|
-
userAccessRulesStorage,
|
|
353
|
-
email,
|
|
354
|
-
clientRecord.settings.spamEmailDomainCheckEnabled,
|
|
355
|
-
clientRecord.settings.trafficFilter,
|
|
356
|
-
clientRecord.settings.storeMetadata
|
|
357
|
-
);
|
|
358
|
-
const verificationResponse = tasks$1.puzzleCaptchaManager.getVerificationResponse(
|
|
359
|
-
verified,
|
|
360
|
-
clientRecord,
|
|
361
|
-
req.i18n.t,
|
|
362
|
-
score
|
|
363
|
-
);
|
|
364
|
-
return res.json(verificationResponse);
|
|
365
|
-
} catch (err) {
|
|
366
|
-
req.logger.error(() => ({
|
|
367
|
-
msg: "Error in verifyPuzzleCaptchaSolution",
|
|
368
|
-
err,
|
|
369
|
-
data: { body: req.body }
|
|
370
|
-
}));
|
|
371
|
-
return next(
|
|
372
|
-
new common.ProsopoApiError("API.BAD_REQUEST", {
|
|
373
|
-
context: { code: 500, error: err },
|
|
374
|
-
i18n: req.i18n,
|
|
375
|
-
logger: req.logger
|
|
376
|
-
})
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
);
|
|
381
|
-
router.use(apiExpressRouter.handleErrors);
|
|
382
|
-
return router;
|
|
38
|
+
const router = express.default.Router();
|
|
39
|
+
let userAccessRulesStorage;
|
|
40
|
+
try {
|
|
41
|
+
userAccessRulesStorage = env.getDb().getUserAccessRulesStorage();
|
|
42
|
+
} catch (err) {
|
|
43
|
+
env.logger.warn(() => ({
|
|
44
|
+
msg: "User access rules storage unavailable; verify endpoints will skip access-policy checks",
|
|
45
|
+
err
|
|
46
|
+
}));
|
|
47
|
+
userAccessRulesStorage = void 0;
|
|
48
|
+
}
|
|
49
|
+
router.use((req, res, next) => {
|
|
50
|
+
if (!require_metrics.metricsEnabled()) return next();
|
|
51
|
+
const type = VERIFY_PATH_TYPE[req.path];
|
|
52
|
+
if (!type) return next();
|
|
53
|
+
const originalJson = res.json.bind(res);
|
|
54
|
+
res.json = (body) => {
|
|
55
|
+
if (res.statusCode < 300) {
|
|
56
|
+
const verified = !!(body && typeof body === "object" && body.verified);
|
|
57
|
+
require_metrics.recordCaptchaVerify({
|
|
58
|
+
type,
|
|
59
|
+
verified,
|
|
60
|
+
source: deriveVerifySource(req.body)
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return originalJson(body);
|
|
64
|
+
};
|
|
65
|
+
next();
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* Verifies a dapp's solution as being approved or not
|
|
69
|
+
*
|
|
70
|
+
* @param {string} user - Dapp User AccountId
|
|
71
|
+
* @param {string} dapp - Dapp Contract AccountId
|
|
72
|
+
* @param {string} blockNumber - The block number at which the captcha was requested
|
|
73
|
+
* @param {string} dappUserSignature - The signature fo dapp user
|
|
74
|
+
* @param {string} commitmentId - The captcha solution to look up
|
|
75
|
+
* @param {number} maxVerifiedTime - The maximum time in milliseconds since the blockNumber
|
|
76
|
+
*/
|
|
77
|
+
router.post(_prosopo_types.ClientApiPaths.VerifyImageCaptchaSolutionDapp, async (req, res, next) => {
|
|
78
|
+
if (require_apiToggleMaintenanceModeEndpoint.getMaintenanceMode()) {
|
|
79
|
+
req.logger.info(() => ({ msg: "Maintenance mode active - returning verified for image captcha verification" }));
|
|
80
|
+
return res.json({
|
|
81
|
+
status: "ok",
|
|
82
|
+
verified: true
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
let parsed;
|
|
86
|
+
try {
|
|
87
|
+
parsed = _prosopo_types.VerifySolutionBody.parse(req.body);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
return next(new _prosopo_common.ProsopoApiError("CAPTCHA.PARSE_ERROR", {
|
|
90
|
+
context: {
|
|
91
|
+
code: 400,
|
|
92
|
+
error: err,
|
|
93
|
+
body: req.body
|
|
94
|
+
},
|
|
95
|
+
i18n: req.i18n,
|
|
96
|
+
logger: req.logger
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
const { dappSignature, token, ip, maxVerifiedTime, email } = parsed;
|
|
100
|
+
try {
|
|
101
|
+
const { user, dapp, timestamp, commitmentId, providerUrl } = (0, _prosopo_types.decodeProcaptchaOutput)(token);
|
|
102
|
+
const testVerdict = require_testSiteKey.resolveTestSiteKeyVerdict(dapp, req.logger);
|
|
103
|
+
if (testVerdict !== null) {
|
|
104
|
+
const verificationResponse = {
|
|
105
|
+
status: "ok",
|
|
106
|
+
verified: testVerdict
|
|
107
|
+
};
|
|
108
|
+
return res.json(verificationResponse);
|
|
109
|
+
}
|
|
110
|
+
const forwarded = await require_forwardVerify.forwardVerifyIfNotIssuer({
|
|
111
|
+
env,
|
|
112
|
+
logger: req.logger,
|
|
113
|
+
path: _prosopo_types.ClientApiPaths.VerifyImageCaptchaSolutionDapp,
|
|
114
|
+
providerUrl,
|
|
115
|
+
dapp,
|
|
116
|
+
user,
|
|
117
|
+
body: parsed,
|
|
118
|
+
alreadyForwarded: req.headers[_prosopo_api.VERIFY_FORWARDED_HEADER] !== void 0
|
|
119
|
+
});
|
|
120
|
+
if (forwarded) return res.json(forwarded);
|
|
121
|
+
const tasks = new require_tasks.Tasks(env, req.logger);
|
|
122
|
+
(0, _prosopo_util_crypto.validateAddress)(dapp, false, 42);
|
|
123
|
+
(0, _prosopo_util_crypto.validateAddress)(user, false, 42);
|
|
124
|
+
const clientRecord = await tasks.db.getClientRecord(dapp);
|
|
125
|
+
if (!clientRecord) return next(new _prosopo_common.ProsopoApiError("API.SITE_KEY_NOT_REGISTERED", {
|
|
126
|
+
context: {
|
|
127
|
+
code: 400,
|
|
128
|
+
siteKey: dapp,
|
|
129
|
+
user
|
|
130
|
+
},
|
|
131
|
+
i18n: req.i18n,
|
|
132
|
+
logger: req.logger
|
|
133
|
+
}));
|
|
134
|
+
const keyPair = env.keyring.addFromAddress(dapp);
|
|
135
|
+
(0, _prosopo_api_express_router.verifySignature)(dappSignature, timestamp.toString(), keyPair);
|
|
136
|
+
const response = await tasks.imgCaptchaManager.verifyImageCaptchaSolution(user, dapp, commitmentId, env, maxVerifiedTime, ip, clientRecord.settings.disallowWebView, clientRecord.settings.contextAware?.enabled, userAccessRulesStorage, email, clientRecord.settings.spamEmailDomainCheckEnabled, clientRecord.settings.spamFilter, clientRecord.settings.trafficFilter, clientRecord.settings.storeMetadata);
|
|
137
|
+
req.logger.debug(() => ({ data: { response } }));
|
|
138
|
+
const verificationResponse = tasks.imgCaptchaManager.getVerificationResponse(response[_prosopo_types.ApiParams.verified], clientRecord, req.i18n.t, response[_prosopo_types.ApiParams.score], response[_prosopo_types.ApiParams.commitmentId], response[_prosopo_types.ApiParams.status]);
|
|
139
|
+
res.json(verificationResponse);
|
|
140
|
+
} catch (err) {
|
|
141
|
+
req.logger.error(() => ({
|
|
142
|
+
err,
|
|
143
|
+
msg: "Error in verifyImageCaptchaSolution",
|
|
144
|
+
data: { body: req.body }
|
|
145
|
+
}));
|
|
146
|
+
return next(new _prosopo_common.ProsopoApiError("API.BAD_REQUEST", {
|
|
147
|
+
context: {
|
|
148
|
+
code: 500,
|
|
149
|
+
siteKey: req.body.dapp,
|
|
150
|
+
user: req.body.user
|
|
151
|
+
},
|
|
152
|
+
i18n: req.i18n,
|
|
153
|
+
logger: req.logger
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
/**
|
|
158
|
+
* Verifies a dapp's solution as being approved or not
|
|
159
|
+
*
|
|
160
|
+
* @param {string} token - Token containing dapp, blockNumber and challenge
|
|
161
|
+
* @param {string} dappSignature - Signed token
|
|
162
|
+
* @param {number} verifiedTimeout - The maximum time in milliseconds to be valid
|
|
163
|
+
*/
|
|
164
|
+
router.post(_prosopo_types.ClientApiPaths.VerifyPowCaptchaSolution, async (req, res, next) => {
|
|
165
|
+
if (require_apiToggleMaintenanceModeEndpoint.getMaintenanceMode()) {
|
|
166
|
+
req.logger.info(() => ({ msg: "Maintenance mode active - returning verified for PoW captcha verification" }));
|
|
167
|
+
return res.json({
|
|
168
|
+
status: "ok",
|
|
169
|
+
verified: true
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
let parsed;
|
|
173
|
+
try {
|
|
174
|
+
parsed = _prosopo_types.ServerPowCaptchaVerifyRequestBody.parse(req.body);
|
|
175
|
+
} catch (err) {
|
|
176
|
+
return next(new _prosopo_common.ProsopoApiError("CAPTCHA.PARSE_ERROR", {
|
|
177
|
+
context: {
|
|
178
|
+
code: 400,
|
|
179
|
+
error: err,
|
|
180
|
+
body: req.body
|
|
181
|
+
},
|
|
182
|
+
i18n: req.i18n,
|
|
183
|
+
logger: req.logger
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
const { token, dappSignature, ip, email } = parsed;
|
|
188
|
+
const { dapp, user, timestamp, challenge, providerUrl } = (0, _prosopo_types.decodeProcaptchaOutput)(token);
|
|
189
|
+
const testVerdict = require_testSiteKey.resolveTestSiteKeyVerdict(dapp, req.logger);
|
|
190
|
+
if (testVerdict !== null) {
|
|
191
|
+
const verificationResponse = {
|
|
192
|
+
status: "ok",
|
|
193
|
+
verified: testVerdict
|
|
194
|
+
};
|
|
195
|
+
return res.json(verificationResponse);
|
|
196
|
+
}
|
|
197
|
+
const forwarded = await require_forwardVerify.forwardVerifyIfNotIssuer({
|
|
198
|
+
env,
|
|
199
|
+
logger: req.logger,
|
|
200
|
+
path: _prosopo_types.ClientApiPaths.VerifyPowCaptchaSolution,
|
|
201
|
+
providerUrl,
|
|
202
|
+
dapp,
|
|
203
|
+
user,
|
|
204
|
+
body: parsed,
|
|
205
|
+
alreadyForwarded: req.headers[_prosopo_api.VERIFY_FORWARDED_HEADER] !== void 0
|
|
206
|
+
});
|
|
207
|
+
if (forwarded) return res.json(forwarded);
|
|
208
|
+
const tasks = new require_tasks.Tasks(env, req.logger);
|
|
209
|
+
(0, _prosopo_util_crypto.validateAddress)(dapp, false, 42);
|
|
210
|
+
(0, _prosopo_util_crypto.validateAddress)(user, false, 42);
|
|
211
|
+
const clientRecord = await tasks.db.getClientRecord(dapp);
|
|
212
|
+
if (!clientRecord) return next(new _prosopo_common.ProsopoApiError("API.SITE_KEY_NOT_REGISTERED", {
|
|
213
|
+
context: {
|
|
214
|
+
code: 400,
|
|
215
|
+
siteKey: dapp
|
|
216
|
+
},
|
|
217
|
+
i18n: req.i18n,
|
|
218
|
+
logger: req.logger
|
|
219
|
+
}));
|
|
220
|
+
if (!challenge) {
|
|
221
|
+
const unverifiedResponse = {
|
|
222
|
+
status: req.i18n.t("API.USER_NOT_VERIFIED"),
|
|
223
|
+
[_prosopo_types.ApiParams.verified]: false
|
|
224
|
+
};
|
|
225
|
+
return res.json(unverifiedResponse);
|
|
226
|
+
}
|
|
227
|
+
const dappPair = env.keyring.addFromAddress(dapp);
|
|
228
|
+
(0, _prosopo_api_express_router.verifySignature)(dappSignature, timestamp.toString(), dappPair);
|
|
229
|
+
const { verified, score, reason } = await tasks.powCaptchaManager.serverVerifyPowCaptchaSolution(dapp, challenge, clientRecord.settings.verifiedTimeout, env, ip, userAccessRulesStorage, email, clientRecord.settings.spamEmailDomainCheckEnabled, clientRecord.settings.spamFilter, clientRecord.settings.trafficFilter, clientRecord.settings.storeMetadata);
|
|
230
|
+
const verificationResponse = tasks.powCaptchaManager.getVerificationResponse(verified, clientRecord, req.i18n.t, score, reason);
|
|
231
|
+
return res.json(verificationResponse);
|
|
232
|
+
} catch (err) {
|
|
233
|
+
req.logger.error(() => ({
|
|
234
|
+
msg: "Error in verifyPowCaptchaSolution",
|
|
235
|
+
err,
|
|
236
|
+
data: { body: req.body }
|
|
237
|
+
}));
|
|
238
|
+
return next(new _prosopo_common.ProsopoApiError("API.BAD_REQUEST", {
|
|
239
|
+
context: {
|
|
240
|
+
code: 500,
|
|
241
|
+
error: err
|
|
242
|
+
},
|
|
243
|
+
i18n: req.i18n,
|
|
244
|
+
logger: req.logger
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
/**
|
|
249
|
+
* Verifies a dapp's puzzle captcha solution as being approved or not
|
|
250
|
+
*
|
|
251
|
+
* @param {string} token - Token containing dapp, blockNumber and challenge
|
|
252
|
+
* @param {string} dappSignature - Signed token
|
|
253
|
+
* @param {number} verifiedTimeout - The maximum time in milliseconds to be valid
|
|
254
|
+
*/
|
|
255
|
+
router.post(_prosopo_types.ClientApiPaths.VerifyPuzzleCaptchaSolution, async (req, res, next) => {
|
|
256
|
+
if (require_apiToggleMaintenanceModeEndpoint.getMaintenanceMode()) {
|
|
257
|
+
req.logger.info(() => ({ msg: "Maintenance mode active - returning verified for puzzle captcha verification" }));
|
|
258
|
+
return res.json({
|
|
259
|
+
status: "ok",
|
|
260
|
+
verified: true
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
let parsed;
|
|
264
|
+
try {
|
|
265
|
+
parsed = _prosopo_types.ServerPuzzleCaptchaVerifyRequestBody.parse(req.body);
|
|
266
|
+
} catch (err) {
|
|
267
|
+
return next(new _prosopo_common.ProsopoApiError("CAPTCHA.PARSE_ERROR", {
|
|
268
|
+
context: {
|
|
269
|
+
code: 400,
|
|
270
|
+
error: err,
|
|
271
|
+
body: req.body
|
|
272
|
+
},
|
|
273
|
+
i18n: req.i18n,
|
|
274
|
+
logger: req.logger
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
try {
|
|
278
|
+
const { token, dappSignature, ip, email } = parsed;
|
|
279
|
+
const { dapp, user, timestamp, challenge, providerUrl } = (0, _prosopo_types.decodeProcaptchaOutput)(token);
|
|
280
|
+
const testVerdict = require_testSiteKey.resolveTestSiteKeyVerdict(dapp, req.logger);
|
|
281
|
+
if (testVerdict !== null) {
|
|
282
|
+
const verificationResponse = {
|
|
283
|
+
status: "ok",
|
|
284
|
+
verified: testVerdict
|
|
285
|
+
};
|
|
286
|
+
return res.json(verificationResponse);
|
|
287
|
+
}
|
|
288
|
+
const forwarded = await require_forwardVerify.forwardVerifyIfNotIssuer({
|
|
289
|
+
env,
|
|
290
|
+
logger: req.logger,
|
|
291
|
+
path: _prosopo_types.ClientApiPaths.VerifyPuzzleCaptchaSolution,
|
|
292
|
+
providerUrl,
|
|
293
|
+
dapp,
|
|
294
|
+
user,
|
|
295
|
+
body: parsed,
|
|
296
|
+
alreadyForwarded: req.headers[_prosopo_api.VERIFY_FORWARDED_HEADER] !== void 0
|
|
297
|
+
});
|
|
298
|
+
if (forwarded) return res.json(forwarded);
|
|
299
|
+
const tasks = new require_tasks.Tasks(env, req.logger);
|
|
300
|
+
(0, _prosopo_util_crypto.validateAddress)(dapp, false, 42);
|
|
301
|
+
(0, _prosopo_util_crypto.validateAddress)(user, false, 42);
|
|
302
|
+
const clientRecord = await tasks.db.getClientRecord(dapp);
|
|
303
|
+
if (!clientRecord) return next(new _prosopo_common.ProsopoApiError("API.SITE_KEY_NOT_REGISTERED", {
|
|
304
|
+
context: {
|
|
305
|
+
code: 400,
|
|
306
|
+
siteKey: dapp
|
|
307
|
+
},
|
|
308
|
+
i18n: req.i18n,
|
|
309
|
+
logger: req.logger
|
|
310
|
+
}));
|
|
311
|
+
if (!challenge) {
|
|
312
|
+
const unverifiedResponse = {
|
|
313
|
+
status: req.i18n.t("API.USER_NOT_VERIFIED"),
|
|
314
|
+
[_prosopo_types.ApiParams.verified]: false
|
|
315
|
+
};
|
|
316
|
+
return res.json(unverifiedResponse);
|
|
317
|
+
}
|
|
318
|
+
const dappPair = env.keyring.addFromAddress(dapp);
|
|
319
|
+
(0, _prosopo_api_express_router.verifySignature)(dappSignature, timestamp.toString(), dappPair);
|
|
320
|
+
const { verified, score } = await tasks.puzzleCaptchaManager.serverVerifyPuzzleCaptchaSolution(dapp, challenge, clientRecord.settings.verifiedTimeout, env, ip, userAccessRulesStorage, email, clientRecord.settings.spamEmailDomainCheckEnabled, clientRecord.settings.trafficFilter, clientRecord.settings.storeMetadata);
|
|
321
|
+
const verificationResponse = tasks.puzzleCaptchaManager.getVerificationResponse(verified, clientRecord, req.i18n.t, score);
|
|
322
|
+
return res.json(verificationResponse);
|
|
323
|
+
} catch (err) {
|
|
324
|
+
req.logger.error(() => ({
|
|
325
|
+
msg: "Error in verifyPuzzleCaptchaSolution",
|
|
326
|
+
err,
|
|
327
|
+
data: { body: req.body }
|
|
328
|
+
}));
|
|
329
|
+
return next(new _prosopo_common.ProsopoApiError("API.BAD_REQUEST", {
|
|
330
|
+
context: {
|
|
331
|
+
code: 500,
|
|
332
|
+
error: err
|
|
333
|
+
},
|
|
334
|
+
i18n: req.i18n,
|
|
335
|
+
logger: req.logger
|
|
336
|
+
}));
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
router.use(_prosopo_api_express_router.handleErrors);
|
|
340
|
+
return router;
|
|
383
341
|
}
|
|
342
|
+
//#endregion
|
|
384
343
|
exports.prosopoVerifyRouter = prosopoVerifyRouter;
|