@prosopo/procaptcha 0.1.0 → 0.1.3
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/README.md +13 -0
- package/dist/api/AsyncFactory.d.ts +7 -0
- package/dist/api/AsyncFactory.d.ts.map +1 -0
- package/{src/api/AsyncFactory.ts → dist/api/AsyncFactory.js} +8 -9
- package/dist/api/AsyncFactory.js.map +1 -0
- package/dist/api/Extension.d.ts +22 -0
- package/dist/api/Extension.d.ts.map +1 -0
- package/{src/api/Extension.ts → dist/api/Extension.js} +39 -56
- package/dist/api/Extension.js.map +1 -0
- package/dist/api/HttpClientBase.d.ts +9 -0
- package/dist/api/HttpClientBase.d.ts.map +1 -0
- package/dist/api/HttpClientBase.js +36 -0
- package/dist/api/HttpClientBase.js.map +1 -0
- package/dist/api/ProsopoContract.d.ts +13 -0
- package/dist/api/ProsopoContract.d.ts.map +1 -0
- package/{src/api/ProsopoContract.ts → dist/api/ProsopoContract.js} +18 -20
- package/dist/api/ProsopoContract.js.map +1 -0
- package/dist/api/ProsopoContractBase.d.ts +31 -0
- package/dist/api/ProsopoContractBase.d.ts.map +1 -0
- package/dist/api/ProsopoContractBase.js +131 -0
- package/dist/api/ProsopoContractBase.js.map +1 -0
- package/dist/api/ProviderApi.d.ts +21 -0
- package/dist/api/ProviderApi.d.ts.map +1 -0
- package/dist/api/ProviderApi.js +54 -0
- package/dist/api/ProviderApi.js.map +1 -0
- package/dist/api/handlers.d.ts +5 -0
- package/dist/api/handlers.d.ts.map +1 -0
- package/dist/api/handlers.js +14 -0
- package/dist/api/handlers.js.map +1 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.d.ts.map +1 -0
- package/{src/api/handlers.ts → dist/api/index.js} +10 -14
- package/dist/api/index.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/{src/modules/index.ts → dist/index.js} +7 -7
- package/dist/index.js.map +1 -0
- package/dist/modules/ProsopoCaptchaApi.d.ts +16 -0
- package/dist/modules/ProsopoCaptchaApi.d.ts.map +1 -0
- package/dist/modules/ProsopoCaptchaApi.js +86 -0
- package/dist/modules/ProsopoCaptchaApi.js.map +1 -0
- package/dist/modules/ProsopoCaptchaClient.d.ts +27 -0
- package/dist/modules/ProsopoCaptchaClient.d.ts.map +1 -0
- package/dist/modules/ProsopoCaptchaClient.js +97 -0
- package/dist/modules/ProsopoCaptchaClient.js.map +1 -0
- package/dist/modules/ProsopoCaptchaStateClient.d.ts +17 -0
- package/dist/modules/ProsopoCaptchaStateClient.d.ts.map +1 -0
- package/dist/modules/ProsopoCaptchaStateClient.js +104 -0
- package/dist/modules/ProsopoCaptchaStateClient.js.map +1 -0
- package/dist/modules/client.d.ts +9 -0
- package/dist/modules/client.d.ts.map +1 -0
- package/{src/modules/client.ts → dist/modules/client.js} +13 -12
- package/dist/modules/client.js.map +1 -0
- package/dist/modules/contract.d.ts +7 -0
- package/dist/modules/contract.d.ts.map +1 -0
- package/{src/api/HttpClientBase.ts → dist/modules/contract.js} +14 -21
- package/dist/modules/contract.js.map +1 -0
- package/dist/modules/extension.d.ts +3 -0
- package/dist/modules/extension.d.ts.map +1 -0
- package/{src/api/index.ts → dist/modules/extension.js} +10 -6
- package/dist/modules/extension.js.map +1 -0
- package/dist/modules/index.d.ts +8 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/{src/modules/contract.ts → dist/modules/index.js} +11 -8
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/storage.d.ts +14 -0
- package/dist/modules/storage.d.ts.map +1 -0
- package/{src/modules/storage.ts → dist/modules/storage.js} +7 -7
- package/dist/modules/storage.js.map +1 -0
- package/dist/types/api.d.ts +45 -0
- package/dist/types/api.d.ts.map +1 -0
- package/{src/types/index.ts → dist/types/api.js} +7 -3
- package/dist/types/api.js.map +1 -0
- package/{src/types/client.ts → dist/types/client.d.ts} +8 -36
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/client.js +3 -0
- package/dist/types/client.js.map +1 -0
- package/dist/types/contract.d.ts +5 -0
- package/dist/types/contract.d.ts.map +1 -0
- package/dist/types/contract.js +3 -0
- package/dist/types/contract.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/{src/modules/extension.ts → dist/types/index.js} +7 -5
- package/dist/types/index.js.map +1 -0
- package/img/contracts-page.png +0 -0
- package/package.json +2 -2
- package/tsconfig.tsbuildinfo +1 -0
- package/src/api/ProsopoContractBase.ts +0 -169
- package/src/api/ProviderApi.ts +0 -59
- package/src/index.ts +0 -18
- package/src/modules/ProsopoCaptchaApi.ts +0 -105
- package/src/modules/ProsopoCaptchaClient.ts +0 -131
- package/src/modules/ProsopoCaptchaStateClient.ts +0 -146
- package/src/types/api.ts +0 -79
- package/src/types/contract.ts +0 -21
- package/tests/mocks/browser.ts +0 -25
- package/tests/modules/client.test.ts +0 -56
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../src/modules/extension.ts"],"names":[],"mappings":"AAeA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,wBAAsB,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC,CAEvD"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExtension = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
1
5
|
// Copyright (C) 2021-2022 Prosopo (UK) Ltd.
|
|
2
6
|
// This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
|
|
3
7
|
//
|
|
@@ -13,9 +17,9 @@
|
|
|
13
17
|
//
|
|
14
18
|
// You should have received a copy of the GNU General Public License
|
|
15
19
|
// along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const Extension_1 = tslib_1.__importDefault(require("../api/Extension"));
|
|
21
|
+
async function getExtension() {
|
|
22
|
+
return await Extension_1.default.create();
|
|
23
|
+
}
|
|
24
|
+
exports.getExtension = getExtension;
|
|
25
|
+
//# sourceMappingURL=extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/modules/extension.ts"],"names":[],"mappings":";;;;AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,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,yEAAyC;AAElC,KAAK,UAAU,YAAY;IAC9B,OAAO,MAAM,mBAAS,CAAC,MAAM,EAAE,CAAC;AACpC,CAAC;AAFD,oCAEC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './contract';
|
|
2
|
+
export * from './extension';
|
|
3
|
+
export * from './storage';
|
|
4
|
+
export * from './client';
|
|
5
|
+
export * from './ProsopoCaptchaApi';
|
|
6
|
+
export * from './ProsopoCaptchaClient';
|
|
7
|
+
export * from './ProsopoCaptchaStateClient';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAeA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
1
4
|
// Copyright (C) 2021-2022 Prosopo (UK) Ltd.
|
|
2
5
|
// This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
|
|
3
6
|
//
|
|
@@ -13,11 +16,11 @@
|
|
|
13
16
|
//
|
|
14
17
|
// You should have received a copy of the GNU General Public License
|
|
15
18
|
// along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
tslib_1.__exportStar(require("./contract"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./extension"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./storage"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./client"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./ProsopoCaptchaApi"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./ProsopoCaptchaClient"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./ProsopoCaptchaStateClient"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,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,qDAA2B;AAC3B,sDAA4B;AAC5B,oDAA0B;AAC1B,mDAAyB;AACzB,8DAAoC;AACpC,iEAAuC;AACvC,sEAA4C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets default `account`
|
|
3
|
+
*/
|
|
4
|
+
declare function setAccount(account: string): void;
|
|
5
|
+
/**
|
|
6
|
+
* Gets default `account`
|
|
7
|
+
*/
|
|
8
|
+
declare function getAccount(): string | null;
|
|
9
|
+
declare const _default: {
|
|
10
|
+
setAccount: typeof setAccount;
|
|
11
|
+
getAccount: typeof getAccount;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/modules/storage.ts"],"names":[],"mappings":"AAiBA;;GAEG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,MAAM,QAElC;AAED;;GAEG;AACH,iBAAS,UAAU,IAAI,MAAM,GAAG,IAAI,CAEnC;;;;;AAED,wBAGC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
// Copyright (C) 2021-2022 Prosopo (UK) Ltd.
|
|
2
4
|
// This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
|
|
3
5
|
//
|
|
@@ -14,22 +16,20 @@
|
|
|
14
16
|
// You should have received a copy of the GNU General Public License
|
|
15
17
|
// along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
|
|
16
18
|
const CURRENT_ACCOUNT_KEY = "@prosopo/current_account";
|
|
17
|
-
|
|
18
19
|
/**
|
|
19
20
|
* Sets default `account`
|
|
20
21
|
*/
|
|
21
|
-
function setAccount(account
|
|
22
|
+
function setAccount(account) {
|
|
22
23
|
localStorage.setItem(CURRENT_ACCOUNT_KEY, account);
|
|
23
24
|
}
|
|
24
|
-
|
|
25
25
|
/**
|
|
26
26
|
* Gets default `account`
|
|
27
27
|
*/
|
|
28
|
-
function getAccount()
|
|
28
|
+
function getAccount() {
|
|
29
29
|
return localStorage.getItem(CURRENT_ACCOUNT_KEY);
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
export default {
|
|
31
|
+
exports.default = {
|
|
33
32
|
setAccount,
|
|
34
33
|
getAccount
|
|
35
|
-
}
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/modules/storage.ts"],"names":[],"mappings":";;AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,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,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAEvD;;GAEG;AACH,SAAS,UAAU,CAAC,OAAe;IAC/B,YAAY,CAAC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,SAAS,UAAU;IACf,OAAO,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACrD,CAAC;AAED,kBAAe;IACX,UAAU;IACV,UAAU;CACb,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Captcha } from "@prosopo/contract";
|
|
2
|
+
export interface ProsopoRandomProviderResponse {
|
|
3
|
+
providerId: string;
|
|
4
|
+
blockNumber: string;
|
|
5
|
+
provider: ProposoProvider;
|
|
6
|
+
}
|
|
7
|
+
export declare type ProsopoDappOperatorIsHumanUserResponse = boolean;
|
|
8
|
+
export interface ProposoProvider {
|
|
9
|
+
balance: string;
|
|
10
|
+
captchaDatasetId: string;
|
|
11
|
+
fee: string;
|
|
12
|
+
payee: string;
|
|
13
|
+
serviceOrigin: string;
|
|
14
|
+
status: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CaptchaImageSchema {
|
|
17
|
+
path: string;
|
|
18
|
+
type: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CaptchaResponseCaptcha {
|
|
21
|
+
captcha: Captcha;
|
|
22
|
+
proof: string[][];
|
|
23
|
+
}
|
|
24
|
+
export interface GetCaptchaResponse {
|
|
25
|
+
captchas: CaptchaResponseCaptcha[];
|
|
26
|
+
requestHash: string;
|
|
27
|
+
}
|
|
28
|
+
export interface CaptchaSolution {
|
|
29
|
+
captchaId: string;
|
|
30
|
+
solution: number[];
|
|
31
|
+
salt: string;
|
|
32
|
+
}
|
|
33
|
+
export interface CaptchaSolutionResponse {
|
|
34
|
+
captchas: CaptchaResponseCaptcha[];
|
|
35
|
+
status: string;
|
|
36
|
+
partialFee: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ProsopoCaptchaConfig {
|
|
39
|
+
"providerApi.baseURL": string;
|
|
40
|
+
"providerApi.prefix": string;
|
|
41
|
+
"dappAccount": string;
|
|
42
|
+
"dappUrl": string;
|
|
43
|
+
"solutionThreshold": number;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAC,OAAO,EAAgB,MAAM,mBAAmB,CAAC;AAEzD,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,oBAAY,sCAAsC,GAAG,OAAO,CAAA;AAE5D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAWD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// Copyright (C) 2021-2022 Prosopo (UK) Ltd.
|
|
2
3
|
// This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
|
|
3
4
|
//
|
|
@@ -13,6 +14,9 @@
|
|
|
13
14
|
//
|
|
14
15
|
// You should have received a copy of the GNU General Public License
|
|
15
16
|
// along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export
|
|
17
|
+
// declare module "*.json" {
|
|
18
|
+
// const value: any;
|
|
19
|
+
// export default value;
|
|
20
|
+
// }
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,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,4BAA4B;AAC5B,sBAAsB;AACtB,0BAA0B;AAC1B,IAAI"}
|
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
// Copyright (C) 2021-2022 Prosopo (UK) Ltd.
|
|
2
|
-
// This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
|
|
3
|
-
//
|
|
4
|
-
// procaptcha is free software: you can redistribute it and/or modify
|
|
5
|
-
// it under the terms of the GNU General Public License as published by
|
|
6
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
// (at your option) any later version.
|
|
8
|
-
//
|
|
9
|
-
// procaptcha is distributed in the hope that it will be useful,
|
|
10
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
// GNU General Public License for more details.
|
|
13
|
-
//
|
|
14
|
-
// You should have received a copy of the GNU General Public License
|
|
15
|
-
// along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
|
|
16
1
|
import { InjectedAccountWithMeta, InjectedExtension } from "@polkadot/extension-inject/types";
|
|
17
2
|
import { ProsopoCaptchaConfig, GetCaptchaResponse, CaptchaSolutionResponse } from "../types/api";
|
|
18
3
|
import { TransactionResponse } from "../types/contract";
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export type TExtensionAccount = InjectedAccountWithMeta;
|
|
23
|
-
|
|
24
|
-
export type TCaptchaSubmitResult = [CaptchaSolutionResponse, TransactionResponse, CaptchaSolutionCommitment];
|
|
25
|
-
|
|
4
|
+
import { CaptchaSolutionCommitment } from "@prosopo/contract";
|
|
5
|
+
export declare type TExtensionAccount = InjectedAccountWithMeta;
|
|
6
|
+
export declare type TCaptchaSubmitResult = [CaptchaSolutionResponse, TransactionResponse, CaptchaSolutionCommitment];
|
|
26
7
|
export interface IExtensionInterface {
|
|
27
8
|
checkExtension(): void;
|
|
28
9
|
getExtension(): InjectedExtension;
|
|
@@ -32,57 +13,48 @@ export interface IExtensionInterface {
|
|
|
32
13
|
unsetAccount(): void;
|
|
33
14
|
getDefaultAccount(): InjectedAccountWithMeta | undefined;
|
|
34
15
|
setDefaultAccount(): void;
|
|
35
|
-
|
|
36
|
-
|
|
16
|
+
}
|
|
37
17
|
export interface ICaptchaClientEvents {
|
|
38
18
|
onLoad?: (extension: IExtensionInterface, contractAddress: string) => void;
|
|
39
19
|
onAccountChange?: (account?: TExtensionAccount) => void;
|
|
40
20
|
}
|
|
41
|
-
|
|
42
21
|
export interface ICaptchaStateClientEvents {
|
|
43
22
|
onLoadCaptcha?: (captchaChallenge: GetCaptchaResponse | Error) => void;
|
|
44
23
|
onSubmit?: (result: TCaptchaSubmitResult | Error, captchaState: ICaptchaState) => void;
|
|
45
24
|
onChange?: (captchaSolution: number[][], index: number) => void;
|
|
46
25
|
onCancel?: () => void;
|
|
47
|
-
onSolved?: (result: TCaptchaSubmitResult) => void;
|
|
26
|
+
onSolved?: (result: TCaptchaSubmitResult, isHuman?: boolean) => void;
|
|
27
|
+
}
|
|
28
|
+
export interface CaptchaEventCallbacks extends ICaptchaClientEvents, ICaptchaStateClientEvents {
|
|
48
29
|
}
|
|
49
|
-
|
|
50
|
-
export interface CaptchaEventCallbacks extends ICaptchaClientEvents, ICaptchaStateClientEvents { }
|
|
51
|
-
|
|
52
30
|
export interface ICaptchaContextState {
|
|
53
31
|
config: ProsopoCaptchaConfig;
|
|
54
32
|
contractAddress?: string;
|
|
55
33
|
account?: InjectedAccountWithMeta;
|
|
56
34
|
}
|
|
57
|
-
|
|
58
35
|
export interface ICaptchaContextReducer {
|
|
59
36
|
state: ICaptchaContextState;
|
|
60
37
|
update: (value: Partial<ICaptchaContextState>) => void;
|
|
61
38
|
}
|
|
62
|
-
|
|
63
39
|
export interface ICaptchaState {
|
|
64
40
|
captchaChallenge?: GetCaptchaResponse;
|
|
65
41
|
captchaIndex: number;
|
|
66
42
|
captchaSolution: number[][];
|
|
67
|
-
// captchaSolutions: CaptchaSolution[];
|
|
68
43
|
}
|
|
69
|
-
|
|
70
44
|
export interface ICaptchaStateReducer {
|
|
71
45
|
state: ICaptchaState;
|
|
72
46
|
update: (value: Partial<ICaptchaState>) => void;
|
|
73
47
|
}
|
|
74
|
-
|
|
75
48
|
export interface ICaptchaStatusState {
|
|
76
49
|
info?: string;
|
|
77
50
|
error?: string;
|
|
78
51
|
}
|
|
79
|
-
|
|
80
52
|
export interface ICaptchaStatusReducerAction {
|
|
81
53
|
info?: [string, any] | string;
|
|
82
54
|
error?: [string, any] | string | Error;
|
|
83
55
|
}
|
|
84
|
-
|
|
85
56
|
export interface ICaptchaStatusReducer {
|
|
86
57
|
state: ICaptchaStatusState;
|
|
87
58
|
update: (value: Partial<ICaptchaStatusReducerAction>) => void;
|
|
88
59
|
}
|
|
60
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/types/contract.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,oBAAY,mBAAmB,GAAG,sBAAsB,GAAG;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/types/contract.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAeA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
1
4
|
// Copyright (C) 2021-2022 Prosopo (UK) Ltd.
|
|
2
5
|
// This file is part of procaptcha <https://github.com/prosopo-io/procaptcha>.
|
|
3
6
|
//
|
|
@@ -13,8 +16,7 @@
|
|
|
13
16
|
//
|
|
14
17
|
// You should have received a copy of the GNU General Public License
|
|
15
18
|
// along with procaptcha. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
19
|
+
tslib_1.__exportStar(require("./api"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./contract"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./client"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,8EAA8E;AAC9E,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,gDAAsB;AACtB,qDAA2B;AAC3B,mDAAyB"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/procaptcha",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@polkadot/types": "^8.7.1",
|
|
18
18
|
"@polkadot/util": "^9.4.1",
|
|
19
19
|
"@polkadot/util-crypto": "^9.4.1",
|
|
20
|
-
"@prosopo/contract": "0.1.
|
|
20
|
+
"@prosopo/contract": "0.1.3",
|
|
21
21
|
"axios": "^0.27.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|