@prosopo/keyring 2.9.59 → 2.9.61

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @prosopo/keyring@2.9.59 build:cjs
2
+ > @prosopo/keyring@2.9.61 build:cjs
3
3
  > NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
4
 
5
5
  ViteCommonJSConfig: .
@@ -23,23 +23,25 @@ ViteCommonJSConfig: .
23
23
  '@prosopo/util-crypto'
24
24
  ]
25
25
  }
26
- vite v6.4.1 building SSR bundle for production...
26
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
27
+ vite v8.1.5 building ssr environment for production...
27
28
  Bundle build started
28
- transforming...
29
- Build end
30
- ✓ 13 modules transformed.
29
+ 
30
+ ✓ 14 modules transformed.
31
31
  rendering chunks...
32
- dist/cjs/keyring/index.cjs  0.27 kB
33
- dist/cjs/pair/toJson.cjs  0.43 kB
34
- dist/cjs/accounts/index.cjs  0.50 kB
35
- dist/cjs/pair/defaults.cjs  0.56 kB
36
- dist/cjs/accounts/mnemonic.cjs  0.77 kB
37
- dist/cjs/pair/encode.cjs  0.80 kB
38
- dist/cjs/keyring/pairs.cjs  0.83 kB
39
- dist/cjs/index.cjs  0.87 kB
40
- dist/cjs/accounts/testAccounts.cjs  1.39 kB
41
- dist/cjs/accounts/getPair.cjs  1.48 kB
42
- dist/cjs/pair/decode.cjs  1.49 kB
43
- dist/cjs/pair/index.cjs  5.24 kB
44
- dist/cjs/keyring/keyring.cjs 10.59 kB
45
- ✓ built in 345ms
32
+ computing gzip size...
33
+ dist/cjs/keyring/index.cjs 0.22 kB │ gzip: 0.11 kB
34
+ dist/cjs/pair/toJson.cjs 0.40 kB │ gzip: 0.25 kB
35
+ dist/cjs/pair/defaults.cjs 0.45 kB │ gzip: 0.25 kB
36
+ dist/cjs/accounts/index.cjs 0.47 kB │ gzip: 0.17 kB
37
+ dist/cjs/keyring/pairs.cjs 0.86 kB │ gzip: 0.38 kB
38
+ dist/cjs/index.cjs 0.91 kB │ gzip: 0.31 kB
39
+ dist/cjs/pair/encode.cjs 0.91 kB │ gzip: 0.44 kB
40
+ dist/cjs/accounts/mnemonic.cjs 0.95 kB │ gzip: 0.38 kB
41
+ dist/cjs/accounts/testAccounts.cjs 1.31 kB │ gzip: 0.63 kB
42
+ dist/cjs/accounts/getPair.cjs 1.41 kB │ gzip: 0.60 kB
43
+ dist/cjs/pair/decode.cjs 1.77 kB │ gzip: 0.70 kB
44
+ dist/cjs/pair/index.cjs 7.26 kB │ gzip: 2.12 kB
45
+ dist/cjs/keyring/keyring.cjs 11.14 kB │ gzip: 3.05 kB
46
+
47
+ ✓ built in 85ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/keyring@2.9.59 build:tsc
2
+ > @prosopo/keyring@2.9.61 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 12:17:13 PM - Projects in this build:
5
+ 8:59:09 PM - Projects in this build:
6
6
  * ../../dev/config/tsconfig.json
7
7
  * ../locale/tsconfig.json
8
8
  * ../util/tsconfig.json
@@ -12,21 +12,21 @@
12
12
  * ../common/tsconfig.json
13
13
  * tsconfig.json
14
14
 
15
- 12:17:13 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/index.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
15
+ 8:59:09 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/webpack/webpack.config.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
16
16
 
17
- 12:17:14 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
17
+ 8:59:09 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
18
18
 
19
- 12:17:14 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
19
+ 8:59:09 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
20
20
 
