@prosopo/procaptcha 2.0.3 → 2.1.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.
- package/dist/cjs/modules/Manager.cjs +156 -171
- package/dist/modules/Manager.d.ts.map +1 -1
- package/dist/modules/Manager.js +10 -35
- package/dist/modules/Manager.js.map +1 -1
- package/dist/modules/ProsopoCaptchaApi.d.ts.map +1 -1
- package/dist/modules/ProsopoCaptchaApi.js.map +1 -1
- package/dist/modules/collector.js.map +1 -1
- package/package.json +83 -77
- package/dist/cjs/account/dist/extension/Extension.cjs +0 -5
- package/dist/cjs/account/dist/extension/ExtensionWeb2.cjs +0 -78
- package/dist/cjs/account/dist/extension/ExtensionWeb3.cjs +0 -30
- package/dist/cjs/account/dist/index.cjs +0 -8
- package/dist/cjs/detector/src/index.cjs +0 -4586
package/package.json
CHANGED
|
@@ -1,79 +1,85 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
2
|
+
"name": "@prosopo/procaptcha",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20",
|
|
11
|
+
"npm": ">=9"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"clean": "tsc --build --clean",
|
|
15
|
+
"build": "tsc --build --verbose",
|
|
16
|
+
"build:cjs": "npx vite --config vite.cjs.config.ts build",
|
|
17
|
+
"test": "NODE_ENV=${NODE_ENV:-test}; vitest --run --config vite.test.config.ts"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/cjs/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./modules/Manager": {
|
|
25
|
+
"types": "./dist/modules/Manager.d.ts",
|
|
26
|
+
"import": "./dist/modules/Manager.js",
|
|
27
|
+
"require": "./dist/cjs/modules/Manager.cjs",
|
|
28
|
+
"default": "./dist/modules/Manager.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@polkadot/api": "10.13.1",
|
|
33
|
+
"@polkadot/api-contract": "10.13.1",
|
|
34
|
+
"@polkadot/util": "12.6.2",
|
|
35
|
+
"@polkadot/util-crypto": "12.6.2",
|
|
36
|
+
"@prosopo/account": "2.1.0",
|
|
37
|
+
"@prosopo/api": "2.1.0",
|
|
38
|
+
"@prosopo/common": "2.1.0",
|
|
39
|
+
"@prosopo/datasets": "2.1.0",
|
|
40
|
+
"@prosopo/load-balancer": "2.1.0",
|
|
41
|
+
"@prosopo/procaptcha-common": "2.1.0",
|
|
42
|
+
"@prosopo/types": "2.1.0",
|
|
43
|
+
"@prosopo/util": "2.1.0",
|
|
44
|
+
"jsdom": "25.0.0"
|
|
45
|
+
},
|
|
46
|
+
"overrides": {
|
|
47
|
+
"@polkadot/extension-inject": {
|
|
48
|
+
"@polkadot/api": {
|
|
49
|
+
"version": "10.13.1"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"@polkadot/extension-dapp": {
|
|
53
|
+
"@polkadot/api": {
|
|
54
|
+
"version": "10.13.1"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@prosopo/config": "2.1.0",
|
|
60
|
+
"@vitest/coverage-v8": "2.1.1",
|
|
61
|
+
"concurrently": "9.0.1",
|
|
62
|
+
"dotenv": "16.4.5",
|
|
63
|
+
"npm-run-all": "4.1.5",
|
|
64
|
+
"rimraf": "6.0.1",
|
|
65
|
+
"tslib": "2.7.0",
|
|
66
|
+
"tsx": "4.19.1",
|
|
67
|
+
"typescript": "5.6.2",
|
|
68
|
+
"vite": "5.4.6",
|
|
69
|
+
"vitest": "2.1.1"
|
|
70
|
+
},
|
|
71
|
+
"keywords": [],
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "git+https://github.com/prosopo/captcha.git"
|
|
75
|
+
},
|
|
76
|
+
"bugs": {
|
|
77
|
+
"url": "https://github.com/prosopo/captcha/issues"
|
|
78
|
+
},
|
|
79
|
+
"homepage": "https://github.com/prosopo/captcha#readme",
|
|
80
|
+
"description": "",
|
|
81
|
+
"publishConfig": {
|
|
82
|
+
"registry": "https://registry.npmjs.org"
|
|
83
|
+
},
|
|
84
|
+
"sideEffects": false
|
|
79
85
|
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Signer = require("@polkadot/extension-base/page/Signer");
|
|
4
|
-
const keyring = require("@polkadot/keyring");
|
|
5
|
-
const utilCrypto = require("@polkadot/util-crypto");
|
|
6
|
-
const bip39 = require("@polkadot/util-crypto/mnemonic/bip39");
|
|
7
|
-
const string = require("@polkadot/util/string");
|
|
8
|
-
const u8a = require("@polkadot/util/u8a");
|
|
9
|
-
const common = require("@prosopo/common");
|
|
10
|
-
const index = require("../../../detector/src/index.cjs");
|
|
11
|
-
const util = require("@prosopo/util");
|
|
12
|
-
const Extension = require("./Extension.cjs");
|
|
13
|
-
class ExtensionWeb2 extends Extension.Extension {
|
|
14
|
-
async getAccount(config) {
|
|
15
|
-
const account = await this.createAccount(config);
|
|
16
|
-
const extension = await this.createExtension(account);
|
|
17
|
-
return {
|
|
18
|
-
account,
|
|
19
|
-
extension
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
async createExtension(account) {
|
|
23
|
-
const signer = new Signer(async () => {
|
|
24
|
-
return;
|
|
25
|
-
});
|
|
26
|
-
signer.signRaw = async (payload) => {
|
|
27
|
-
const signature = account.keypair.sign(payload.data);
|
|
28
|
-
return {
|
|
29
|
-
id: 1,
|
|
30
|
-
signature: u8a.u8aToHex(signature)
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
34
|
-
accounts: {
|
|
35
|
-
get: async () => {
|
|
36
|
-
return [account];
|
|
37
|
-
},
|
|
38
|
-
subscribe: () => {
|
|
39
|
-
return () => {
|
|
40
|
-
return;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
name: "procaptcha-web2",
|
|
45
|
-
version: util.version,
|
|
46
|
-
signer
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
async createAccount(config) {
|
|
50
|
-
await utilCrypto.cryptoWaitReady();
|
|
51
|
-
const params = {
|
|
52
|
-
area: { width: 300, height: 300 },
|
|
53
|
-
offsetParameter: 2001000001,
|
|
54
|
-
multiplier: 15e3,
|
|
55
|
-
fontSizeFactor: 1.5,
|
|
56
|
-
maxShadowBlur: 50,
|
|
57
|
-
numberOfRounds: 5,
|
|
58
|
-
seed: 42
|
|
59
|
-
};
|
|
60
|
-
const browserEntropy = await index.getFingerprint();
|
|
61
|
-
const canvasEntropy = util.picassoCanvas(params.numberOfRounds, params.seed, params);
|
|
62
|
-
const entropy = common.hexHash([canvasEntropy, browserEntropy].join(""), 128).slice(2);
|
|
63
|
-
const u8Entropy = string.stringToU8a(entropy);
|
|
64
|
-
const mnemonic = bip39.entropyToMnemonic(u8Entropy);
|
|
65
|
-
const type = "sr25519";
|
|
66
|
-
const keyring$1 = new keyring.Keyring({
|
|
67
|
-
type
|
|
68
|
-
});
|
|
69
|
-
const keypair = keyring$1.addFromMnemonic(mnemonic);
|
|
70
|
-
const address = keypair.address;
|
|
71
|
-
return {
|
|
72
|
-
address,
|
|
73
|
-
name: address,
|
|
74
|
-
keypair
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.ExtensionWeb2 = ExtensionWeb2;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const extensionDapp = require("@polkadot/extension-dapp");
|
|
4
|
-
const common = require("@prosopo/common");
|
|
5
|
-
const Extension = require("./Extension.cjs");
|
|
6
|
-
class ExtensionWeb3 extends Extension.Extension {
|
|
7
|
-
async getAccount(config) {
|
|
8
|
-
const { dappName, userAccountAddress: address } = config;
|
|
9
|
-
if (!address) {
|
|
10
|
-
throw new common.ProsopoError("WIDGET.NO_ACCOUNTS_FOUND", {
|
|
11
|
-
context: { error: "No account address provided" }
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
const extensions = await extensionDapp.web3Enable(dappName);
|
|
15
|
-
if (extensions.length === 0) {
|
|
16
|
-
throw new common.ProsopoError("WIDGET.NO_EXTENSION_FOUND");
|
|
17
|
-
}
|
|
18
|
-
for (const extension of extensions) {
|
|
19
|
-
const accounts = await extension.accounts.get();
|
|
20
|
-
const account = accounts.find((account2) => account2.address === address);
|
|
21
|
-
if (account) {
|
|
22
|
-
return { account, extension };
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
throw new common.ProsopoError("WIDGET.ACCOUNT_NOT_FOUND", {
|
|
26
|
-
context: { error: `No account found matching ${address}` }
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.ExtensionWeb3 = ExtensionWeb3;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Extension = require("./extension/Extension.cjs");
|
|
4
|
-
const ExtensionWeb2 = require("./extension/ExtensionWeb2.cjs");
|
|
5
|
-
const ExtensionWeb3 = require("./extension/ExtensionWeb3.cjs");
|
|
6
|
-
exports.Extension = Extension.Extension;
|
|
7
|
-
exports.ExtensionWeb2 = ExtensionWeb2.ExtensionWeb2;
|
|
8
|
-
exports.ExtensionWeb3 = ExtensionWeb3.ExtensionWeb3;
|