@prosopo/server 2.9.10 → 2.9.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @prosopo/server
2
2
 
3
+ ## 2.9.12
4
+ ### Patch Changes
5
+
6
+ - 93d5e50: ensure packages have @prosopo/config as dep for vite configs
7
+ - 3573f0b: fix npm scripts bundle command
8
+ - 3573f0b: build using vite, typecheck using tsc
9
+ - efd8102: Add tests for unwrap error helper
10
+ - 93d5e50: fix missing dep for @prosopo/config
11
+ - 3573f0b: standardise all vite based npm scripts for bundling
12
+ - Updated dependencies [93d5e50]
13
+ - Updated dependencies [3573f0b]
14
+ - Updated dependencies [3573f0b]
15
+ - Updated dependencies [efd8102]
16
+ - Updated dependencies [93d5e50]
17
+ - Updated dependencies [63519d7]
18
+ - Updated dependencies [f29fc7e]
19
+ - Updated dependencies [3573f0b]
20
+ - Updated dependencies [2d0dd8a]
21
+ - @prosopo/keyring@2.8.7
22
+ - @prosopo/types@3.0.4
23
+ - @prosopo/load-balancer@2.6.15
24
+ - @prosopo/common@3.1.0
25
+ - @prosopo/api@3.1.1
26
+ - @prosopo/config@3.1.1
27
+
28
+ ## 2.9.11
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [b7c3258]
32
+ - @prosopo/api@3.1.0
33
+
3
34
  ## 2.9.10
4
35
  ### Patch Changes
5
36
 