21
- 12:17:14 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
21
+ 8:59:09 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
22
22
 
23
- 12:17:14 PM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/tsconfig.tsbuildinfo'
23
+ 8:59:09 PM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/tsconfig.tsbuildinfo'
24
24
 
25
- 12:17:14 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/provider/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
25
+ 8:59:09 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/provider/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
26
26
 
27
- 12:17:14 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/index.ts' is older than output '../common/tsconfig.tsbuildinfo'
27
+ 8:59:09 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/tests/utils/batches.unit.test.ts' is older than output '../common/tsconfig.tsbuildinfo'
28
28
 
29
- 12:17:14 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
29
+ 8:59:09 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
30
30
 
31
- 12:17:14 PM - Building project '/home/runner/work/captcha/captcha/packages/keyring/tsconfig.json'...
31
+ 8:59:09 PM - Building project '/home/runner/work/captcha/captcha/packages/keyring/tsconfig.json'...
32
32
 
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/keyring@2.9.59 build
2
+ > @prosopo/keyring@2.9.61 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/keyring@2.9.59 build:cross-env
6
+ > @prosopo/keyring@2.9.61 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
@@ -27,23 +27,26 @@ ViteEsmConfig: .
27
27
  '@prosopo/util-crypto'
28
28
  ]
29
29
  }
30
- vite v6.4.1 building SSR bundle for production...
30
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
31
+ vite v8.1.5 building ssr environment for production...
31
32
  Bundle build started
32
- transforming...
33
- Build end
34
- ✓ 13 modules transformed.
33
+ 
34
+ ✓ 14 modules transformed.
35
35
  rendering chunks...
36
- dist/keyring/index.js  0.13 kB
37
- dist/accounts/index.js  0.30 kB
38
- dist/pair/toJson.js  0.33 kB
39
- dist/pair/defaults.js  0.37 kB
40
- dist/index.js  0.58 kB
41
- dist/accounts/mnemonic.js  0.63 kB
42
- dist/pair/encode.js  0.68 kB
43
- dist/keyring/pairs.js  0.70 kB
44
- dist/accounts/testAccounts.js  1.23 kB
45
- dist/pair/decode.js  1.31 kB
46
- dist/accounts/getPair.js  1.34 kB
47
- dist/pair/index.js  5.18 kB
48
- dist/keyring/keyring.js 10.45 kB
49
- ✓ built in 332ms
36
+ computing gzip size...
37
+ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
38
+ dist/keyring/index.js 0.12 kB │ gzip: 0.09 kB
39
+ dist/accounts/index.js 0.28 kB │ gzip: 0.14 kB
40
+ dist/pair/toJson.js 0.34 kB │ gzip: 0.22 kB
41
+ dist/pair/defaults.js 0.42 kB │ gzip: 0.25 kB
42
+ dist/index.js 0.54 kB │ gzip: 0.23 kB
43
+ dist/keyring/pairs.js 0.71 kB │ gzip: 0.36 kB
44
+ dist/pair/encode.js 0.77 kB │ gzip: 0.41 kB
45
+ dist/accounts/mnemonic.js 0.84 kB │ gzip: 0.36 kB
46
+ dist/accounts/testAccounts.js 1.14 kB │ gzip: 0.60 kB
47
+ dist/accounts/getPair.js 1.24 kB │ gzip: 0.56 kB
48
+ dist/pair/decode.js 1.48 kB │ gzip: 0.66 kB
49
+ dist/pair/index.js 6.96 kB │ gzip: 2.09 kB
50
+ dist/keyring/keyring.js 10.74 kB │ gzip: 2.99 kB
51
+
52
+ ✓ built in 83ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @prosopo/keyring
2
2
 
