@prosopo/procaptcha 0.1.16 → 0.1.18
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/package.json +64 -50
- package/dist/api/Extension.d.ts +0 -16
- package/dist/api/Extension.d.ts.map +0 -1
- package/dist/api/Extension.js +0 -9
- package/dist/api/Extension.js.map +0 -1
- package/dist/api/ExtensionWeb2.d.ts +0 -13
- package/dist/api/ExtensionWeb2.d.ts.map +0 -1
- package/dist/api/ExtensionWeb2.js +0 -101
- package/dist/api/ExtensionWeb2.js.map +0 -1
- package/dist/api/ExtensionWeb3.d.ts +0 -10
- package/dist/api/ExtensionWeb3.d.ts.map +0 -1
- package/dist/api/ExtensionWeb3.js +0 -33
- package/dist/api/ExtensionWeb3.js.map +0 -1
- package/dist/api/HttpClientBase.d.ts +0 -9
- package/dist/api/HttpClientBase.d.ts.map +0 -1
- package/dist/api/HttpClientBase.js +0 -36
- package/dist/api/HttpClientBase.js.map +0 -1
- package/dist/api/errors.d.ts +0 -16
- package/dist/api/errors.d.ts.map +0 -1
- package/dist/api/errors.js +0 -34
- package/dist/api/errors.js.map +0 -1
- package/dist/api/handlers.d.ts +0 -5
- package/dist/api/handlers.d.ts.map +0 -1
- package/dist/api/handlers.js +0 -13
- package/dist/api/handlers.js.map +0 -1
- package/dist/api/index.d.ts +0 -4
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -22
- package/dist/api/index.js.map +0 -1
- package/dist/api/sign.d.ts +0 -5
- package/dist/api/sign.d.ts.map +0 -1
- package/dist/api/sign.js +0 -16
- package/dist/api/sign.js.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -23
- package/dist/index.js.map +0 -1
- package/dist/modules/Manager.d.ts +0 -22
- package/dist/modules/Manager.d.ts.map +0 -1
- package/dist/modules/Manager.js +0 -419
- package/dist/modules/Manager.js.map +0 -1
- package/dist/modules/ProsopoCaptchaApi.d.ts +0 -21
- package/dist/modules/ProsopoCaptchaApi.d.ts.map +0 -1
- package/dist/modules/ProsopoCaptchaApi.js +0 -120
- package/dist/modules/ProsopoCaptchaApi.js.map +0 -1
- package/dist/modules/canvas.d.ts +0 -2
- package/dist/modules/canvas.d.ts.map +0 -1
- package/dist/modules/canvas.js +0 -349
- package/dist/modules/canvas.js.map +0 -1
- package/dist/modules/index.d.ts +0 -3
- package/dist/modules/index.d.ts.map +0 -1
- package/dist/modules/index.js +0 -21
- package/dist/modules/index.js.map +0 -1
- package/dist/modules/storage.d.ts +0 -24
- package/dist/modules/storage.d.ts.map +0 -1
- package/dist/modules/storage.js +0 -50
- package/dist/modules/storage.js.map +0 -1
- package/dist/types/api.d.ts +0 -35
- package/dist/types/api.d.ts.map +0 -1
- package/dist/types/api.js +0 -22
- package/dist/types/api.js.map +0 -1
- package/dist/types/client.d.ts +0 -5
- package/dist/types/client.d.ts.map +0 -1
- package/dist/types/client.js +0 -3
- package/dist/types/client.js.map +0 -1
- package/dist/types/contract.d.ts +0 -5
- package/dist/types/contract.d.ts.map +0 -1
- package/dist/types/contract.js +0 -3
- package/dist/types/contract.js.map +0 -1
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -23
- package/dist/types/index.js.map +0 -1
- package/dist/types/manager.d.ts +0 -60
- package/dist/types/manager.d.ts.map +0 -1
- package/dist/types/manager.js +0 -3
- package/dist/types/manager.js.map +0 -1
- package/dist/types/utils.d.ts +0 -2
- package/dist/types/utils.d.ts.map +0 -1
- package/dist/types/utils.js +0 -3
- package/dist/types/utils.js.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -5
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/utils.d.ts +0 -2
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/utils/utils.js +0 -8
- package/dist/utils/utils.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,52 +1,66 @@
|
|
|
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
|
-
|
|
2
|
+
"name": "@prosopo/procaptcha",
|
|
3
|
+
"version": "0.1.18",
|
|
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
|
+
"scripts": {
|
|
10
|
+
"test": "NODE_ENV=test ts-mocha \"tests/**/*.test.ts\" && exit 0",
|
|
11
|
+
"clean": "tsc --build --clean",
|
|
12
|
+
"build": "tsc --build --verbose",
|
|
13
|
+
"lint": "npx eslint .",
|
|
14
|
+
"lint:fix": "npx eslint . --fix --config ../../.eslintrc.js"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"require": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./modules/Manager": {
|
|
22
|
+
"import": "./dist/modules/Manager.js",
|
|
23
|
+
"require": "./dist/modules/Manager.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@fingerprintjs/fingerprintjs": "^3.3.6",
|
|
28
|
+
"@polkadot/api": "10.9.1",
|
|
29
|
+
"@polkadot/api-contract": "10.9.1",
|
|
30
|
+
"@polkadot/extension-base": "0.46.5",
|
|
31
|
+
"@polkadot/extension-dapp": "0.46.5",
|
|
32
|
+
"@polkadot/extension-inject": "0.46.5",
|
|
33
|
+
"@polkadot/keyring": "12.3.2",
|
|
34
|
+
"@polkadot/rpc-provider": "10.9.1",
|
|
35
|
+
"@polkadot/types": "10.9.1",
|
|
36
|
+
"@polkadot/util": "12.3.2",
|
|
37
|
+
"@polkadot/util-crypto": "12.3.2",
|
|
38
|
+
"@prosopo/api": "^0.1.18",
|
|
39
|
+
"@prosopo/common": "^0.1.18",
|
|
40
|
+
"@prosopo/contract": "^0.1.18",
|
|
41
|
+
"@prosopo/datasets": "^0.1.18",
|
|
42
|
+
"@prosopo/types": "^0.1.18",
|
|
43
|
+
"@prosopo/util": "^0.1.18",
|
|
44
|
+
"axios": "^0.27.2"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"mocha": "^10.0.0",
|
|
48
|
+
"ts-mocha": "^10.0.0",
|
|
49
|
+
"tslib": "^2.6.2",
|
|
50
|
+
"typescript": "^5.1.6"
|
|
51
|
+
},
|
|
52
|
+
"keywords": [],
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/prosopo/captcha.git"
|
|
56
|
+
},
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/prosopo/captcha/issues"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://github.com/prosopo/captcha#readme",
|
|
61
|
+
"description": "",
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"registry": "https://registry.npmjs.org"
|
|
64
|
+
},
|
|
65
|
+
"sideEffects": false
|
|
52
66
|
}
|
package/dist/api/Extension.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Account } from '../types';
|
|
2
|
-
import { ProcaptchaClientConfig } from '@prosopo/types';
|
|
3
|
-
/**
|
|
4
|
-
* Class to interface with accounts.
|
|
5
|
-
*/
|
|
6
|
-
export default abstract class Extension {
|
|
7
|
-
/**
|
|
8
|
-
* Find an account given an address.
|
|
9
|
-
* @param address the address of the account
|
|
10
|
-
* @param dappName the name of the dapp wanting to gain access to accounts (e.g. "Prosopo")
|
|
11
|
-
* @returns the account
|
|
12
|
-
* @throws if the account is not found
|
|
13
|
-
*/
|
|
14
|
-
abstract getAccount(config: ProcaptchaClientConfig): Promise<Account>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=Extension.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Extension.d.ts","sourceRoot":"","sources":["../../src/api/Extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEvD;;GAEG;AACH,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,SAAS;IACnC;;;;;;OAMG;aACa,UAAU,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;CAC/E"}
|
package/dist/api/Extension.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Extension.js","sourceRoot":"","sources":["../../src/api/Extension.ts"],"names":[],"mappings":";;AAGA;;GAEG;AACH,MAA8B,SAAS;CAStC;AATD,4BASC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Account } from '../types';
|
|
2
|
-
import { ProcaptchaClientConfig } from '@prosopo/types';
|
|
3
|
-
import Extension from './Extension';
|
|
4
|
-
/**
|
|
5
|
-
* Class for interfacing with web3 accounts.
|
|
6
|
-
*/
|
|
7
|
-
export default class ExtWeb2 extends Extension {
|
|
8
|
-
getAccount(config: ProcaptchaClientConfig): Promise<Account>;
|
|
9
|
-
private createExtension;
|
|
10
|
-
private createAccount;
|
|
11
|
-
private getFingerprint;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=ExtensionWeb2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionWeb2.d.ts","sourceRoot":"","sources":["../../src/api/ExtensionWeb2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAMlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAQvD,OAAO,SAAS,MAAM,aAAa,CAAA;AAMnC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,SAAS;IAC7B,UAAU,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;YAa3D,eAAe;YAiCf,aAAa;YAmCb,cAAc;CAU/B"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const api_1 = require("@polkadot/api");
|
|
5
|
-
const ws_1 = require("@polkadot/rpc-provider/ws");
|
|
6
|
-
const util_crypto_1 = require("@polkadot/util-crypto");
|
|
7
|
-
const bip39_1 = require("@polkadot/util-crypto/mnemonic/bip39");
|
|
8
|
-
const Manager_1 = require("../modules/Manager");
|
|
9
|
-
const common_1 = require("@prosopo/common");
|
|
10
|
-
const canvas_1 = require("../modules/canvas");
|
|
11
|
-
const util_1 = require("@polkadot/util");
|
|
12
|
-
const Extension_1 = tslib_1.__importDefault(require("./Extension"));
|
|
13
|
-
const fingerprintjs_1 = tslib_1.__importStar(require("@fingerprintjs/fingerprintjs"));
|
|
14
|
-
const Signer_1 = tslib_1.__importDefault(require("@polkadot/extension-base/page/Signer"));
|
|
15
|
-
/**
|
|
16
|
-
* Class for interfacing with web3 accounts.
|
|
17
|
-
*/
|
|
18
|
-
class ExtWeb2 extends Extension_1.default {
|
|
19
|
-
async getAccount(config) {
|
|
20
|
-
const network = (0, Manager_1.getNetwork)(config);
|
|
21
|
-
const wsProvider = new ws_1.WsProvider(network.endpoint);
|
|
22
|
-
const account = await this.createAccount(wsProvider);
|
|
23
|
-
const extension = await this.createExtension(account);
|
|
24
|
-
return {
|
|
25
|
-
account,
|
|
26
|
-
extension,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
async createExtension(account) {
|
|
30
|
-
const signer = new Signer_1.default(async () => {
|
|
31
|
-
return;
|
|
32
|
-
});
|
|
33
|
-
// signing carried out by the keypair. Signs the data with the private key, creating a signature. Other people can verify this signature given the message and the public key, proving that the message was indeed signed by account and proving ownership of the account.
|
|
34
|
-
signer.signRaw = async (payload) => {
|
|
35
|
-
const signature = account.keypair.sign(payload.data);
|
|
36
|
-
return {
|
|
37
|
-
id: 1,
|
|
38
|
-
signature: (0, util_1.u8aToHex)(signature),
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
return {
|
|
42
|
-
accounts: {
|
|
43
|
-
get: async () => {
|
|
44
|
-
// there is only ever 1 account
|
|
45
|
-
return [account];
|
|
46
|
-
},
|
|
47
|
-
subscribe: () => {
|
|
48
|
-
// do nothing, there will never be account changes
|
|
49
|
-
return () => {
|
|
50
|
-
return;
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
name: 'procaptcha-web2',
|
|
55
|
-
version: '0.1.11',
|
|
56
|
-
signer,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
async createAccount(wsProvider) {
|
|
60
|
-
const params = {
|
|
61
|
-
area: { width: 300, height: 300 },
|
|
62
|
-
offsetParameter: 2001000001,
|
|
63
|
-
multiplier: 15000,
|
|
64
|
-
fontSizeFactor: 1.5,
|
|
65
|
-
maxShadowBlur: 50,
|
|
66
|
-
numberOfRounds: 5,
|
|
67
|
-
seed: 42,
|
|
68
|
-
};
|
|
69
|
-
const browserEntropy = await this.getFingerprint();
|
|
70
|
-
const canvasEntropy = (0, canvas_1.picassoCanvas)(params.numberOfRounds, params.seed, params);
|
|
71
|
-
const entropy = (0, common_1.hexHash)([canvasEntropy, browserEntropy].join(''), 128).slice(2);
|
|
72
|
-
const u8Entropy = (0, util_1.stringToU8a)(entropy);
|
|
73
|
-
const mnemonic = (0, bip39_1.entropyToMnemonic)(u8Entropy);
|
|
74
|
-
const api = await api_1.ApiPromise.create({ provider: wsProvider });
|
|
75
|
-
const type = 'sr25519';
|
|
76
|
-
const keyring = new api_1.Keyring({ type, ss58Format: api.registry.chainSS58 });
|
|
77
|
-
await (0, util_crypto_1.cryptoWaitReady)();
|
|
78
|
-
const keypair = keyring.addFromMnemonic(mnemonic);
|
|
79
|
-
const address = keypair.address.length === 42
|
|
80
|
-
? keypair.address
|
|
81
|
-
: (0, util_crypto_1.encodeAddress)((0, util_crypto_1.decodeAddress)(keypair.address), api.registry.chainSS58);
|
|
82
|
-
return {
|
|
83
|
-
address,
|
|
84
|
-
type,
|
|
85
|
-
name: address,
|
|
86
|
-
keypair,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
async getFingerprint() {
|
|
90
|
-
// Initialize an agent at application startup.
|
|
91
|
-
const fpPromise = fingerprintjs_1.default.load();
|
|
92
|
-
// Get the visitor identifier when you need it.
|
|
93
|
-
const fp = await fpPromise;
|
|
94
|
-
const result = await fp.get();
|
|
95
|
-
// strip out the components that change in incognito mode
|
|
96
|
-
const { screenFrame, ...componentsReduced } = result.components;
|
|
97
|
-
return (0, fingerprintjs_1.hashComponents)(componentsReduced);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.default = ExtWeb2;
|
|
101
|
-
//# sourceMappingURL=ExtensionWeb2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionWeb2.js","sourceRoot":"","sources":["../../src/api/ExtensionWeb2.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Account } from '../types';
|
|
2
|
-
import { ProcaptchaClientConfig } from '@prosopo/types';
|
|
3
|
-
import Extension from './Extension';
|
|
4
|
-
/**
|
|
5
|
-
* Class for interfacing with web3 accounts.
|
|
6
|
-
*/
|
|
7
|
-
export default class ExtWeb3 extends Extension {
|
|
8
|
-
getAccount(config: ProcaptchaClientConfig): Promise<Account>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=ExtensionWeb3.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionWeb3.d.ts","sourceRoot":"","sources":["../../src/api/ExtensionWeb3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,OAAO,SAAS,MAAM,aAAa,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,SAAS;IAC7B,UAAU,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;CAwB5E"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const errors_1 = require("./errors");
|
|
5
|
-
const extension_dapp_1 = require("@polkadot/extension-dapp");
|
|
6
|
-
const Extension_1 = tslib_1.__importDefault(require("./Extension"));
|
|
7
|
-
/**
|
|
8
|
-
* Class for interfacing with web3 accounts.
|
|
9
|
-
*/
|
|
10
|
-
class ExtWeb3 extends Extension_1.default {
|
|
11
|
-
async getAccount(config) {
|
|
12
|
-
const { dappName, userAccountAddress: address } = config;
|
|
13
|
-
if (!address) {
|
|
14
|
-
throw new errors_1.AccountNotFoundError('No account address provided');
|
|
15
|
-
}
|
|
16
|
-
// enable access to all extensions
|
|
17
|
-
const extensions = await (0, extension_dapp_1.web3Enable)(dappName);
|
|
18
|
-
if (extensions.length === 0) {
|
|
19
|
-
throw new errors_1.ExtensionNotFoundError();
|
|
20
|
-
}
|
|
21
|
-
// search through all extensions for the one that has the account
|
|
22
|
-
for (const extension of extensions) {
|
|
23
|
-
const accounts = await extension.accounts.get();
|
|
24
|
-
const account = accounts.find((account) => account.address === address);
|
|
25
|
-
if (account) {
|
|
26
|
-
return { account, extension };
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
throw new errors_1.AccountNotFoundError('No account found matching ' + address);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.default = ExtWeb3;
|
|
33
|
-
//# sourceMappingURL=ExtensionWeb3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionWeb3.js","sourceRoot":"","sources":["../../src/api/ExtensionWeb3.ts"],"names":[],"mappings":";;;AACA,qCAAuE;AAGvE,6DAAqD;AACrD,oEAAmC;AAEnC;;GAEG;AACH,MAAqB,OAAQ,SAAQ,mBAAS;IACnC,KAAK,CAAC,UAAU,CAAC,MAA8B;QAClD,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;QAExD,IAAI,CAAC,OAAO,EAAE;YACV,MAAM,IAAI,6BAAoB,CAAC,6BAA6B,CAAC,CAAA;SAChE;QAED,kCAAkC;QAClC,MAAM,UAAU,GAAwB,MAAM,IAAA,2BAAU,EAAC,QAAQ,CAAC,CAAA;QAClE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,MAAM,IAAI,+BAAsB,EAAE,CAAA;SACrC;QAED,iEAAiE;QACjE,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAChC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAA;YAC/C,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,CAAA;YACvE,IAAI,OAAO,EAAE;gBACT,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;aAChC;SACJ;QAED,MAAM,IAAI,6BAAoB,CAAC,4BAA4B,GAAG,OAAO,CAAC,CAAA;IAC1E,CAAC;CACJ;AAzBD,0BAyBC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
2
|
-
export declare class HttpClientBase {
|
|
3
|
-
protected readonly axios: AxiosInstance;
|
|
4
|
-
constructor(baseURL: string, prefix?: string);
|
|
5
|
-
protected responseHandler: (response: AxiosResponse) => any;
|
|
6
|
-
protected errorHandler: (error: any) => Promise<never>;
|
|
7
|
-
}
|
|
8
|
-
export default HttpClientBase;
|
|
9
|
-
//# sourceMappingURL=HttpClientBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClientBase.d.ts","sourceRoot":"","sources":["../../src/api/HttpClientBase.ts"],"names":[],"mappings":"AAeA,OAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE3D,qBAAa,cAAc;IACvB,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;gBAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAK;IAMxC,SAAS,CAAC,eAAe,aAAc,aAAa,SAGnD;IAED,SAAS,CAAC,YAAY,UAAW,GAAG,oBAAmC;CAC1E;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpClientBase = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// Copyright (C) 2021-2022 Prosopo (UK) Ltd.
|
|
6
|
-
// This file is part of procaptcha <https://github.com/prosopo/procaptcha>.
|
|
7
|
-
//
|
|
8
|
-
// procaptcha is free software: you can redistribute it and/or modify
|
|
9
|
-
// it under the terms of the GNU General Public License as published by
|
|
10
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
-
// (at your option) any later version.
|
|
12
|
-
//
|
|
13
|
-
// procaptcha is distributed in the hope that it will be useful,
|
|
14
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
// GNU General Public License for more details.
|
|
17
|
-
//
|
|
18
|
-
// You should have received a copy of the GNU General Public License
|
|
19
|
-
// along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
21
|
-
class HttpClientBase {
|
|
22
|
-
axios;
|
|
23
|
-
constructor(baseURL, prefix = '') {
|
|
24
|
-
baseURL = baseURL + prefix;
|
|
25
|
-
this.axios = axios_1.default.create({ baseURL });
|
|
26
|
-
this.axios.interceptors.response.use(this.responseHandler, this.errorHandler);
|
|
27
|
-
}
|
|
28
|
-
responseHandler = (response) => {
|
|
29
|
-
console.log('API REQUEST', response.request);
|
|
30
|
-
return response.data;
|
|
31
|
-
};
|
|
32
|
-
errorHandler = (error) => Promise.reject(error.response);
|
|
33
|
-
}
|
|
34
|
-
exports.HttpClientBase = HttpClientBase;
|
|
35
|
-
exports.default = HttpClientBase;
|
|
36
|
-
//# sourceMappingURL=HttpClientBase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClientBase.js","sourceRoot":"","sources":["../../src/api/HttpClientBase.ts"],"names":[],"mappings":";;;;AAAA,4CAA4C;AAC5C,2EAA2E;AAC3E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,0DAA2D;AAE3D,MAAa,cAAc;IACJ,KAAK,CAAe;IAEvC,YAAY,OAAe,EAAE,MAAM,GAAG,EAAE;QACpC,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;QAC1B,IAAI,CAAC,KAAK,GAAG,eAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;QACtC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;IACjF,CAAC;IAES,eAAe,GAAG,CAAC,QAAuB,EAAE,EAAE;QACpD,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC5C,OAAO,QAAQ,CAAC,IAAI,CAAA;IACxB,CAAC,CAAA;IAES,YAAY,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;CAC1E;AAfD,wCAeC;AAED,kBAAe,cAAc,CAAA"}
|
package/dist/api/errors.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare class NoExtensionsFoundError extends Error {
|
|
2
|
-
constructor(msg?: string);
|
|
3
|
-
}
|
|
4
|
-
export declare class AccountCreationUnsupportedError extends Error {
|
|
5
|
-
constructor(msg?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class AccountNotFoundError extends Error {
|
|
8
|
-
constructor(msg?: string);
|
|
9
|
-
}
|
|
10
|
-
export declare class ExtensionNotFoundError extends Error {
|
|
11
|
-
constructor(msg?: string);
|
|
12
|
-
}
|
|
13
|
-
export declare class ExpiredError extends Error {
|
|
14
|
-
constructor(msg?: string);
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/api/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAuB,SAAQ,KAAK;gBACjC,GAAG,CAAC,EAAE,MAAM;CAG3B;AAED,qBAAa,+BAAgC,SAAQ,KAAK;gBAC1C,GAAG,CAAC,EAAE,MAAM;CAG3B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBAC/B,GAAG,CAAC,EAAE,MAAM;CAG3B;AAED,qBAAa,sBAAuB,SAAQ,KAAK;gBACjC,GAAG,CAAC,EAAE,MAAM;CAG3B;AAED,qBAAa,YAAa,SAAQ,KAAK;gBACvB,GAAG,CAAC,EAAE,MAAM;CAG3B"}
|
package/dist/api/errors.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExpiredError = exports.ExtensionNotFoundError = exports.AccountNotFoundError = exports.AccountCreationUnsupportedError = exports.NoExtensionsFoundError = void 0;
|
|
4
|
-
class NoExtensionsFoundError extends Error {
|
|
5
|
-
constructor(msg) {
|
|
6
|
-
super(msg || 'No extensions found');
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
exports.NoExtensionsFoundError = NoExtensionsFoundError;
|
|
10
|
-
class AccountCreationUnsupportedError extends Error {
|
|
11
|
-
constructor(msg) {
|
|
12
|
-
super(msg || 'Account creation is not supported');
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.AccountCreationUnsupportedError = AccountCreationUnsupportedError;
|
|
16
|
-
class AccountNotFoundError extends Error {
|
|
17
|
-
constructor(msg) {
|
|
18
|
-
super(msg || 'No account found');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.AccountNotFoundError = AccountNotFoundError;
|
|
22
|
-
class ExtensionNotFoundError extends Error {
|
|
23
|
-
constructor(msg) {
|
|
24
|
-
super(msg || 'No extensions found');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.ExtensionNotFoundError = ExtensionNotFoundError;
|
|
28
|
-
class ExpiredError extends Error {
|
|
29
|
-
constructor(msg) {
|
|
30
|
-
super(msg || 'The challenge has expired');
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.ExpiredError = ExpiredError;
|
|
34
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/api/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,sBAAuB,SAAQ,KAAK;IAC7C,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAA;IACvC,CAAC;CACJ;AAJD,wDAIC;AAED,MAAa,+BAAgC,SAAQ,KAAK;IACtD,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,mCAAmC,CAAC,CAAA;IACrD,CAAC;CACJ;AAJD,0EAIC;AAED,MAAa,oBAAqB,SAAQ,KAAK;IAC3C,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,kBAAkB,CAAC,CAAA;IACpC,CAAC;CACJ;AAJD,oDAIC;AAED,MAAa,sBAAuB,SAAQ,KAAK;IAC7C,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAA;IACvC,CAAC;CACJ;AAJD,wDAIC;AAED,MAAa,YAAa,SAAQ,KAAK;IACnC,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,2BAA2B,CAAC,CAAA;IAC7C,CAAC;CACJ;AAJD,oCAIC"}
|
package/dist/api/handlers.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,qBAAa,eAAgB,SAAQ,KAAK;gBAC1B,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE;CAQpE"}
|
package/dist/api/handlers.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProsopoApiError = void 0;
|
|
4
|
-
class ProsopoApiError extends Error {
|
|
5
|
-
constructor(error, context, ...params) {
|
|
6
|
-
super(error ? error.message : 'Unknown API Error');
|
|
7
|
-
this.name = (context && `${ProsopoApiError.name}@${context}`) || ProsopoApiError.name;
|
|
8
|
-
console.error('\n********************* ERROR *********************\n');
|
|
9
|
-
console.error(this.cause, this.stack, ...params);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.ProsopoApiError = ProsopoApiError;
|
|
13
|
-
//# sourceMappingURL=handlers.js.map
|
package/dist/api/handlers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":";;;AAiBA,MAAa,eAAgB,SAAQ,KAAK;IACtC,YAAY,KAAiB,EAAE,OAAgB,EAAE,GAAG,MAAa;QAC7D,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAA;QAElD,IAAI,CAAC,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,eAAe,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC,IAAI,eAAe,CAAC,IAAI,CAAA;QAErF,OAAO,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAA;QACtE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,CAAA;IACpD,CAAC;CACJ;AATD,0CASC"}
|
package/dist/api/index.d.ts
DELETED
package/dist/api/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAeA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
|
package/dist/api/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
// Copyright (C) 2021-2022 Prosopo (UK) Ltd.
|
|
5
|
-
// This file is part of procaptcha <https://github.com/prosopo/procaptcha>.
|
|
6
|
-
//
|
|
7
|
-
// procaptcha is free software: you can redistribute it and/or modify
|
|
8
|
-
// it under the terms of the GNU General Public License as published by
|
|
9
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
// (at your option) any later version.
|
|
11
|
-
//
|
|
12
|
-
// procaptcha is distributed in the hope that it will be useful,
|
|
13
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
// GNU General Public License for more details.
|
|
16
|
-
//
|
|
17
|
-
// You should have received a copy of the GNU General Public License
|
|
18
|
-
// along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
-
tslib_1.__exportStar(require("./ExtensionWeb3"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./ExtensionWeb2"), exports);
|
|
21
|
-
tslib_1.__exportStar(require("./HttpClientBase"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
package/dist/api/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,2EAA2E;AAC3E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,0DAA+B;AAC/B,0DAA+B;AAC/B,2DAAgC"}
|
package/dist/api/sign.d.ts
DELETED
package/dist/api/sign.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/api/sign.ts"],"names":[],"mappings":"AAIA,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,KAAA,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAOzF"}
|
package/dist/api/sign.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sign = void 0;
|
|
4
|
-
const keyring_1 = require("@polkadot/keyring");
|
|
5
|
-
const util_crypto_1 = require("@polkadot/util-crypto");
|
|
6
|
-
const util_1 = require("@polkadot/util");
|
|
7
|
-
function sign(message, account) {
|
|
8
|
-
const keyring = new keyring_1.Keyring({ type: 'ecdsa' });
|
|
9
|
-
const pair = keyring.addFromUri('//Alice');
|
|
10
|
-
const sig = pair.sign(message);
|
|
11
|
-
const signature = (0, util_1.u8aToHex)(sig);
|
|
12
|
-
const messageHash = (0, util_crypto_1.blake2AsHex)(message);
|
|
13
|
-
return { messageHash, signature };
|
|
14
|
-
}
|
|
15
|
-
exports.sign = sign;
|
|
16
|
-
//# sourceMappingURL=sign.js.map
|
package/dist/api/sign.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/api/sign.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,uDAAmD;AACnD,yCAAyC;AAEzC,SAAgB,IAAI,CAAC,OAAe,EAAE,OAAO;IACzC,MAAM,OAAO,GAAG,IAAI,iBAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;IAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC9B,MAAM,SAAS,GAAG,IAAA,eAAQ,EAAC,GAAG,CAAC,CAAA;IAC/B,MAAM,WAAW,GAAG,IAAA,yBAAW,EAAC,OAAO,CAAC,CAAA;IACxC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA;AACrC,CAAC;AAPD,oBAOC"}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,cAAc,OAAO,CAAA;AACrB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
package/dist/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
// Copyright (C) 2021-2022 Prosopo (UK) Ltd.
|
|
5
|
-
// This file is part of procaptcha <https://github.com/prosopo/procaptcha>.
|
|
6
|
-
//
|
|
7
|
-
// procaptcha is free software: you can redistribute it and/or modify
|
|
8
|
-
// it under the terms of the GNU General Public License as published by
|
|
9
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
// (at your option) any later version.
|
|
11
|
-
//
|
|
12
|
-
// procaptcha is distributed in the hope that it will be useful,
|
|
13
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
// GNU General Public License for more details.
|
|
16
|
-
//
|
|
17
|
-
// You should have received a copy of the GNU General Public License
|
|
18
|
-
// along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
-
tslib_1.__exportStar(require("./api"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./modules"), exports);
|
|
21
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
22
|
-
tslib_1.__exportStar(require("./utils"), exports);
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,2EAA2E;AAC3E,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,gDAAqB;AACrB,oDAAyB;AACzB,kDAAuB;AACvB,kDAAuB"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ProcaptchaCallbacks, ProcaptchaConfigOptional, ProcaptchaState, ProcaptchaStateUpdateFn } from '../types/manager';
|
|
2
|
-
import { ProsopoClientConfig } from '@prosopo/types';
|
|
3
|
-
export declare const defaultState: () => Partial<ProcaptchaState>;
|
|
4
|
-
export declare const getNetwork: (config: ProsopoClientConfig) => {
|
|
5
|
-
endpoint: string;
|
|
6
|
-
contract: {
|
|
7
|
-
address: string;
|
|
8
|
-
name: string;
|
|
9
|
-
};
|
|
10
|
-
accounts: string[];
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* The state operator. This is used to mutate the state of Procaptcha during the captcha process. State updates are published via the onStateUpdate callback. This should be used by frontends, e.g. react, to maintain the state of Procaptcha across renders.
|
|
14
|
-
*/
|
|
15
|
-
export declare const Manager: (configOptional: ProcaptchaConfigOptional, state: ProcaptchaState, onStateUpdate: ProcaptchaStateUpdateFn, callbacks: ProcaptchaCallbacks) => {
|
|
16
|
-
start: () => Promise<void>;
|
|
17
|
-
cancel: () => Promise<void>;
|
|
18
|
-
submit: () => Promise<void>;
|
|
19
|
-
select: (hash: string) => void;
|
|
20
|
-
nextRound: () => void;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=Manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Manager.d.ts","sourceRoot":"","sources":["../../src/modules/Manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,mBAAmB,EACnB,wBAAwB,EAExB,eAAe,EACf,uBAAuB,EAC1B,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAIH,mBAAmB,EAEtB,MAAM,gBAAgB,CAAA;AAevB,eAAO,MAAM,YAAY,QAAO,QAAQ,eAAe,CAatD,CAAA;AAkBD,eAAO,MAAM,UAAU,WAAY,mBAAmB;;;;;;;CAMrD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,mBACA,wBAAwB,SACjC,eAAe,iBACP,uBAAuB,aAC3B,mBAAmB;;;;mBA2RR,MAAM;;CA0J/B,CAAA"}
|