@prosopo/server 2.10.59 → 2.11.1
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 +3 -3
- package/.turbo/turbo-build$colon$tsc.log +14 -14
- package/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +31 -0
- package/dist/cjs/server.cjs +12 -8
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +12 -8
- package/dist/server.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/server@2.
|
|
2
|
+
> @prosopo/server@2.11.1 build:cjs
|
|
3
3
|
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
4
|
|
|
5
5
|
ViteCommonJSConfig: .
|
|
@@ -39,6 +39,6 @@ computing gzip size...
|
|
|
39
39
|
dist/cjs/index.cjs 0.65 kB │ gzip: 0.31 kB
|
|
40
40
|
dist/cjs/config.cjs 0.82 kB │ gzip: 0.41 kB
|
|
41
41
|
dist/cjs/_virtual/_rolldown/runtime.cjs 1.00 kB │ gzip: 0.50 kB
|
|
42
|
-
dist/cjs/server.cjs
|
|
42
|
+
dist/cjs/server.cjs 6.14 kB │ gzip: 1.90 kB
|
|
43
43
|
|
|
44
|
-
[32m✓ built in
|
|
44
|
+
[32m✓ built in 53ms[39m
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/server@2.
|
|
2
|
+
> @prosopo/server@2.11.1 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
6:42:30 PM - Projects in this build:
|
|
6
6
|
* ../../dev/config/tsconfig.json
|
|
7
7
|
* ../locale/tsconfig.json
|
|
8
8
|
* ../util/tsconfig.json
|
|
@@ -15,27 +15,27 @@
|
|
|
15
15
|
* ../load-balancer/tsconfig.json
|
|
16
16
|
* tsconfig.json
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
6:42:30 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'
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
6:42:30 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
6:42:30 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
6:42:30 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'
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
6:42:30 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'
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
6:42:30 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
6:42:30 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
6:42:30 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
6:42:30 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'
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
6:42:30 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/index.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
6:42:30 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
6:42:30 PM - Building project '/home/runner/work/captcha/captcha/packages/server/tsconfig.json'...
|
|
41
41
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/server@2.
|
|
2
|
+
> @prosopo/server@2.11.1 build
|
|
3
3
|
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @prosopo/server@2.
|
|
6
|
+
> @prosopo/server@2.11.1 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
@@ -23,6 +23,7 @@ ViteEsmConfig: .
|
|
|
23
23
|
{
|
|
24
24
|
externals: [
|
|
25
25
|
'@prosopo/api',
|
|
26
|
+
[33mThe plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the [1mresolve.tsconfigPaths[22m option. You can remove the plugin and set [1mresolve.tsconfigPaths: true[22m in your Vite config instead.[39m
|
|
26
27
|
'@prosopo/types',
|
|
27
28
|
'@prosopo/locale',
|
|
28
29
|
'@prosopo/util',
|
|
@@ -33,7 +34,6 @@ ViteEsmConfig: .
|
|
|
33
34
|
'@prosopo/load-balancer'
|
|
34
35
|
]
|
|
35
36
|
}
|
|
36
|
-
[33mThe plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the [1mresolve.tsconfigPaths[22m option. You can remove the plugin and set [1mresolve.tsconfigPaths: true[22m in your Vite config instead.[39m
|
|
37
37
|
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
38
38
|
Bundle build started
|
|
39
39
|
[2K
|
|
@@ -43,6 +43,6 @@ computing gzip size...
|
|
|
43
43
|
dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
44
44
|
dist/index.js 0.43 kB │ gzip: 0.23 kB
|
|
45
45
|
dist/config.js 0.78 kB │ gzip: 0.40 kB
|
|
46
|
-
dist/server.js 5.
|
|
46
|
+
dist/server.js 5.79 kB │ gzip: 1.81 kB
|
|
47
47
|
|
|
48
|
-
[32m✓ built in
|
|
48
|
+
[32m✓ built in 30ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @prosopo/server
|
|
2
2
|
|
|
3
|
+
## 2.11.1
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- Updated dependencies [eb34de6]
|
|
7
|
+
- @prosopo/types@5.5.0
|
|
8
|
+
- @prosopo/api@4.1.1
|
|
9
|
+
- @prosopo/keyring@2.9.80
|
|
10
|
+
- @prosopo/load-balancer@2.10.34
|
|
11
|
+
|
|
12
|
+
## 2.11.0
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 4b1cb19: Correlate a site-supplied session id across render and verify.
|
|
16
|
+
|
|
17
|
+
A site can now hand the widget its own session identifier — Protect's JTI, or any per-user session id it already holds — and have the provider confirm at verify time that the token was earned in that same session. Render it with `data-sessionid="..."` or `renderOptions.sessionId`, resolved the same way `mode` and `language` already are, so implicit, explicit and invisible-button renders all pick it up. Pass the same value as the new trailing `clientSessionId` argument to `ProsopoServer.isVerified`.
|
|
18
|
+
|
|
19
|
+
The widget attaches it to the solution as `clientMetaData.clientSessionId`. It is persisted on the captcha record (PoW, puzzle and image alike) and mirrored to a new top-level `clientMetaData` key on the session record — an object rather than a flat field, because more render-time metadata is expected to land there. It survives the PoW→image/puzzle escalation handoff, since the escalated widget is mounted with the same config.
|
|
20
|
+
|
|
21
|
+
At verify, when the value is supplied and the solve does not carry exactly that value — including carrying none at all, which is what a token minted outside the site's session looks like — the token is disapproved with the new `ResultReason.CLIENT_SESSION_MISMATCH` (`API.CLIENT_SESSION_MISMATCH`, translated in all 31 locales), recorded on both the captcha record and the session.
|
|
22
|
+
|
|
23
|
+
Omitting the id preserves existing behaviour, so this is opt-in and backward compatible. The verify request field is `clientSessionId` rather than `sessionId` because `VerificationResponse.sessionId` already means the provider's own frictionless session; same-named request and response fields meaning different things would be a trap for integrators.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [4b1cb19]
|
|
28
|
+
- @prosopo/types@5.4.0
|
|
29
|
+
- @prosopo/api@4.1.0
|
|
30
|
+
- @prosopo/common@3.1.52
|
|
31
|
+
- @prosopo/keyring@2.9.79
|
|
32
|
+
- @prosopo/load-balancer@2.10.33
|
|
33
|
+
|
|
3
34
|
## 2.10.59
|
|
4
35
|
### Patch Changes
|
|
5
36
|
|
package/dist/cjs/server.cjs
CHANGED
|
@@ -40,8 +40,11 @@ var ProsopoServer = class {
|
|
|
40
40
|
* @param ip
|
|
41
41
|
* @param email
|
|
42
42
|
* @param captchaType
|
|
43
|
+
* @param clientSessionId - the session id the widget was rendered with
|
|
44
|
+
* (`data-sessionid` / `renderOptions.sessionId`). When supplied, the
|
|
45
|
+
* provider only verifies the token if the solve carries the same value.
|
|
43
46
|
*/
|
|
44
|
-
async verifyProvider(token, timeouts, providerUrl, timestamp, user, challenge, ip, email, captchaType) {
|
|
47
|
+
async verifyProvider(token, timeouts, providerUrl, timestamp, user, challenge, ip, email, captchaType, clientSessionId) {
|
|
45
48
|
this.logger.info(() => ({
|
|
46
49
|
data: {
|
|
47
50
|
providerUrl,
|
|
@@ -56,17 +59,17 @@ var ProsopoServer = class {
|
|
|
56
59
|
if (captchaType === _prosopo_types.CaptchaType.puzzle) {
|
|
57
60
|
const puzzleTimeout = this.config.timeouts.puzzle.cachedTimeout;
|
|
58
61
|
if (!this.isRecent(timestamp, puzzleTimeout, "Puzzle")) return this.notRecentResponse();
|
|
59
|
-
return await providerApi.submitPuzzleCaptchaVerify(token, signatureHex, user, ip, email);
|
|
62
|
+
return await providerApi.submitPuzzleCaptchaVerify(token, signatureHex, user, ip, email, clientSessionId);
|
|
60
63
|
}
|
|
61
64
|
if (captchaType === _prosopo_types.CaptchaType.pow) {
|
|
62
65
|
const powTimeout = this.config.timeouts.pow.cachedTimeout;
|
|
63
66
|
if (!this.isRecent(timestamp, powTimeout, "PoW")) return this.notRecentResponse();
|
|
64
|
-
return await providerApi.submitPowCaptchaVerify(token, signatureHex, user, ip, email);
|
|
67
|
+
return await providerApi.submitPowCaptchaVerify(token, signatureHex, user, ip, email, clientSessionId);
|
|
65
68
|
}
|
|
66
69
|
if (captchaType === _prosopo_types.CaptchaType.image) {
|
|
67
70
|
const imageTimeout = this.config.timeouts.image.cachedTimeout;
|
|
68
71
|
if (!this.isRecent(timestamp, imageTimeout, "Image")) return this.notRecentResponse();
|
|
69
|
-
return await providerApi.verifyDappUser(token, signatureHex, user, timeouts.image.cachedTimeout, ip, email);
|
|
72
|
+
return await providerApi.verifyDappUser(token, signatureHex, user, timeouts.image.cachedTimeout, ip, email, clientSessionId);
|
|
70
73
|
}
|
|
71
74
|
this.logger.warn(() => ({
|
|
72
75
|
data: { challenge: Boolean(challenge) },
|
|
@@ -75,11 +78,11 @@ var ProsopoServer = class {
|
|
|
75
78
|
if (challenge) {
|
|
76
79
|
const powTimeout = this.config.timeouts.pow.cachedTimeout;
|
|
77
80
|
if (!this.isRecent(timestamp, powTimeout, "PoW")) return this.notRecentResponse();
|
|
78
|
-
return await providerApi.submitPowCaptchaVerify(token, signatureHex, user, ip, email);
|
|
81
|
+
return await providerApi.submitPowCaptchaVerify(token, signatureHex, user, ip, email, clientSessionId);
|
|
79
82
|
}
|
|
80
83
|
const imageTimeout = this.config.timeouts.image.cachedTimeout;
|
|
81
84
|
if (!this.isRecent(timestamp, imageTimeout, "Image")) return this.notRecentResponse();
|
|
82
|
-
return await providerApi.verifyDappUser(token, signatureHex, user, timeouts.image.cachedTimeout, ip, email);
|
|
85
|
+
return await providerApi.verifyDappUser(token, signatureHex, user, timeouts.image.cachedTimeout, ip, email, clientSessionId);
|
|
83
86
|
}
|
|
84
87
|
isRecent(timestamp, timeoutMs, label) {
|
|
85
88
|
if (!timestamp) return false;
|
|
@@ -103,8 +106,9 @@ var ProsopoServer = class {
|
|
|
103
106
|
* @param token
|
|
104
107
|
* @param ip
|
|
105
108
|
* @param email
|
|
109
|
+
* @param clientSessionId - see `verifyProvider`
|
|
106
110
|
*/
|
|
107
|
-
async isVerified(token, ip, email) {
|
|
111
|
+
async isVerified(token, ip, email, clientSessionId) {
|
|
108
112
|
try {
|
|
109
113
|
const payload = (0, _prosopo_types.decodeProcaptchaOutput)(token);
|
|
110
114
|
const { providerUrl, challenge, timestamp, user, captchaType } = _prosopo_types.ProcaptchaOutputSchema.parse(payload);
|
|
@@ -119,7 +123,7 @@ var ProsopoServer = class {
|
|
|
119
123
|
status: i18next.default.t("API.USER_NOT_VERIFIED")
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
|
-
const verificationResponse = await this.verifyProvider(token, this.config.timeouts, provider.url, Number(timestamp), user, challenge, ip, email, captchaType);
|
|
126
|
+
const verificationResponse = await this.verifyProvider(token, this.config.timeouts, provider.url, Number(timestamp), user, challenge, ip, email, captchaType, clientSessionId);
|
|
123
127
|
this.logger.info(() => ({ data: {
|
|
124
128
|
verificationResponse,
|
|
125
129
|
providerUrl,
|
package/dist/server.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ export declare class ProsopoServer {
|
|
|
12
12
|
pair: KeyringPair | undefined;
|
|
13
13
|
constructor(config: ProsopoServerConfigOutput, pair?: KeyringPair);
|
|
14
14
|
getProviderApi(providerUrl: string): ProviderApi;
|
|
15
|
-
verifyProvider(token: string, timeouts: CaptchaTimeoutOutput, providerUrl: string, timestamp: number, user: string, challenge?: string, ip?: string, email?: string, captchaType?: CaptchaType): Promise<VerificationResponse>;
|
|
15
|
+
verifyProvider(token: string, timeouts: CaptchaTimeoutOutput, providerUrl: string, timestamp: number, user: string, challenge?: string, ip?: string, email?: string, captchaType?: CaptchaType, clientSessionId?: string): Promise<VerificationResponse>;
|
|
16
16
|
private isRecent;
|
|
17
17
|
private notRecentResponse;
|
|
18
|
-
isVerified(token: ProcaptchaToken, ip?: string, email?: string): Promise<VerificationResponse>;
|
|
18
|
+
isVerified(token: ProcaptchaToken, ip?: string, email?: string, clientSessionId?: string): Promise<VerificationResponse>;
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAcA,OAAO,EAAa,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAiB,KAAK,MAAM,EAAa,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACN,KAAK,oBAAoB,EACzB,WAAW,EAEX,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EAEzB,MAAM,gBAAgB,CAAC;AAIxB,qBAAa,aAAa;IACzB,MAAM,EAAE,yBAAyB,CAAC;IAClC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC;gBAElB,MAAM,EAAE,yBAAyB,EAAE,IAAI,CAAC,EAAE,WAAW;IAcjE,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAcA,OAAO,EAAa,WAAW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-38,8 +38,11 @@ var ProsopoServer = class {
|
|
|
38
38
|
* @param ip
|
|
39
39
|
* @param email
|
|
40
40
|
* @param captchaType
|
|
41
|
+
* @param clientSessionId - the session id the widget was rendered with
|
|
42
|
+
* (`data-sessionid` / `renderOptions.sessionId`). When supplied, the
|
|
43
|
+
* provider only verifies the token if the solve carries the same value.
|
|
41
44
|
*/
|
|
42
|
-
async verifyProvider(token, timeouts, providerUrl, timestamp, user, challenge, ip, email, captchaType) {
|
|
45
|
+
async verifyProvider(token, timeouts, providerUrl, timestamp, user, challenge, ip, email, captchaType, clientSessionId) {
|
|
43
46
|
this.logger.info(() => ({
|
|
44
47
|
data: {
|
|
45
48
|
providerUrl,
|
|
@@ -54,17 +57,17 @@ var ProsopoServer = class {
|
|
|
54
57
|
if (captchaType === CaptchaType.puzzle) {
|
|
55
58
|
const puzzleTimeout = this.config.timeouts.puzzle.cachedTimeout;
|
|
56
59
|
if (!this.isRecent(timestamp, puzzleTimeout, "Puzzle")) return this.notRecentResponse();
|
|
57
|
-
return await providerApi.submitPuzzleCaptchaVerify(token, signatureHex, user, ip, email);
|
|
60
|
+
return await providerApi.submitPuzzleCaptchaVerify(token, signatureHex, user, ip, email, clientSessionId);
|
|
58
61
|
}
|
|
59
62
|
if (captchaType === CaptchaType.pow) {
|
|
60
63
|
const powTimeout = this.config.timeouts.pow.cachedTimeout;
|
|
61
64
|
if (!this.isRecent(timestamp, powTimeout, "PoW")) return this.notRecentResponse();
|
|
62
|
-
return await providerApi.submitPowCaptchaVerify(token, signatureHex, user, ip, email);
|
|
65
|
+
return await providerApi.submitPowCaptchaVerify(token, signatureHex, user, ip, email, clientSessionId);
|
|
63
66
|
}
|
|
64
67
|
if (captchaType === CaptchaType.image) {
|
|
65
68
|
const imageTimeout = this.config.timeouts.image.cachedTimeout;
|
|
66
69
|
if (!this.isRecent(timestamp, imageTimeout, "Image")) return this.notRecentResponse();
|
|
67
|
-
return await providerApi.verifyDappUser(token, signatureHex, user, timeouts.image.cachedTimeout, ip, email);
|
|
70
|
+
return await providerApi.verifyDappUser(token, signatureHex, user, timeouts.image.cachedTimeout, ip, email, clientSessionId);
|
|
68
71
|
}
|
|
69
72
|
this.logger.warn(() => ({
|
|
70
73
|
data: { challenge: Boolean(challenge) },
|
|
@@ -73,11 +76,11 @@ var ProsopoServer = class {
|
|
|
73
76
|
if (challenge) {
|
|
74
77
|
const powTimeout = this.config.timeouts.pow.cachedTimeout;
|
|
75
78
|
if (!this.isRecent(timestamp, powTimeout, "PoW")) return this.notRecentResponse();
|
|
76
|
-
return await providerApi.submitPowCaptchaVerify(token, signatureHex, user, ip, email);
|
|
79
|
+
return await providerApi.submitPowCaptchaVerify(token, signatureHex, user, ip, email, clientSessionId);
|
|
77
80
|
}
|
|
78
81
|
const imageTimeout = this.config.timeouts.image.cachedTimeout;
|
|
79
82
|
if (!this.isRecent(timestamp, imageTimeout, "Image")) return this.notRecentResponse();
|
|
80
|
-
return await providerApi.verifyDappUser(token, signatureHex, user, timeouts.image.cachedTimeout, ip, email);
|
|
83
|
+
return await providerApi.verifyDappUser(token, signatureHex, user, timeouts.image.cachedTimeout, ip, email, clientSessionId);
|
|
81
84
|
}
|
|
82
85
|
isRecent(timestamp, timeoutMs, label) {
|
|
83
86
|
if (!timestamp) return false;
|
|
@@ -101,8 +104,9 @@ var ProsopoServer = class {
|
|
|
101
104
|
* @param token
|
|
102
105
|
* @param ip
|
|
103
106
|
* @param email
|
|
107
|
+
* @param clientSessionId - see `verifyProvider`
|
|
104
108
|
*/
|
|
105
|
-
async isVerified(token, ip, email) {
|
|
109
|
+
async isVerified(token, ip, email, clientSessionId) {
|
|
106
110
|
try {
|
|
107
111
|
const payload = decodeProcaptchaOutput(token);
|
|
108
112
|
const { providerUrl, challenge, timestamp, user, captchaType } = ProcaptchaOutputSchema.parse(payload);
|
|
@@ -117,7 +121,7 @@ var ProsopoServer = class {
|
|
|
117
121
|
status: i18n.t("API.USER_NOT_VERIFIED")
|
|
118
122
|
};
|
|
119
123
|
}
|
|
120
|
-
const verificationResponse = await this.verifyProvider(token, this.config.timeouts, provider.url, Number(timestamp), user, challenge, ip, email, captchaType);
|
|
124
|
+
const verificationResponse = await this.verifyProvider(token, this.config.timeouts, provider.url, Number(timestamp), user, challenge, ip, email, captchaType, clientSessionId);
|
|
121
125
|
this.logger.info(() => ({ data: {
|
|
122
126
|
verificationResponse,
|
|
123
127
|
providerUrl,
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAA8B,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExE,OAAO,EAEN,WAAW,EACX,sBAAsB,EAItB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,MAAM,OAAO,aAAa;IAQzB,YAAY,MAAiC,EAAE,IAAkB;QAChE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;QACzD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,SAAS,CACtB,IAAI,CAAC,MAAM,CAAC,QAA+B,EAC3C,iBAAiB,CACjB,CAAC;QACF,IAAI,CAAC,OAAO,GAA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AAC,CAAC,CAAC;YAEJ,OAAO,oBAAoB,CAAC;QAC7B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;YACpD,MAAM,IAAI,GAAG,GAAG,YAAY,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;YACzD,MAAM,IAAI,eAAe,CAAC,iBAAiB,EAAE;gBAC5C,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;aACxB,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;CACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"description": "NodeJS package for server side communication with the prosopo captcha client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"homepage": "https://github.com/prosopo/captcha#readme",
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@prosopo/api": "4.
|
|
42
|
-
"@prosopo/common": "3.1.
|
|
41
|
+
"@prosopo/api": "4.1.1",
|
|
42
|
+
"@prosopo/common": "3.1.52",
|
|
43
43
|
"@prosopo/logger": "2.0.7",
|
|
44
|
-
"@prosopo/keyring": "2.9.
|
|
45
|
-
"@prosopo/load-balancer": "2.10.
|
|
46
|
-
"@prosopo/types": "5.
|
|
44
|
+
"@prosopo/keyring": "2.9.80",
|
|
45
|
+
"@prosopo/load-balancer": "2.10.34",
|
|
46
|
+
"@prosopo/types": "5.5.0",
|
|
47
47
|
"@prosopo/util": "3.3.7",
|
|
48
48
|
"i18next": "24.1.0"
|
|
49
49
|
},
|