3
+ ## 2.9.61
4
+ ### Patch Changes
5
+
6
+ - e14fce6: chore(deps): bump vite to 6.4.3 and mongoose to 8.24.1, and adjust types for the mongoose 8.24 Document/ObjectId changes
7
+ - Updated dependencies [2c47bb7]
8
+ - Updated dependencies [0e1171c]
9
+ - Updated dependencies [103318c]
10
+ - Updated dependencies [270a8d8]
11
+ - Updated dependencies [e14fce6]
12
+ - @prosopo/util@3.3.5
13
+ - @prosopo/types@4.10.0
14
+ - @prosopo/common@3.1.48
15
+
16
+ ## 2.9.60
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [a0cb39e]
20
+ - @prosopo/types@4.9.12
21
+
3
22
  ## 2.9.59
4
23
  ### Patch Changes
5
24
 
@@ -0,0 +1,3 @@
1
+ import "node:module";
2
+ //#endregion
3
+ export {};
@@ -1,43 +1,33 @@
1
+ import { Keyring } from "../keyring/keyring.js";
2
+ import { mnemonicValidate } from "@prosopo/util-crypto";
1
3
  import { hexToU8a } from "@polkadot/util/hex";
2
4
  import { isHex } from "@polkadot/util/is";
3
5
  import { ProsopoEnvError } from "@prosopo/common";
4
- import { mnemonicValidate } from "@prosopo/util-crypto";
5
- import { Keyring } from "../keyring/keyring.js";
6
+ //#region src/accounts/getPair.ts
6
7
  function getPair(secret, account, pairType, ss58Format) {
7
- pairType = pairType || "sr25519";
8
- ss58Format = ss58Format || 42;
9
- const keyring = new Keyring({ type: pairType, ss58Format });
10
- if (!secret && account) {
11
- return keyring.addFromAddress(account);
12
- }
13
- if (secret && typeof secret === "string") {
14
- if (mnemonicValidate(secret)) {
15
- return keyring.addFromMnemonic(secret);
16
- }
17
- if (isHex(secret)) {
18
- return keyring.addFromSeed(hexToU8a(secret));
19
- }
20
- if (secret.includes("//")) {
21
- return keyring.addFromUri(secret);
22
- }
23
- try {
24
- const json = JSON.parse(secret);
25
- const {
26
- encoding: { content }
27
- } = json;
28
- const keyring2 = new Keyring({ type: content[1], ss58Format });
29
- return keyring2.addFromJson(json);
30
- } catch (e) {
31
- throw new ProsopoEnvError("GENERAL.MISSING_SECRET_KEY", {
32
- context: { error: e }
33
- });
34
- }
35
- } else if (typeof secret === "object") {
36
- return keyring.addFromJson(secret);
37
- } else {
38
- throw new ProsopoEnvError("GENERAL.MISSING_SECRET_KEY");
39
- }
8
+ pairType = pairType || "sr25519";
9
+ ss58Format = ss58Format || 42;
10
+ const keyring = new Keyring({
11
+ type: pairType,
12
+ ss58Format
13
+ });
14
+ if (!secret && account) return keyring.addFromAddress(account);
15
+ if (secret && typeof secret === "string") {
16
+ if (mnemonicValidate(secret)) return keyring.addFromMnemonic(secret);
17
+ if (isHex(secret)) return keyring.addFromSeed(hexToU8a(secret));
18
+ if (secret.includes("//")) return keyring.addFromUri(secret);
19
+ try {
20
+ const json = JSON.parse(secret);
21
+ const { encoding: { content } } = json;
22
+ return new Keyring({
23
+ type: content[1],
24
+ ss58Format
25
+ }).addFromJson(json);
26
+ } catch (e) {
27
+ throw new ProsopoEnvError("GENERAL.MISSING_SECRET_KEY", { context: { error: e } });
28
+ }
29
+ } else if (typeof secret === "object") return keyring.addFromJson(secret);
30
+ else throw new ProsopoEnvError("GENERAL.MISSING_SECRET_KEY");
40
31
  }
41
- export {
42
- getPair
43
- };
32
+ //#endregion
33
+ export { getPair };
@@ -1,10 +1,4 @@
1
1
  import { generateMiniSecret, generateMnemonic } from "./mnemonic.js";
