@prosopo/procaptcha-pow 2.10.23 → 2.10.25
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 +12 -10
- package/.turbo/turbo-build$colon$tsc.log +19 -19
- package/.turbo/turbo-build.log +14 -11
- package/CHANGELOG.md +46 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/cjs/components/ProcaptchaPoW.cjs +6 -9
- package/dist/cjs/components/ProcaptchaWidget.cjs +117 -127
- package/dist/cjs/index.cjs +2 -4
- package/dist/cjs/services/Manager.cjs +193 -277
- package/dist/components/ProcaptchaPoW.js +6 -8
- package/dist/components/ProcaptchaWidget.d.ts.map +1 -1
- package/dist/components/ProcaptchaWidget.js +117 -127
- package/dist/components/ProcaptchaWidget.js.map +1 -1
- package/dist/index.js +2 -4
- package/dist/services/Manager.d.ts.map +1 -1
- package/dist/services/Manager.js +189 -274
- package/dist/services/Manager.js.map +1 -1
- package/dist/tests/manager.unit.test.d.ts +2 -0
- package/dist/tests/manager.unit.test.d.ts.map +1 -0
- package/dist/tests/manager.unit.test.js +752 -0
- package/dist/tests/manager.unit.test.js.map +1 -0
- package/dist/tests/managerHarness.d.ts +17 -0
- package/dist/tests/managerHarness.d.ts.map +1 -0
- package/dist/tests/managerHarness.js +70 -0
- package/dist/tests/managerHarness.js.map +1 -0
- package/dist/tests/procaptchaPoW.unit.test.d.ts +2 -0
- package/dist/tests/procaptchaPoW.unit.test.d.ts.map +1 -0
- package/dist/tests/procaptchaPoW.unit.test.js +79 -0
- package/dist/tests/procaptchaPoW.unit.test.js.map +1 -0
- package/dist/tests/procaptchaPow.test-d.d.ts +2 -0
- package/dist/tests/procaptchaPow.test-d.d.ts.map +1 -0
- package/dist/tests/procaptchaPow.test-d.js +62 -0
- package/dist/tests/procaptchaPow.test-d.js.map +1 -0
- package/dist/tests/procaptchaWidget.unit.test.d.ts +2 -0
- package/dist/tests/procaptchaWidget.unit.test.d.ts.map +1 -0
- package/dist/tests/procaptchaWidget.unit.test.js +410 -0
- package/dist/tests/procaptchaWidget.unit.test.js.map +1 -0
- package/package.json +18 -13
- package/src/components/ProcaptchaWidget.tsx +22 -5
- package/src/services/Manager.ts +9 -5
- package/src/tests/manager.unit.test.ts +1105 -0
- package/src/tests/managerHarness.ts +135 -0
- package/src/tests/procaptchaPoW.unit.test.ts +120 -0
- package/src/tests/procaptchaPow.test-d.ts +122 -0
- package/src/tests/procaptchaWidget.unit.test.ts +571 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.test.config.ts +25 -0
|
@@ -1,279 +1,195 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
const dataToEncrypt = frictionlessState.packBehavioralData ? frictionlessState.packBehavioralData(behavioralData) : behavioralData;
|
|
194
|
-
encryptedBehavioralData = await frictionlessState.encryptBehavioralData(
|
|
195
|
-
JSON.stringify(dataToEncrypt)
|
|
196
|
-
);
|
|
197
|
-
} catch {
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const simdReadings = frictionlessState?.getSimdReadings ? await frictionlessState.getSimdReadings() : void 0;
|
|
201
|
-
const hpValue = getHoneypotValue?.();
|
|
202
|
-
const clientMetaData = hpValue ? { hp: hpValue } : void 0;
|
|
203
|
-
let fingerprintProof;
|
|
204
|
-
try {
|
|
205
|
-
fingerprintProof = fingerprint.encodeFingerprintProof(
|
|
206
|
-
await fingerprint.getFingerprintProof(fingerprint.FINGERPRINT_DISCLOSURE_KEYS)
|
|
207
|
-
);
|
|
208
|
-
} catch {
|
|
209
|
-
fingerprintProof = void 0;
|
|
210
|
-
}
|
|
211
|
-
const fpTest = globalThis.__prosopoFingerprintProofTest__;
|
|
212
|
-
if (fpTest === "omit") {
|
|
213
|
-
fingerprintProof = void 0;
|
|
214
|
-
} else if (typeof fpTest === "string" && fpTest.length > 0) {
|
|
215
|
-
fingerprintProof = "invalid-fingerprint-proof";
|
|
216
|
-
}
|
|
217
|
-
const verifiedSolution = await providerApi.submitPowCaptchaSolution(
|
|
218
|
-
challenge,
|
|
219
|
-
getAccount().account.account.address,
|
|
220
|
-
getDappAccount(),
|
|
221
|
-
solution,
|
|
222
|
-
userTimestampSignature.signature.toString(),
|
|
223
|
-
encryptedBehavioralData,
|
|
224
|
-
salt,
|
|
225
|
-
simdReadings,
|
|
226
|
-
clientMetaData,
|
|
227
|
-
fingerprintProof
|
|
228
|
-
);
|
|
229
|
-
const escalation = verifiedSolution[types.ApiParams.escalation];
|
|
230
|
-
if (escalation && (escalation[types.ApiParams.captchaType] === types.CaptchaType.image || escalation[types.ApiParams.captchaType] === types.CaptchaType.puzzle)) {
|
|
231
|
-
updateState({ loading: false });
|
|
232
|
-
const isRealClick = checkboxClickX !== 0 || checkboxClickY !== 0;
|
|
233
|
-
onEscalate?.(
|
|
234
|
-
escalation[types.ApiParams.captchaType],
|
|
235
|
-
escalation[types.ApiParams.sessionId],
|
|
236
|
-
isRealClick ? { x: checkboxClickX, y: checkboxClickY } : void 0
|
|
237
|
-
);
|
|
238
|
-
} else if (verifiedSolution[types.ApiParams.verified]) {
|
|
239
|
-
updateState({
|
|
240
|
-
isHuman: true,
|
|
241
|
-
loading: false
|
|
242
|
-
});
|
|
243
|
-
events.onHuman(
|
|
244
|
-
types.encodeProcaptchaOutput({
|
|
245
|
-
[types.ApiParams.providerUrl]: providerUrl,
|
|
246
|
-
[types.ApiParams.user]: getAccount().account.account.address,
|
|
247
|
-
[types.ApiParams.dapp]: getDappAccount(),
|
|
248
|
-
[types.ApiParams.challenge]: challenge.challenge,
|
|
249
|
-
[types.ApiParams.nonce]: solution,
|
|
250
|
-
[types.ApiParams.timestamp]: challenge.timestamp,
|
|
251
|
-
[types.ApiParams.signature]: {
|
|
252
|
-
[types.ApiParams.provider]: challenge.signature.provider,
|
|
253
|
-
[types.ApiParams.user]: {
|
|
254
|
-
[types.ApiParams.timestamp]: userTimestampSignature.signature.toString()
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
[types.ApiParams.captchaType]: types.CaptchaType.pow
|
|
258
|
-
})
|
|
259
|
-
);
|
|
260
|
-
setValidChallengeTimeout();
|
|
261
|
-
} else {
|
|
262
|
-
onFailed();
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
start,
|
|
267
|
-
() => {
|
|
268
|
-
resetState();
|
|
269
|
-
},
|
|
270
|
-
state.attemptCount,
|
|
271
|
-
3
|
|
272
|
-
);
|
|
273
|
-
};
|
|
274
|
-
return {
|
|
275
|
-
start,
|
|
276
|
-
resetState
|
|
277
|
-
};
|
|
1
|
+
let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
|
|
2
|
+
let _prosopo_types = require("@prosopo/types");
|
|
3
|
+
let _polkadot_util_string = require("@polkadot/util/string");
|
|
4
|
+
let _prosopo_api = require("@prosopo/api");
|
|
5
|
+
let _prosopo_common = require("@prosopo/common");
|
|
6
|
+
let _prosopo_fingerprint = require("@prosopo/fingerprint");
|
|
7
|
+
let _prosopo_util = require("@prosopo/util");
|
|
8
|
+
let _prosopo_util_crypto = require("@prosopo/util-crypto");
|
|
9
|
+
//#region src/services/Manager.ts
|
|
10
|
+
var Manager = (configInput, state, onStateUpdate, callbacks, frictionlessState, onEscalate, getHoneypotValue) => {
|
|
11
|
+
const events = (0, _prosopo_procaptcha_common.getDefaultEvents)(callbacks);
|
|
12
|
+
let previousProviderUrl;
|
|
13
|
+
const defaultState = () => {
|
|
14
|
+
return {
|
|
15
|
+
showModal: false,
|
|
16
|
+
loading: false,
|
|
17
|
+
index: 0,
|
|
18
|
+
challenge: void 0,
|
|
19
|
+
solutions: void 0,
|
|
20
|
+
isHuman: false,
|
|
21
|
+
captchaApi: void 0,
|
|
22
|
+
account: void 0
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const clearTimeout = () => {
|
|
26
|
+
window.clearTimeout(Number(state.timeout));
|
|
27
|
+
updateState({ timeout: void 0 });
|
|
28
|
+
};
|
|
29
|
+
const onFailed = () => {
|
|
30
|
+
updateState({
|
|
31
|
+
isHuman: false,
|
|
32
|
+
loading: false
|
|
33
|
+
});
|
|
34
|
+
events.onFailed();
|
|
35
|
+
resetState(frictionlessState?.restart);
|
|
36
|
+
};
|
|
37
|
+
const clearSuccessfulChallengeTimeout = () => {
|
|
38
|
+
window.clearTimeout(Number(state.successfullChallengeTimeout));
|
|
39
|
+
updateState({ successfullChallengeTimeout: void 0 });
|
|
40
|
+
};
|
|
41
|
+
const getConfig = () => {
|
|
42
|
+
const config = {
|
|
43
|
+
userAccountAddress: configInput.userAccountAddress || "",
|
|
44
|
+
...configInput
|
|
45
|
+
};
|
|
46
|
+
if (state.account) config.userAccountAddress = state.account.account.address;
|
|
47
|
+
return _prosopo_types.ProcaptchaConfigSchema.parse(config);
|
|
48
|
+
};
|
|
49
|
+
const getAccount = () => {
|
|
50
|
+
if (!state.account) throw new _prosopo_common.ProsopoEnvError("GENERAL.ACCOUNT_NOT_FOUND", { context: { error: "Account not loaded" } });
|
|
51
|
+
return { account: state.account };
|
|
52
|
+
};
|
|
53
|
+
const getDappAccount = () => {
|
|
54
|
+
if (!state.dappAccount) throw new _prosopo_common.ProsopoEnvError("GENERAL.SITE_KEY_MISSING");
|
|
55
|
+
return state.dappAccount;
|
|
56
|
+
};
|
|
57
|
+
const updateState = (0, _prosopo_procaptcha_common.buildUpdateState)(state, onStateUpdate);
|
|
58
|
+
const resetState = (frictionlessRestart) => {
|
|
59
|
+
clearTimeout();
|
|
60
|
+
clearSuccessfulChallengeTimeout();
|
|
61
|
+
updateState(defaultState());
|
|
62
|
+
events.onReset();
|
|
63
|
+
if (frictionlessRestart) frictionlessRestart();
|
|
64
|
+
};
|
|
65
|
+
const setValidChallengeTimeout = () => {
|
|
66
|
+
const timeMillis = getConfig().captchas.pow.solutionTimeout;
|
|
67
|
+
const successfullChallengeTimeout = setTimeout(() => {
|
|
68
|
+
updateState({ isHuman: false });
|
|
69
|
+
events.onExpired();
|
|
70
|
+
resetState(frictionlessState?.restart);
|
|
71
|
+
}, timeMillis);
|
|
72
|
+
updateState({ successfullChallengeTimeout });
|
|
73
|
+
};
|
|
74
|
+
let checkboxClickX = 0;
|
|
75
|
+
let checkboxClickY = 0;
|
|
76
|
+
const start = async (x = 0, y = 0) => {
|
|
77
|
+
checkboxClickX = x;
|
|
78
|
+
checkboxClickY = y;
|
|
79
|
+
await (0, _prosopo_procaptcha_common.providerRetry)(async () => {
|
|
80
|
+
if (state.loading) return;
|
|
81
|
+
if (state.isHuman) return;
|
|
82
|
+
resetState();
|
|
83
|
+
updateState({ loading: true });
|
|
84
|
+
updateState({ attemptCount: state.attemptCount + 1 });
|
|
85
|
+
const config = getConfig();
|
|
86
|
+
const selectAccount = async () => {
|
|
87
|
+
if (frictionlessState) return frictionlessState.userAccount;
|
|
88
|
+
return new (await ((0, _prosopo_procaptcha_common.ExtensionLoader)(config.web2)))().getAccount(config);
|
|
89
|
+
};
|
|
90
|
+
const user = await selectAccount();
|
|
91
|
+
const userAccount = user.account.address;
|
|
92
|
+
updateState({ account: { account: { address: userAccount } } });
|
|
93
|
+
updateState({ dappAccount: config.account.address });
|
|
94
|
+
await (0, _prosopo_util.sleep)(100);
|
|
95
|
+
if (!config.web2 && !config.userAccountAddress) throw new _prosopo_common.ProsopoEnvError("GENERAL.ACCOUNT_NOT_FOUND", { context: { error: "Account address has not been set for web3 mode" } });
|
|
96
|
+
let getRandomProviderResponse = void 0;
|
|
97
|
+
if (frictionlessState?.provider) getRandomProviderResponse = frictionlessState.provider;
|
|
98
|
+
else {
|
|
99
|
+
const currentConfig = getConfig();
|
|
100
|
+
getRandomProviderResponse = await (0, _prosopo_procaptcha_common.getProcaptchaRandomActiveProvider)(currentConfig.defaultEnvironment, (0, _prosopo_procaptcha_common.pickIpMode)(currentConfig), {
|
|
101
|
+
attempt: state.attemptCount,
|
|
102
|
+
excludeUrl: previousProviderUrl
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const providerUrl = getRandomProviderResponse.provider.url;
|
|
106
|
+
previousProviderUrl = providerUrl;
|
|
107
|
+
const providerApi = new _prosopo_api.ProviderApi(providerUrl, getDappAccount());
|
|
108
|
+
const simdReadingsOnChallenge = frictionlessState?.getSimdReadings ? await frictionlessState.getSimdReadings(0) : void 0;
|
|
109
|
+
const challenge = await providerApi.getPowCaptchaChallenge(userAccount, getDappAccount(), frictionlessState?.sessionId, simdReadingsOnChallenge);
|
|
110
|
+
if (challenge.error) updateState({
|
|
111
|
+
loading: false,
|
|
112
|
+
error: {
|
|
113
|
+
message: challenge.error.message,
|
|
114
|
+
key: challenge.error.key || "API.UNKNOWN_ERROR"
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
else {
|
|
118
|
+
const solution = await (0, _prosopo_util.solvePoW)(challenge.challenge, challenge.difficulty);
|
|
119
|
+
let salt;
|
|
120
|
+
if (x !== void 0 && y !== void 0) {
|
|
121
|
+
const coords = [x, y];
|
|
122
|
+
const randomSalt = (0, _prosopo_util_crypto.randomAsHex)(coords.map((coord) => coord.toString(16).length + 4).reduce((acc, curr) => acc + curr, 0));
|
|
123
|
+
salt = (0, _prosopo_util.embedData)(randomSalt, coords);
|
|
124
|
+
}
|
|
125
|
+
const signer = user.extension?.signer;
|
|
126
|
+
if (!signer || !signer.signRaw) throw new _prosopo_common.ProsopoEnvError("GENERAL.CANT_FIND_KEYRINGPAIR", { context: { error: "Signer is not defined, cannot sign message to prove account ownership" } });
|
|
127
|
+
const userTimestampSignature = await signer.signRaw({
|
|
128
|
+
address: userAccount,
|
|
129
|
+
data: (0, _polkadot_util_string.stringToHex)(challenge[_prosopo_types.ApiParams.timestamp].toString()),
|
|
130
|
+
type: "bytes"
|
|
131
|
+
});
|
|
132
|
+
let encryptedBehavioralData;
|
|
133
|
+
if (frictionlessState?.encryptBehavioralData && (frictionlessState?.behaviorCollector1 || frictionlessState?.behaviorCollector2 || frictionlessState?.behaviorCollector3)) try {
|
|
134
|
+
const behavioralData = {
|
|
135
|
+
collector1: frictionlessState.behaviorCollector1?.getData() || [],
|
|
136
|
+
collector2: frictionlessState.behaviorCollector2?.getData() || [],
|
|
137
|
+
collector3: frictionlessState.behaviorCollector3?.getData() || [],
|
|
138
|
+
deviceCapability: frictionlessState.deviceCapability || "unknown"
|
|
139
|
+
};
|
|
140
|
+
const dataToEncrypt = frictionlessState.packBehavioralData ? frictionlessState.packBehavioralData(behavioralData) : behavioralData;
|
|
141
|
+
encryptedBehavioralData = await frictionlessState.encryptBehavioralData(JSON.stringify(dataToEncrypt));
|
|
142
|
+
} catch {}
|
|
143
|
+
const simdReadings = await (0, _prosopo_procaptcha_common.getSimdReadingsForSubmit)(frictionlessState);
|
|
144
|
+
const hpValue = getHoneypotValue?.();
|
|
145
|
+
const clientMetaData = hpValue ? { hp: hpValue } : void 0;
|
|
146
|
+
let fingerprintProof;
|
|
147
|
+
try {
|
|
148
|
+
fingerprintProof = (0, _prosopo_fingerprint.encodeFingerprintProof)(await (0, _prosopo_fingerprint.getFingerprintProof)(_prosopo_fingerprint.FINGERPRINT_DISCLOSURE_KEYS));
|
|
149
|
+
} catch {
|
|
150
|
+
fingerprintProof = void 0;
|
|
151
|
+
}
|
|
152
|
+
const fpTest = globalThis.__prosopoFingerprintProofTest__;
|
|
153
|
+
if (fpTest === "omit") fingerprintProof = void 0;
|
|
154
|
+
else if (typeof fpTest === "string" && fpTest.length > 0) fingerprintProof = "invalid-fingerprint-proof";
|
|
155
|
+
const verifiedSolution = await providerApi.submitPowCaptchaSolution(challenge, getAccount().account.account.address, getDappAccount(), solution, userTimestampSignature.signature.toString(), encryptedBehavioralData, salt, simdReadings, clientMetaData, fingerprintProof);
|
|
156
|
+
const escalation = verifiedSolution[_prosopo_types.ApiParams.escalation];
|
|
157
|
+
if (escalation && (escalation[_prosopo_types.ApiParams.captchaType] === _prosopo_types.CaptchaType.image || escalation[_prosopo_types.ApiParams.captchaType] === _prosopo_types.CaptchaType.puzzle)) {
|
|
158
|
+
updateState({ loading: false });
|
|
159
|
+
const isRealClick = checkboxClickX !== 0 || checkboxClickY !== 0;
|
|
160
|
+
onEscalate?.(escalation[_prosopo_types.ApiParams.captchaType], escalation[_prosopo_types.ApiParams.sessionId], isRealClick ? {
|
|
161
|
+
x: checkboxClickX,
|
|
162
|
+
y: checkboxClickY
|
|
163
|
+
} : void 0);
|
|
164
|
+
} else if (verifiedSolution[_prosopo_types.ApiParams.verified]) {
|
|
165
|
+
updateState({
|
|
166
|
+
isHuman: true,
|
|
167
|
+
loading: false
|
|
168
|
+
});
|
|
169
|
+
events.onHuman((0, _prosopo_types.encodeProcaptchaOutput)({
|
|
170
|
+
[_prosopo_types.ApiParams.providerUrl]: providerUrl,
|
|
171
|
+
[_prosopo_types.ApiParams.user]: getAccount().account.account.address,
|
|
172
|
+
[_prosopo_types.ApiParams.dapp]: getDappAccount(),
|
|
173
|
+
[_prosopo_types.ApiParams.challenge]: challenge.challenge,
|
|
174
|
+
[_prosopo_types.ApiParams.nonce]: solution,
|
|
175
|
+
[_prosopo_types.ApiParams.timestamp]: challenge.timestamp,
|
|
176
|
+
[_prosopo_types.ApiParams.signature]: {
|
|
177
|
+
[_prosopo_types.ApiParams.provider]: challenge.signature.provider,
|
|
178
|
+
[_prosopo_types.ApiParams.user]: { [_prosopo_types.ApiParams.timestamp]: userTimestampSignature.signature.toString() }
|
|
179
|
+
},
|
|
180
|
+
[_prosopo_types.ApiParams.captchaType]: _prosopo_types.CaptchaType.pow
|
|
181
|
+
}));
|
|
182
|
+
setValidChallengeTimeout();
|
|
183
|
+
} else onFailed();
|
|
184
|
+
}
|
|
185
|
+
}, () => start(x, y), () => {
|
|
186
|
+
resetState();
|
|
187
|
+
}, state.attemptCount, 3);
|
|
188
|
+
};
|
|
189
|
+
return {
|
|
190
|
+
start,
|
|
191
|
+
resetState
|
|
192
|
+
};
|
|
278
193
|
};
|
|
194
|
+
//#endregion
|
|
279
195
|
exports.Manager = Manager;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import { Suspense, lazy } from "react";
|
|
1
2
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
ProcaptchaPow
|
|
9
|
-
};
|
|
3
|
+
//#region src/components/ProcaptchaPoW.tsx
|
|
4
|
+
var ProcaptchaWidget = lazy(async () => import("./ProcaptchaWidget.js"));
|
|
5
|
+
var ProcaptchaPow = (props) => /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(ProcaptchaWidget, { ...props }) });
|
|
6
|
+
//#endregion
|
|
7
|
+
export { ProcaptchaPow };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcaptchaWidget.d.ts","sourceRoot":"","sources":["../../src/components/ProcaptchaWidget.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAQhE,QAAA,MAAM,UAAU,UAAW,eAAe,
|
|
1
|
+
{"version":3,"file":"ProcaptchaWidget.d.ts","sourceRoot":"","sources":["../../src/components/ProcaptchaWidget.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAQhE,QAAA,MAAM,UAAU,UAAW,eAAe,4DAyLzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|