@prosopo/client-example-server 2.7.17 → 2.7.39

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,299 @@
1
1
  # @prosopo/client-example-server
2
2
 
3
+ ## 2.7.39
4
+ ### Patch Changes
5
+
6
+ - Updated dependencies [1e3a838]
7
+ - @prosopo/config@3.1.20
8
+ - @prosopo/server@2.9.35
9
+ - @prosopo/common@3.1.20
10
+ - @prosopo/dotenv@3.0.25
11
+ - @prosopo/keyring@2.8.27
12
+ - @prosopo/types@3.5.3
13
+ - @prosopo/util@3.1.5
14
+
15
+ ## 2.7.38
16
+ ### Patch Changes
17
+
18
+ - 5659b24: Release 3.4.4
19
+ - Updated dependencies [f912439]
20
+ - Updated dependencies [5659b24]
21
+ - @prosopo/common@3.1.19
22
+ - @prosopo/keyring@2.8.26
23
+ - @prosopo/dotenv@3.0.24
24
+ - @prosopo/server@2.9.34
25
+ - @prosopo/types@3.5.2
26
+ - @prosopo/util@3.1.4
27
+ - @prosopo/config@3.1.19
28
+
29
+ ## 2.7.37
30
+ ### Patch Changes
31
+
32
+ - 50c4120: Release 3.4.3
33
+ - Updated dependencies [52cd544]
34
+ - Updated dependencies [c72ecbd]
35
+ - Updated dependencies [b117ba3]
36
+ - Updated dependencies [50c4120]
37
+ - @prosopo/types@3.5.1
38
+ - @prosopo/dotenv@3.0.23
39
+ - @prosopo/keyring@2.8.25
40
+ - @prosopo/common@3.1.18
41
+ - @prosopo/server@2.9.33
42
+ - @prosopo/util@3.1.3
43
+ - @prosopo/config@3.1.18
44
+
45
+ ## 2.7.36
46
+ ### Patch Changes
47
+
48
+ - 618703f: Release 3.4.2
49
+ - Updated dependencies [618703f]
50
+ - Updated dependencies [e20ad6b]
51
+ - @prosopo/keyring@2.8.24
52
+ - @prosopo/common@3.1.17
53
+ - @prosopo/dotenv@3.0.22
54
+ - @prosopo/server@2.9.32
55
+ - @prosopo/types@3.5.0
56
+ - @prosopo/util@3.1.2
57
+ - @prosopo/config@3.1.17
58
+
59
+ ## 2.7.35
60
+ ### Patch Changes
61
+
62
+ - 11303d9: Release 3.4.0
63
+ - 18cb28b: Release 3.4.1
64
+ - Updated dependencies [11303d9]
65
+ - Updated dependencies [18cb28b]
66
+ - Updated dependencies [11303d9]
67
+ - @prosopo/keyring@2.8.23
68
+ - @prosopo/common@3.1.16
69
+ - @prosopo/dotenv@3.0.21
70
+ - @prosopo/server@2.9.31
71
+ - @prosopo/types@3.4.1
72
+ - @prosopo/util@3.1.1
73
+ - @prosopo/config@3.1.16
74
+
75
+ ## 2.7.34
76
+ ### Patch Changes
77
+
78
+ - f3f7aec: Release 3.4.0
79
+ - Updated dependencies [f3f7aec]
80
+ - Updated dependencies [6768f14]
81
+ - @prosopo/keyring@2.8.22
82
+ - @prosopo/common@3.1.15
83
+ - @prosopo/dotenv@3.0.20
84
+ - @prosopo/server@2.9.30
85
+ - @prosopo/types@3.4.0
86
+ - @prosopo/util@3.1.0
87
+ - @prosopo/config@3.1.15
88
+
89
+ ## 2.7.33
90
+ ### Patch Changes
91
+
92
+ - Release 3.3.1
93
+ - 0824221: Release 3.2.4
94
+ - Updated dependencies [97edf3f]
95
+ - Updated dependencies
96
+ - Updated dependencies [0824221]
97
+ - @prosopo/types@3.3.0
98
+ - @prosopo/keyring@2.8.21
99
+ - @prosopo/common@3.1.14
100
+ - @prosopo/dotenv@3.0.19
101
+ - @prosopo/server@2.9.29
102
+ - @prosopo/util@3.0.17
103
+ - @prosopo/config@3.1.14
104
+
105
+ ## 2.7.32
106
+ ### Patch Changes
107
+
108
+ - 008d112: Release 3.3.0
109
+ - Updated dependencies [509be28]
110
+ - Updated dependencies [008d112]
111
+ - @prosopo/types@3.2.1
112
+ - @prosopo/keyring@2.8.20
113
+ - @prosopo/common@3.1.13
114
+ - @prosopo/dotenv@3.0.18
115
+ - @prosopo/server@2.9.28
116
+ - @prosopo/util@3.0.16
117
+ - @prosopo/config@3.1.13
118
+
119
+ ## 2.7.31
120
+ ### Patch Changes
121
+
122
+ - 0824221: Release 3.2.4
123
+ - Updated dependencies [cf48565]
124
+ - Updated dependencies [0824221]
125
+ - @prosopo/types@3.2.0
126
+ - @prosopo/keyring@2.8.19
127
+ - @prosopo/common@3.1.12
128
+ - @prosopo/dotenv@3.0.17
129
+ - @prosopo/server@2.9.27
130
+ - @prosopo/util@3.0.15
131
+ - @prosopo/config@3.1.12
132
+
133
+ ## 2.7.30
134
+ ### Patch Changes
135
+
136
+ - 0d1a33e: Adding ipcomparison service with user features
137
+ - 1a23649: Release 3.2.3
138
+ - Updated dependencies [0d1a33e]
139
+ - Updated dependencies [0d1a33e]
140
+ - Updated dependencies [1a23649]
141
+ - @prosopo/types@3.1.4
142
+ - @prosopo/keyring@2.8.18
143
+ - @prosopo/common@3.1.11
144
+ - @prosopo/dotenv@3.0.16
145
+ - @prosopo/server@2.9.26
146
+ - @prosopo/util@3.0.14
147
+ - @prosopo/config@3.1.11
148
+
149
+ ## 2.7.29
150
+ ### Patch Changes
151
+
152
+ - 657a827: Release 3.2.2
153
+ - Updated dependencies [657a827]
154
+ - @prosopo/keyring@2.8.17
155
+ - @prosopo/common@3.1.10
156
+ - @prosopo/dotenv@3.0.15
157
+ - @prosopo/server@2.9.25
158
+ - @prosopo/types@3.1.3
159
+ - @prosopo/util@3.0.13
160
+ - @prosopo/config@3.1.10
161
+
162
+ ## 2.7.28
163
+ ### Patch Changes
164
+
165
+ - 4440947: fix type-only tsc compilation
166
+ - 7bdaca6: Release 3.2.1
167
+ - Updated dependencies [4440947]
168
+ - Updated dependencies [7bdaca6]
169
+ - Updated dependencies [809b984]
170
+ - Updated dependencies [1249ce0]
171
+ - Updated dependencies [809b984]
172
+ - @prosopo/keyring@2.8.16
173
+ - @prosopo/common@3.1.9
174
+ - @prosopo/dotenv@3.0.14
175
+ - @prosopo/server@2.9.24
176
+ - @prosopo/types@3.1.2
177
+ - @prosopo/util@3.0.12
178
+ - @prosopo/config@3.1.9
179
+
180
+ ## 2.7.27
181
+ ### Patch Changes
182
+
183
+ - 6fe8570: Release 3.2.0
184
+ - Updated dependencies [1f980c4]
185
+ - Updated dependencies [6fe8570]
186
+ - @prosopo/types@3.1.1
187
+ - @prosopo/keyring@2.8.15
188
+ - @prosopo/common@3.1.8
189
+ - @prosopo/dotenv@3.0.13
190
+ - @prosopo/server@2.9.23
191
+ - @prosopo/util@3.0.11
192
+ - @prosopo/config@3.1.8
193
+
194
+ ## 2.7.26
195
+ ### Patch Changes
196
+
197
+ - f304be9: Release 3.1.13
198
+ - Updated dependencies [f304be9]
199
+ - Updated dependencies [8bdc7f0]
200
+ - @prosopo/keyring@2.8.14
201
+ - @prosopo/common@3.1.7
202
+ - @prosopo/dotenv@3.0.12
203
+ - @prosopo/server@2.9.22
204
+ - @prosopo/types@3.1.0
205
+ - @prosopo/util@3.0.10
206
+ - @prosopo/config@3.1.7
207
+
208
+ ## 2.7.25
209
+ ### Patch Changes
210
+
211
+ - a07db04: Release 3.1.12
212
+ - Updated dependencies [9eed772]
213
+ - Updated dependencies [a07db04]
214
+ - Updated dependencies [ebb0168]
215
+ - @prosopo/config@3.1.6
216
+ - @prosopo/server@2.9.21
217
+ - @prosopo/util@3.0.9
218
+ - @prosopo/common@3.1.6
219
+ - @prosopo/dotenv@3.0.11
220
+ - @prosopo/keyring@2.8.13
221
+ - @prosopo/types@3.0.10
222
+
223
+ ## 2.7.24
224
+ ### Patch Changes
225
+
226
+ - @prosopo/server@2.9.20
227
+
228
+ ## 2.7.23
229
+ ### Patch Changes
230
+
231
+ - 6960643: lint detect missing and unneccessary imports
232
+ - Updated dependencies [6960643]
233
+ - @prosopo/keyring@2.8.12
234
+ - @prosopo/common@3.1.5
235
+ - @prosopo/dotenv@3.0.10
236
+ - @prosopo/server@2.9.19
237
+ - @prosopo/types@3.0.9
238
+ - @prosopo/util@3.0.8
239
+
240
+ ## 2.7.22
241
+ ### Patch Changes
242
+
243
+ - Updated dependencies [30e7d4d]
244
+ - @prosopo/config@3.1.5
245
+ - @prosopo/common@3.1.4
246
+ - @prosopo/dotenv@3.0.9
247
+ - @prosopo/server@2.9.18
248
+ - @prosopo/types@3.0.8
249
+ - @prosopo/util@3.0.7
250
+
251
+ ## 2.7.21
252
+ ### Patch Changes
253
+
254
+ - 1f3a02f: Release 3.1.8
255
+ - Updated dependencies [1f3a02f]
256
+ - @prosopo/server@2.9.17
257
+
258
+ ## 2.7.20
259
+ ### Patch Changes
260
+
261
+ - @prosopo/server@2.9.16
262
+
263
+ ## 2.7.19
264
+ ### Patch Changes
265
+
266
+ - Updated dependencies [44ffda2]
267
+ - Updated dependencies [a49b538]
268
+ - @prosopo/config@3.1.4
269
+ - @prosopo/common@3.1.3
270
+ - @prosopo/dotenv@3.0.8
271
+ - @prosopo/server@2.9.15
272
+ - @prosopo/types@3.0.7
273
+ - @prosopo/util@3.0.6
274
+
275
+ ## 2.7.18
276
+ ### Patch Changes
277
+
278
+ - 828066d: remove empty test npm scripts, add missing npm test scripts
279
+ - 91bbe87: configure typecheck before bundle for vue packages
280
+ - 91bbe87: make typecheck script always recompile
281
+ - 346e092: NODE_ENV default to "development"
282
+ - 5d36e05: remove tsc --force
283
+ - Updated dependencies [828066d]
284
+ - Updated dependencies [df4e030]
285
+ - Updated dependencies [91bbe87]
286
+ - Updated dependencies [3ef4fd2]
287
+ - Updated dependencies [91bbe87]
288
+ - Updated dependencies [346e092]
289
+ - Updated dependencies [5d36e05]
290
+ - @prosopo/common@3.1.2
291
+ - @prosopo/dotenv@3.0.7
292
+ - @prosopo/server@2.9.14
293
+ - @prosopo/types@3.0.6
294
+ - @prosopo/config@3.1.3
295
+ - @prosopo/util@3.0.5
296
+
3
297
  ## 2.7.17