2
2
  import { getPair } from "./getPair.js";
3
3
  import { getDefaultProviders, getDefaultSiteKeys } from "./testAccounts.js";
4
- export {
5
- generateMiniSecret,
6
- generateMnemonic,
7
- getDefaultProviders,
8
- getDefaultSiteKeys,
9
- getPair
10
- };
4
+ export { generateMiniSecret, generateMnemonic, getDefaultProviders, getDefaultSiteKeys, getPair };
@@ -1,18 +1,22 @@
1
- import { mnemonicGenerate, mnemonicToMiniSecret } from "@prosopo/util-crypto";
2
1
  import { Keyring } from "../keyring/keyring.js";
2
+ import { mnemonicGenerate, mnemonicToMiniSecret } from "@prosopo/util-crypto";
3
+ //#region src/accounts/mnemonic.ts
4
+ /** Generate a mnemonic, returning the mnemonic and associated address
5
+ * @param keyring
6
+ * @param pairType
7
+ */
3
8
  async function generateMnemonic(keyring, pairType) {
4
- if (!keyring) {
5
- keyring = new Keyring({ type: pairType || "sr25519" });
6
- }
7
- const mnemonic = mnemonicGenerate();
8
- const account = keyring.addFromMnemonic(mnemonic);
9
- return [mnemonic, account.address];
9
+ if (!keyring) keyring = new Keyring({ type: pairType || "sr25519" });
10
+ const mnemonic = mnemonicGenerate();
11
+ return [mnemonic, keyring.addFromMnemonic(mnemonic).address];
10
12
  }
13
+ /** Generate a secret, returning the secret and associated address
14
+ * @param keyring
15
+ * @param pairType
16
+ */
11
17
  async function generateMiniSecret(keyring, pairType) {
12
- const [mnemonic, address] = await generateMnemonic(keyring, pairType);
13
- return [mnemonicToMiniSecret(mnemonic), address];
18
+ const [mnemonic, address] = await generateMnemonic(keyring, pairType);
19
+ return [mnemonicToMiniSecret(mnemonic), address];
14
20
  }
15
- export {
16
- generateMiniSecret,
17
- generateMnemonic
18
- };
21
+ //#endregion
22
+ export { generateMiniSecret, generateMnemonic };
@@ -1,47 +1,41 @@
1
- import { CaptchaType, ClientSettingsSchema } from "@prosopo/types";
2
- import "../keyring/index.js";
3
- import { getPair } from "./getPair.js";
4
1
  import { DEV_PHRASE } from "../keyring/keyring.js";
2
+ import { getPair } from "./getPair.js";
3
+ import { CaptchaType, ClientSettingsSchema } from "@prosopo/types";
4
+ //#region src/accounts/testAccounts.ts
5
5
  function getDefaultSiteKeys() {
6
- const captchaTypes = [
7
- CaptchaType.image,
8
- CaptchaType.pow,
9
- CaptchaType.frictionless,
10
- CaptchaType.puzzle
11
- ];
12
- const sites = [];
13
- for (const captchaType of captchaTypes) {
14
- const secret = `${DEV_PHRASE}//${captchaType}`;
15
- const pair = getPair(secret);
16
- sites.push({
17
- pair,
18
- address: pair.address,
19
- secret,
20
- settings: ClientSettingsSchema.parse({
21
- captchaType,
22
- domains: ["localhost"],
23
- imageMaxRounds: 2,
24
- frictionlessThreshold: 0.8
25
- })
26
- });
27
- }
28
- return sites;
6
+ const captchaTypes = [
7
+ CaptchaType.image,
8
+ CaptchaType.pow,
9
+ CaptchaType.frictionless,
10
+ CaptchaType.puzzle
11
+ ];
12
+ const sites = [];
13
+ for (const captchaType of captchaTypes) {
14
+ const secret = `${DEV_PHRASE}//${captchaType}`;
15
+ const pair = getPair(secret);
16
+ sites.push({
17
+ pair,
18
+ address: pair.address,
19
+ secret,
20
+ settings: ClientSettingsSchema.parse({
21
+ captchaType,
22
+ domains: ["localhost"],
23
+ imageMaxRounds: 2,
24
+ frictionlessThreshold: .8
25
+ })
26
+ });
27
+ }
28
+ return sites;
29
29
  }
