@getpara/server-sdk 1.4.3 → 1.4.4
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/cjs/index.js +490 -1
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/cjs/workers/worker.js +1008 -2
- package/dist/cjs/workers/worker.js.br +0 -0
- package/dist/cjs/workers/worker.js.gz +0 -0
- package/dist/esm/index.js +454 -1
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
- package/dist/esm/workers/chunk-MCKGQKYU.js +15 -0
- package/dist/esm/workers/chunk-MCKGQKYU.js.br +0 -0
- package/dist/esm/workers/chunk-MCKGQKYU.js.gz +0 -0
- package/dist/esm/workers/wasm_exec-UV7SYRZI.js +577 -0
- package/dist/esm/workers/wasm_exec-UV7SYRZI.js.br +0 -0
- package/dist/esm/workers/wasm_exec-UV7SYRZI.js.gz +0 -0
- package/dist/esm/workers/worker.js +408 -1
- package/dist/esm/workers/worker.js.br +0 -0
- package/dist/esm/workers/worker.js.gz +0 -0
- package/package.json +4 -4
- package/dist/esm/workers/chunk-NEJSZOZX.js +0 -1
- package/dist/esm/workers/chunk-NEJSZOZX.js.br +0 -0
- package/dist/esm/workers/chunk-NEJSZOZX.js.gz +0 -0
- package/dist/esm/workers/wasm_exec-TBSO5IWG.js +0 -2
- package/dist/esm/workers/wasm_exec-TBSO5IWG.js.br +0 -0
- package/dist/esm/workers/wasm_exec-TBSO5IWG.js.gz +0 -0
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1,490 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
Para: () => Para,
|
|
34
|
+
default: () => src_default
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
__reExport(src_exports, require("@getpara/core-sdk"), module.exports);
|
|
38
|
+
|
|
39
|
+
// src/ParaServer.ts
|
|
40
|
+
var import_core_sdk3 = __toESM(require("@getpara/core-sdk"));
|
|
41
|
+
var Sentry = __toESM(require("@sentry/node"));
|
|
42
|
+
|
|
43
|
+
// src/ServerLocalStorage.ts
|
|
44
|
+
var ServerLocalStorage = class {
|
|
45
|
+
constructor() {
|
|
46
|
+
this.localStorage = {};
|
|
47
|
+
this.get = (key) => {
|
|
48
|
+
return this.localStorage[key] || null;
|
|
49
|
+
};
|
|
50
|
+
this.set = (key, value) => {
|
|
51
|
+
this.localStorage[key] = value;
|
|
52
|
+
};
|
|
53
|
+
this.removeItem = (key) => {
|
|
54
|
+
delete this.localStorage[key];
|
|
55
|
+
};
|
|
56
|
+
this.clear = (prefix) => {
|
|
57
|
+
const keys = Object.keys(this.localStorage);
|
|
58
|
+
for (let key in keys) {
|
|
59
|
+
if (key && key.startsWith(prefix)) {
|
|
60
|
+
this.removeItem(key);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// src/ServerSessionStorage.ts
|
|
68
|
+
var ServerSessionStorage = class {
|
|
69
|
+
constructor() {
|
|
70
|
+
this.sessionStorage = {};
|
|
71
|
+
this.get = (key) => {
|
|
72
|
+
return this.sessionStorage[key] || null;
|
|
73
|
+
};
|
|
74
|
+
this.set = (key, value) => {
|
|
75
|
+
this.sessionStorage[key] = value;
|
|
76
|
+
};
|
|
77
|
+
this.removeItem = (key) => {
|
|
78
|
+
delete this.sessionStorage[key];
|
|
79
|
+
};
|
|
80
|
+
this.clear = (prefix) => {
|
|
81
|
+
const keys = Object.keys(this.sessionStorage);
|
|
82
|
+
for (let key in keys) {
|
|
83
|
+
if (key && key.startsWith(prefix)) {
|
|
84
|
+
this.removeItem(key);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// src/wallet/keygen.ts
|
|
92
|
+
var uuid = __toESM(require("uuid"));
|
|
93
|
+
var import_core_sdk2 = require("@getpara/core-sdk");
|
|
94
|
+
|
|
95
|
+
// src/workers/workerWrapper.ts
|
|
96
|
+
var import_worker_threads = require("worker_threads");
|
|
97
|
+
var import_core_sdk = require("@getpara/core-sdk");
|
|
98
|
+
var CLEAR_WORKER_TIMEOUT_MS = 1e3 * 90;
|
|
99
|
+
var worker;
|
|
100
|
+
var resFunctionMap = {};
|
|
101
|
+
function removeWorkId(workId, skipClearTimeout) {
|
|
102
|
+
const { timeoutId } = resFunctionMap[workId];
|
|
103
|
+
delete resFunctionMap[workId];
|
|
104
|
+
if (skipClearTimeout) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
clearTimeout(timeoutId);
|
|
108
|
+
}
|
|
109
|
+
async function setupWorker(ctx, resFunction, workId) {
|
|
110
|
+
const timeoutId = setTimeout(() => {
|
|
111
|
+
removeWorkId(workId, true);
|
|
112
|
+
}, CLEAR_WORKER_TIMEOUT_MS);
|
|
113
|
+
resFunctionMap[workId] = {
|
|
114
|
+
fn: resFunction,
|
|
115
|
+
timeoutId
|
|
116
|
+
};
|
|
117
|
+
if (!worker || !worker.threadId) {
|
|
118
|
+
const workerRes = await fetch(`${(0, import_core_sdk.getPortalBaseURL)(ctx)}/static/js/mpcWorkerServer-bundle.js`);
|
|
119
|
+
worker = new import_worker_threads.Worker(await workerRes.text(), { eval: true });
|
|
120
|
+
const onmessage = async (message) => {
|
|
121
|
+
const { workId: messageWorkId } = message;
|
|
122
|
+
delete message.workId;
|
|
123
|
+
await resFunctionMap[messageWorkId].fn(message);
|
|
124
|
+
removeWorkId(messageWorkId);
|
|
125
|
+
};
|
|
126
|
+
worker.on("message", onmessage);
|
|
127
|
+
worker.on("error", (err) => {
|
|
128
|
+
throw err;
|
|
129
|
+
});
|
|
130
|
+
worker.on("exit", (code) => {
|
|
131
|
+
console.error(`worker stopped with exit code ${code}`);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return worker;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/wallet/keygen.ts
|
|
138
|
+
async function isKeygenComplete(ctx, userId, walletId) {
|
|
139
|
+
const wallets = await ctx.client.getWallets(userId);
|
|
140
|
+
const wallet = wallets.data.wallets.find((w) => w.id === walletId);
|
|
141
|
+
return !!wallet.address;
|
|
142
|
+
}
|
|
143
|
+
async function isPreKeygenComplete(ctx, pregenIdentifier, pregenIdentifierType, walletId) {
|
|
144
|
+
const wallets = await ctx.client.getPregenWallets({ [pregenIdentifierType]: [pregenIdentifier] });
|
|
145
|
+
const wallet = wallets.wallets.find((w) => w.id === walletId);
|
|
146
|
+
return !!wallet?.address;
|
|
147
|
+
}
|
|
148
|
+
function keygen(ctx, userId, type, secretKey, skipDistribute = false, sessionCookie, _emailProps = {}) {
|
|
149
|
+
return new Promise(async (resolve) => {
|
|
150
|
+
const workId = uuid.v4();
|
|
151
|
+
const worker2 = await setupWorker(
|
|
152
|
+
ctx,
|
|
153
|
+
async (res) => {
|
|
154
|
+
await (0, import_core_sdk2.waitUntilTrue)(async () => isKeygenComplete(ctx, userId, res.walletId), 15e3, 1e3);
|
|
155
|
+
if (skipDistribute) {
|
|
156
|
+
resolve({
|
|
157
|
+
signer: res.signer,
|
|
158
|
+
walletId: res.walletId,
|
|
159
|
+
recoveryShare: null
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
workId
|
|
164
|
+
);
|
|
165
|
+
worker2.postMessage({
|
|
166
|
+
env: ctx.env,
|
|
167
|
+
apiKey: ctx.apiKey,
|
|
168
|
+
cosmosPrefix: ctx.cosmosPrefix,
|
|
169
|
+
params: { userId, secretKey, type },
|
|
170
|
+
functionType: "KEYGEN",
|
|
171
|
+
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
172
|
+
disableWorkers: ctx.disableWorkers,
|
|
173
|
+
sessionCookie,
|
|
174
|
+
useDKLS: ctx.useDKLS,
|
|
175
|
+
disableWebSockets: ctx.disableWebSockets,
|
|
176
|
+
wasmOverride: ctx.wasmOverride,
|
|
177
|
+
workId
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function preKeygen(ctx, pregenIdentifier, pregenIdentifierType, type, secretKey, _skipDistribute = false, partnerId, sessionCookie) {
|
|
182
|
+
return new Promise(async (resolve) => {
|
|
183
|
+
const workId = uuid.v4();
|
|
184
|
+
const worker2 = await setupWorker(
|
|
185
|
+
ctx,
|
|
186
|
+
async (res) => {
|
|
187
|
+
await (0, import_core_sdk2.waitUntilTrue)(
|
|
188
|
+
async () => isPreKeygenComplete(ctx, pregenIdentifier, pregenIdentifierType, res.walletId),
|
|
189
|
+
15e3,
|
|
190
|
+
1e3
|
|
191
|
+
);
|
|
192
|
+
resolve({
|
|
193
|
+
signer: res.signer,
|
|
194
|
+
walletId: res.walletId,
|
|
195
|
+
recoveryShare: null
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
workId
|
|
199
|
+
);
|
|
200
|
+
const email = void 0;
|
|
201
|
+
const params = { pregenIdentifier, pregenIdentifierType, secretKey, partnerId, email, type };
|
|
202
|
+
if (pregenIdentifierType === "EMAIL") {
|
|
203
|
+
params.email = pregenIdentifier;
|
|
204
|
+
}
|
|
205
|
+
worker2.postMessage({
|
|
206
|
+
env: ctx.env,
|
|
207
|
+
apiKey: ctx.apiKey,
|
|
208
|
+
cosmosPrefix: ctx.cosmosPrefix,
|
|
209
|
+
params,
|
|
210
|
+
functionType: "PREKEYGEN",
|
|
211
|
+
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
212
|
+
disableWorkers: ctx.disableWorkers,
|
|
213
|
+
sessionCookie,
|
|
214
|
+
useDKLS: ctx.useDKLS,
|
|
215
|
+
disableWebSockets: ctx.disableWebSockets,
|
|
216
|
+
wasmOverride: ctx.wasmOverride,
|
|
217
|
+
workId
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}) {
|
|
222
|
+
return new Promise(async (resolve) => {
|
|
223
|
+
const workId = uuid.v4();
|
|
224
|
+
const worker2 = await setupWorker(
|
|
225
|
+
ctx,
|
|
226
|
+
async (res) => {
|
|
227
|
+
await (0, import_core_sdk2.waitUntilTrue)(async () => isKeygenComplete(ctx, userId, res.walletId), 15e3, 1e3);
|
|
228
|
+
resolve({
|
|
229
|
+
signer: res.signer,
|
|
230
|
+
walletId: res.walletId,
|
|
231
|
+
recoveryShare: null
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
workId
|
|
235
|
+
);
|
|
236
|
+
worker2.postMessage({
|
|
237
|
+
env: ctx.env,
|
|
238
|
+
apiKey: ctx.apiKey,
|
|
239
|
+
cosmosPrefix: ctx.cosmosPrefix,
|
|
240
|
+
params: { userId },
|
|
241
|
+
functionType: "ED25519_KEYGEN",
|
|
242
|
+
disableWorkers: ctx.disableWorkers,
|
|
243
|
+
sessionCookie,
|
|
244
|
+
disableWebSockets: ctx.disableWebSockets,
|
|
245
|
+
wasmOverride: ctx.wasmOverride,
|
|
246
|
+
workId
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie) {
|
|
251
|
+
return new Promise(async (resolve) => {
|
|
252
|
+
const workId = uuid.v4();
|
|
253
|
+
const worker2 = await setupWorker(
|
|
254
|
+
ctx,
|
|
255
|
+
async (res) => {
|
|
256
|
+
await (0, import_core_sdk2.waitUntilTrue)(
|
|
257
|
+
async () => isPreKeygenComplete(ctx, pregenIdentifier, pregenIdentifierType, res.walletId),
|
|
258
|
+
15e3,
|
|
259
|
+
1e3
|
|
260
|
+
);
|
|
261
|
+
resolve({
|
|
262
|
+
signer: res.signer,
|
|
263
|
+
walletId: res.walletId,
|
|
264
|
+
recoveryShare: null
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
workId
|
|
268
|
+
);
|
|
269
|
+
const email = void 0;
|
|
270
|
+
const params = { pregenIdentifier, pregenIdentifierType, email };
|
|
271
|
+
if (pregenIdentifierType === "EMAIL") {
|
|
272
|
+
params.email = pregenIdentifier;
|
|
273
|
+
}
|
|
274
|
+
worker2.postMessage({
|
|
275
|
+
env: ctx.env,
|
|
276
|
+
apiKey: ctx.apiKey,
|
|
277
|
+
cosmosPrefix: ctx.cosmosPrefix,
|
|
278
|
+
params,
|
|
279
|
+
functionType: "ED25519_PREKEYGEN",
|
|
280
|
+
disableWorkers: ctx.disableWorkers,
|
|
281
|
+
sessionCookie,
|
|
282
|
+
disableWebSockets: ctx.disableWebSockets,
|
|
283
|
+
wasmOverride: ctx.wasmOverride,
|
|
284
|
+
workId
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// src/wallet/signing.ts
|
|
290
|
+
var uuid2 = __toESM(require("uuid"));
|
|
291
|
+
async function signTransaction(ctx, userId, walletId, share, tx, chainId, sessionCookie, isDKLS) {
|
|
292
|
+
return await new Promise(async (resolve) => {
|
|
293
|
+
const workId = uuid2.v4();
|
|
294
|
+
const worker2 = await setupWorker(
|
|
295
|
+
ctx,
|
|
296
|
+
async (sendTransactionRes) => {
|
|
297
|
+
resolve(sendTransactionRes);
|
|
298
|
+
},
|
|
299
|
+
workId
|
|
300
|
+
);
|
|
301
|
+
worker2.postMessage({
|
|
302
|
+
env: ctx.env,
|
|
303
|
+
apiKey: ctx.apiKey,
|
|
304
|
+
cosmosPrefix: ctx.cosmosPrefix,
|
|
305
|
+
params: { share, walletId, userId, tx, chainId },
|
|
306
|
+
functionType: "SIGN_TRANSACTION",
|
|
307
|
+
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
308
|
+
disableWorkers: ctx.disableWorkers,
|
|
309
|
+
sessionCookie,
|
|
310
|
+
useDKLS: isDKLS,
|
|
311
|
+
disableWebSockets: ctx.disableWebSockets,
|
|
312
|
+
wasmOverride: ctx.wasmOverride,
|
|
313
|
+
workId
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
async function sendTransaction(ctx, userId, walletId, share, tx, chainId, sessionCookie, isDKLS) {
|
|
318
|
+
return await new Promise(async (resolve) => {
|
|
319
|
+
const workId = uuid2.v4();
|
|
320
|
+
const worker2 = await setupWorker(
|
|
321
|
+
ctx,
|
|
322
|
+
async (sendTransactionRes) => {
|
|
323
|
+
resolve(sendTransactionRes);
|
|
324
|
+
},
|
|
325
|
+
workId
|
|
326
|
+
);
|
|
327
|
+
worker2.postMessage({
|
|
328
|
+
env: ctx.env,
|
|
329
|
+
apiKey: ctx.apiKey,
|
|
330
|
+
params: { share, walletId, userId, tx, chainId },
|
|
331
|
+
functionType: "SEND_TRANSACTION",
|
|
332
|
+
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
333
|
+
disableWorkers: ctx.disableWorkers,
|
|
334
|
+
sessionCookie,
|
|
335
|
+
useDKLS: isDKLS,
|
|
336
|
+
disableWebSockets: ctx.disableWebSockets,
|
|
337
|
+
wasmOverride: ctx.wasmOverride,
|
|
338
|
+
workId
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
async function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS) {
|
|
343
|
+
return await new Promise(async (resolve) => {
|
|
344
|
+
const workId = uuid2.v4();
|
|
345
|
+
const worker2 = await setupWorker(
|
|
346
|
+
ctx,
|
|
347
|
+
async (signMessageRes) => {
|
|
348
|
+
resolve(signMessageRes);
|
|
349
|
+
},
|
|
350
|
+
workId
|
|
351
|
+
);
|
|
352
|
+
worker2.postMessage({
|
|
353
|
+
env: ctx.env,
|
|
354
|
+
apiKey: ctx.apiKey,
|
|
355
|
+
params: { share, walletId, userId, message },
|
|
356
|
+
functionType: "SIGN_MESSAGE",
|
|
357
|
+
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
358
|
+
disableWorkers: ctx.disableWorkers,
|
|
359
|
+
sessionCookie,
|
|
360
|
+
useDKLS: isDKLS,
|
|
361
|
+
disableWebSockets: ctx.disableWebSockets,
|
|
362
|
+
wasmOverride: ctx.wasmOverride,
|
|
363
|
+
workId
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
async function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie) {
|
|
368
|
+
return await new Promise(async (resolve) => {
|
|
369
|
+
const workId = uuid2.v4();
|
|
370
|
+
const worker2 = await setupWorker(
|
|
371
|
+
ctx,
|
|
372
|
+
async (signMessageRes) => {
|
|
373
|
+
resolve(signMessageRes);
|
|
374
|
+
},
|
|
375
|
+
workId
|
|
376
|
+
);
|
|
377
|
+
worker2.postMessage({
|
|
378
|
+
env: ctx.env,
|
|
379
|
+
apiKey: ctx.apiKey,
|
|
380
|
+
params: { share, walletId, userId, base64Bytes },
|
|
381
|
+
functionType: "ED25519_SIGN",
|
|
382
|
+
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
383
|
+
disableWorkers: ctx.disableWorkers,
|
|
384
|
+
sessionCookie,
|
|
385
|
+
disableWebSockets: ctx.disableWebSockets,
|
|
386
|
+
wasmOverride: ctx.wasmOverride,
|
|
387
|
+
workId
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// src/wallet/privateKey.ts
|
|
393
|
+
var uuid3 = __toESM(require("uuid"));
|
|
394
|
+
async function getPrivateKey(ctx, userId, walletId, share, sessionCookie) {
|
|
395
|
+
return await new Promise(async (resolve) => {
|
|
396
|
+
const workId = uuid3.v4();
|
|
397
|
+
const worker2 = await setupWorker(
|
|
398
|
+
ctx,
|
|
399
|
+
async (res) => {
|
|
400
|
+
resolve(res);
|
|
401
|
+
},
|
|
402
|
+
workId
|
|
403
|
+
);
|
|
404
|
+
worker2.postMessage({
|
|
405
|
+
env: ctx.env,
|
|
406
|
+
apiKey: ctx.apiKey,
|
|
407
|
+
cosmosPrefix: ctx.cosmosPrefix,
|
|
408
|
+
params: { share, walletId, userId },
|
|
409
|
+
functionType: "GET_PRIVATE_KEY",
|
|
410
|
+
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
411
|
+
disableWorkers: ctx.disableWorkers,
|
|
412
|
+
sessionCookie,
|
|
413
|
+
useDKLS: ctx.useDKLS,
|
|
414
|
+
disableWebSockets: ctx.disableWebSockets,
|
|
415
|
+
wasmOverride: ctx.wasmOverride,
|
|
416
|
+
workId
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// src/ServerUtils.ts
|
|
422
|
+
var ServerUtils = class {
|
|
423
|
+
constructor() {
|
|
424
|
+
this.localStorage = new ServerLocalStorage();
|
|
425
|
+
this.sessionStorage = new ServerSessionStorage();
|
|
426
|
+
this.secureStorage = void 0;
|
|
427
|
+
this.isSyncStorage = true;
|
|
428
|
+
this.disableProviderModal = true;
|
|
429
|
+
}
|
|
430
|
+
getPrivateKey(ctx, userId, walletId, share, sessionCookie) {
|
|
431
|
+
return getPrivateKey(ctx, userId, walletId, share, sessionCookie);
|
|
432
|
+
}
|
|
433
|
+
keygen(ctx, userId, type, secretKey, sessionCookie, emailProps) {
|
|
434
|
+
return keygen(ctx, userId, type, secretKey, true, sessionCookie, emailProps);
|
|
435
|
+
}
|
|
436
|
+
refresh(_ctx, _sessionCookie, _userId, _walletId, _share, _oldPartnerId, _newPartnerId) {
|
|
437
|
+
throw new Error("not implemented");
|
|
438
|
+
}
|
|
439
|
+
preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType, type, secretKey, sessionCookie) {
|
|
440
|
+
return preKeygen(ctx, pregenIdentifier, pregenIdentifierType, type, secretKey, false, partnerId, sessionCookie);
|
|
441
|
+
}
|
|
442
|
+
signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS) {
|
|
443
|
+
return signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS);
|
|
444
|
+
}
|
|
445
|
+
signTransaction(ctx, userId, walletId, share, message, chainId, sessionCookie, isDKLS) {
|
|
446
|
+
return signTransaction(ctx, userId, walletId, share, message, chainId, sessionCookie, isDKLS);
|
|
447
|
+
}
|
|
448
|
+
sendTransaction(ctx, userId, walletId, share, tx, chainId, sessionCookie, isDKLS) {
|
|
449
|
+
return sendTransaction(ctx, userId, walletId, share, tx, chainId, sessionCookie, isDKLS);
|
|
450
|
+
}
|
|
451
|
+
signHash(_address, _hash) {
|
|
452
|
+
throw new Error("not implemented");
|
|
453
|
+
}
|
|
454
|
+
ed25519Keygen(ctx, userId, sessionCookie, emailProps) {
|
|
455
|
+
return ed25519Keygen(ctx, userId, sessionCookie, emailProps);
|
|
456
|
+
}
|
|
457
|
+
ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie) {
|
|
458
|
+
return ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie);
|
|
459
|
+
}
|
|
460
|
+
ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie) {
|
|
461
|
+
return ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie);
|
|
462
|
+
}
|
|
463
|
+
openPopup(_popupUrl) {
|
|
464
|
+
throw new Error("not implemented");
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
// src/ParaServer.ts
|
|
469
|
+
var Para = class extends import_core_sdk3.default {
|
|
470
|
+
constructor(env, apiKey, opts) {
|
|
471
|
+
super(env, apiKey, opts);
|
|
472
|
+
if (env !== import_core_sdk3.Environment.PROD && env !== import_core_sdk3.Environment.DEV) {
|
|
473
|
+
Sentry.init({
|
|
474
|
+
environment: env.toLowerCase(),
|
|
475
|
+
dsn: "https://2a26842d951255c2721fde5c1dd2b252@o4504568036720640.ingest.us.sentry.io/4508850906791936"
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
getPlatformUtils() {
|
|
480
|
+
return new ServerUtils();
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
// src/index.ts
|
|
485
|
+
var src_default = Para;
|
|
486
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
487
|
+
0 && (module.exports = {
|
|
488
|
+
Para,
|
|
489
|
+
...require("@getpara/core-sdk")
|
|
490
|
+
});
|
package/dist/cjs/index.js.br
CHANGED
|
Binary file
|
package/dist/cjs/index.js.gz
CHANGED
|
Binary file
|