@prosopo/types 2.0.1 → 2.0.2
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/api.d.ts +1 -1
- package/dist/api/api.d.ts.map +1 -1
- package/dist/api/params.d.ts.map +1 -1
- package/dist/api/params.js.map +1 -1
- package/dist/cjs/config/config.cjs +0 -4
- package/dist/cjs/config/index.cjs +0 -3
- package/dist/cjs/config/network.cjs +0 -27
- package/dist/cjs/datasets/captcha.cjs +2 -0
- package/dist/cjs/datasets/index.cjs +1 -0
- package/dist/cjs/dist/config/config.cjs +0 -4
- package/dist/cjs/dist/config/index.cjs +0 -3
- package/dist/cjs/dist/config/network.cjs +0 -24
- package/dist/cjs/dist/datasets/captcha.cjs +2 -0
- package/dist/cjs/dist/datasets/index.cjs +1 -0
- package/dist/cjs/dist/index.cjs +2 -4
- package/dist/cjs/dist/procaptcha/index.cjs +3 -0
- package/dist/cjs/dist/procaptcha/token.cjs +33 -11
- package/dist/cjs/dist/provider/api.cjs +4 -9
- package/dist/cjs/dist/provider/scheduler.cjs +1 -0
- package/dist/cjs/index.cjs +6 -7
- package/dist/cjs/procaptcha/index.cjs +3 -0
- package/dist/cjs/procaptcha/token.cjs +33 -11
- package/dist/cjs/provider/api.cjs +4 -9
- package/dist/cjs/provider/scheduler.cjs +1 -0
- package/dist/config/config.d.ts +4 -350
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +0 -4
- package/dist/config/config.js.map +1 -1
- package/dist/config/network.d.ts +0 -82
- package/dist/config/network.d.ts.map +1 -1
- package/dist/config/network.js +1 -22
- package/dist/config/network.js.map +1 -1
- package/dist/datasets/captcha.d.ts +17 -31
- package/dist/datasets/captcha.d.ts.map +1 -1
- package/dist/datasets/captcha.js +2 -1
- package/dist/datasets/captcha.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/procaptcha/api.d.ts +1 -4
- package/dist/procaptcha/api.d.ts.map +1 -1
- package/dist/procaptcha/manager.d.ts +0 -1
- package/dist/procaptcha/manager.d.ts.map +1 -1
- package/dist/procaptcha/token.d.ts +87 -29
- package/dist/procaptcha/token.d.ts.map +1 -1
- package/dist/procaptcha/token.js +29 -10
- package/dist/procaptcha/token.js.map +1 -1
- package/dist/provider/api.d.ts +19 -27
- package/dist/provider/api.d.ts.map +1 -1
- package/dist/provider/api.js +4 -9
- package/dist/provider/api.js.map +1 -1
- package/dist/provider/scheduler.d.ts +2 -1
- package/dist/provider/scheduler.d.ts.map +1 -1
- package/dist/provider/scheduler.js +1 -0
- package/dist/provider/scheduler.js.map +1 -1
- package/package.json +50 -50
- package/dist/cjs/config/enumMap.cjs +0 -8
- package/dist/cjs/dist/config/enumMap.cjs +0 -8
- package/dist/cjs/dist/networks/index.cjs +0 -52
- package/dist/cjs/networks/index.cjs +0 -58
- package/dist/networks/index.d.ts +0 -4
- package/dist/networks/index.d.ts.map +0 -1
- package/dist/networks/index.js +0 -61
- package/dist/networks/index.js.map +0 -1
package/dist/api/api.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { StoredEvents } from "../procaptcha/index.js";
|
|
|
3
3
|
import type { CaptchaResponseBody, CaptchaSolutionResponse, GetPowCaptchaResponse, ImageVerificationResponse, PowCaptchaSolutionResponse, Provider, ProviderRegistered, RandomProvider } from "../provider/index.js";
|
|
4
4
|
export interface ProviderApiInterface {
|
|
5
5
|
getCaptchaChallenge(userAccount: string, randomProvider: RandomProvider): Promise<CaptchaResponseBody>;
|
|
6
|
-
submitCaptchaSolution(captchas: CaptchaSolution[], requestHash: string, userAccount: string,
|
|
6
|
+
submitCaptchaSolution(captchas: CaptchaSolution[], requestHash: string, userAccount: string, timestamp: string, providerRequestHashSignature: string, userRequestHashSignature: string): Promise<CaptchaSolutionResponse>;
|
|
7
7
|
verifyDappUser(dapp: string, userAccount: string, blockNumber: number, dappUserSignature: string, commitmentId?: string, maxVerifiedTime?: number): Promise<ImageVerificationResponse>;
|
|
8
8
|
verifyUser(dapp: string, userAccount: string, blockNumber: number, dappUserSignature: string, commitmentId?: string, maxVerifiedTime?: number): Promise<ImageVerificationResponse>;
|
|
9
9
|
getPowCaptchaChallenge(userAccount: string, dappAccount: string): Promise<GetPowCaptchaResponse>;
|
package/dist/api/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,oBAAoB;IACnC,mBAAmB,CACjB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,qBAAqB,CACnB,QAAQ,EAAE,eAAe,EAAE,EAC3B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,oBAAoB;IACnC,mBAAmB,CACjB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,qBAAqB,CACnB,QAAQ,EAAE,eAAe,EAAE,EAC3B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,4BAA4B,EAAE,MAAM,EACpC,wBAAwB,EAAE,MAAM,GAC/B,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACpC,cAAc,CACZ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,MAAM,EACzB,YAAY,CAAC,EAAE,MAAM,EACrB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtC,UAAU,CACR,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,MAAM,EACzB,YAAY,CAAC,EAAE,MAAM,EACrB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtC,sBAAsB,CACpB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAClC,wBAAwB,CACtB,SAAS,EAAE,qBAAqB,EAChC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,sBAAsB,EAAE,MAAM,EAC9B,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACvC,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzE,iBAAiB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjD,kBAAkB,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;CACzC"}
|
package/dist/api/params.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../src/api/params.ts"],"names":[],"mappings":"AAaA,oBAAY,SAAS;
|
|
1
|
+
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../src/api/params.ts"],"names":[],"mappings":"AAaA,oBAAY,SAAS;IACnB,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,KAAK,UAAU;IACf,aAAa,kBAAkB;IAC/B,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,kBAAkB,wBAAwB;IAC1C,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB"}
|
package/dist/api/params.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.js","sourceRoot":"","sources":["../../src/api/params.ts"],"names":[],"mappings":"AAaA,MAAM,CAAN,IAAY,SA0BX;AA1BD,WAAY,SAAS;
|
|
1
|
+
{"version":3,"file":"params.js","sourceRoot":"","sources":["../../src/api/params.ts"],"names":[],"mappings":"AAaA,MAAM,CAAN,IAAY,SA0BX;AA1BD,WAAY,SAAS;IACnB,oCAAuB,CAAA;IACvB,0BAAa,CAAA;IACb,0BAAa,CAAA;IACb,kCAAqB,CAAA;IACrB,wCAA2B,CAAA;IAC3B,wCAA2B,CAAA;IAC3B,kCAAqB,CAAA;IACrB,0CAA6B,CAAA;IAC7B,4BAAe,CAAA;IACf,4CAA+B,CAAA;IAC/B,oDAAuC,CAAA;IACvC,wCAA2B,CAAA;IAC3B,uDAA0C,CAAA;IAC1C,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,oCAAuB,CAAA;IACvB,sCAAyB,CAAA;IACzB,4BAAe,CAAA;IACf,kCAAqB,CAAA;IACrB,4BAAe,CAAA;IACf,8BAAiB,CAAA;IACjB,oCAAuB,CAAA;IACvB,oCAAuB,CAAA;AACzB,CAAC,EA1BW,SAAS,KAAT,SAAS,QA0BpB"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const z = require("zod");
|
|
4
|
-
const index = require("../networks/index.cjs");
|
|
5
4
|
require("../provider/index.cjs");
|
|
6
|
-
const network = require("./network.cjs");
|
|
7
5
|
const timeouts = require("./timeouts.cjs");
|
|
8
6
|
const api = require("../provider/api.cjs");
|
|
9
7
|
const LogLevel = z.enum([
|
|
@@ -39,7 +37,6 @@ const ProsopoBaseConfigSchema = z.object({
|
|
|
39
37
|
defaultEnvironment: EnvironmentTypesSchema.default(
|
|
40
38
|
EnvironmentTypesSchema.Values.production
|
|
41
39
|
),
|
|
42
|
-
defaultNetwork: network.NetworkNamesSchema.default(network.NetworkNamesSchema.Values.astar),
|
|
43
40
|
// The account with which to query the contract.merge sign transactions
|
|
44
41
|
account: z.object({
|
|
45
42
|
address: z.string().optional(),
|
|
@@ -63,7 +60,6 @@ const PolkadotSecretJSONSpec = z.object({
|
|
|
63
60
|
});
|
|
64
61
|
const ProsopoBasicConfigSchema = ProsopoBaseConfigSchema.merge(
|
|
65
62
|
z.object({
|
|
66
|
-
networks: network.ProsopoNetworkSchema.default(index),
|
|
67
63
|
database: DatabaseConfigSchema.optional(),
|
|
68
64
|
devOnlyWatchEvents: z.boolean().optional()
|
|
69
65
|
})
|
|
@@ -19,10 +19,7 @@ exports.ProsopoClientConfigSchema = config.ProsopoClientConfigSchema;
|
|
|
19
19
|
exports.ProsopoConfigSchema = config.ProsopoConfigSchema;
|
|
20
20
|
exports.ProsopoImageServerConfigSchema = config.ProsopoImageServerConfigSchema;
|
|
21
21
|
exports.ProsopoServerConfigSchema = config.ProsopoServerConfigSchema;
|
|
22
|
-
exports.NetworkConfigSchema = network.NetworkConfigSchema;
|
|
23
|
-
exports.NetworkNamesSchema = network.NetworkNamesSchema;
|
|
24
22
|
exports.NetworkPairTypeSchema = network.NetworkPairTypeSchema;
|
|
25
|
-
exports.ProsopoNetworkSchema = network.ProsopoNetworkSchema;
|
|
26
23
|
exports.DEFAULT_IMAGE_CAPTCHA_SOLUTION_TIMEOUT = timeouts.DEFAULT_IMAGE_CAPTCHA_SOLUTION_TIMEOUT;
|
|
27
24
|
exports.DEFAULT_IMAGE_CAPTCHA_TIMEOUT = timeouts.DEFAULT_IMAGE_CAPTCHA_TIMEOUT;
|
|
28
25
|
exports.DEFAULT_IMAGE_CAPTCHA_VERIFIED_TIMEOUT = timeouts.DEFAULT_IMAGE_CAPTCHA_VERIFIED_TIMEOUT;
|
|
@@ -1,37 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const z = require("zod");
|
|
4
|
-
const enumMap = require("./enumMap.cjs");
|
|
5
|
-
const NetworkNamesSchema = z.enum([
|
|
6
|
-
"development",
|
|
7
|
-
"rococo",
|
|
8
|
-
"shiden",
|
|
9
|
-
"astar"
|
|
10
|
-
]);
|
|
11
4
|
const NetworkPairTypeSchema = z.union([
|
|
12
5
|
z.literal("sr25519"),
|
|
13
6
|
z.literal("ed25519"),
|
|
14
7
|
z.literal("ecdsa"),
|
|
15
8
|
z.literal("ethereum")
|
|
16
9
|
]);
|
|
17
|
-
const NetworkConfigSchema = z.object({
|
|
18
|
-
endpoint: z.array(z.string().url()),
|
|
19
|
-
contract: z.object({
|
|
20
|
-
address: z.string(),
|
|
21
|
-
name: z.string()
|
|
22
|
-
}),
|
|
23
|
-
pairType: NetworkPairTypeSchema,
|
|
24
|
-
ss58Format: z.number().positive().default(42)
|
|
25
|
-
});
|
|
26
|
-
const ProsopoNetworkSchema = enumMap.enumMap(
|
|
27
|
-
NetworkNamesSchema,
|
|
28
|
-
NetworkConfigSchema.required({
|
|
29
|
-
endpoint: true,
|
|
30
|
-
pairType: true,
|
|
31
|
-
ss58Format: true
|
|
32
|
-
})
|
|
33
|
-
);
|
|
34
|
-
exports.NetworkConfigSchema = NetworkConfigSchema;
|
|
35
|
-
exports.NetworkNamesSchema = NetworkNamesSchema;
|
|
36
10
|
exports.NetworkPairTypeSchema = NetworkPairTypeSchema;
|
|
37
|
-
exports.ProsopoNetworkSchema = ProsopoNetworkSchema;
|
|
@@ -32,6 +32,7 @@ var DappPayee = /* @__PURE__ */ ((DappPayee2) => {
|
|
|
32
32
|
DappPayee2["any"] = "Any";
|
|
33
33
|
return DappPayee2;
|
|
34
34
|
})(DappPayee || {});
|
|
35
|
+
const TimestampSchema = z.number();
|
|
35
36
|
const POW_SEPARATOR = "___";
|
|
36
37
|
const PowChallengeIdSchema = z.custom((val) => {
|
|
37
38
|
const valSplit = val.split(POW_SEPARATOR);
|
|
@@ -124,3 +125,4 @@ exports.PowChallengeIdSchema = PowChallengeIdSchema;
|
|
|
124
125
|
exports.SelectAllCaptchaSchema = SelectAllCaptchaSchema;
|
|
125
126
|
exports.SelectAllCaptchaSchemaRaw = SelectAllCaptchaSchemaRaw;
|
|
126
127
|
exports.SelectAllCaptchaSchemaWithNumericSolution = SelectAllCaptchaSchemaWithNumericSolution;
|
|
128
|
+
exports.TimestampSchema = TimestampSchema;
|
|
@@ -28,6 +28,7 @@ exports.PowChallengeIdSchema = captcha.PowChallengeIdSchema;
|
|
|
28
28
|
exports.SelectAllCaptchaSchema = captcha.SelectAllCaptchaSchema;
|
|
29
29
|
exports.SelectAllCaptchaSchemaRaw = captcha.SelectAllCaptchaSchemaRaw;
|
|
30
30
|
exports.SelectAllCaptchaSchemaWithNumericSolution = captcha.SelectAllCaptchaSchemaWithNumericSolution;
|
|
31
|
+
exports.TimestampSchema = captcha.TimestampSchema;
|
|
31
32
|
exports.DatasetSchema = dataset.DatasetSchema;
|
|
32
33
|
exports.DatasetWithIdsAndTreeSchema = dataset.DatasetWithIdsAndTreeSchema;
|
|
33
34
|
exports.DatasetWithIdsSchema = dataset.DatasetWithIdsSchema;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const z = require("zod");
|
|
4
|
-
const index = require("../networks/index.cjs");
|
|
5
4
|
require("../provider/index.cjs");
|
|
6
|
-
const network = require("./network.cjs");
|
|
7
5
|
const timeouts = require("./timeouts.cjs");
|
|
8
6
|
const api = require("../provider/api.cjs");
|
|
9
7
|
const LogLevel = z.enum([
|
|
@@ -34,7 +32,6 @@ const BatchCommitConfigSchema = z.object({
|
|
|
34
32
|
const ProsopoBaseConfigSchema = z.object({
|
|
35
33
|
logLevel: LogLevel.optional().default(LogLevel.enum.info),
|
|
36
34
|
defaultEnvironment: EnvironmentTypesSchema.default(EnvironmentTypesSchema.Values.production),
|
|
37
|
-
defaultNetwork: network.NetworkNamesSchema.default(network.NetworkNamesSchema.Values.astar),
|
|
38
35
|
account: z.object({
|
|
39
36
|
address: z.string().optional(),
|
|
40
37
|
secret: z.string().optional(),
|
|
@@ -56,7 +53,6 @@ const PolkadotSecretJSONSpec = z.object({
|
|
|
56
53
|
})
|
|
57
54
|
});
|
|
58
55
|
const ProsopoBasicConfigSchema = ProsopoBaseConfigSchema.merge(z.object({
|
|
59
|
-
networks: network.ProsopoNetworkSchema.default(index),
|
|
60
56
|
database: DatabaseConfigSchema.optional(),
|
|
61
57
|
devOnlyWatchEvents: z.boolean().optional()
|
|
62
58
|
}));
|
|
@@ -19,10 +19,7 @@ exports.ProsopoClientConfigSchema = config.ProsopoClientConfigSchema;
|
|
|
19
19
|
exports.ProsopoConfigSchema = config.ProsopoConfigSchema;
|
|
20
20
|
exports.ProsopoImageServerConfigSchema = config.ProsopoImageServerConfigSchema;
|
|
21
21
|
exports.ProsopoServerConfigSchema = config.ProsopoServerConfigSchema;
|
|
22
|
-
exports.NetworkConfigSchema = network.NetworkConfigSchema;
|
|
23
|
-
exports.NetworkNamesSchema = network.NetworkNamesSchema;
|
|
24
22
|
exports.NetworkPairTypeSchema = network.NetworkPairTypeSchema;
|
|
25
|
-
exports.ProsopoNetworkSchema = network.ProsopoNetworkSchema;
|
|
26
23
|
exports.DEFAULT_IMAGE_CAPTCHA_SOLUTION_TIMEOUT = timeouts.DEFAULT_IMAGE_CAPTCHA_SOLUTION_TIMEOUT;
|
|
27
24
|
exports.DEFAULT_IMAGE_CAPTCHA_TIMEOUT = timeouts.DEFAULT_IMAGE_CAPTCHA_TIMEOUT;
|
|
28
25
|
exports.DEFAULT_IMAGE_CAPTCHA_VERIFIED_TIMEOUT = timeouts.DEFAULT_IMAGE_CAPTCHA_VERIFIED_TIMEOUT;
|
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const z = require("zod");
|
|
4
|
-
const enumMap = require("./enumMap.cjs");
|
|
5
|
-
const NetworkNamesSchema = z.enum([
|
|
6
|
-
"development",
|
|
7
|
-
"rococo",
|
|
8
|
-
"shiden",
|
|
9
|
-
"astar"
|
|
10
|
-
]);
|
|
11
4
|
const NetworkPairTypeSchema = z.union([
|
|
12
5
|
z.literal("sr25519"),
|
|
13
6
|
z.literal("ed25519"),
|
|
14
7
|
z.literal("ecdsa"),
|
|
15
8
|
z.literal("ethereum")
|
|
16
9
|
]);
|
|
17
|
-
const NetworkConfigSchema = z.object({
|
|
18
|
-
endpoint: z.array(z.string().url()),
|
|
19
|
-
contract: z.object({
|
|
20
|
-
address: z.string(),
|
|
21
|
-
name: z.string()
|
|
22
|
-
}),
|
|
23
|
-
pairType: NetworkPairTypeSchema,
|
|
24
|
-
ss58Format: z.number().positive().default(42)
|
|
25
|
-
});
|
|
26
|
-
const ProsopoNetworkSchema = enumMap.enumMap(NetworkNamesSchema, NetworkConfigSchema.required({
|
|
27
|
-
endpoint: true,
|
|
28
|
-
pairType: true,
|
|
29
|
-
ss58Format: true
|
|
30
|
-
}));
|
|
31
|
-
exports.NetworkConfigSchema = NetworkConfigSchema;
|
|
32
|
-
exports.NetworkNamesSchema = NetworkNamesSchema;
|
|
33
10
|
exports.NetworkPairTypeSchema = NetworkPairTypeSchema;
|
|
34
|
-
exports.ProsopoNetworkSchema = ProsopoNetworkSchema;
|
|
@@ -32,6 +32,7 @@ exports.DappPayee = void 0;
|
|
|
32
32
|
DappPayee["dapp"] = "Dapp";
|
|
33
33
|
DappPayee["any"] = "Any";
|
|
34
34
|
})(exports.DappPayee || (exports.DappPayee = {}));
|
|
35
|
+
const TimestampSchema = z.number();
|
|
35
36
|
const POW_SEPARATOR = "___";
|
|
36
37
|
const PowChallengeIdSchema = z.custom((val) => {
|
|
37
38
|
const valSplit = val.split(POW_SEPARATOR);
|
|
@@ -116,3 +117,4 @@ exports.PowChallengeIdSchema = PowChallengeIdSchema;
|
|
|
116
117
|
exports.SelectAllCaptchaSchema = SelectAllCaptchaSchema;
|
|
117
118
|
exports.SelectAllCaptchaSchemaRaw = SelectAllCaptchaSchemaRaw;
|
|
118
119
|
exports.SelectAllCaptchaSchemaWithNumericSolution = SelectAllCaptchaSchemaWithNumericSolution;
|
|
120
|
+
exports.TimestampSchema = TimestampSchema;
|
|
@@ -46,6 +46,7 @@ exports.PowChallengeIdSchema = captcha.PowChallengeIdSchema;
|
|
|
46
46
|
exports.SelectAllCaptchaSchema = captcha.SelectAllCaptchaSchema;
|
|
47
47
|
exports.SelectAllCaptchaSchemaRaw = captcha.SelectAllCaptchaSchemaRaw;
|
|
48
48
|
exports.SelectAllCaptchaSchemaWithNumericSolution = captcha.SelectAllCaptchaSchemaWithNumericSolution;
|
|
49
|
+
exports.TimestampSchema = captcha.TimestampSchema;
|
|
49
50
|
exports.DatasetSchema = dataset.DatasetSchema;
|
|
50
51
|
exports.DatasetWithIdsAndTreeSchema = dataset.DatasetWithIdsAndTreeSchema;
|
|
51
52
|
exports.DatasetWithIdsSchema = dataset.DatasetWithIdsSchema;
|
package/dist/cjs/dist/index.cjs
CHANGED
|
@@ -6,11 +6,9 @@ require("./contract/index.cjs");
|
|
|
6
6
|
require("./datasets/index.cjs");
|
|
7
7
|
require("./provider/index.cjs");
|
|
8
8
|
require("./procaptcha/index.cjs");
|
|
9
|
-
const index
|
|
9
|
+
const index = require("./procaptcha-bundle/index.cjs");
|
|
10
10
|
require("./procaptcha-frictionless/index.cjs");
|
|
11
|
-
const index = require("./networks/index.cjs");
|
|
12
11
|
Object.defineProperty(exports, "FeaturesEnum", {
|
|
13
12
|
enumerable: true,
|
|
14
|
-
get: () => index
|
|
13
|
+
get: () => index.FeaturesEnum
|
|
15
14
|
});
|
|
16
|
-
exports.networks = index;
|
|
@@ -10,8 +10,11 @@ const token = require("./token.cjs");
|
|
|
10
10
|
require("./utils.cjs");
|
|
11
11
|
exports.ProcaptchaResponse = manager.ProcaptchaResponse;
|
|
12
12
|
exports.ProsopoLocalStorageSchema = storage.ProsopoLocalStorageSchema;
|
|
13
|
+
exports.ChallengeSignatureSchema = token.ChallengeSignatureSchema;
|
|
13
14
|
exports.ProcaptchaOutputSchema = token.ProcaptchaOutputSchema;
|
|
14
15
|
exports.ProcaptchaTokenCodec = token.ProcaptchaTokenCodec;
|
|
15
16
|
exports.ProcaptchaTokenSpec = token.ProcaptchaTokenSpec;
|
|
17
|
+
exports.RequestHashSignatureSchema = token.RequestHashSignatureSchema;
|
|
18
|
+
exports.SignatureTypesSchema = token.SignatureTypesSchema;
|
|
16
19
|
exports.decodeProcaptchaOutput = token.decodeProcaptchaOutput;
|
|
17
20
|
exports.encodeProcaptchaOutput = token.encodeProcaptchaOutput;
|
|
@@ -4,22 +4,28 @@ const util = require("@polkadot/util");
|
|
|
4
4
|
const scaleTs = require("scale-ts");
|
|
5
5
|
const z = require("zod");
|
|
6
6
|
const params = require("../api/params.cjs");
|
|
7
|
+
const RequestHashSignatureSchema = z.object({
|
|
8
|
+
[params.ApiParams.requestHash]: z.string()
|
|
9
|
+
});
|
|
10
|
+
const ChallengeSignatureSchema = z.object({
|
|
11
|
+
[params.ApiParams.challenge]: z.string()
|
|
12
|
+
});
|
|
13
|
+
const SignatureTypesSchema = z.object({
|
|
14
|
+
[params.ApiParams.challenge]: z.string().optional(),
|
|
15
|
+
[params.ApiParams.requestHash]: z.string().optional(),
|
|
16
|
+
[params.ApiParams.timestamp]: z.string().optional()
|
|
17
|
+
});
|
|
7
18
|
const ProcaptchaOutputSchema = z.object({
|
|
8
19
|
[params.ApiParams.commitmentId]: z.string().optional(),
|
|
9
20
|
[params.ApiParams.providerUrl]: z.string().optional(),
|
|
10
21
|
[params.ApiParams.dapp]: z.string(),
|
|
11
22
|
[params.ApiParams.user]: z.string(),
|
|
12
|
-
[params.ApiParams.blockNumber]: z.number(),
|
|
13
23
|
[params.ApiParams.challenge]: z.string().optional(),
|
|
14
24
|
[params.ApiParams.nonce]: z.number().optional(),
|
|
15
25
|
[params.ApiParams.timestamp]: z.string(),
|
|
16
26
|
[params.ApiParams.signature]: z.object({
|
|
17
|
-
[params.ApiParams.provider]:
|
|
18
|
-
|
|
19
|
-
}),
|
|
20
|
-
[params.ApiParams.user]: z.object({
|
|
21
|
-
[params.ApiParams.timestamp]: z.string()
|
|
22
|
-
}).optional()
|
|
27
|
+
[params.ApiParams.provider]: SignatureTypesSchema,
|
|
28
|
+
[params.ApiParams.user]: SignatureTypesSchema
|
|
23
29
|
})
|
|
24
30
|
});
|
|
25
31
|
const ProcaptchaTokenCodec = scaleTs.Struct({
|
|
@@ -27,32 +33,48 @@ const ProcaptchaTokenCodec = scaleTs.Struct({
|
|
|
27
33
|
[params.ApiParams.providerUrl]: scaleTs.Option(scaleTs.str),
|
|
28
34
|
[params.ApiParams.dapp]: scaleTs.str,
|
|
29
35
|
[params.ApiParams.user]: scaleTs.str,
|
|
30
|
-
[params.ApiParams.blockNumber]: scaleTs.u32,
|
|
31
36
|
[params.ApiParams.challenge]: scaleTs.Option(scaleTs.str),
|
|
32
37
|
[params.ApiParams.nonce]: scaleTs.Option(scaleTs.u32),
|
|
33
38
|
[params.ApiParams.timestamp]: scaleTs.str,
|
|
34
39
|
[params.ApiParams.signature]: scaleTs.Struct({
|
|
35
40
|
[params.ApiParams.provider]: scaleTs.Struct({
|
|
36
|
-
[params.ApiParams.
|
|
41
|
+
[params.ApiParams.challenge]: scaleTs.Option(scaleTs.str),
|
|
42
|
+
[params.ApiParams.requestHash]: scaleTs.Option(scaleTs.str)
|
|
43
|
+
}),
|
|
44
|
+
[params.ApiParams.user]: scaleTs.Struct({
|
|
45
|
+
[params.ApiParams.timestamp]: scaleTs.Option(scaleTs.str),
|
|
46
|
+
[params.ApiParams.requestHash]: scaleTs.Option(scaleTs.str)
|
|
37
47
|
})
|
|
38
48
|
})
|
|
39
49
|
});
|
|
40
50
|
const ProcaptchaTokenSpec = z.string().startsWith("0x");
|
|
41
51
|
const encodeProcaptchaOutput = (procaptchaOutput) => {
|
|
42
|
-
console.log("encoding", procaptchaOutput);
|
|
43
52
|
return util.u8aToHex(ProcaptchaTokenCodec.enc({
|
|
44
53
|
[params.ApiParams.commitmentId]: void 0,
|
|
45
54
|
[params.ApiParams.providerUrl]: void 0,
|
|
46
55
|
[params.ApiParams.challenge]: void 0,
|
|
47
56
|
[params.ApiParams.nonce]: void 0,
|
|
48
|
-
...procaptchaOutput
|
|
57
|
+
...procaptchaOutput,
|
|
58
|
+
signature: {
|
|
59
|
+
provider: {
|
|
60
|
+
challenge: procaptchaOutput.signature.provider?.challenge || void 0,
|
|
61
|
+
requestHash: procaptchaOutput.signature.provider?.requestHash || void 0
|
|
62
|
+
},
|
|
63
|
+
user: {
|
|
64
|
+
timestamp: procaptchaOutput.signature.user?.timestamp || void 0,
|
|
65
|
+
requestHash: procaptchaOutput.signature.user?.requestHash || void 0
|
|
66
|
+
}
|
|
67
|
+
}
|
|
49
68
|
}));
|
|
50
69
|
};
|
|
51
70
|
const decodeProcaptchaOutput = (procaptchaToken) => {
|
|
52
71
|
return ProcaptchaOutputSchema.parse(ProcaptchaTokenCodec.dec(util.hexToU8a(procaptchaToken)));
|
|
53
72
|
};
|
|
73
|
+
exports.ChallengeSignatureSchema = ChallengeSignatureSchema;
|
|
54
74
|
exports.ProcaptchaOutputSchema = ProcaptchaOutputSchema;
|
|
55
75
|
exports.ProcaptchaTokenCodec = ProcaptchaTokenCodec;
|
|
56
76
|
exports.ProcaptchaTokenSpec = ProcaptchaTokenSpec;
|
|
77
|
+
exports.RequestHashSignatureSchema = RequestHashSignatureSchema;
|
|
78
|
+
exports.SignatureTypesSchema = SignatureTypesSchema;
|
|
57
79
|
exports.decodeProcaptchaOutput = decodeProcaptchaOutput;
|
|
58
80
|
exports.encodeProcaptchaOutput = encodeProcaptchaOutput;
|
|
@@ -55,8 +55,7 @@ const ApiPathRateLimits = createRateLimitSchemaWithDefaults(ProviderDefaultRateL
|
|
|
55
55
|
const CaptchaRequestBody = z.object({
|
|
56
56
|
[params.ApiParams.user]: z.string(),
|
|
57
57
|
[params.ApiParams.dapp]: z.string(),
|
|
58
|
-
[params.ApiParams.datasetId]: z.string()
|
|
59
|
-
[params.ApiParams.blockNumber]: z.string()
|
|
58
|
+
[params.ApiParams.datasetId]: z.string()
|
|
60
59
|
});
|
|
61
60
|
const CaptchaSolutionBody = z.object({
|
|
62
61
|
[params.ApiParams.user]: z.string(),
|
|
@@ -65,17 +64,13 @@ const CaptchaSolutionBody = z.object({
|
|
|
65
64
|
[params.ApiParams.requestHash]: z.string(),
|
|
66
65
|
[params.ApiParams.timestamp]: z.string(),
|
|
67
66
|
[params.ApiParams.signature]: z.object({
|
|
68
|
-
[params.ApiParams.user]:
|
|
69
|
-
|
|
70
|
-
}),
|
|
71
|
-
[params.ApiParams.provider]: z.object({
|
|
72
|
-
[params.ApiParams.timestamp]: z.string()
|
|
73
|
-
})
|
|
67
|
+
[params.ApiParams.user]: token.RequestHashSignatureSchema,
|
|
68
|
+
[params.ApiParams.provider]: token.RequestHashSignatureSchema
|
|
74
69
|
})
|
|
75
70
|
});
|
|
76
71
|
const VerifySolutionBody = z.object({
|
|
77
72
|
[params.ApiParams.token]: token.ProcaptchaTokenSpec,
|
|
78
|
-
[params.ApiParams.
|
|
73
|
+
[params.ApiParams.dappSignature]: z.string(),
|
|
79
74
|
[params.ApiParams.maxVerifiedTime]: z.number().optional().default(timeouts.DEFAULT_IMAGE_MAX_VERIFIED_TIME_CACHED)
|
|
80
75
|
});
|
|
81
76
|
const ServerPowCaptchaVerifyRequestBody = z.object({
|
|
@@ -4,6 +4,7 @@ exports.ScheduledTaskNames = void 0;
|
|
|
4
4
|
(function(ScheduledTaskNames) {
|
|
5
5
|
ScheduledTaskNames["BatchCommitment"] = "BatchCommitment";
|
|
6
6
|
ScheduledTaskNames["CalculateSolution"] = "CalculateSolution";
|
|
7
|
+
ScheduledTaskNames["StoreCommitmentsExternal"] = "StoreCommitmentsExternal";
|
|
7
8
|
})(exports.ScheduledTaskNames || (exports.ScheduledTaskNames = {}));
|
|
8
9
|
exports.ScheduledTaskStatus = void 0;
|
|
9
10
|
(function(ScheduledTaskStatus) {
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -6,9 +6,8 @@ require("./contract/index.cjs");
|
|
|
6
6
|
require("./datasets/index.cjs");
|
|
7
7
|
require("./provider/index.cjs");
|
|
8
8
|
require("./procaptcha/index.cjs");
|
|
9
|
-
const index
|
|
9
|
+
const index = require("./procaptcha-bundle/index.cjs");
|
|
10
10
|
require("./procaptcha-frictionless/index.cjs");
|
|
11
|
-
const index = require("./networks/index.cjs");
|
|
12
11
|
const params = require("./api/params.cjs");
|
|
13
12
|
const config = require("./config/config.cjs");
|
|
14
13
|
const network = require("./config/network.cjs");
|
|
@@ -23,8 +22,7 @@ const argv = require("./provider/argv.cjs");
|
|
|
23
22
|
const manager = require("./procaptcha/manager.cjs");
|
|
24
23
|
const storage = require("./procaptcha/storage.cjs");
|
|
25
24
|
const token = require("./procaptcha/token.cjs");
|
|
26
|
-
exports.FeaturesEnum = index
|
|
27
|
-
exports.networks = index;
|
|
25
|
+
exports.FeaturesEnum = index.FeaturesEnum;
|
|
28
26
|
exports.ApiParams = params.ApiParams;
|
|
29
27
|
exports.AccountCreatorConfigSchema = config.AccountCreatorConfigSchema;
|
|
30
28
|
exports.BatchCommitConfigSchema = config.BatchCommitConfigSchema;
|
|
@@ -42,10 +40,7 @@ exports.ProsopoClientConfigSchema = config.ProsopoClientConfigSchema;
|
|
|
42
40
|
exports.ProsopoConfigSchema = config.ProsopoConfigSchema;
|
|
43
41
|
exports.ProsopoImageServerConfigSchema = config.ProsopoImageServerConfigSchema;
|
|
44
42
|
exports.ProsopoServerConfigSchema = config.ProsopoServerConfigSchema;
|
|
45
|
-
exports.NetworkConfigSchema = network.NetworkConfigSchema;
|
|
46
|
-
exports.NetworkNamesSchema = network.NetworkNamesSchema;
|
|
47
43
|
exports.NetworkPairTypeSchema = network.NetworkPairTypeSchema;
|
|
48
|
-
exports.ProsopoNetworkSchema = network.ProsopoNetworkSchema;
|
|
49
44
|
exports.DEFAULT_IMAGE_CAPTCHA_SOLUTION_TIMEOUT = timeouts.DEFAULT_IMAGE_CAPTCHA_SOLUTION_TIMEOUT;
|
|
50
45
|
exports.DEFAULT_IMAGE_CAPTCHA_TIMEOUT = timeouts.DEFAULT_IMAGE_CAPTCHA_TIMEOUT;
|
|
51
46
|
exports.DEFAULT_IMAGE_CAPTCHA_VERIFIED_TIMEOUT = timeouts.DEFAULT_IMAGE_CAPTCHA_VERIFIED_TIMEOUT;
|
|
@@ -93,6 +88,7 @@ exports.PowChallengeIdSchema = captcha.PowChallengeIdSchema;
|
|
|
93
88
|
exports.SelectAllCaptchaSchema = captcha.SelectAllCaptchaSchema;
|
|
94
89
|
exports.SelectAllCaptchaSchemaRaw = captcha.SelectAllCaptchaSchemaRaw;
|
|
95
90
|
exports.SelectAllCaptchaSchemaWithNumericSolution = captcha.SelectAllCaptchaSchemaWithNumericSolution;
|
|
91
|
+
exports.TimestampSchema = captcha.TimestampSchema;
|
|
96
92
|
exports.DatasetSchema = dataset.DatasetSchema;
|
|
97
93
|
exports.DatasetWithIdsAndTreeSchema = dataset.DatasetWithIdsAndTreeSchema;
|
|
98
94
|
exports.DatasetWithIdsSchema = dataset.DatasetWithIdsSchema;
|
|
@@ -113,8 +109,11 @@ exports.ScheduledTaskStatus = scheduler.ScheduledTaskStatus;
|
|
|
113
109
|
exports.PayeeSchema = argv.PayeeSchema;
|
|
114
110
|
exports.ProcaptchaResponse = manager.ProcaptchaResponse;
|
|
115
111
|
exports.ProsopoLocalStorageSchema = storage.ProsopoLocalStorageSchema;
|
|
112
|
+
exports.ChallengeSignatureSchema = token.ChallengeSignatureSchema;
|
|
116
113
|
exports.ProcaptchaOutputSchema = token.ProcaptchaOutputSchema;
|
|
117
114
|
exports.ProcaptchaTokenCodec = token.ProcaptchaTokenCodec;
|
|
118
115
|
exports.ProcaptchaTokenSpec = token.ProcaptchaTokenSpec;
|
|
116
|
+
exports.RequestHashSignatureSchema = token.RequestHashSignatureSchema;
|
|
117
|
+
exports.SignatureTypesSchema = token.SignatureTypesSchema;
|
|
119
118
|
exports.decodeProcaptchaOutput = token.decodeProcaptchaOutput;
|
|
120
119
|
exports.encodeProcaptchaOutput = token.encodeProcaptchaOutput;
|
|
@@ -10,8 +10,11 @@ const token = require("./token.cjs");
|
|
|
10
10
|
require("./utils.cjs");
|
|
11
11
|
exports.ProcaptchaResponse = manager.ProcaptchaResponse;
|
|
12
12
|
exports.ProsopoLocalStorageSchema = storage.ProsopoLocalStorageSchema;
|
|
13
|
+
exports.ChallengeSignatureSchema = token.ChallengeSignatureSchema;
|
|
13
14
|
exports.ProcaptchaOutputSchema = token.ProcaptchaOutputSchema;
|
|
14
15
|
exports.ProcaptchaTokenCodec = token.ProcaptchaTokenCodec;
|
|
15
16
|
exports.ProcaptchaTokenSpec = token.ProcaptchaTokenSpec;
|
|
17
|
+
exports.RequestHashSignatureSchema = token.RequestHashSignatureSchema;
|
|
18
|
+
exports.SignatureTypesSchema = token.SignatureTypesSchema;
|
|
16
19
|
exports.decodeProcaptchaOutput = token.decodeProcaptchaOutput;
|
|
17
20
|
exports.encodeProcaptchaOutput = token.encodeProcaptchaOutput;
|
|
@@ -4,22 +4,28 @@ const util = require("@polkadot/util");
|
|
|
4
4
|
const scaleTs = require("scale-ts");
|
|
5
5
|
const z = require("zod");
|
|
6
6
|
const params = require("../api/params.cjs");
|
|
7
|
+
const RequestHashSignatureSchema = z.object({
|
|
8
|
+
[params.ApiParams.requestHash]: z.string()
|
|
9
|
+
});
|
|
10
|
+
const ChallengeSignatureSchema = z.object({
|
|
11
|
+
[params.ApiParams.challenge]: z.string()
|
|
12
|
+
});
|
|
13
|
+
const SignatureTypesSchema = z.object({
|
|
14
|
+
[params.ApiParams.challenge]: z.string().optional(),
|
|
15
|
+
[params.ApiParams.requestHash]: z.string().optional(),
|
|
16
|
+
[params.ApiParams.timestamp]: z.string().optional()
|
|
17
|
+
});
|
|
7
18
|
const ProcaptchaOutputSchema = z.object({
|
|
8
19
|
[params.ApiParams.commitmentId]: z.string().optional(),
|
|
9
20
|
[params.ApiParams.providerUrl]: z.string().optional(),
|
|
10
21
|
[params.ApiParams.dapp]: z.string(),
|
|
11
22
|
[params.ApiParams.user]: z.string(),
|
|
12
|
-
[params.ApiParams.blockNumber]: z.number(),
|
|
13
23
|
[params.ApiParams.challenge]: z.string().optional(),
|
|
14
24
|
[params.ApiParams.nonce]: z.number().optional(),
|
|
15
25
|
[params.ApiParams.timestamp]: z.string(),
|
|
16
26
|
[params.ApiParams.signature]: z.object({
|
|
17
|
-
[params.ApiParams.provider]:
|
|
18
|
-
|
|
19
|
-
}),
|
|
20
|
-
[params.ApiParams.user]: z.object({
|
|
21
|
-
[params.ApiParams.timestamp]: z.string()
|
|
22
|
-
}).optional()
|
|
27
|
+
[params.ApiParams.provider]: SignatureTypesSchema,
|
|
28
|
+
[params.ApiParams.user]: SignatureTypesSchema
|
|
23
29
|
})
|
|
24
30
|
});
|
|
25
31
|
const ProcaptchaTokenCodec = scaleTs.Struct({
|
|
@@ -27,19 +33,22 @@ const ProcaptchaTokenCodec = scaleTs.Struct({
|
|
|
27
33
|
[params.ApiParams.providerUrl]: scaleTs.Option(scaleTs.str),
|
|
28
34
|
[params.ApiParams.dapp]: scaleTs.str,
|
|
29
35
|
[params.ApiParams.user]: scaleTs.str,
|
|
30
|
-
[params.ApiParams.blockNumber]: scaleTs.u32,
|
|
31
36
|
[params.ApiParams.challenge]: scaleTs.Option(scaleTs.str),
|
|
32
37
|
[params.ApiParams.nonce]: scaleTs.Option(scaleTs.u32),
|
|
33
38
|
[params.ApiParams.timestamp]: scaleTs.str,
|
|
34
39
|
[params.ApiParams.signature]: scaleTs.Struct({
|
|
35
40
|
[params.ApiParams.provider]: scaleTs.Struct({
|
|
36
|
-
[params.ApiParams.
|
|
41
|
+
[params.ApiParams.challenge]: scaleTs.Option(scaleTs.str),
|
|
42
|
+
[params.ApiParams.requestHash]: scaleTs.Option(scaleTs.str)
|
|
43
|
+
}),
|
|
44
|
+
[params.ApiParams.user]: scaleTs.Struct({
|
|
45
|
+
[params.ApiParams.timestamp]: scaleTs.Option(scaleTs.str),
|
|
46
|
+
[params.ApiParams.requestHash]: scaleTs.Option(scaleTs.str)
|
|
37
47
|
})
|
|
38
48
|
})
|
|
39
49
|
});
|
|
40
50
|
const ProcaptchaTokenSpec = z.string().startsWith("0x");
|
|
41
51
|
const encodeProcaptchaOutput = (procaptchaOutput) => {
|
|
42
|
-
console.log("encoding", procaptchaOutput);
|
|
43
52
|
return util.u8aToHex(
|
|
44
53
|
ProcaptchaTokenCodec.enc({
|
|
45
54
|
[params.ApiParams.commitmentId]: void 0,
|
|
@@ -47,7 +56,17 @@ const encodeProcaptchaOutput = (procaptchaOutput) => {
|
|
|
47
56
|
[params.ApiParams.challenge]: void 0,
|
|
48
57
|
[params.ApiParams.nonce]: void 0,
|
|
49
58
|
// override any optional fields by spreading the procaptchaOutput
|
|
50
|
-
...procaptchaOutput
|
|
59
|
+
...procaptchaOutput,
|
|
60
|
+
signature: {
|
|
61
|
+
provider: {
|
|
62
|
+
challenge: procaptchaOutput.signature.provider?.challenge || void 0,
|
|
63
|
+
requestHash: procaptchaOutput.signature.provider?.requestHash || void 0
|
|
64
|
+
},
|
|
65
|
+
user: {
|
|
66
|
+
timestamp: procaptchaOutput.signature.user?.timestamp || void 0,
|
|
67
|
+
requestHash: procaptchaOutput.signature.user?.requestHash || void 0
|
|
68
|
+
}
|
|
69
|
+
}
|
|
51
70
|
})
|
|
52
71
|
);
|
|
53
72
|
};
|
|
@@ -56,8 +75,11 @@ const decodeProcaptchaOutput = (procaptchaToken) => {
|
|
|
56
75
|
ProcaptchaTokenCodec.dec(util.hexToU8a(procaptchaToken))
|
|
57
76
|
);
|
|
58
77
|
};
|
|
78
|
+
exports.ChallengeSignatureSchema = ChallengeSignatureSchema;
|
|
59
79
|
exports.ProcaptchaOutputSchema = ProcaptchaOutputSchema;
|
|
60
80
|
exports.ProcaptchaTokenCodec = ProcaptchaTokenCodec;
|
|
61
81
|
exports.ProcaptchaTokenSpec = ProcaptchaTokenSpec;
|
|
82
|
+
exports.RequestHashSignatureSchema = RequestHashSignatureSchema;
|
|
83
|
+
exports.SignatureTypesSchema = SignatureTypesSchema;
|
|
62
84
|
exports.decodeProcaptchaOutput = decodeProcaptchaOutput;
|
|
63
85
|
exports.encodeProcaptchaOutput = encodeProcaptchaOutput;
|
|
@@ -104,8 +104,7 @@ const ApiPathRateLimits = createRateLimitSchemaWithDefaults(
|
|
|
104
104
|
const CaptchaRequestBody = z.object({
|
|
105
105
|
[params.ApiParams.user]: z.string(),
|
|
106
106
|
[params.ApiParams.dapp]: z.string(),
|
|
107
|
-
[params.ApiParams.datasetId]: z.string()
|
|
108
|
-
[params.ApiParams.blockNumber]: z.string()
|
|
107
|
+
[params.ApiParams.datasetId]: z.string()
|
|
109
108
|
});
|
|
110
109
|
const CaptchaSolutionBody = z.object({
|
|
111
110
|
[params.ApiParams.user]: z.string(),
|
|
@@ -114,17 +113,13 @@ const CaptchaSolutionBody = z.object({
|
|
|
114
113
|
[params.ApiParams.requestHash]: z.string(),
|
|
115
114
|
[params.ApiParams.timestamp]: z.string(),
|
|
116
115
|
[params.ApiParams.signature]: z.object({
|
|
117
|
-
[params.ApiParams.user]:
|
|
118
|
-
|
|
119
|
-
}),
|
|
120
|
-
[params.ApiParams.provider]: z.object({
|
|
121
|
-
[params.ApiParams.timestamp]: z.string()
|
|
122
|
-
})
|
|
116
|
+
[params.ApiParams.user]: token.RequestHashSignatureSchema,
|
|
117
|
+
[params.ApiParams.provider]: token.RequestHashSignatureSchema
|
|
123
118
|
})
|
|
124
119
|
});
|
|
125
120
|
const VerifySolutionBody = z.object({
|
|
126
121
|
[params.ApiParams.token]: token.ProcaptchaTokenSpec,
|
|
127
|
-
[params.ApiParams.
|
|
122
|
+
[params.ApiParams.dappSignature]: z.string(),
|
|
128
123
|
[params.ApiParams.maxVerifiedTime]: z.number().optional().default(timeouts.DEFAULT_IMAGE_MAX_VERIFIED_TIME_CACHED)
|
|
129
124
|
});
|
|
130
125
|
const ServerPowCaptchaVerifyRequestBody = z.object({
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
var ScheduledTaskNames = /* @__PURE__ */ ((ScheduledTaskNames2) => {
|
|
4
4
|
ScheduledTaskNames2["BatchCommitment"] = "BatchCommitment";
|
|
5
5
|
ScheduledTaskNames2["CalculateSolution"] = "CalculateSolution";
|
|
6
|
+
ScheduledTaskNames2["StoreCommitmentsExternal"] = "StoreCommitmentsExternal";
|
|
6
7
|
return ScheduledTaskNames2;
|
|
7
8
|
})(ScheduledTaskNames || {});
|
|
8
9
|
var ScheduledTaskStatus = /* @__PURE__ */ ((ScheduledTaskStatus2) => {
|