@prosopo/provider-mock 0.3.42 → 1.0.2
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/dist/api.d.ts.map +1 -1
- package/dist/api.js +11 -9
- package/dist/api.js.map +1 -1
- package/package.json +7 -7
- package/typedoc.config.js +0 -19
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAgBA,OAAgB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAOzC,wBAAgB,aAAa,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAgBA,OAAgB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAOzC,wBAAgB,aAAa,IAAI,MAAM,CAqDtC"}
|
package/dist/api.js
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
import { ApiPaths, VerifySolutionBody } from '@prosopo/types';
|
|
1
|
+
import { ApiPaths, VerifySolutionBody, decodeProcaptchaOutput } from '@prosopo/types';
|
|
2
2
|
import { ProsopoApiError } from '@prosopo/common';
|
|
3
3
|
import express from 'express';
|
|
4
4
|
export function prosopoRouter() {
|
|
5
5
|
const router = express.Router();
|
|
6
|
-
router.post(ApiPaths.
|
|
7
|
-
let
|
|
6
|
+
router.post(ApiPaths.VerifyImageCaptchaSolutionDapp, async (req, res, next) => {
|
|
7
|
+
let body;
|
|
8
8
|
try {
|
|
9
|
-
|
|
9
|
+
body = VerifySolutionBody.parse(req.body);
|
|
10
10
|
}
|
|
11
11
|
catch (err) {
|
|
12
12
|
return next(new ProsopoApiError('CAPTCHA.PARSE_ERROR', {
|
|
13
|
-
context: { error: err,
|
|
13
|
+
context: { error: err, code: 400 },
|
|
14
14
|
logLevel: 'info',
|
|
15
15
|
}));
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
|
+
const { token } = body;
|
|
19
|
+
const { user, dapp, commitmentId } = decodeProcaptchaOutput(token);
|
|
18
20
|
const testCommitmentId = '0x123456789test';
|
|
19
21
|
const testAccount = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
|
20
22
|
const testDapp = '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM';
|
|
21
23
|
let statusMessage = 'API.USER_NOT_VERIFIED';
|
|
22
24
|
let approved = false;
|
|
23
|
-
if ((
|
|
24
|
-
(
|
|
25
|
-
(
|
|
25
|
+
if ((user && user === testAccount) ||
|
|
26
|
+
(commitmentId && commitmentId === testCommitmentId) ||
|
|
27
|
+
(dapp && dapp === testDapp)) {
|
|
26
28
|
approved = true;
|
|
27
29
|
statusMessage = 'API.USER_VERIFIED';
|
|
28
30
|
return res.json({
|
|
@@ -37,7 +39,7 @@ export function prosopoRouter() {
|
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
41
|
catch (err) {
|
|
40
|
-
return next(new ProsopoApiError('API.UNKNOWN', { context: { error: err,
|
|
42
|
+
return next(new ProsopoApiError('API.UNKNOWN', { context: { error: err, code: 500 } }));
|
|
41
43
|
}
|
|
42
44
|
});
|
|
43
45
|
return router;
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,OAAmB,MAAM,SAAS,CAAA;AAOzC,MAAM,UA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jC,CAAC,CAAA;aACL;YAED,OAAO,GAAG,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC;gBAC5B,QAAQ,EAAE,KAAK;aAClB,CAAC,CAAA;SACL;QAAC,OAAO,GAAG,EAAE;YACV,OAAO,IAAI,CAAC,IAAI,eAAe,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAA;SAC1F;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/provider-mock",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
9
|
+
"node": ">=20",
|
|
10
10
|
"npm": ">=9"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
13
|
"test": "echo \"No test specified\"",
|
|
14
14
|
"clean": "tsc --build --clean",
|
|
15
15
|
"build": "tsc --build --verbose tsconfig.json",
|
|
16
|
-
"eslint": "npx eslint . --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
|
|
16
|
+
"eslint": "npx eslint . --cache --cache-location ../../node_modules/.cache/eslint/.eslintcache --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore --quiet",
|
|
17
17
|
"eslint:fix": "npm run eslint -- --fix",
|
|
18
|
-
"prettier": "npx prettier . --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
|
|
18
|
+
"prettier": "npx prettier . --cache --cache-location ../../node_modules/.cache/prettier/.prettiercache --check --no-error-on-unmatched-pattern --ignore-path ../../.eslintignore",
|
|
19
19
|
"prettier:fix": "npm run prettier -- --write",
|
|
20
20
|
"lint": "npm run eslint && npm run prettier",
|
|
21
21
|
"lint:fix": "npm run eslint:fix && npm run prettier:fix"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@prosopo/cli": "0.
|
|
25
|
-
"@prosopo/common": "0.
|
|
26
|
-
"@prosopo/types": "0.
|
|
24
|
+
"@prosopo/cli": "1.0.2",
|
|
25
|
+
"@prosopo/common": "1.0.2",
|
|
26
|
+
"@prosopo/types": "1.0.2",
|
|
27
27
|
"es-main": "^1.3.0",
|
|
28
28
|
"express": "^4.18.1"
|
|
29
29
|
},
|
package/typedoc.config.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Copyright 2021-2024 Prosopo (UK) Ltd.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
export default {
|
|
15
|
-
entryPoints: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.js', 'src/**/*.jsx', 'src/**/*.json'],
|
|
16
|
-
includes: 'src',
|
|
17
|
-
extends: '../../typedoc.base.config.js',
|
|
18
|
-
readme: 'README.md',
|
|
19
|
-
}
|