@portal-hq/web 1.0.0 → 1.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/lib/commonjs/index.js +6 -23
- package/lib/commonjs/mpc/index.js +3 -46
- package/lib/commonjs/provider/index.js +2 -3
- package/lib/esm/index.js +6 -23
- package/lib/esm/mpc/index.js +3 -46
- package/lib/esm/provider/index.js +2 -3
- package/package.json +1 -1
- package/src/index.ts +7 -29
- package/src/mpc/index.ts +3 -57
- package/src/provider/index.ts +2 -3
- package/types.d.ts +24 -14
package/lib/commonjs/index.js
CHANGED
|
@@ -20,7 +20,7 @@ class Portal {
|
|
|
20
20
|
// Required
|
|
21
21
|
gatewayConfig,
|
|
22
22
|
// Optional
|
|
23
|
-
apiKey, authToken, authUrl, autoApprove = false, chainId = 1, gdrive, passkey, host = 'web.portalhq.io', mpcVersion = 'v6', featureFlags = {
|
|
23
|
+
apiKey, authToken, authUrl, autoApprove = false, chainId = 1, gdrive, passkey, host = 'web.portalhq.io', mpcVersion = 'v6', mpcHost = 'mpc-client.portalhq.io', featureFlags = {
|
|
24
24
|
optimized: false,
|
|
25
25
|
}, }) {
|
|
26
26
|
this.ready = false;
|
|
@@ -33,6 +33,7 @@ class Portal {
|
|
|
33
33
|
this.chainId = chainId;
|
|
34
34
|
this.gatewayConfig = gatewayConfig;
|
|
35
35
|
this.host = host;
|
|
36
|
+
this.mpcHost = mpcHost;
|
|
36
37
|
this.mpcVersion = mpcVersion;
|
|
37
38
|
this.featureFlags = featureFlags;
|
|
38
39
|
if (gdrive) {
|
|
@@ -136,24 +137,6 @@ class Portal {
|
|
|
136
137
|
return address;
|
|
137
138
|
});
|
|
138
139
|
}
|
|
139
|
-
/**
|
|
140
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
141
|
-
* Use the `recoverWallet` method instead.
|
|
142
|
-
*/
|
|
143
|
-
legacyRecoverWallet(cipherText, progress = () => {
|
|
144
|
-
// Noop
|
|
145
|
-
}) {
|
|
146
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const recoveredCipherText = yield this.mpc.legacyRecover({
|
|
148
|
-
cipherText,
|
|
149
|
-
host: this.host,
|
|
150
|
-
mpcVersion: this.mpcVersion,
|
|
151
|
-
featureFlags: this.featureFlags,
|
|
152
|
-
}, progress);
|
|
153
|
-
this.address = yield this.mpc.getAddress();
|
|
154
|
-
return recoveredCipherText;
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
140
|
provisionWallet(cipherText, backupMethod, backupConfigs, progress = () => {
|
|
158
141
|
// Noop
|
|
159
142
|
}) {
|
|
@@ -161,16 +144,16 @@ class Portal {
|
|
|
161
144
|
return this.recoverWallet(cipherText, backupMethod, backupConfigs, progress);
|
|
162
145
|
});
|
|
163
146
|
}
|
|
164
|
-
ejectPrivateKey(
|
|
147
|
+
ejectPrivateKey(clientBackupCipherText, backupMethod, backupConfigs, orgBackupShare) {
|
|
165
148
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
-
if (
|
|
167
|
-
throw new Error('
|
|
149
|
+
if (clientBackupCipherText === '') {
|
|
150
|
+
throw new Error('clientBackupCipherText cannot be empty string.');
|
|
168
151
|
}
|
|
169
152
|
if (orgBackupShare === '') {
|
|
170
153
|
throw new Error('orgBackupShare cannot be empty string.');
|
|
171
154
|
}
|
|
172
155
|
const privateKey = yield this.mpc.eject({
|
|
173
|
-
cipherText:
|
|
156
|
+
cipherText: clientBackupCipherText,
|
|
174
157
|
backupMethod,
|
|
175
158
|
backupConfigs,
|
|
176
159
|
organizationBackupShare: orgBackupShare,
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MpcErrorCodes = exports.MpcError = void 0;
|
|
13
13
|
const errors_1 = require("./errors");
|
|
14
14
|
const index_1 = require("../index");
|
|
15
|
-
const WEB_SDK_VERSION = '1.0.
|
|
15
|
+
const WEB_SDK_VERSION = '1.0.2';
|
|
16
16
|
class Mpc {
|
|
17
17
|
constructor({ portal }) {
|
|
18
18
|
this.configureIframe = () => {
|
|
@@ -26,6 +26,8 @@ class Mpc {
|
|
|
26
26
|
passkey: this.portal.passkeyConfig,
|
|
27
27
|
host: this.portal.host,
|
|
28
28
|
rpcUrl: this.portal.getRpcUrl(),
|
|
29
|
+
mpcHost: this.portal.mpcHost,
|
|
30
|
+
mpcVersion: this.portal.mpcVersion,
|
|
29
31
|
featureFlags: this.portal.featureFlags,
|
|
30
32
|
};
|
|
31
33
|
const message = {
|
|
@@ -278,51 +280,6 @@ class Mpc {
|
|
|
278
280
|
});
|
|
279
281
|
});
|
|
280
282
|
}
|
|
281
|
-
legacyRecover(data, progress = () => {
|
|
282
|
-
// Noop
|
|
283
|
-
}) {
|
|
284
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
285
|
-
return new Promise((resolve, reject) => {
|
|
286
|
-
const handleRecover = (message) => {
|
|
287
|
-
const { type, data } = message.data;
|
|
288
|
-
const { origin } = message;
|
|
289
|
-
// ignore any broadcast postMessages
|
|
290
|
-
if (origin !== this.getOrigin()) {
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
if (type === 'portal:wasm:legacyRecoverError') {
|
|
294
|
-
// Remove the event listeners
|
|
295
|
-
window.removeEventListener('message', handleRecover);
|
|
296
|
-
window.removeEventListener('message', handleProgress);
|
|
297
|
-
reject(new errors_1.PortalMpcError(data));
|
|
298
|
-
}
|
|
299
|
-
else if (type === 'portal:wasm:legacyRecoverResult') {
|
|
300
|
-
// Remove the event listeners
|
|
301
|
-
window.removeEventListener('message', handleRecover);
|
|
302
|
-
window.removeEventListener('message', handleProgress);
|
|
303
|
-
resolve(data);
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
const handleProgress = (message) => {
|
|
307
|
-
const { type, data: status } = message.data;
|
|
308
|
-
const { origin } = message;
|
|
309
|
-
// ignore any broadcast postMessages
|
|
310
|
-
if (origin !== this.getOrigin()) {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
if (type === 'portal:wasm:legacyRecoverProgress') {
|
|
314
|
-
void progress(status);
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
window.addEventListener('message', handleRecover);
|
|
318
|
-
window.addEventListener('message', handleProgress);
|
|
319
|
-
this.postMessage({
|
|
320
|
-
type: 'portal:wasm:legacyRecover',
|
|
321
|
-
data,
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
283
|
sign(data, progress = () => {
|
|
327
284
|
// Noop
|
|
328
285
|
}) {
|
|
@@ -261,11 +261,10 @@ class Provider {
|
|
|
261
261
|
case 'eth_signTypedData_v4':
|
|
262
262
|
case 'personal_sign': {
|
|
263
263
|
const result = yield this.portal.mpc.sign({
|
|
264
|
-
|
|
264
|
+
chainId: this.portal.chainId.toString(),
|
|
265
265
|
method,
|
|
266
|
-
mpcVersion: this.portal.mpcVersion,
|
|
267
266
|
params: this.buildParams(method, params),
|
|
268
|
-
|
|
267
|
+
rpcUrl: this.portal.getRpcUrl(),
|
|
269
268
|
});
|
|
270
269
|
return result;
|
|
271
270
|
}
|
package/lib/esm/index.js
CHANGED
|
@@ -14,7 +14,7 @@ class Portal {
|
|
|
14
14
|
// Required
|
|
15
15
|
gatewayConfig,
|
|
16
16
|
// Optional
|
|
17
|
-
apiKey, authToken, authUrl, autoApprove = false, chainId = 1, gdrive, passkey, host = 'web.portalhq.io', mpcVersion = 'v6', featureFlags = {
|
|
17
|
+
apiKey, authToken, authUrl, autoApprove = false, chainId = 1, gdrive, passkey, host = 'web.portalhq.io', mpcVersion = 'v6', mpcHost = 'mpc-client.portalhq.io', featureFlags = {
|
|
18
18
|
optimized: false,
|
|
19
19
|
}, }) {
|
|
20
20
|
this.ready = false;
|
|
@@ -27,6 +27,7 @@ class Portal {
|
|
|
27
27
|
this.chainId = chainId;
|
|
28
28
|
this.gatewayConfig = gatewayConfig;
|
|
29
29
|
this.host = host;
|
|
30
|
+
this.mpcHost = mpcHost;
|
|
30
31
|
this.mpcVersion = mpcVersion;
|
|
31
32
|
this.featureFlags = featureFlags;
|
|
32
33
|
if (gdrive) {
|
|
@@ -130,24 +131,6 @@ class Portal {
|
|
|
130
131
|
return address;
|
|
131
132
|
});
|
|
132
133
|
}
|
|
133
|
-
/**
|
|
134
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
135
|
-
* Use the `recoverWallet` method instead.
|
|
136
|
-
*/
|
|
137
|
-
legacyRecoverWallet(cipherText, progress = () => {
|
|
138
|
-
// Noop
|
|
139
|
-
}) {
|
|
140
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
const recoveredCipherText = yield this.mpc.legacyRecover({
|
|
142
|
-
cipherText,
|
|
143
|
-
host: this.host,
|
|
144
|
-
mpcVersion: this.mpcVersion,
|
|
145
|
-
featureFlags: this.featureFlags,
|
|
146
|
-
}, progress);
|
|
147
|
-
this.address = yield this.mpc.getAddress();
|
|
148
|
-
return recoveredCipherText;
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
134
|
provisionWallet(cipherText, backupMethod, backupConfigs, progress = () => {
|
|
152
135
|
// Noop
|
|
153
136
|
}) {
|
|
@@ -155,16 +138,16 @@ class Portal {
|
|
|
155
138
|
return this.recoverWallet(cipherText, backupMethod, backupConfigs, progress);
|
|
156
139
|
});
|
|
157
140
|
}
|
|
158
|
-
ejectPrivateKey(
|
|
141
|
+
ejectPrivateKey(clientBackupCipherText, backupMethod, backupConfigs, orgBackupShare) {
|
|
159
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
if (
|
|
161
|
-
throw new Error('
|
|
143
|
+
if (clientBackupCipherText === '') {
|
|
144
|
+
throw new Error('clientBackupCipherText cannot be empty string.');
|
|
162
145
|
}
|
|
163
146
|
if (orgBackupShare === '') {
|
|
164
147
|
throw new Error('orgBackupShare cannot be empty string.');
|
|
165
148
|
}
|
|
166
149
|
const privateKey = yield this.mpc.eject({
|
|
167
|
-
cipherText:
|
|
150
|
+
cipherText: clientBackupCipherText,
|
|
168
151
|
backupMethod,
|
|
169
152
|
backupConfigs,
|
|
170
153
|
organizationBackupShare: orgBackupShare,
|
package/lib/esm/mpc/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { PortalMpcError } from './errors';
|
|
11
11
|
import { BackupMethods } from '../index';
|
|
12
|
-
const WEB_SDK_VERSION = '1.0.
|
|
12
|
+
const WEB_SDK_VERSION = '1.0.2';
|
|
13
13
|
class Mpc {
|
|
14
14
|
constructor({ portal }) {
|
|
15
15
|
this.configureIframe = () => {
|
|
@@ -23,6 +23,8 @@ class Mpc {
|
|
|
23
23
|
passkey: this.portal.passkeyConfig,
|
|
24
24
|
host: this.portal.host,
|
|
25
25
|
rpcUrl: this.portal.getRpcUrl(),
|
|
26
|
+
mpcHost: this.portal.mpcHost,
|
|
27
|
+
mpcVersion: this.portal.mpcVersion,
|
|
26
28
|
featureFlags: this.portal.featureFlags,
|
|
27
29
|
};
|
|
28
30
|
const message = {
|
|
@@ -275,51 +277,6 @@ class Mpc {
|
|
|
275
277
|
});
|
|
276
278
|
});
|
|
277
279
|
}
|
|
278
|
-
legacyRecover(data, progress = () => {
|
|
279
|
-
// Noop
|
|
280
|
-
}) {
|
|
281
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
282
|
-
return new Promise((resolve, reject) => {
|
|
283
|
-
const handleRecover = (message) => {
|
|
284
|
-
const { type, data } = message.data;
|
|
285
|
-
const { origin } = message;
|
|
286
|
-
// ignore any broadcast postMessages
|
|
287
|
-
if (origin !== this.getOrigin()) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
if (type === 'portal:wasm:legacyRecoverError') {
|
|
291
|
-
// Remove the event listeners
|
|
292
|
-
window.removeEventListener('message', handleRecover);
|
|
293
|
-
window.removeEventListener('message', handleProgress);
|
|
294
|
-
reject(new PortalMpcError(data));
|
|
295
|
-
}
|
|
296
|
-
else if (type === 'portal:wasm:legacyRecoverResult') {
|
|
297
|
-
// Remove the event listeners
|
|
298
|
-
window.removeEventListener('message', handleRecover);
|
|
299
|
-
window.removeEventListener('message', handleProgress);
|
|
300
|
-
resolve(data);
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
const handleProgress = (message) => {
|
|
304
|
-
const { type, data: status } = message.data;
|
|
305
|
-
const { origin } = message;
|
|
306
|
-
// ignore any broadcast postMessages
|
|
307
|
-
if (origin !== this.getOrigin()) {
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
if (type === 'portal:wasm:legacyRecoverProgress') {
|
|
311
|
-
void progress(status);
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
window.addEventListener('message', handleRecover);
|
|
315
|
-
window.addEventListener('message', handleProgress);
|
|
316
|
-
this.postMessage({
|
|
317
|
-
type: 'portal:wasm:legacyRecover',
|
|
318
|
-
data,
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
280
|
sign(data, progress = () => {
|
|
324
281
|
// Noop
|
|
325
282
|
}) {
|
|
@@ -259,11 +259,10 @@ class Provider {
|
|
|
259
259
|
case 'eth_signTypedData_v4':
|
|
260
260
|
case 'personal_sign': {
|
|
261
261
|
const result = yield this.portal.mpc.sign({
|
|
262
|
-
|
|
262
|
+
chainId: this.portal.chainId.toString(),
|
|
263
263
|
method,
|
|
264
|
-
mpcVersion: this.portal.mpcVersion,
|
|
265
264
|
params: this.buildParams(method, params),
|
|
266
|
-
|
|
265
|
+
rpcUrl: this.portal.getRpcUrl(),
|
|
267
266
|
});
|
|
268
267
|
return result;
|
|
269
268
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ class Portal {
|
|
|
33
33
|
public passkeyConfig?: PasskeyConfig
|
|
34
34
|
public host: string
|
|
35
35
|
public mpc: Mpc
|
|
36
|
+
public mpcHost: string
|
|
36
37
|
public mpcVersion: string
|
|
37
38
|
public provider: Provider
|
|
38
39
|
public ready = false
|
|
@@ -56,6 +57,7 @@ class Portal {
|
|
|
56
57
|
passkey,
|
|
57
58
|
host = 'web.portalhq.io',
|
|
58
59
|
mpcVersion = 'v6',
|
|
60
|
+
mpcHost = 'mpc-client.portalhq.io',
|
|
59
61
|
featureFlags = {
|
|
60
62
|
optimized: false,
|
|
61
63
|
},
|
|
@@ -67,6 +69,7 @@ class Portal {
|
|
|
67
69
|
this.chainId = chainId
|
|
68
70
|
this.gatewayConfig = gatewayConfig
|
|
69
71
|
this.host = host
|
|
72
|
+
this.mpcHost = mpcHost
|
|
70
73
|
this.mpcVersion = mpcVersion
|
|
71
74
|
this.featureFlags = featureFlags
|
|
72
75
|
|
|
@@ -205,31 +208,6 @@ class Portal {
|
|
|
205
208
|
return address
|
|
206
209
|
}
|
|
207
210
|
|
|
208
|
-
/**
|
|
209
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
210
|
-
* Use the `recoverWallet` method instead.
|
|
211
|
-
*/
|
|
212
|
-
public async legacyRecoverWallet(
|
|
213
|
-
cipherText: string,
|
|
214
|
-
progress: ProgressCallback = () => {
|
|
215
|
-
// Noop
|
|
216
|
-
},
|
|
217
|
-
): Promise<string> {
|
|
218
|
-
const recoveredCipherText = await this.mpc.legacyRecover(
|
|
219
|
-
{
|
|
220
|
-
cipherText,
|
|
221
|
-
host: this.host,
|
|
222
|
-
mpcVersion: this.mpcVersion,
|
|
223
|
-
featureFlags: this.featureFlags,
|
|
224
|
-
},
|
|
225
|
-
progress,
|
|
226
|
-
)
|
|
227
|
-
|
|
228
|
-
this.address = await this.mpc.getAddress()
|
|
229
|
-
|
|
230
|
-
return recoveredCipherText
|
|
231
|
-
}
|
|
232
|
-
|
|
233
211
|
public async provisionWallet(
|
|
234
212
|
cipherText: string,
|
|
235
213
|
backupMethod: BackupMethods,
|
|
@@ -242,13 +220,13 @@ class Portal {
|
|
|
242
220
|
}
|
|
243
221
|
|
|
244
222
|
public async ejectPrivateKey(
|
|
245
|
-
|
|
223
|
+
clientBackupCipherText: string,
|
|
246
224
|
backupMethod: BackupMethods,
|
|
247
225
|
backupConfigs: BackupConfigs,
|
|
248
226
|
orgBackupShare: string,
|
|
249
227
|
): Promise<string> {
|
|
250
|
-
if (
|
|
251
|
-
throw new Error('
|
|
228
|
+
if (clientBackupCipherText === '') {
|
|
229
|
+
throw new Error('clientBackupCipherText cannot be empty string.')
|
|
252
230
|
}
|
|
253
231
|
|
|
254
232
|
if (orgBackupShare === '') {
|
|
@@ -256,7 +234,7 @@ class Portal {
|
|
|
256
234
|
}
|
|
257
235
|
|
|
258
236
|
const privateKey = await this.mpc.eject({
|
|
259
|
-
cipherText:
|
|
237
|
+
cipherText: clientBackupCipherText,
|
|
260
238
|
backupMethod,
|
|
261
239
|
backupConfigs,
|
|
262
240
|
organizationBackupShare: orgBackupShare,
|
package/src/mpc/index.ts
CHANGED
|
@@ -9,7 +9,6 @@ import type {
|
|
|
9
9
|
EjectArgs,
|
|
10
10
|
GenerateArgs,
|
|
11
11
|
IframeConfigurationOptions,
|
|
12
|
-
LegacyRecoverArgs,
|
|
13
12
|
MpcOptions,
|
|
14
13
|
MpcStatus,
|
|
15
14
|
NFT,
|
|
@@ -26,7 +25,7 @@ import type {
|
|
|
26
25
|
WorkerResult,
|
|
27
26
|
} from '../../types'
|
|
28
27
|
|
|
29
|
-
const WEB_SDK_VERSION = '1.0.
|
|
28
|
+
const WEB_SDK_VERSION = '1.0.2'
|
|
30
29
|
|
|
31
30
|
class Mpc {
|
|
32
31
|
public iframe?: HTMLIFrameElement
|
|
@@ -329,61 +328,6 @@ class Mpc {
|
|
|
329
328
|
})
|
|
330
329
|
}
|
|
331
330
|
|
|
332
|
-
public async legacyRecover(
|
|
333
|
-
data: LegacyRecoverArgs,
|
|
334
|
-
progress: ProgressCallback = () => {
|
|
335
|
-
// Noop
|
|
336
|
-
},
|
|
337
|
-
): Promise<string> {
|
|
338
|
-
return new Promise((resolve, reject) => {
|
|
339
|
-
const handleRecover = (message: MessageEvent<WorkerResult>) => {
|
|
340
|
-
const { type, data } = message.data
|
|
341
|
-
const { origin } = message
|
|
342
|
-
|
|
343
|
-
// ignore any broadcast postMessages
|
|
344
|
-
if (origin !== this.getOrigin()) {
|
|
345
|
-
return
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
if (type === 'portal:wasm:legacyRecoverError') {
|
|
349
|
-
// Remove the event listeners
|
|
350
|
-
window.removeEventListener('message', handleRecover)
|
|
351
|
-
window.removeEventListener('message', handleProgress)
|
|
352
|
-
|
|
353
|
-
reject(new PortalMpcError(data as PortalError))
|
|
354
|
-
} else if (type === 'portal:wasm:legacyRecoverResult') {
|
|
355
|
-
// Remove the event listeners
|
|
356
|
-
window.removeEventListener('message', handleRecover)
|
|
357
|
-
window.removeEventListener('message', handleProgress)
|
|
358
|
-
|
|
359
|
-
resolve(data as string)
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
const handleProgress = (message: MessageEvent<WorkerResult>) => {
|
|
364
|
-
const { type, data: status } = message.data
|
|
365
|
-
const { origin } = message
|
|
366
|
-
|
|
367
|
-
// ignore any broadcast postMessages
|
|
368
|
-
if (origin !== this.getOrigin()) {
|
|
369
|
-
return
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
if (type === 'portal:wasm:legacyRecoverProgress') {
|
|
373
|
-
void progress(status as MpcStatus)
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
window.addEventListener('message', handleRecover)
|
|
378
|
-
window.addEventListener('message', handleProgress)
|
|
379
|
-
|
|
380
|
-
this.postMessage({
|
|
381
|
-
type: 'portal:wasm:legacyRecover',
|
|
382
|
-
data,
|
|
383
|
-
})
|
|
384
|
-
})
|
|
385
|
-
}
|
|
386
|
-
|
|
387
331
|
public async sign(
|
|
388
332
|
data: SignArgs,
|
|
389
333
|
progress: ProgressCallback = () => {
|
|
@@ -885,6 +829,8 @@ class Mpc {
|
|
|
885
829
|
passkey: this.portal.passkeyConfig,
|
|
886
830
|
host: this.portal.host,
|
|
887
831
|
rpcUrl: this.portal.getRpcUrl(),
|
|
832
|
+
mpcHost: this.portal.mpcHost,
|
|
833
|
+
mpcVersion: this.portal.mpcVersion,
|
|
888
834
|
featureFlags: this.portal.featureFlags,
|
|
889
835
|
}
|
|
890
836
|
|
package/src/provider/index.ts
CHANGED
|
@@ -303,11 +303,10 @@ class Provider {
|
|
|
303
303
|
case 'eth_signTypedData_v4':
|
|
304
304
|
case 'personal_sign': {
|
|
305
305
|
const result = await this.portal.mpc.sign({
|
|
306
|
-
|
|
306
|
+
chainId: this.portal.chainId.toString(),
|
|
307
307
|
method,
|
|
308
|
-
mpcVersion: this.portal.mpcVersion,
|
|
309
308
|
params: this.buildParams(method, params),
|
|
310
|
-
|
|
309
|
+
rpcUrl: this.portal.getRpcUrl(),
|
|
311
310
|
})
|
|
312
311
|
|
|
313
312
|
return result
|
package/types.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type ValidRpcErrorCodes = 4001 | 4100 | 4200 | 4900 | 4901
|
|
|
22
22
|
// Interfaces
|
|
23
23
|
|
|
24
24
|
export interface FeatureFlags {
|
|
25
|
+
isMultiBackupEnabled?: boolean
|
|
25
26
|
optimized: boolean = false
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -177,6 +178,15 @@ export interface DecryptResult {
|
|
|
177
178
|
error: PortalError
|
|
178
179
|
}
|
|
179
180
|
|
|
181
|
+
export interface EjectArgs extends RecoverArgs {
|
|
182
|
+
organizationBackupShare: string
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface EjectWorkerArgs extends MpcOperationArgs {
|
|
186
|
+
clientShare: string
|
|
187
|
+
organizationBackupShare: string
|
|
188
|
+
}
|
|
189
|
+
|
|
180
190
|
export interface GatewayConfig {
|
|
181
191
|
[key: number]: string
|
|
182
192
|
}
|
|
@@ -231,6 +241,8 @@ export interface IframeConfigurationOptions {
|
|
|
231
241
|
passkey?: PasskeyConfig
|
|
232
242
|
host: string
|
|
233
243
|
rpcUrl: string
|
|
244
|
+
mpcHost: string
|
|
245
|
+
mpcVersion: string
|
|
234
246
|
|
|
235
247
|
// One of these three is required for authentication
|
|
236
248
|
apiKey?: string
|
|
@@ -293,6 +305,14 @@ export interface NFTContract {
|
|
|
293
305
|
address: string
|
|
294
306
|
}
|
|
295
307
|
|
|
308
|
+
export interface PasskeyConfig {
|
|
309
|
+
relyingParty?: string = 'backup.web.portalhq.io'
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export interface PasskeyStatusResponse {
|
|
313
|
+
status: PasskeyStatus
|
|
314
|
+
}
|
|
315
|
+
|
|
296
316
|
export interface PedersonParams {
|
|
297
317
|
n: string
|
|
298
318
|
s: string
|
|
@@ -325,6 +345,7 @@ export interface PortalOptions {
|
|
|
325
345
|
gdrive?: GDriveConfig
|
|
326
346
|
passkey?: PasskeyConfig
|
|
327
347
|
host?: string
|
|
348
|
+
mpcHost?: string
|
|
328
349
|
keychain?: KeychainAdapter
|
|
329
350
|
mpcVersion?: string
|
|
330
351
|
featureFlags?: FeatureFlags
|
|
@@ -375,9 +396,6 @@ export interface RequestArguments {
|
|
|
375
396
|
params?: unknown[] | SigningRequestParams
|
|
376
397
|
}
|
|
377
398
|
|
|
378
|
-
export interface LegacyRecoverArgs extends MpcOperationArgs {
|
|
379
|
-
cipherText: string
|
|
380
|
-
}
|
|
381
399
|
export interface RecoverArgs extends MpcOperationArgs {
|
|
382
400
|
cipherText: string
|
|
383
401
|
backupMethod: BackupMethods
|
|
@@ -385,15 +403,6 @@ export interface RecoverArgs extends MpcOperationArgs {
|
|
|
385
403
|
featureFlags?: FeatureFlags // TODO: Remove this
|
|
386
404
|
}
|
|
387
405
|
|
|
388
|
-
export interface EjectArgs extends RecoverArgs {
|
|
389
|
-
organizationBackupShare: string
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
export interface EjectWorkerArgs extends MpcOperationArgs {
|
|
393
|
-
clientShare: string
|
|
394
|
-
organizationBackupShare: string
|
|
395
|
-
}
|
|
396
|
-
|
|
397
406
|
export interface RotateResult {
|
|
398
407
|
data: RotateData
|
|
399
408
|
error: PortalError
|
|
@@ -414,10 +423,11 @@ export interface RpcErrorOptions {
|
|
|
414
423
|
data?: unknown
|
|
415
424
|
}
|
|
416
425
|
|
|
417
|
-
export interface SignArgs
|
|
426
|
+
export interface SignArgs {
|
|
427
|
+
chainId: string
|
|
418
428
|
method: string
|
|
419
429
|
params: string
|
|
420
|
-
|
|
430
|
+
rpcUrl: string
|
|
421
431
|
}
|
|
422
432
|
|
|
423
433
|
export interface SignData {
|