@portal-hq/web 0.1.0 → 0.1.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.
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.BackupMethods = exports.MpcStatuses = exports.MpcErrorCodes = exports.MpcError = void 0;
15
+ exports.GetTransactionsOrder = exports.BackupMethods = exports.MpcStatuses = exports.MpcErrorCodes = exports.MpcError = void 0;
16
16
  const mpc_1 = __importDefault(require("./mpc"));
17
17
  const provider_1 = __importDefault(require("./provider"));
18
18
  class Portal {
@@ -20,7 +20,7 @@ class Portal {
20
20
  // Required
21
21
  gatewayConfig,
22
22
  // Optional
23
- apiKey, authToken, authUrl, autoApprove = false, chainId = 1, gdrive, host = 'web.portalhq.io', mpcVersion = 'v5', featureFlags = {
23
+ apiKey, authToken, authUrl, autoApprove = false, chainId = 1, gdrive, passkey, host = 'web.portalhq.io', mpcVersion = 'v5', featureFlags = {
24
24
  optimized: false,
25
25
  }, }) {
26
26
  this.ready = false;
@@ -38,6 +38,9 @@ class Portal {
38
38
  if (gdrive) {
39
39
  this.gDriveConfig = gdrive;
40
40
  }
41
+ else if (passkey) {
42
+ this.passkeyConfig = passkey;
43
+ }
41
44
  this.mpc = new mpc_1.default({
42
45
  portal: this,
43
46
  });
@@ -117,7 +120,7 @@ class Portal {
117
120
  return cipherText;
118
121
  });
119
122
  }
120
- recoverWallet(cipherText, backupMethod, backupConfigs, progress = () => {
123
+ recoverWallet(cipherText, backupMethod, backupConfigs = {}, progress = () => {
121
124
  // Noop
122
125
  }) {
123
126
  return __awaiter(this, void 0, void 0, function* () {
@@ -129,6 +132,7 @@ class Portal {
129
132
  mpcVersion: this.mpcVersion,
130
133
  featureFlags: this.featureFlags,
131
134
  }, progress);
135
+ this.address = address;
132
136
  return address;
133
137
  });
134
138
  }
@@ -374,5 +378,11 @@ var BackupMethods;
374
378
  (function (BackupMethods) {
375
379
  BackupMethods["gdrive"] = "GDRIVE";
376
380
  BackupMethods["password"] = "PASSWORD";
381
+ BackupMethods["passkey"] = "PASSKEY";
377
382
  })(BackupMethods = exports.BackupMethods || (exports.BackupMethods = {}));
383
+ var GetTransactionsOrder;
384
+ (function (GetTransactionsOrder) {
385
+ GetTransactionsOrder["ASC"] = "asc";
386
+ GetTransactionsOrder["DESC"] = "desc";
387
+ })(GetTransactionsOrder = exports.GetTransactionsOrder || (exports.GetTransactionsOrder = {}));
378
388
  exports.default = Portal;
@@ -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 = '0.1.0';
15
+ const WEB_SDK_VERSION = '0.1.2';
16
16
  class Mpc {
17
17
  constructor({ portal }) {
18
18
  this.configureIframe = () => {
@@ -23,6 +23,7 @@ class Mpc {
23
23
  autoApprove: this.portal.autoApprove,
24
24
  chainId: this.portal.chainId,
25
25
  gdrive: this.portal.gDriveConfig,
26
+ passkey: this.portal.passkeyConfig,
26
27
  host: this.portal.host,
27
28
  rpcUrl: this.portal.getRpcUrl(),
28
29
  featureFlags: this.portal.featureFlags,
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, host = 'web.portalhq.io', mpcVersion = 'v5', featureFlags = {
17
+ apiKey, authToken, authUrl, autoApprove = false, chainId = 1, gdrive, passkey, host = 'web.portalhq.io', mpcVersion = 'v5', featureFlags = {
18
18
  optimized: false,
19
19
  }, }) {
20
20
  this.ready = false;
@@ -32,6 +32,9 @@ class Portal {
32
32
  if (gdrive) {
33
33
  this.gDriveConfig = gdrive;
34
34
  }
35
+ else if (passkey) {
36
+ this.passkeyConfig = passkey;
37
+ }
35
38
  this.mpc = new Mpc({
36
39
  portal: this,
37
40
  });
@@ -111,7 +114,7 @@ class Portal {
111
114
  return cipherText;
112
115
  });
113
116
  }
114
- recoverWallet(cipherText, backupMethod, backupConfigs, progress = () => {
117
+ recoverWallet(cipherText, backupMethod, backupConfigs = {}, progress = () => {
115
118
  // Noop
116
119
  }) {
117
120
  return __awaiter(this, void 0, void 0, function* () {
@@ -123,6 +126,7 @@ class Portal {
123
126
  mpcVersion: this.mpcVersion,
124
127
  featureFlags: this.featureFlags,
125
128
  }, progress);
129
+ this.address = address;
126
130
  return address;
127
131
  });
128
132
  }
@@ -366,5 +370,11 @@ export var BackupMethods;
366
370
  (function (BackupMethods) {
367
371
  BackupMethods["gdrive"] = "GDRIVE";
368
372
  BackupMethods["password"] = "PASSWORD";
373
+ BackupMethods["passkey"] = "PASSKEY";
369
374
  })(BackupMethods || (BackupMethods = {}));
375
+ export var GetTransactionsOrder;
376
+ (function (GetTransactionsOrder) {
377
+ GetTransactionsOrder["ASC"] = "asc";
378
+ GetTransactionsOrder["DESC"] = "desc";
379
+ })(GetTransactionsOrder || (GetTransactionsOrder = {}));
370
380
  export default Portal;
@@ -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 = '0.1.0';
12
+ const WEB_SDK_VERSION = '0.1.2';
13
13
  class Mpc {
14
14
  constructor({ portal }) {
15
15
  this.configureIframe = () => {
@@ -20,6 +20,7 @@ class Mpc {
20
20
  autoApprove: this.portal.autoApprove,
21
21
  chainId: this.portal.chainId,
22
22
  gdrive: this.portal.gDriveConfig,
23
+ passkey: this.portal.passkeyConfig,
23
24
  host: this.portal.host,
24
25
  rpcUrl: this.portal.getRpcUrl(),
25
26
  featureFlags: this.portal.featureFlags,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Portal MPC Support for Web",
4
4
  "author": "Portal Labs, Inc.",
5
5
  "homepage": "https://portalhq.io/",
6
- "version": "0.1.0",
6
+ "version": "0.1.2",
7
7
  "license": "MIT",
8
8
  "main": "lib/commonjs/index",
9
9
  "module": "lib/esm/index",
package/src/index.ts CHANGED
@@ -6,9 +6,9 @@ import type {
6
6
  FeatureFlags,
7
7
  GDriveConfig,
8
8
  GatewayLike,
9
- GetTransactionsOrder,
10
9
  NFT,
11
10
  PortalOptions,
11
+ PasskeyConfig,
12
12
  ProgressCallback,
13
13
  QuoteArgs,
14
14
  QuoteResponse,
@@ -28,6 +28,7 @@ class Portal {
28
28
  public autoApprove: boolean
29
29
  public chainId: number
30
30
  public gDriveConfig?: GDriveConfig
31
+ public passkeyConfig?: PasskeyConfig
31
32
  public host: string
32
33
  public mpc: Mpc
33
34
  public mpcVersion: string
@@ -50,6 +51,7 @@ class Portal {
50
51
  autoApprove = false,
51
52
  chainId = 1,
52
53
  gdrive,
54
+ passkey,
53
55
  host = 'web.portalhq.io',
54
56
  mpcVersion = 'v5',
55
57
  featureFlags = {
@@ -68,6 +70,8 @@ class Portal {
68
70
 
69
71
  if (gdrive) {
70
72
  this.gDriveConfig = gdrive
73
+ } else if (passkey) {
74
+ this.passkeyConfig = passkey
71
75
  }
72
76
 
73
77
  this.mpc = new Mpc({
@@ -176,7 +180,7 @@ class Portal {
176
180
  public async recoverWallet(
177
181
  cipherText: string,
178
182
  backupMethod: BackupMethods,
179
- backupConfigs: BackupConfigs,
183
+ backupConfigs: BackupConfigs = {},
180
184
  progress: ProgressCallback = () => {
181
185
  // Noop
182
186
  },
@@ -193,6 +197,8 @@ class Portal {
193
197
  progress,
194
198
  )
195
199
 
200
+ this.address = address
201
+
196
202
  return address
197
203
  }
198
204
 
@@ -469,6 +475,12 @@ export enum MpcStatuses {
469
475
  export enum BackupMethods {
470
476
  gdrive = 'GDRIVE',
471
477
  password = 'PASSWORD',
478
+ passkey = 'PASSKEY',
479
+ }
480
+
481
+ export enum GetTransactionsOrder {
482
+ ASC = 'asc',
483
+ DESC = 'desc',
472
484
  }
473
485
 
474
486
  export default Portal
package/src/mpc/index.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  import { PortalMpcError } from './errors'
2
2
 
3
- import Portal, { BackupMethods } from '../index'
3
+ import Portal, { BackupMethods, GetTransactionsOrder } from '../index'
4
4
  import type {
5
5
  BackupArgs,
6
6
  Balance,
7
7
  ClientWithCustodianData,
8
8
  EjectArgs,
9
9
  GenerateArgs,
10
- GetTransactionsOrder,
11
10
  IframeConfigurationOptions,
12
11
  LegacyRecoverArgs,
13
12
  MpcOptions,
@@ -25,7 +24,7 @@ import type {
25
24
  WorkerResult,
26
25
  } from '../../types'
27
26
 
28
- const WEB_SDK_VERSION = '0.1.0'
27
+ const WEB_SDK_VERSION = '0.1.2'
29
28
 
30
29
  class Mpc {
31
30
  public iframe?: HTMLIFrameElement
@@ -801,6 +800,7 @@ class Mpc {
801
800
  autoApprove: this.portal.autoApprove,
802
801
  chainId: this.portal.chainId,
803
802
  gdrive: this.portal.gDriveConfig,
803
+ passkey: this.portal.passkeyConfig,
804
804
  host: this.portal.host,
805
805
  rpcUrl: this.portal.getRpcUrl(),
806
806
  featureFlags: this.portal.featureFlags,
package/types.d.ts CHANGED
@@ -18,7 +18,7 @@ export type MessageData =
18
18
  | SignArgs
19
19
  export type ProgressCallback = (status: MpcStatus) => void | Promise<void>
20
20
  export type ValidRpcErrorCodes = 4001 | 4100 | 4200 | 4900 | 4901
21
-
21
+ export type PasskeyConfig = PasskeyConfig
22
22
  // Interfaces
23
23
 
24
24
  export interface FeatureFlags {
@@ -178,6 +178,14 @@ export interface GDriveStorageOptions {
178
178
 
179
179
  export type GenerateArgs = MpcOperationArgs
180
180
 
181
+ export interface PasskeyConfig {
182
+ relyingParty?: string = 'backup.web.portalhq.io'
183
+ }
184
+
185
+ export interface PasskeyStatusResponse {
186
+ status: PasskeyStatus
187
+ }
188
+
181
189
  export interface GenerateData {
182
190
  address: string
183
191
  dkgResult: DkgData
@@ -199,6 +207,7 @@ export interface IframeConfigurationOptions {
199
207
  chainId: number
200
208
  featureFlags?: FeatureFlags
201
209
  gdrive?: GDriveConfig
210
+ passkey?: PasskeyConfig
202
211
  host: string
203
212
  rpcUrl: string
204
213
 
@@ -293,6 +302,7 @@ export interface PortalOptions {
293
302
  autoApprove?: boolean
294
303
  chainId?: number
295
304
  gdrive?: GDriveConfig
305
+ passkey?: PasskeyConfig
296
306
  host?: string
297
307
  keychain?: KeychainAdapter
298
308
  mpcVersion?: string
@@ -438,11 +448,6 @@ export interface SimulatedTransaction {
438
448
  requestError?: SimulatedTransactionError
439
449
  }
440
450
 
441
- export enum GetTransactionsOrder {
442
- ASC = 'asc',
443
- DESC = 'desc',
444
- }
445
-
446
451
  export interface Transaction {
447
452
  asset: string
448
453
  blockNum: string