30
30
  function getDefaultProviders() {
31
- const pair = getPair(
32
- "puppy cream effort carbon despair leg pyramid cotton endorse immense drill peasant"
33
- );
34
- return [
35
- {
36
- url: "https://localhost:9229",
37
- pair,
38
- address: pair.address,
39
- datasetFile: "./dev/data/captchas.json",
40
- captchaDatasetId: "0x3e067b8f6aeae82fdbe2b2557b9c2d90aaabff241df651bf0f36667d2ab0018d"
41
- }
42
- ];
31
+ const pair = getPair("puppy cream effort carbon despair leg pyramid cotton endorse immense drill peasant");
32
+ return [{
33
+ url: "https://localhost:9229",
34
+ pair,
35
+ address: pair.address,
36
+ datasetFile: "./dev/data/captchas.json",
37
+ captchaDatasetId: "0x3e067b8f6aeae82fdbe2b2557b9c2d90aaabff241df651bf0f36667d2ab0018d"
38
+ }];
43
39
  }
44
- export {
45
- getDefaultProviders,
46
- getDefaultSiteKeys
47
- };
40
+ //#endregion
41
+ export { getDefaultProviders, getDefaultSiteKeys };
@@ -1,43 +1,33 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const hex = require("@polkadot/util/hex");
4
- const is = require("@polkadot/util/is");
5
- const common = require("@prosopo/common");
6
- const utilCrypto = require("@prosopo/util-crypto");
7
- const keyring = require("../keyring/keyring.cjs");
1
+ const require_keyring = require("../keyring/keyring.cjs");
2
+ let _prosopo_util_crypto = require("@prosopo/util-crypto");
3
+ let _polkadot_util_hex = require("@polkadot/util/hex");
4
+ let _polkadot_util_is = require("@polkadot/util/is");
5
+ let _prosopo_common = require("@prosopo/common");
6
+ //#region src/accounts/getPair.ts
8
7
  function getPair(secret, account, pairType, ss58Format) {
9
- pairType = pairType || "sr25519";
10
- ss58Format = ss58Format || 42;
11
- const keyring$1 = new keyring.Keyring({ type: pairType, ss58Format });
12
- if (!secret && account) {
13
- return keyring$1.addFromAddress(account);
14
- }
15
- if (secret && typeof secret === "string") {
16
- if (utilCrypto.mnemonicValidate(secret)) {
17
- return keyring$1.addFromMnemonic(secret);
18
- }
19
- if (is.isHex(secret)) {
20
- return keyring$1.addFromSeed(hex.hexToU8a(secret));
21
- }
22
- if (secret.includes("//")) {
23
- return keyring$1.addFromUri(secret);
24
- }
25
- try {
26
- const json = JSON.parse(secret);
27
- const {
28
- encoding: { content }
29
- } = json;
30
- const keyring2 = new keyring.Keyring({ type: content[1], ss58Format });
31
- return keyring2.addFromJson(json);
32
- } catch (e) {
33
- throw new common.ProsopoEnvError("GENERAL.MISSING_SECRET_KEY", {
34
- context: { error: e }
35
- });
36
- }
37
- } else if (typeof secret === "object") {
38
- return keyring$1.addFromJson(secret);
39
- } else {
40
- throw new common.ProsopoEnvError("GENERAL.MISSING_SECRET_KEY");
41
- }
8
+ pairType = pairType || "sr25519";
9
+ ss58Format = ss58Format || 42;
10
+ const keyring = new require_keyring.Keyring({
11
+ type: pairType,
12
+ ss58Format
13
+ });
14
+ if (!secret && account) return keyring.addFromAddress(account);
15
+ if (secret && typeof secret === "string") {
16
+ if ((0, _prosopo_util_crypto.mnemonicValidate)(secret)) return keyring.addFromMnemonic(secret);
17
+ if ((0, _polkadot_util_is.isHex)(secret)) return keyring.addFromSeed((0, _polkadot_util_hex.hexToU8a)(secret));
18
+ if (secret.includes("//")) return keyring.addFromUri(secret);
19
+ try {
20
+ const json = JSON.parse(secret);
21
+ const { encoding: { content } } = json;
22
+ return new require_keyring.Keyring({
23
+ type: content[1],
24
+ ss58Format
25
+ }).addFromJson(json);
26
+ } catch (e) {
27
+ throw new _prosopo_common.ProsopoEnvError("GENERAL.MISSING_SECRET_KEY", { context: { error: e } });
28
+ }
29
+ } else if (typeof secret === "object") return keyring.addFromJson(secret);
30
+ else throw new _prosopo_common.ProsopoEnvError("GENERAL.MISSING_SECRET_KEY");
42
31
  }
