@prosopo/procaptcha 0.1.16 → 0.1.17
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/Extension.d.ts +1 -1
- package/dist/api/Extension.d.ts.map +1 -1
- package/dist/api/Extension.js +1 -4
- package/dist/api/Extension.js.map +1 -1
- package/dist/api/ExtensionWeb2.d.ts +2 -2
- package/dist/api/ExtensionWeb2.d.ts.map +1 -1
- package/dist/api/ExtensionWeb2.js +26 -30
- package/dist/api/ExtensionWeb2.js.map +1 -1
- package/dist/api/ExtensionWeb3.d.ts +2 -2
- package/dist/api/ExtensionWeb3.d.ts.map +1 -1
- package/dist/api/ExtensionWeb3.js +8 -12
- package/dist/api/ExtensionWeb3.js.map +1 -1
- package/dist/api/HttpClientBase.d.ts.map +1 -1
- package/dist/api/HttpClientBase.js +14 -21
- package/dist/api/HttpClientBase.js.map +1 -1
- package/dist/api/errors.d.ts.map +1 -1
- package/dist/api/errors.js +18 -13
- package/dist/api/errors.js.map +1 -1
- package/dist/api/handlers.d.ts.map +1 -1
- package/dist/api/handlers.js +1 -5
- package/dist/api/handlers.js.map +1 -1
- package/dist/api/index.d.ts +3 -3
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +13 -18
- package/dist/api/index.js.map +1 -1
- package/dist/api/sign.d.ts.map +1 -1
- package/dist/api/sign.js +20 -11
- package/dist/api/sign.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -19
- package/dist/index.js.map +1 -1
- package/dist/modules/Manager.d.ts +2 -2
- package/dist/modules/Manager.d.ts.map +1 -1
- package/dist/modules/Manager.js +43 -41
- package/dist/modules/Manager.js.map +1 -1
- package/dist/modules/ProsopoCaptchaApi.d.ts +2 -2
- package/dist/modules/ProsopoCaptchaApi.d.ts.map +1 -1
- package/dist/modules/ProsopoCaptchaApi.js +27 -33
- package/dist/modules/ProsopoCaptchaApi.js.map +1 -1
- package/dist/modules/canvas.d.ts.map +1 -1
- package/dist/modules/canvas.js +16 -7
- package/dist/modules/canvas.js.map +1 -1
- package/dist/modules/index.d.ts +2 -2
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +12 -17
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/storage.d.ts.map +1 -1
- package/dist/modules/storage.js +11 -15
- package/dist/modules/storage.js.map +1 -1
- package/dist/types/api.js +1 -2
- package/dist/types/api.js.map +1 -1
- package/dist/types/client.d.ts +1 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client.js +1 -2
- package/dist/types/contract.d.ts.map +1 -1
- package/dist/types/contract.js +1 -2
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +14 -19
- package/dist/types/index.js.map +1 -1
- package/dist/types/manager.d.ts +5 -3
- package/dist/types/manager.d.ts.map +1 -1
- package/dist/types/manager.js +8 -2
- package/dist/types/manager.js.map +1 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/utils.js +1 -2
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +14 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +14 -5
- package/dist/utils/utils.js.map +1 -1
- package/package.json +18 -7
package/dist/api/Extension.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Extension.d.ts","sourceRoot":"","sources":["../../src/api/Extension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Extension.d.ts","sourceRoot":"","sources":["../../src/api/Extension.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Extension.js","sourceRoot":"","sources":["../../src/api/Extension.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Extension.js","sourceRoot":"","sources":["../../src/api/Extension.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAgB,SAAS;CAStC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Account } from '../types';
|
|
1
|
+
import { Account } from '../types/index.js';
|
|
2
2
|
import { ProcaptchaClientConfig } from '@prosopo/types';
|
|
3
|
-
import Extension from './Extension';
|
|
3
|
+
import Extension from './Extension.js';
|
|
4
4
|
/**
|
|
5
5
|
* Class for interfacing with web3 accounts.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionWeb2.d.ts","sourceRoot":"","sources":["../../src/api/ExtensionWeb2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExtensionWeb2.d.ts","sourceRoot":"","sources":["../../src/api/ExtensionWeb2.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAM3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAQvD,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAMtC;;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,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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"));
|
|
1
|
+
import { ApiPromise, Keyring } from '@polkadot/api';
|
|
2
|
+
import { WsProvider } from '@polkadot/rpc-provider/ws';
|
|
3
|
+
import { cryptoWaitReady, decodeAddress, encodeAddress } from '@polkadot/util-crypto';
|
|
4
|
+
import { entropyToMnemonic } from '@polkadot/util-crypto/mnemonic/bip39';
|
|
5
|
+
import { getNetwork } from '../modules/Manager.js';
|
|
6
|
+
import { hexHash } from '@prosopo/common';
|
|
7
|
+
import { picassoCanvas } from '../modules/canvas.js';
|
|
8
|
+
import { stringToU8a, u8aToHex } from '@polkadot/util';
|
|
9
|
+
import Extension from './Extension.js';
|
|
10
|
+
import FingerprintJS, { hashComponents } from '@fingerprintjs/fingerprintjs';
|
|
11
|
+
import Signer from '@polkadot/extension-base/page/Signer';
|
|
15
12
|
/**
|
|
16
13
|
* Class for interfacing with web3 accounts.
|
|
17
14
|
*/
|
|
18
|
-
class ExtWeb2 extends
|
|
15
|
+
export default class ExtWeb2 extends Extension {
|
|
19
16
|
async getAccount(config) {
|
|
20
|
-
const network =
|
|
21
|
-
const wsProvider = new
|
|
17
|
+
const network = getNetwork(config);
|
|
18
|
+
const wsProvider = new WsProvider(network.endpoint);
|
|
22
19
|
const account = await this.createAccount(wsProvider);
|
|
23
20
|
const extension = await this.createExtension(account);
|
|
24
21
|
return {
|
|
@@ -27,7 +24,7 @@ class ExtWeb2 extends Extension_1.default {
|
|
|
27
24
|
};
|
|
28
25
|
}
|
|
29
26
|
async createExtension(account) {
|
|
30
|
-
const signer = new
|
|
27
|
+
const signer = new Signer(async () => {
|
|
31
28
|
return;
|
|
32
29
|
});
|
|
33
30
|
// 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.
|
|
@@ -35,7 +32,7 @@ class ExtWeb2 extends Extension_1.default {
|
|
|
35
32
|
const signature = account.keypair.sign(payload.data);
|
|
36
33
|
return {
|
|
37
34
|
id: 1,
|
|
38
|
-
signature:
|
|
35
|
+
signature: u8aToHex(signature),
|
|
39
36
|
};
|
|
40
37
|
};
|
|
41
38
|
return {
|
|
@@ -67,18 +64,18 @@ class ExtWeb2 extends Extension_1.default {
|
|
|
67
64
|
seed: 42,
|
|
68
65
|
};
|
|
69
66
|
const browserEntropy = await this.getFingerprint();
|
|
70
|
-
const canvasEntropy =
|
|
71
|
-
const entropy =
|
|
72
|
-
const u8Entropy =
|
|
73
|
-
const mnemonic =
|
|
74
|
-
const api = await
|
|
67
|
+
const canvasEntropy = picassoCanvas(params.numberOfRounds, params.seed, params);
|
|
68
|
+
const entropy = hexHash([canvasEntropy, browserEntropy].join(''), 128).slice(2);
|
|
69
|
+
const u8Entropy = stringToU8a(entropy);
|
|
70
|
+
const mnemonic = entropyToMnemonic(u8Entropy);
|
|
71
|
+
const api = await ApiPromise.create({ provider: wsProvider });
|
|
75
72
|
const type = 'sr25519';
|
|
76
|
-
const keyring = new
|
|
77
|
-
await
|
|
73
|
+
const keyring = new Keyring({ type, ss58Format: api.registry.chainSS58 });
|
|
74
|
+
await cryptoWaitReady();
|
|
78
75
|
const keypair = keyring.addFromMnemonic(mnemonic);
|
|
79
76
|
const address = keypair.address.length === 42
|
|
80
77
|
? keypair.address
|
|
81
|
-
:
|
|
78
|
+
: encodeAddress(decodeAddress(keypair.address), api.registry.chainSS58);
|
|
82
79
|
return {
|
|
83
80
|
address,
|
|
84
81
|
type,
|
|
@@ -88,14 +85,13 @@ class ExtWeb2 extends Extension_1.default {
|
|
|
88
85
|
}
|
|
89
86
|
async getFingerprint() {
|
|
90
87
|
// Initialize an agent at application startup.
|
|
91
|
-
const fpPromise =
|
|
88
|
+
const fpPromise = FingerprintJS.load();
|
|
92
89
|
// Get the visitor identifier when you need it.
|
|
93
90
|
const fp = await fpPromise;
|
|
94
91
|
const result = await fp.get();
|
|
95
92
|
// strip out the components that change in incognito mode
|
|
96
93
|
const { screenFrame, ...componentsReduced } = result.components;
|
|
97
|
-
return
|
|
94
|
+
return hashComponents(componentsReduced);
|
|
98
95
|
}
|
|
99
96
|
}
|
|
100
|
-
exports.default = ExtWeb2;
|
|
101
97
|
//# sourceMappingURL=ExtensionWeb2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionWeb2.js","sourceRoot":"","sources":["../../src/api/ExtensionWeb2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExtensionWeb2.js","sourceRoot":"","sources":["../../src/api/ExtensionWeb2.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Account } from '../types';
|
|
1
|
+
import { Account } from '../types/index.js';
|
|
2
2
|
import { ProcaptchaClientConfig } from '@prosopo/types';
|
|
3
|
-
import Extension from './Extension';
|
|
3
|
+
import Extension from './Extension.js';
|
|
4
4
|
/**
|
|
5
5
|
* Class for interfacing with web3 accounts.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionWeb3.d.ts","sourceRoot":"","sources":["../../src/api/ExtensionWeb3.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExtensionWeb3.d.ts","sourceRoot":"","sources":["../../src/api/ExtensionWeb3.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAG3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAEtC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,SAAS;IAC7B,UAAU,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;CAwB5E"}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const errors_1 = require("./errors");
|
|
5
|
-
const extension_dapp_1 = require("@polkadot/extension-dapp");
|
|
6
|
-
const Extension_1 = tslib_1.__importDefault(require("./Extension"));
|
|
1
|
+
import { AccountNotFoundError, ExtensionNotFoundError } from './errors.js';
|
|
2
|
+
import { web3Enable } from '@polkadot/extension-dapp';
|
|
3
|
+
import Extension from './Extension.js';
|
|
7
4
|
/**
|
|
8
5
|
* Class for interfacing with web3 accounts.
|
|
9
6
|
*/
|
|
10
|
-
class ExtWeb3 extends
|
|
7
|
+
export default class ExtWeb3 extends Extension {
|
|
11
8
|
async getAccount(config) {
|
|
12
9
|
const { dappName, userAccountAddress: address } = config;
|
|
13
10
|
if (!address) {
|
|
14
|
-
throw new
|
|
11
|
+
throw new AccountNotFoundError('No account address provided');
|
|
15
12
|
}
|
|
16
13
|
// enable access to all extensions
|
|
17
|
-
const extensions = await
|
|
14
|
+
const extensions = await web3Enable(dappName);
|
|
18
15
|
if (extensions.length === 0) {
|
|
19
|
-
throw new
|
|
16
|
+
throw new ExtensionNotFoundError();
|
|
20
17
|
}
|
|
21
18
|
// search through all extensions for the one that has the account
|
|
22
19
|
for (const extension of extensions) {
|
|
@@ -26,8 +23,7 @@ class ExtWeb3 extends Extension_1.default {
|
|
|
26
23
|
return { account, extension };
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
throw new
|
|
26
|
+
throw new AccountNotFoundError('No account found matching ' + address);
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
exports.default = ExtWeb3;
|
|
33
29
|
//# sourceMappingURL=ExtensionWeb3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionWeb3.js","sourceRoot":"","sources":["../../src/api/ExtensionWeb3.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExtensionWeb3.js","sourceRoot":"","sources":["../../src/api/ExtensionWeb3.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAG1E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAEtC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,SAAS;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,oBAAoB,CAAC,6BAA6B,CAAC,CAAA;SAChE;QAED,kCAAkC;QAClC,MAAM,UAAU,GAAwB,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAA;QAClE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,MAAM,IAAI,sBAAsB,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,oBAAoB,CAAC,4BAA4B,GAAG,OAAO,CAAC,CAAA;IAC1E,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClientBase.d.ts","sourceRoot":"","sources":["../../src/api/HttpClientBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HttpClientBase.d.ts","sourceRoot":"","sources":["../../src/api/HttpClientBase.ts"],"names":[],"mappings":"AAaA,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,28 +1,22 @@
|
|
|
1
|
-
|
|
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>.
|
|
1
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
7
2
|
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// (at your option) any later version.
|
|
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
|
|
12
6
|
//
|
|
13
|
-
//
|
|
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.
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
17
8
|
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
import axios from 'axios';
|
|
15
|
+
export class HttpClientBase {
|
|
22
16
|
axios;
|
|
23
17
|
constructor(baseURL, prefix = '') {
|
|
24
18
|
baseURL = baseURL + prefix;
|
|
25
|
-
this.axios =
|
|
19
|
+
this.axios = axios.default.create({ baseURL });
|
|
26
20
|
this.axios.interceptors.response.use(this.responseHandler, this.errorHandler);
|
|
27
21
|
}
|
|
28
22
|
responseHandler = (response) => {
|
|
@@ -31,6 +25,5 @@ class HttpClientBase {
|
|
|
31
25
|
};
|
|
32
26
|
errorHandler = (error) => Promise.reject(error.response);
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
exports.default = HttpClientBase;
|
|
28
|
+
export default HttpClientBase;
|
|
36
29
|
//# sourceMappingURL=HttpClientBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClientBase.js","sourceRoot":"","sources":["../../src/api/HttpClientBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HttpClientBase.js","sourceRoot":"","sources":["../../src/api/HttpClientBase.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,KAAuC,MAAM,OAAO,CAAA;AAE3D,MAAM,OAAO,cAAc;IACJ,KAAK,CAAe;IAEvC,YAAY,OAAe,EAAE,MAAM,GAAG,EAAE;QACpC,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;QAC9C,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;AAED,eAAe,cAAc,CAAA"}
|
package/dist/api/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":"
|
|
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
CHANGED
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// Copyright 2021-2023 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 class NoExtensionsFoundError extends Error {
|
|
5
15
|
constructor(msg) {
|
|
6
16
|
super(msg || 'No extensions found');
|
|
7
17
|
}
|
|
8
18
|
}
|
|
9
|
-
|
|
10
|
-
class AccountCreationUnsupportedError extends Error {
|
|
19
|
+
export class AccountCreationUnsupportedError extends Error {
|
|
11
20
|
constructor(msg) {
|
|
12
21
|
super(msg || 'Account creation is not supported');
|
|
13
22
|
}
|
|
14
23
|
}
|
|
15
|
-
|
|
16
|
-
class AccountNotFoundError extends Error {
|
|
24
|
+
export class AccountNotFoundError extends Error {
|
|
17
25
|
constructor(msg) {
|
|
18
26
|
super(msg || 'No account found');
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
|
-
|
|
22
|
-
class ExtensionNotFoundError extends Error {
|
|
29
|
+
export class ExtensionNotFoundError extends Error {
|
|
23
30
|
constructor(msg) {
|
|
24
31
|
super(msg || 'No extensions found');
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
|
-
|
|
28
|
-
class ExpiredError extends Error {
|
|
34
|
+
export class ExpiredError extends Error {
|
|
29
35
|
constructor(msg) {
|
|
30
36
|
super(msg || 'The challenge has expired');
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
|
-
exports.ExpiredError = ExpiredError;
|
|
34
39
|
//# sourceMappingURL=errors.js.map
|
package/dist/api/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/api/errors.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC7C,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAA;IACvC,CAAC;CACJ;AAED,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IACtD,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,mCAAmC,CAAC,CAAA;IACrD,CAAC;CACJ;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC3C,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,kBAAkB,CAAC,CAAA;IACpC,CAAC;CACJ;AAED,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC7C,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAA;IACvC,CAAC;CACJ;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;IACnC,YAAY,GAAY;QACpB,KAAK,CAAC,GAAG,IAAI,2BAA2B,CAAC,CAAA;IAC7C,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":"AAaA,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
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProsopoApiError = void 0;
|
|
4
|
-
class ProsopoApiError extends Error {
|
|
1
|
+
export class ProsopoApiError extends Error {
|
|
5
2
|
constructor(error, context, ...params) {
|
|
6
3
|
super(error ? error.message : 'Unknown API Error');
|
|
7
4
|
this.name = (context && `${ProsopoApiError.name}@${context}`) || ProsopoApiError.name;
|
|
@@ -9,5 +6,4 @@ class ProsopoApiError extends Error {
|
|
|
9
6
|
console.error(this.cause, this.stack, ...params);
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
exports.ProsopoApiError = ProsopoApiError;
|
|
13
9
|
//# sourceMappingURL=handlers.js.map
|
package/dist/api/handlers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":"AAeA,MAAM,OAAO,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"}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './ExtensionWeb3';
|
|
2
|
-
export * from './ExtensionWeb2';
|
|
3
|
-
export * from './HttpClientBase';
|
|
1
|
+
export * from './ExtensionWeb3.js';
|
|
2
|
+
export * from './ExtensionWeb2.js';
|
|
3
|
+
export * from './HttpClientBase.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
|
package/dist/api/index.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
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>.
|
|
1
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
6
2
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// (at your option) any later version.
|
|
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
|
|
11
6
|
//
|
|
12
|
-
//
|
|
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.
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
16
8
|
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 * from './ExtensionWeb3.js';
|
|
15
|
+
export * from './ExtensionWeb2.js';
|
|
16
|
+
export * from './HttpClientBase.js';
|
|
22
17
|
//# sourceMappingURL=index.js.map
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
|
package/dist/api/sign.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/api/sign.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/api/sign.ts"],"names":[],"mappings":"AAiBA,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
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
// Copyright 2021-2023 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
|
+
import { Keyring } from '@polkadot/keyring';
|
|
15
|
+
import { blake2AsHex } from '@polkadot/util-crypto';
|
|
16
|
+
import { u8aToHex } from '@polkadot/util';
|
|
17
|
+
export function sign(message, account) {
|
|
18
|
+
const keyring = new Keyring({ type: 'ecdsa' });
|
|
9
19
|
const pair = keyring.addFromUri('//Alice');
|
|
10
20
|
const sig = pair.sign(message);
|
|
11
|
-
const signature =
|
|
12
|
-
const messageHash =
|
|
21
|
+
const signature = u8aToHex(sig);
|
|
22
|
+
const messageHash = blake2AsHex(message);
|
|
13
23
|
return { messageHash, signature };
|
|
14
24
|
}
|
|
15
|
-
exports.sign = sign;
|
|
16
25
|
//# sourceMappingURL=sign.js.map
|
package/dist/api/sign.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/api/sign.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/api/sign.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,MAAM,UAAU,IAAI,CAAC,OAAe,EAAE,OAAO;IACzC,MAAM,OAAO,GAAG,IAAI,OAAO,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,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC/B,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACxC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA;AACrC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './api';
|
|
2
|
-
export * from './modules';
|
|
3
|
-
export * from './types';
|
|
4
|
-
export * from './utils';
|
|
1
|
+
export * from './api/index.js';
|
|
2
|
+
export * from './modules/index.js';
|
|
3
|
+
export * from './types/index.js';
|
|
4
|
+
export * from './utils/index.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
|
|
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>.
|
|
1
|
+
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
6
2
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// (at your option) any later version.
|
|
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
|
|
11
6
|
//
|
|
12
|
-
//
|
|
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.
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
16
8
|
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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 * from './api/index.js';
|
|
15
|
+
export * from './modules/index.js';
|
|
16
|
+
export * from './types/index.js';
|
|
17
|
+
export * from './utils/index.js';
|
|
23
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProcaptchaCallbacks, ProcaptchaConfigOptional, ProcaptchaState, ProcaptchaStateUpdateFn } from '../types/manager';
|
|
1
|
+
import { ProcaptchaCallbacks, ProcaptchaConfigOptional, ProcaptchaState, ProcaptchaStateUpdateFn } from '../types/manager.js';
|
|
2
2
|
import { ProsopoClientConfig } from '@prosopo/types';
|
|
3
3
|
export declare const defaultState: () => Partial<ProcaptchaState>;
|
|
4
4
|
export declare const getNetwork: (config: ProsopoClientConfig) => {
|
|
@@ -12,7 +12,7 @@ export declare const getNetwork: (config: ProsopoClientConfig) => {
|
|
|
12
12
|
/**
|
|
13
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
14
|
*/
|
|
15
|
-
export declare
|
|
15
|
+
export declare function Manager(configOptional: ProcaptchaConfigOptional, state: ProcaptchaState, onStateUpdate: ProcaptchaStateUpdateFn, callbacks: ProcaptchaCallbacks): {
|
|
16
16
|
start: () => Promise<void>;
|
|
17
17
|
cancel: () => Promise<void>;
|
|
18
18
|
submit: () => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Manager.d.ts","sourceRoot":"","sources":["../../src/modules/Manager.ts"],"names":[],"mappings":"
|
|
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,qBAAqB,CAAA;AAE5B,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,wBAAgB,OAAO,CACnB,cAAc,EAAE,wBAAwB,EACxC,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,uBAAuB,EACtC,SAAS,EAAE,mBAAmB;;;;mBAkSR,MAAM;;EA4J/B"}
|