4
298
  ### Patch Changes
5
299
 
package/dist/app.js CHANGED
@@ -27,6 +27,7 @@ async function main() {
27
27
  ProsopoVerificationType
28
28
  ).includes(process.env.PROSOPO_VERIFICATION_TYPE) ? process.env.PROSOPO_VERIFICATION_TYPE : "api";
29
29
  const app = express();
30
+ app.set("trust proxy", 1);
30
31
  app.use(cors({ origin: true, credentials: true }));
31
32
  app.use(express.urlencoded({ extended: true }));
32
33
  app.use(express.json());
@@ -45,7 +46,11 @@ async function main() {
45
46
  app.options("/*", (_, res) => {
46
47
  res.sendStatus(200);
47
48
  });
48
- const uri = await memoryServerSetup();
49
+ if (!process.env.MONGO_URI && process.env.NODE_ENV !== "development") {
50
+ throw new Error("Cannot run mongo memory in non-development environment");
51
+ }
52
+ logger.info(() => ({ msg: process.env.MONGO_URI }));
53
+ const uri = process.env.MONGO_URI || await memoryServerSetup();
49
54
  logger.info(() => ({ msg: "mongo uri", data: { uri } }));
50
55
  const mongoose = connectionFactory(uri);
51
56
  if (!process.env.PROSOPO_SITE_PRIVATE_KEY) {
@@ -58,9 +63,9 @@ async function main() {
58
63
  const config = getServerConfig();
59
64
  logger.info(() => ({ msg: "Config", data: { config } }));
60
65
  app.use(getRoutes(mongoose, config, verifyEndpoint, verifyType));
61
- app.listen(
62
- config.serverUrl ? Number.parseInt(at(config.serverUrl.split(":"), 2)) : 9228
63
- );
66
+ const port = config.serverUrl ? Number.parseInt(at(config.serverUrl.split(":"), 2)) : 9228;
67
+ logger.info(() => ({ msg: "Listening on port", data: { port } }));
68
+ app.listen(port);
64
69
  }
65
70
  main().then(() => {
66
71
  logger.info(() => ({ msg: "Server started" }));
package/dist/cjs/app.cjs CHANGED
@@ -29,6 +29,7 @@ async function main() {
29
29
  ProsopoVerificationType
30
30
  ).includes(process.env.PROSOPO_VERIFICATION_TYPE) ? process.env.PROSOPO_VERIFICATION_TYPE : "api";
31
31
  const app = express();
32
+ app.set("trust proxy", 1);
32
33
  app.use(cors({ origin: true, credentials: true }));
33
34
  app.use(express.urlencoded({ extended: true }));
34
35
  app.use(express.json());
@@ -47,7 +48,11 @@ async function main() {
47
48
  app.options("/*", (_, res) => {
48
49
  res.sendStatus(200);
49
50
  });
50
- const uri = await database.memoryServerSetup();
51
+ if (!process.env.MONGO_URI && process.env.NODE_ENV !== "development") {
52
+ throw new Error("Cannot run mongo memory in non-development environment");
53
+ }
54
+ logger.info(() => ({ msg: process.env.MONGO_URI }));
55
+ const uri = process.env.MONGO_URI || await database.memoryServerSetup();
51
56
  logger.info(() => ({ msg: "mongo uri", data: { uri } }));
52
57
  const mongoose = connection(uri);
53
58
  if (!process.env.PROSOPO_SITE_PRIVATE_KEY) {
@@ -60,9 +65,9 @@ async function main() {
60
65
  const config = server.getServerConfig();
61
66
  logger.info(() => ({ msg: "Config", data: { config } }));
62
67
  app.use(routes(mongoose, config, verifyEndpoint, verifyType));
63
- app.listen(
64
- config.serverUrl ? Number.parseInt(util.at(config.serverUrl.split(":"), 2)) : 9228
65
- );
68
+ const port = config.serverUrl ? Number.parseInt(util.at(config.serverUrl.split(":"), 2)) : 9228;
69
+ logger.info(() => ({ msg: "Listening on port", data: { port } }));
70
+ app.listen(port);
66
71
  }
67
72
  main().then(() => {
68
73
  logger.info(() => ({ msg: "Server started" }));
@@ -19,19 +19,28 @@ const SubscribeBodySpec = types.ProcaptchaResponse.merge(
19
19
  function hashPassword(password) {
20
20
  return util.u8aToHex(blake2b.blake2b(password));
21
21
  }
22
- const verify = async (prosopoServer, verifyType, verifyEndpoint, token, secret) => {
22
+ const NO_IP = "NO_IP";
23
+ const getResponse = async (ip, token, secret, verifyEndpoint) => {
24
+ const body = {
25
+ [types.ApiParams.token]: token,
26
+ [types.ApiParams.secret]: secret
27
+ };
28
+ if (process.env.NODE_ENV !== "development") {
29
+ body[types.ApiParams.ip] = ip;
30
+ }
31
+ console.log({ body });
32
+ const response = await fetch(verifyEndpoint, {
33
+ method: "POST",
34
+ body: JSON.stringify(body)
35
+ });
36
+ return response.json();
37
+ };
38
+ const verify = async (prosopoServer, verifyType, verifyEndpoint, token, secret, ip) => {
23
39
  if (verifyType === "api") {
24
40
  console.log("Verifying using the API endpoint", verifyEndpoint);
25
- const response = await fetch(verifyEndpoint, {
26
- method: "POST",
27
- body: JSON.stringify({
28
- [types.ApiParams.token]: token,
29
- [types.ApiParams.secret]: secret
30
- })
31
- });
32
- const verifiedResponse = await response.json();
33
- console.log(verifiedResponse);
34
- return verifiedResponse.verified;
41
+ const response = await getResponse(ip, token, secret, verifyEndpoint);
42
+ console.log(response);
43
+ return response.verified;
35
44
  }
36
45
  const verified = await prosopoServer.isVerified(token);
37
46
  console.log(verified);
@@ -60,7 +69,8 @@ const signup = async (mongoose, config, verifyEndpoint, verifyType, req, res, ne
60
69
  verifyType,
61
70
  verifyEndpoint,
62
71
  token,
63
- config.account.secret
72
+ config.account.secret,
73
+ req.headers["x-client-ip"]?.toString() || NO_IP
64
74
  );
65
75
  if (verified) {
66
76
  const salt = utilCrypto.randomAsHex(32);
@@ -98,7 +108,7 @@ const login = async (mongoose, config, verifyEndpoint, verifyType, req, res) =>
98
108
  const payload = SubscribeBodySpec.parse(req.body);
99
109
  const token = payload[types.ApiParams.procaptchaResponse];
100
110
  if (!config.account.secret) {
101
- throw new common.ProsopoEnvError("GENERAL.MNEMONIC_UNDEFINED", {
111
+ throw new common.ProsopoEnvError("GENERAL.SECRET_MISSING", {
102
112
  context: { missingParams: ["PROSOPO_SITE_PRIVATE_KEY"] }
103
113
  });
104
114
  }
@@ -107,7 +117,8 @@ const login = async (mongoose, config, verifyEndpoint, verifyType, req, res) =>
107
117
  verifyType,
108
118
  verifyEndpoint,
109
119
  token,
110
- config.account.secret
120
+ config.account.secret,
121
+ req.headers["x-client-ip"]?.toString() || NO_IP
111
122
  );
112
123
  console.log("verified", verified);
113
124
  if (verified) {
@@ -1,8 +1,30 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
2
24
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const mongodbMemoryServer = require("mongodb-memory-server");
4
25
  async function memoryServerSetup() {
5
- const mongod = mongodbMemoryServer.MongoMemoryServer.create();
26
+ const MongoMemoryServer = (await import("mongodb-memory-server")).MongoMemoryServer;
27
+ const mongod = MongoMemoryServer.create();
6
28
  const memoryServer = await mongod;
7
29
  return memoryServer.getUri();
8
30
  }
@@ -17,19 +17,28 @@ const SubscribeBodySpec = ProcaptchaResponse.merge(
17
17
  function hashPassword(password) {
18
18
  return u8aToHex(blake2b(password));
19
19
  }
20
- const verify = async (prosopoServer, verifyType, verifyEndpoint, token, secret) => {
20
+ const NO_IP = "NO_IP";
21
+ const getResponse = async (ip, token, secret, verifyEndpoint) => {
22
+ const body = {
23
+ [ApiParams.token]: token,
24
+ [ApiParams.secret]: secret
25
+ };
26
+ if (process.env.NODE_ENV !== "development") {
27
+ body[ApiParams.ip] = ip;
28
+ }
29
+ console.log({ body });
30
+ const response = await fetch(verifyEndpoint, {
31
+ method: "POST",
32
+ body: JSON.stringify(body)
33
+ });
34
+ return response.json();
35
+ };
36
+ const verify = async (prosopoServer, verifyType, verifyEndpoint, token, secret, ip) => {
21
37
  if (verifyType === "api") {
22
38
  console.log("Verifying using the API endpoint", verifyEndpoint);
23
- const response = await fetch(verifyEndpoint, {
24
- method: "POST",
25
- body: JSON.stringify({
26
- [ApiParams.token]: token,
27
- [ApiParams.secret]: secret
28
- })
29
- });
30
- const verifiedResponse = await response.json();
31
- console.log(verifiedResponse);
32
- return verifiedResponse.verified;
39
+ const response = await getResponse(ip, token, secret, verifyEndpoint);
40
+ console.log(response);
41
+ return response.verified;
33
42
  }
34
43
  const verified = await prosopoServer.isVerified(token);
35
44
  console.log(verified);
@@ -58,7 +67,8 @@ const signup = async (mongoose, config, verifyEndpoint, verifyType, req, res, ne
58
67
  verifyType,
59
68
  verifyEndpoint,
60
69
  token,
61
- config.account.secret
70
+ config.account.secret,
71
+ req.headers["x-client-ip"]?.toString() || NO_IP
62
72
  );
63
73
  if (verified) {
64
74
  const salt = randomAsHex(32);
@@ -96,7 +106,7 @@ const login = async (mongoose, config, verifyEndpoint, verifyType, req, res) =>
96
106
  const payload = SubscribeBodySpec.parse(req.body);
97
107
  const token = payload[ApiParams.procaptchaResponse];
98
108
  if (!config.account.secret) {
99
- throw new ProsopoEnvError("GENERAL.MNEMONIC_UNDEFINED", {
109
+ throw new ProsopoEnvError("GENERAL.SECRET_MISSING", {
100
110
  context: { missingParams: ["PROSOPO_SITE_PRIVATE_KEY"] }
101
111
  });
102
112
  }
@@ -105,7 +115,8 @@ const login = async (mongoose, config, verifyEndpoint, verifyType, req, res) =>
105
115
  verifyType,
106
116
  verifyEndpoint,
107
117
  token,
108
- config.account.secret
118
+ config.account.secret,
119
+ req.headers["x-client-ip"]?.toString() || NO_IP
109
120
  );
110
121
  console.log("verified", verified);
111
122
  if (verified) {
@@ -1,5 +1,5 @@
1
- import { MongoMemoryServer } from "mongodb-memory-server";
2
1
  async function memoryServerSetup() {
2
+ const MongoMemoryServer = (await import("mongodb-memory-server")).MongoMemoryServer;
3
3
  const mongod = MongoMemoryServer.create();
4
4
  const memoryServer = await mongod;
5
5
  return memoryServer.getUri();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/client-example-server",
3
- "version": "2.7.17",
3
+ "version": "2.7.39",
4
4
  "description": "Backend for client-example",
5
5
  "main": "dist/app.js",
6
6
  "types": "dist/app.d.ts",
@@ -20,12 +20,11 @@
20
20
  "dev": "NODE_ENV=${NODE_ENV:-development}; vite serve --mode=$NODE_ENV --config ./vite.config.ts --host",
21
21
  "start": "node ./dist/app.js",
22
22
  "start:bundle": "node ./dist/bundle/prosopo_client_example_server.app.bundle.js",
23
- "build": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.esm.config.ts --mode $NODE_ENV",
23
+ "build": "NODE_ENV=${NODE_ENV:-development}; vite build --config vite.esm.config.ts --mode $NODE_ENV",
24
24
  "build:tsc": "tsc --build --verbose",
25
- "build:cjs": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.cjs.config.ts --mode $NODE_ENV",
26
- "typecheck": "tsc --build --declaration --emitDeclarationOnly --force",
27
- "test": "echo no tests",
28
- "bundle": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.config.ts --mode $NODE_ENV"
25
+ "build:cjs": "NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV",
26
+ "typecheck": "tsc --project tsconfig.types.json",
27
+ "bundle": "NODE_ENV=${NODE_ENV:-development}; vite build --config vite.config.ts --mode $NODE_ENV"
29
28
  },
30
29
  "repository": {
31
30
  "type": "git",
@@ -41,26 +40,24 @@
41
40
  "@noble/hashes": "1.8.0",
42
41
  "@polkadot/util": "12.6.2",
43
42
  "@polkadot/util-crypto": "12.6.2",
44
- "@prosopo/common": "3.1.1",
45
- "@prosopo/dotenv": "3.0.6",
46
- "@prosopo/server": "2.9.13",
47
- "@prosopo/types": "3.0.5",
48
- "@prosopo/util": "3.0.4",
43
+ "@prosopo/common": "3.1.20",
44
+ "@prosopo/dotenv": "3.0.25",
45
+ "@prosopo/keyring": "2.8.27",
46
+ "@prosopo/server": "2.9.35",
47
+ "@prosopo/types": "3.5.3",
48
+ "@prosopo/util": "3.1.5",
49
+ "@prosopo/config": "3.1.20",
49
50
  "@typegoose/auto-increment": "4.13.0",
50
- "axios": "1.10.0",
51
51
  "cors": "2.8.5",
52
- "esbuild": "0.25.6",
53
52
  "express": "4.21.2",
54
53
  "jsonwebtoken": "9.0.2",
55
54
  "mongodb-memory-server": "10.0.0",
56
- "@prosopo/config": "3.1.2",
57
55
  "mongoose": "8.13.0",
58
- "openpgp": "5.11.3",
59
- "webpack-dev-server": "5.2.2",
60
56
  "zod": "3.23.8"
61
57
  },
62
58
  "devDependencies": {
63
59
  "@types/jsonwebtoken": "9.0.6",
60
+ "@types/node": "22.10.2",
64
61
  "@vitest/coverage-v8": "3.0.9",
65
62
  "concurrently": "9.0.1",
66
63
  "del-cli": "6.0.0",
package/vite.config.ts CHANGED
@@ -40,8 +40,41 @@ export default defineConfig(async ({ command, mode }) => {
40
40
  command,
41
41
  mode,
42
42
  );
43
+ const define = {
44
+ ...backendConfig.define,
45
+ // Not specifying a mongo uri will default to in-memory mongo server but does not work in a container
46
+ ...(process.env.MONGO_URI && {
47
+ "process.env.MONGO_URI": JSON.stringify(process.env.MONGO_URI),
48
+ }),
49
+ ...(process.env.PROSOPO_VERIFICATION_TYPE && {
50
+ "process.env.PROSOPO_VERIFICATION_TYPE": JSON.stringify(
51
+ process.env.PROSOPO_VERIFICATION_TYPE,
52
+ ),
53
+ }),
54
+ ...(process.env.PROSOPO_SITE_PRIVATE_KEY && {
55
+ "process.env.PROSOPO_SITE_PRIVATE_KEY": JSON.stringify(
56
+ process.env.PROSOPO_SITE_PRIVATE_KEY,
57
+ ),
58
+ }),
59
+ };
60
+ console.log({ define });
43
61
  return defineConfig({
44
62
  ...backendConfig,
45
- server: { port: process.env.PROSOPO_SERVER_PORT },
63
+ define: define,
64
+ build: {
65
+ ...backendConfig.build,
66
+ rollupOptions: {
67
+ ...backendConfig.build?.rollupOptions,
68
+ external: [
69
+ ...(backendConfig.build?.rollupOptions?.external as string[]),
70
+ "mongodb-memory-server",
71
+ ],
72
+ },
73
+ },
74
+ server: {
75
+ port: process.env.PROSOPO_SERVER_PORT
76
+ ? Number(process.env.PROSOPO_SERVER_PORT)
77
+ : 9228,
78
+ },
46
79
  });
47
80
  });