32
+ //#endregion
43
33
  exports.getPair = getPair;
@@ -1,10 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const mnemonic = require("./mnemonic.cjs");
4
- const getPair = require("./getPair.cjs");
5
- const testAccounts = require("./testAccounts.cjs");
6
- exports.generateMiniSecret = mnemonic.generateMiniSecret;
7
- exports.generateMnemonic = mnemonic.generateMnemonic;
8
- exports.getPair = getPair.getPair;
9
- exports.getDefaultProviders = testAccounts.getDefaultProviders;
10
- exports.getDefaultSiteKeys = testAccounts.getDefaultSiteKeys;
1
+ const require_mnemonic = require("./mnemonic.cjs");
2
+ const require_getPair = require("./getPair.cjs");
3
+ const require_testAccounts = require("./testAccounts.cjs");
4
+ exports.generateMiniSecret = require_mnemonic.generateMiniSecret;
5
+ exports.generateMnemonic = require_mnemonic.generateMnemonic;
6
+ exports.getDefaultProviders = require_testAccounts.getDefaultProviders;
7
+ exports.getDefaultSiteKeys = require_testAccounts.getDefaultSiteKeys;
8
+ exports.getPair = require_getPair.getPair;
@@ -1,18 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const utilCrypto = require("@prosopo/util-crypto");
4
- const keyring = require("../keyring/keyring.cjs");
5
- async function generateMnemonic(keyring$1, pairType) {
6
- if (!keyring$1) {
7
- keyring$1 = new keyring.Keyring({ type: pairType || "sr25519" });
8
- }
9
- const mnemonic = utilCrypto.mnemonicGenerate();
10
- const account = keyring$1.addFromMnemonic(mnemonic);
11
- return [mnemonic, account.address];
1
+ const require_keyring = require("../keyring/keyring.cjs");
2
+ let _prosopo_util_crypto = require("@prosopo/util-crypto");
3
+ //#region src/accounts/mnemonic.ts
4
+ /** Generate a mnemonic, returning the mnemonic and associated address
5
+ * @param keyring
6
+ * @param pairType
7
+ */
8
+ async function generateMnemonic(keyring, pairType) {
9
+ if (!keyring) keyring = new require_keyring.Keyring({ type: pairType || "sr25519" });
10
+ const mnemonic = (0, _prosopo_util_crypto.mnemonicGenerate)();
11
+ return [mnemonic, keyring.addFromMnemonic(mnemonic).address];
12
12
  }
13
- async function generateMiniSecret(keyring2, pairType) {
14
- const [mnemonic, address] = await generateMnemonic(keyring2, pairType);
15
- return [utilCrypto.mnemonicToMiniSecret(mnemonic), address];
13
+ /** Generate a secret, returning the secret and associated address
14
+ * @param keyring
15
+ * @param pairType
16
+ */
17
+ async function generateMiniSecret(keyring, pairType) {
18
+ const [mnemonic, address] = await generateMnemonic(keyring, pairType);
19
+ return [(0, _prosopo_util_crypto.mnemonicToMiniSecret)(mnemonic), address];
16
20
  }
21
+ //#endregion
17
22
  exports.generateMiniSecret = generateMiniSecret;
18
23
  exports.generateMnemonic = generateMnemonic;
@@ -1,47 +1,42 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const types = require("@prosopo/types");
4
- require("../keyring/index.cjs");
5
- const getPair = require("./getPair.cjs");
6
- const keyring = require("../keyring/keyring.cjs");
1
+ const require_keyring = require("../keyring/keyring.cjs");
2
+ const require_getPair = require("./getPair.cjs");
3
+ let _prosopo_types = require("@prosopo/types");
4
+ //#region src/accounts/testAccounts.ts
7
5
  function getDefaultSiteKeys() {
8
- const captchaTypes = [
9
- types.CaptchaType.image,
10
- types.CaptchaType.pow,
11
- types.CaptchaType.frictionless,
12
- types.CaptchaType.puzzle
13
- ];
14
- const sites = [];
15
- for (const captchaType of captchaTypes) {
16
- const secret = `${keyring.DEV_PHRASE}//${captchaType}`;
17
- const pair = getPair.getPair(secret);
18
- sites.push({
19
- pair,
20
- address: pair.address,
21
- secret,
22
- settings: types.ClientSettingsSchema.parse({
23
- captchaType,
24
- domains: ["localhost"],
25
- imageMaxRounds: 2,
26
- frictionlessThreshold: 0.8
27
- })
28
- });
29
- }
30
- return sites;
6
+ const captchaTypes = [
7
+ _prosopo_types.CaptchaType.image,
8
+ _prosopo_types.CaptchaType.pow,
9
+ _prosopo_types.CaptchaType.frictionless,
10
+ _prosopo_types.CaptchaType.puzzle
11
+ ];
12
+ const sites = [];
13
+ for (const captchaType of captchaTypes) {
14
+ const secret = `${require_keyring.DEV_PHRASE}//${captchaType}`;
15
+ const pair = require_getPair.getPair(secret);
16
+ sites.push({
17
+ pair,
18
+ address: pair.address,
19
+ secret,
20
+ settings: _prosopo_types.ClientSettingsSchema.parse({
21
+ captchaType,
22
+ domains: ["localhost"],
23
+ imageMaxRounds: 2,
24
+ frictionlessThreshold: .8
25
+ })
26
+ });
27
+ }
28
+ return sites;
31
29
  }
32
30
  function getDefaultProviders() {
33
- const pair = getPair.getPair(
34
- "puppy cream effort carbon despair leg pyramid cotton endorse immense drill peasant"
35
- );
36
- return [
37
- {
38
- url: "https://localhost:9229",
39
- pair,
40
- address: pair.address,
41
- datasetFile: "./dev/data/captchas.json",
42
- captchaDatasetId: "0x3e067b8f6aeae82fdbe2b2557b9c2d90aaabff241df651bf0f36667d2ab0018d"
43
- }
44
- ];
31
+ const pair = require_getPair.getPair("puppy cream effort carbon despair leg pyramid cotton endorse immense drill peasant");
32
+ return [{
33
+ url: "https://localhost:9229",
34
+ pair,
35
+ address: pair.address,
36
+ datasetFile: "./dev/data/captchas.json",
37
+ captchaDatasetId: "0x3e067b8f6aeae82fdbe2b2557b9c2d90aaabff241df651bf0f36667d2ab0018d"
38
+ }];
45
39
  }
40
+ //#endregion
46
41
  exports.getDefaultProviders = getDefaultProviders;
47
42
  exports.getDefaultSiteKeys = getDefaultSiteKeys;