@@ -33,6 +33,7 @@ class ProsopoServer {
33
33
  * @param timestamp
34
34
  * @param user
35
35
  * @param challenge
36
+ * @param ip
36
37
  */
37
38
  async verifyProvider(token, timeouts, providerUrl, timestamp, user, challenge, ip) {
38
39
  this.logger.info(() => ({
package/dist/config.js CHANGED
@@ -1,21 +1,25 @@
1
1
  import { ProsopoServerConfigSchema } from "@prosopo/types";
2
- export const getServerConfig = () => ProsopoServerConfigSchema.parse({
3
- defaultEnvironment: process.env.PROSOPO_DEFAULT_ENVIRONMENT,
4
- serverUrl: getServerUrl(),
5
- dappName: process.env.PROSOPO_DAPP_NAME || "client-example-server",
6
- account: {
7
- password: "",
8
- address: process.env.PROSOPO_SITE_KEY || "",
9
- secret: process.env.PROSOPO_SITE_PRIVATE_KEY || "",
10
- },
2
+ const getServerConfig = () => ProsopoServerConfigSchema.parse({
3
+ defaultEnvironment: process.env.PROSOPO_DEFAULT_ENVIRONMENT,
4
+ // environmental variables
5
+ serverUrl: getServerUrl(),
6
+ dappName: process.env.PROSOPO_DAPP_NAME || "client-example-server",
7
+ account: {
8
+ password: "",
9
+ address: process.env.PROSOPO_SITE_KEY || "",
10
+ secret: process.env.PROSOPO_SITE_PRIVATE_KEY || ""
11
+ }
11
12
  });
12
- export const getServerUrl = () => {
13
- if (process.env.PROSOPO_SERVER_URL) {
14
- if (process.env.PROSOPO_SERVER_URL.match(/:\d+/)) {
15
- return process.env.PROSOPO_SERVER_URL;
16
- }
17
- return `${process.env.PROSOPO_SERVER_URL}:${process.env.PROSOPO_SERVER_PORT || 9228}`;
13
+ const getServerUrl = () => {
14
+ if (process.env.PROSOPO_SERVER_URL) {
15
+ if (process.env.PROSOPO_SERVER_URL.match(/:\d+/)) {
16
+ return process.env.PROSOPO_SERVER_URL;
18
17
  }
19
- return "http://localhost:9228";
18
+ return `${process.env.PROSOPO_SERVER_URL}:${process.env.PROSOPO_SERVER_PORT || 9228}`;
19
+ }
20
+ return "http://localhost:9228";
21
+ };
22
+ export {
23
+ getServerConfig,
24
+ getServerUrl
20
25
  };
21
- //# sourceMappingURL=config.js.map
package/dist/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  import { ProsopoServer } from "./server.js";
2
- export { ProsopoServer } from "./server.js";
3
- export { getServerConfig, getServerUrl } from "./config.js";
2
+ import { getServerConfig, getServerUrl } from "./config.js";
4
3
  import { getPair } from "@prosopo/keyring";
5
- export const PublicProsopoServer = async (config) => {
6
- const pair = getPair(undefined, config.account.address);
7
- return new ProsopoServer(config, pair);
4
+ const PublicProsopoServer = async (config) => {
5
+ const pair = getPair(void 0, config.account.address);
6
+ return new ProsopoServer(config, pair);
7
+ };
8
+ export {
9
+ ProsopoServer,
10
+ PublicProsopoServer,
11
+ getServerConfig,
12
+ getServerUrl
8
13
  };
9
- //# sourceMappingURL=index.js.map
package/dist/server.js CHANGED
@@ -1,100 +1,140 @@
1
1
  import { ProviderApi } from "@prosopo/api";
2
- import { ProsopoApiError, ProsopoContractError, getLogger, } from "@prosopo/common";
2
+ import { getLogger, ProsopoContractError, ProsopoApiError } from "@prosopo/common";
3
3
  import { Keyring } from "@prosopo/keyring";
4
4
  import { loadBalancer } from "@prosopo/load-balancer";
5
- import { ProcaptchaOutputSchema, decodeProcaptchaOutput, } from "@prosopo/types";
5
+ import { decodeProcaptchaOutput, ProcaptchaOutputSchema } from "@prosopo/types";
6
6
  import { u8aToHex } from "@prosopo/util";
7
7
  import i18n from "i18next";
8
- export class ProsopoServer {
9
- constructor(config, pair) {
10
- this.config = config;
11
- this.pair = pair;
12
- this.defaultEnvironment = this.config.defaultEnvironment;
13
- this.dappAccount = this.config.account.address;
14
- this.logger = getLogger(this.config.logLevel, "@prosopo/server");
15
- this.keyring = new Keyring({
16
- type: "sr25519",
17
- });
8
+ class ProsopoServer {
9
+ constructor(config, pair) {
10
+ this.config = config;
11
+ this.pair = pair;
12
+ this.defaultEnvironment = this.config.defaultEnvironment;
13
+ this.dappAccount = this.config.account.address;
14
+ this.logger = getLogger(
15
+ this.config.logLevel,
16
+ "@prosopo/server"
17
+ );
18
+ this.keyring = new Keyring({
19
+ type: "sr25519"
20
+ });
21
+ }
22
+ getProviderApi(providerUrl) {
23
+ return new ProviderApi(providerUrl, this.dappAccount || "");
24
+ }
25
+ /**
26
+ * Verify the user with the provider URL passed in. If a challenge is provided, we use the challenge to verify the
27
+ * user. If not, we use the user, dapp, and optionally the commitmentID, to verify the user.
28
+ * @param token
29
+ * @param timeouts
30
+ * @param providerUrl
31
+ * @param timestamp
32
+ * @param user
33
+ * @param challenge
34
+ * @param ip
35
+ */
36
+ async verifyProvider(token, timeouts, providerUrl, timestamp, user, challenge, ip) {
37
+ this.logger.info(() => ({
38
+ data: { providerUrl },
39
+ msg: "Verifying with provider"
40
+ }));
41
+ const dappUserSignature = this.pair?.sign(timestamp.toString());
42
+ if (!dappUserSignature) {
43
+ throw new ProsopoContractError("CAPTCHA.INVALID_TIMESTAMP", {
44
+ context: { error: "Timestamp not found" }
45
+ });
18
46
  }
19
- getProviderApi(providerUrl) {
20
- return new ProviderApi(providerUrl, this.dappAccount || "");
21
- }
22
- async verifyProvider(token, timeouts, providerUrl, timestamp, user, challenge, ip) {
23
- this.logger.info(() => ({
24
- data: { providerUrl },
25
- msg: "Verifying with provider",
47
+ const signatureHex = u8aToHex(dappUserSignature);
48
+ const providerApi = this.getProviderApi(providerUrl);
49
+ if (challenge) {
50
+ const powTimeout = this.config.timeouts.pow.cachedTimeout;
51
+ const recent2 = timestamp ? Date.now() - timestamp < powTimeout : false;
52
+ if (!recent2) {
53
+ this.logger.error(() => ({
54
+ data: { timestamp },
55
+ msg: "PoW captcha is not recent"
26
56
  }));
27
- const dappUserSignature = this.pair?.sign(timestamp.toString());
28
- if (!dappUserSignature) {
29
- throw new ProsopoContractError("CAPTCHA.INVALID_TIMESTAMP", {
30
- context: { error: "Timestamp not found" },
31
- });
32
- }
33
- const signatureHex = u8aToHex(dappUserSignature);
34
- const providerApi = this.getProviderApi(providerUrl);
35
- if (challenge) {
36
- const powTimeout = this.config.timeouts.pow.cachedTimeout;
37
- const recent = timestamp ? Date.now() - timestamp < powTimeout : false;
38
- if (!recent) {
39
- this.logger.error(() => ({
40
- data: { timestamp },
41
- msg: "PoW captcha is not recent",
42
- }));
43
- return {
44
- verified: false,
45
- status: i18n.t("API.USER_NOT_VERIFIED_TIME_EXPIRED"),
46
- };
47
- }
48
- return await providerApi.submitPowCaptchaVerify(token, signatureHex, timeouts.pow.cachedTimeout, user, ip);
49
- }
50
- const imageTimeout = this.config.timeouts.image.cachedTimeout;
51
- const recent = timestamp ? Date.now() - timestamp < imageTimeout : false;
52
- if (!recent) {
53
- this.logger.error(() => ({
54
- data: { timestamp },
55
- msg: "Image captcha is not recent",
56
- }));
57
- return {
58
- verified: false,
59
- status: i18n.t("API.USER_NOT_VERIFIED_TIME_EXPIRED"),
60
- };
61
- }
62
- return await providerApi.verifyDappUser(token, signatureHex, user, timeouts.image.cachedTimeout, ip);
57
+ return {
58
+ verified: false,
59
+ status: i18n.t("API.USER_NOT_VERIFIED_TIME_EXPIRED")
60
+ };
61
+ }
62
+ return await providerApi.submitPowCaptchaVerify(
63
+ token,
64
+ signatureHex,
65
+ timeouts.pow.cachedTimeout,
66
+ user,
67
+ ip
68
+ );
63
69
  }
64
- async isVerified(token, ip) {
65
- try {
66
- const payload = decodeProcaptchaOutput(token);
67
- const { providerUrl, challenge, timestamp, user } = ProcaptchaOutputSchema.parse(payload);
68
- const providers = await loadBalancer(this.config.defaultEnvironment);
69
- const provider = providers.find((p) => p.url === providerUrl);
70
- if (!provider) {
71
- this.logger.error(() => ({
72
- data: { providerUrl },
73
- msg: "Provider not found",
74
- }));
75
- return {
76
- verified: false,
77
- status: i18n.t("API.USER_NOT_VERIFIED"),
78
- };
79
- }
80
- const verificationResponse = await this.verifyProvider(token, this.config.timeouts, provider.url, Number(timestamp), user, challenge, ip);
81
- this.logger.info(() => ({
82
- data: {
83
- verificationResponse,
84
- providerUrl,
85
- user,
86
- challenge,
87
- siteKey: this.pair?.address,
88
- },
89
- }));
90
- return verificationResponse;
91
- }
92
- catch (err) {
93
- this.logger.error(() => ({ err, data: { token } }));
94
- throw new ProsopoApiError("API.BAD_REQUEST", {
95
- context: { code: 500, token },
96
- });
70
+ const imageTimeout = this.config.timeouts.image.cachedTimeout;
71
+ const recent = timestamp ? Date.now() - timestamp < imageTimeout : false;
72
+ if (!recent) {
73
+ this.logger.error(() => ({
74
+ data: { timestamp },
75
+ msg: "Image captcha is not recent"
76
+ }));
77
+ return {
78
+ verified: false,
79
+ status: i18n.t("API.USER_NOT_VERIFIED_TIME_EXPIRED")
80
+ };
81
+ }
82
+ return await providerApi.verifyDappUser(
83
+ token,
84
+ signatureHex,
85
+ user,
86
+ timeouts.image.cachedTimeout,
87
+ ip
88
+ );
89
+ }
90
+ /**
91
+ *
92
+ * @returns
93
+ * @param token
94
+ */
95
+ async isVerified(token, ip) {
96
+ try {
97
+ const payload = decodeProcaptchaOutput(token);
98
+ const { providerUrl, challenge, timestamp, user } = ProcaptchaOutputSchema.parse(payload);
99
+ const providers = await loadBalancer(this.config.defaultEnvironment);
100
+ const provider = providers.find((p) => p.url === providerUrl);
101
+ if (!provider) {
102
+ this.logger.error(() => ({
103
+ data: { providerUrl },
104
+ msg: "Provider not found"
105
+ }));
106
+ return {
107
+ verified: false,
108
+ status: i18n.t("API.USER_NOT_VERIFIED")
109
+ };
110
+ }
111
+ const verificationResponse = await this.verifyProvider(
112
+ token,
113
+ this.config.timeouts,
114
+ provider.url,
115
+ Number(timestamp),
116
+ user,
117
+ challenge,
118
+ ip
119
+ );
120
+ this.logger.info(() => ({
121
+ data: {
122
+ verificationResponse,
123
+ providerUrl,
124
+ user,
125
+ challenge,
126
+ siteKey: this.pair?.address
97
127
  }
128
+ }));
129
+ return verificationResponse;
130
+ } catch (err) {
131
+ this.logger.error(() => ({ err, data: { token } }));
132
+ throw new ProsopoApiError("API.BAD_REQUEST", {
133
+ context: { code: 500, token }
134
+ });
98
135
  }
136
+ }
99
137
  }
100
- //# sourceMappingURL=server.js.map
138
+ export {
139
+ ProsopoServer
140
+ };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@prosopo/server",
3
- "version": "2.9.10",
3
+ "version": "2.9.12",
4
4
  "description": "NodeJS package for server side communication with the prosopo captcha client",
5
- "main": "./dist/index.js",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
6
7
  "type": "module",
7
8
  "engines": {
8
9
  "node": "20",
@@ -10,15 +11,18 @@
10
11
  },
11
12
  "exports": {
12
13
  ".": {
14
+ "types": "./dist/index.d.ts",
13
15
  "import": "./dist/index.js",
14
16
  "require": "./dist/cjs/index.cjs"
15
17
  }
16
18
  },
17
19
  "scripts": {
18
- "test": "echo \"No test specified\"",
19
- "clean": "tsc --build --clean",
20
- "build": "tsc --build --verbose",
21
- "build:cjs": "npx vite --config vite.cjs.config.ts build"
20
+ "clean": "del-cli --verbose dist tsconfig.tsbuildinfo",
21
+ "build": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.esm.config.ts --mode $NODE_ENV",
22
+ "build:tsc": "tsc --build --verbose",
23
+ "build:cjs": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.cjs.config.ts --mode $NODE_ENV",
24
+ "typecheck": "tsc --build --declaration --emitDeclarationOnly",
25
+ "test": "echo no tests"
22
26
  },
23
27
  "repository": {
24
28
  "type": "git",
@@ -33,20 +37,19 @@
33
37
  "sideEffects": false,
34
38
  "dependencies": {
35
39
  "@polkadot/util": "12.6.2",
36
- "@prosopo/api": "3.0.8",
37
- "@prosopo/common": "3.0.2",
38
- "@prosopo/keyring": "2.8.6",
39
- "@prosopo/load-balancer": "2.6.14",
40
- "@prosopo/types": "3.0.3",
40
+ "@prosopo/api": "3.1.1",
41
+ "@prosopo/common": "3.1.0",
42
+ "@prosopo/config": "3.1.1",
43
+ "@prosopo/keyring": "2.8.7",
44
+ "@prosopo/load-balancer": "2.6.15",
45
+ "@prosopo/types": "3.0.4",
41
46
  "@typegoose/auto-increment": "4.13.0",
42
47
  "axios": "1.10.0",
43
48
  "esbuild": "0.25.6",
44
- "express": "4.21.2",
45
49
  "openpgp": "5.11.3",
46
50
  "webpack-dev-server": "5.2.2"
47
51
  },
48
52
  "devDependencies": {
49
- "@prosopo/config": "3.1.0",
50
53
  "@vitest/coverage-v8": "3.0.9",
51
54
  "concurrently": "9.0.1",
52
55
  "del-cli": "6.0.0",
@@ -15,5 +15,8 @@ import path from "node:path";
15
15
  import { ViteCommonJSConfig } from "@prosopo/config";
16
16
 
17
17
  export default function () {
18
- return ViteCommonJSConfig("server", path.resolve("./tsconfig.cjs.json"));
18
+ return ViteCommonJSConfig(
19
+ path.basename("."),
20
+ path.resolve("./tsconfig.json"),
21
+ );
19
22
  }
@@ -0,0 +1,20 @@
1
+ // Copyright 2021-2025 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
+
15
+ import path from "node:path";
16
+ import { ViteEsmConfig } from "@prosopo/config";
17
+
18
+ export default function () {
19
+ return ViteEsmConfig(path.basename("."), path.resolve("./tsconfig.json"));
20
+ }
package/dist/config.d.ts DELETED
@@ -1,39 +0,0 @@
1
- export declare const getServerConfig: () => {
2
- timeouts: {
3
- image: {
4
- verifiedTimeout: number;
5
- challengeTimeout: number;
6
- solutionTimeout: number;
7
- cachedTimeout: number;
8
- };
9
- pow: {
10
- verifiedTimeout: number;
11
- solutionTimeout: number;
12
- cachedTimeout: number;
13
- };
14
- contract: {
15
- maxVerifiedTime: number;
16
- };
17
- };
18
- logLevel: "error" | "trace" | "debug" | "info" | "warn" | "fatal" | "log";
19
- defaultEnvironment: "development" | "staging" | "production";
20
- account: {
21
- secret?: string | undefined;
22
- address?: string | undefined;
23
- password?: string | undefined;
24
- };
25
- web2: boolean;
26
- solutionThreshold: number;
27
- dappName: string;
28
- database?: Partial<Record<"development" | "staging" | "production", {
29
- type: string;
30
- endpoint: string;
31
- dbname: string;
32
- authSource: string;
33
- }>> | undefined;
34
- devOnlyWatchEvents?: boolean | undefined;
35
- userAccountAddress?: string | undefined;
36
- serverUrl?: string | undefined;
37
- };
38
- export declare const getServerUrl: () => string;
39
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;cAqBywf,CAAC;eAAqC,CAAC;gBAAsC,CAAC;;;;;;;;;;;;;;CAXh3f,CAAC;AAEJ,eAAO,MAAM,YAAY,QAAO,MAQ/B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CACnC,yBAAyB,CAAC,KAAK,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,2BAA2B;IAC3D,SAAS,EAAE,YAAY,EAAE;IACzB,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,uBAAuB;IAClE,OAAO,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE;QAC3C,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,EAAE;KAClD;CACD,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,YAAY,GAAG,GAAW,EAAE;IACxC,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;QACpC,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;QACvC,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,IAAI,EAAE,CAAC;IACvF,CAAC;IACD,OAAO,uBAAuB,CAAC;AAChC,CAAC,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { ProsopoServer } from "./server.js";
2
- export { ProsopoServer } from "./server.js";
3
- export { getServerConfig, getServerUrl } from "./config.js";
4
- import type { ProsopoServerConfigOutput } from "@prosopo/types";
5
- export declare const PublicProsopoServer: (config: ProsopoServerConfigOutput) => Promise<ProsopoServer>;
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAChE,eAAO,MAAM,mBAAmB,WACvB,yBAAyB,2BAKjC,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACvC,MAAiC,EAChC,EAAE;IAEH,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,OAAO,IAAI,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC,CAAC"}
package/dist/server.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { ProviderApi } from "@prosopo/api";
2
- import { type Logger } from "@prosopo/common";
3
- import { Keyring } from "@prosopo/keyring";
4
- import type { KeyringPair } from "@prosopo/types";
5
- import { type CaptchaTimeoutOutput, type ProcaptchaToken, type ProsopoServerConfigOutput, type VerificationResponse } from "@prosopo/types";
6
- export declare class ProsopoServer {
7
- config: ProsopoServerConfigOutput;
8
- dappAccount: string | undefined;
9
- defaultEnvironment: string;
10
- logger: Logger;
11
- keyring: Keyring;
12
- pair: KeyringPair | undefined;
13
- constructor(config: ProsopoServerConfigOutput, pair?: KeyringPair);
14
- getProviderApi(providerUrl: string): ProviderApi;
15
- verifyProvider(token: string, timeouts: CaptchaTimeoutOutput, providerUrl: string, timestamp: number, user: string, challenge?: string, ip?: string): Promise<VerificationResponse>;
16
- isVerified(token: ProcaptchaToken, ip?: string): Promise<VerificationResponse>;
17
- }
18
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAEN,KAAK,MAAM,EAIX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACN,KAAK,oBAAoB,EAEzB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EAEzB,MAAM,gBAAgB,CAAC;AAIxB,qBAAa,aAAa;IACzB,MAAM,EAAE,yBAAyB,CAAC;IAClC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC;gBAEl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