@prosopo/procaptcha 0.1.18 → 0.2.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/api/Extension.d.ts +16 -0
- package/dist/api/Extension.d.ts.map +1 -0
- package/dist/api/Extension.js +6 -0
- package/dist/api/Extension.js.map +1 -0
- package/dist/api/ExtensionWeb2.d.ts +13 -0
- package/dist/api/ExtensionWeb2.d.ts.map +1 -0
- package/dist/api/ExtensionWeb2.js +97 -0
- package/dist/api/ExtensionWeb2.js.map +1 -0
- package/dist/api/ExtensionWeb3.d.ts +10 -0
- package/dist/api/ExtensionWeb3.d.ts.map +1 -0
- package/dist/api/ExtensionWeb3.js +29 -0
- package/dist/api/ExtensionWeb3.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 +28 -0
- package/dist/api/HttpClientBase.js.map +1 -0
- package/dist/api/errors.d.ts +16 -0
- package/dist/api/errors.d.ts.map +1 -0
- package/dist/api/errors.js +39 -0
- package/dist/api/errors.js.map +1 -0
- package/dist/api/handlers.d.ts +6 -0
- package/dist/api/handlers.d.ts.map +1 -0
- package/dist/api/handlers.js +9 -0
- package/dist/api/handlers.js.map +1 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +17 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/sign.d.ts +5 -0
- package/dist/api/sign.d.ts.map +1 -0
- package/dist/api/sign.js +25 -0
- package/dist/api/sign.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/Manager.d.ts +22 -0
- package/dist/modules/Manager.d.ts.map +1 -0
- package/dist/modules/Manager.js +421 -0
- package/dist/modules/Manager.js.map +1 -0
- package/dist/modules/ProsopoCaptchaApi.d.ts +21 -0
- package/dist/modules/ProsopoCaptchaApi.d.ts.map +1 -0
- package/dist/modules/ProsopoCaptchaApi.js +100 -0
- package/dist/modules/ProsopoCaptchaApi.js.map +1 -0
- package/dist/modules/canvas.d.ts +13 -0
- package/dist/modules/canvas.d.ts.map +1 -0
- package/dist/modules/canvas.js +359 -0
- package/dist/modules/canvas.js.map +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +16 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/storage.d.ts +24 -0
- package/dist/modules/storage.d.ts.map +1 -0
- package/dist/modules/storage.js +46 -0
- package/dist/modules/storage.js.map +1 -0
- package/dist/types/api.d.ts +35 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +21 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/client.d.ts +5 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/client.js +2 -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 +2 -0
- package/dist/types/contract.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/manager.d.ts +62 -0
- package/dist/types/manager.d.ts.map +1 -0
- package/dist/types/manager.js +9 -0
- package/dist/types/manager.js.map +1 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utils.js +2 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +17 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Account } from '../types/index.js';
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Extension.js","sourceRoot":"","sources":["../../src/api/Extension.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAgB,SAAS;CAStC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Account } from '../types/index.js';
|
|
2
|
+
import { ProcaptchaClientConfig } from '@prosopo/types';
|
|
3
|
+
import Extension from './Extension.js';
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,97 @@
|
|
|
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';
|
|
12
|
+
/**
|
|
13
|
+
* Class for interfacing with web3 accounts.
|
|
14
|
+
*/
|
|
15
|
+
export default class ExtWeb2 extends Extension {
|
|
16
|
+
async getAccount(config) {
|
|
17
|
+
const network = getNetwork(config);
|
|
18
|
+
const wsProvider = new WsProvider(network.endpoint);
|
|
19
|
+
const account = await this.createAccount(wsProvider);
|
|
20
|
+
const extension = await this.createExtension(account);
|
|
21
|
+
return {
|
|
22
|
+
account,
|
|
23
|
+
extension,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
async createExtension(account) {
|
|
27
|
+
const signer = new Signer(async () => {
|
|
28
|
+
return;
|
|
29
|
+
});
|
|
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.
|
|
31
|
+
signer.signRaw = async (payload) => {
|
|
32
|
+
const signature = account.keypair.sign(payload.data);
|
|
33
|
+
return {
|
|
34
|
+
id: 1,
|
|
35
|
+
signature: u8aToHex(signature),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
accounts: {
|
|
40
|
+
get: async () => {
|
|
41
|
+
// there is only ever 1 account
|
|
42
|
+
return [account];
|
|
43
|
+
},
|
|
44
|
+
subscribe: () => {
|
|
45
|
+
// do nothing, there will never be account changes
|
|
46
|
+
return () => {
|
|
47
|
+
return;
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
name: 'procaptcha-web2',
|
|
52
|
+
version: '0.1.11',
|
|
53
|
+
signer,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async createAccount(wsProvider) {
|
|
57
|
+
const params = {
|
|
58
|
+
area: { width: 300, height: 300 },
|
|
59
|
+
offsetParameter: 2001000001,
|
|
60
|
+
multiplier: 15000,
|
|
61
|
+
fontSizeFactor: 1.5,
|
|
62
|
+
maxShadowBlur: 50,
|
|
63
|
+
numberOfRounds: 5,
|
|
64
|
+
seed: 42,
|
|
65
|
+
};
|
|
66
|
+
const browserEntropy = await this.getFingerprint();
|
|
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 });
|
|
72
|
+
const type = 'sr25519';
|
|
73
|
+
const keyring = new Keyring({ type, ss58Format: api.registry.chainSS58 });
|
|
74
|
+
await cryptoWaitReady();
|
|
75
|
+
const keypair = keyring.addFromMnemonic(mnemonic);
|
|
76
|
+
const address = keypair.address.length === 42
|
|
77
|
+
? keypair.address
|
|
78
|
+
: encodeAddress(decodeAddress(keypair.address), api.registry.chainSS58);
|
|
79
|
+
return {
|
|
80
|
+
address,
|
|
81
|
+
type,
|
|
82
|
+
name: address,
|
|
83
|
+
keypair,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async getFingerprint() {
|
|
87
|
+
// Initialize an agent at application startup.
|
|
88
|
+
const fpPromise = FingerprintJS.load();
|
|
89
|
+
// Get the visitor identifier when you need it.
|
|
90
|
+
const fp = await fpPromise;
|
|
91
|
+
const result = await fp.get();
|
|
92
|
+
// strip out the components that change in incognito mode
|
|
93
|
+
const { screenFrame, ...componentsReduced } = result.components;
|
|
94
|
+
return hashComponents(componentsReduced);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=ExtensionWeb2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionWeb2.js","sourceRoot":"","sources":["../../src/api/ExtensionWeb2.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Account } from '../types/index.js';
|
|
2
|
+
import { ProcaptchaClientConfig } from '@prosopo/types';
|
|
3
|
+
import Extension from './Extension.js';
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AccountNotFoundError, ExtensionNotFoundError } from './errors.js';
|
|
2
|
+
import { web3Enable } from '@polkadot/extension-dapp';
|
|
3
|
+
import Extension from './Extension.js';
|
|
4
|
+
/**
|
|
5
|
+
* Class for interfacing with web3 accounts.
|
|
6
|
+
*/
|
|
7
|
+
export default class ExtWeb3 extends Extension {
|
|
8
|
+
async getAccount(config) {
|
|
9
|
+
const { dappName, userAccountAddress: address } = config;
|
|
10
|
+
if (!address) {
|
|
11
|
+
throw new AccountNotFoundError('No account address provided');
|
|
12
|
+
}
|
|
13
|
+
// enable access to all extensions
|
|
14
|
+
const extensions = await web3Enable(dappName);
|
|
15
|
+
if (extensions.length === 0) {
|
|
16
|
+
throw new ExtensionNotFoundError();
|
|
17
|
+
}
|
|
18
|
+
// search through all extensions for the one that has the account
|
|
19
|
+
for (const extension of extensions) {
|
|
20
|
+
const accounts = await extension.accounts.get();
|
|
21
|
+
const account = accounts.find((account) => account.address === address);
|
|
22
|
+
if (account) {
|
|
23
|
+
return { account, extension };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
throw new AccountNotFoundError('No account found matching ' + address);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ExtensionWeb3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 axios from 'axios';
|
|
15
|
+
export class HttpClientBase {
|
|
16
|
+
constructor(baseURL, prefix = '') {
|
|
17
|
+
this.responseHandler = (response) => {
|
|
18
|
+
console.log('API REQUEST', response.request);
|
|
19
|
+
return response.data;
|
|
20
|
+
};
|
|
21
|
+
this.errorHandler = (error) => Promise.reject(error.response);
|
|
22
|
+
baseURL = baseURL + prefix;
|
|
23
|
+
this.axios = axios.default.create({ baseURL });
|
|
24
|
+
this.axios.interceptors.response.use(this.responseHandler, this.errorHandler);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export default HttpClientBase;
|
|
28
|
+
//# sourceMappingURL=HttpClientBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;IAGvB,YAAY,OAAe,EAAE,MAAM,GAAG,EAAE;QAM9B,oBAAe,GAAG,CAAC,QAAuB,EAAE,EAAE;YACpD,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;YAC5C,OAAO,QAAQ,CAAC,IAAI,CAAA;QACxB,CAAC,CAAA;QAES,iBAAY,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAVnE,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;CAQJ;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 {
|
|
15
|
+
constructor(msg) {
|
|
16
|
+
super(msg || 'No extensions found');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class AccountCreationUnsupportedError extends Error {
|
|
20
|
+
constructor(msg) {
|
|
21
|
+
super(msg || 'Account creation is not supported');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class AccountNotFoundError extends Error {
|
|
25
|
+
constructor(msg) {
|
|
26
|
+
super(msg || 'No account found');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class ExtensionNotFoundError extends Error {
|
|
30
|
+
constructor(msg) {
|
|
31
|
+
super(msg || 'No extensions found');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export class ExpiredError extends Error {
|
|
35
|
+
constructor(msg) {
|
|
36
|
+
super(msg || 'The challenge has expired');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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;IACtC,KAAK,EAAE,GAAG,CAAA;gBACE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE;CAQpE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export class ProsopoApiError extends Error {
|
|
2
|
+
constructor(error, context, ...params) {
|
|
3
|
+
super(error ? error.message : 'Unknown API Error');
|
|
4
|
+
this.name = (context && `${ProsopoApiError.name}@${context}`) || ProsopoApiError.name;
|
|
5
|
+
console.error('\n********************* ERROR *********************\n');
|
|
6
|
+
console.error(this.cause, this.stack, ...params);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/api/handlers.ts"],"names":[],"mappings":"AAeA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAEtC,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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 * from './ExtensionWeb3.js';
|
|
15
|
+
export * from './ExtensionWeb2.js';
|
|
16
|
+
export * from './HttpClientBase.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/api/sign.ts"],"names":[],"mappings":"AAiBA,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAOhF"}
|
package/dist/api/sign.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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) {
|
|
18
|
+
const keyring = new Keyring({ type: 'ecdsa' });
|
|
19
|
+
const pair = keyring.addFromUri('//Alice');
|
|
20
|
+
const sig = pair.sign(message);
|
|
21
|
+
const signature = u8aToHex(sig);
|
|
22
|
+
const messageHash = blake2AsHex(message);
|
|
23
|
+
return { messageHash, signature };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=sign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;IAChC,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
ADDED
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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 * from './api/index.js';
|
|
15
|
+
export * from './modules/index.js';
|
|
16
|
+
export * from './types/index.js';
|
|
17
|
+
export * from './utils/index.js';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ProcaptchaCallbacks, ProcaptchaConfigOptional, ProcaptchaState, ProcaptchaStateUpdateFn } from '../types/manager.js';
|
|
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 function 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
|
|
@@ -0,0 +1 @@
|
|
|
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;AAG5B,OAAO,EAIH,mBAAmB,EAEtB,MAAM,gBAAgB,CAAA;AAgBvB,eAAO,MAAM,YAAY,QAAO,QAAQ,eAAe,CAatD,CAAA;AAgBD,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;;;;mBAoSR,MAAM;;EA4J/B"}
|