@getpara/user-management-client 2.0.0-fc.3 → 2.1.0

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.
@@ -132,9 +132,13 @@ class Client {
132
132
  });
133
133
  return res.data;
134
134
  });
135
- this.verifyTelegram = (authObject) => __async(this, null, function* () {
135
+ this.verifyTelegram = (_0) => __async(this, [_0], function* ({
136
+ authObject,
137
+ sessionLookupId
138
+ }) {
136
139
  return (yield this.baseRequest.post("/users/telegram/v2", {
137
- authObject
140
+ authObject,
141
+ sessionLookupId
138
142
  })).data;
139
143
  });
140
144
  this.verifyOAuth = () => __async(this, null, function* () {
@@ -143,16 +147,28 @@ class Client {
143
147
  });
144
148
  this.loginExternalWallet = (_0) => __async(this, [_0], function* ({
145
149
  externalWallet,
146
- shouldTrackUser
150
+ shouldTrackUser,
151
+ chainId,
152
+ uri
147
153
  }) {
148
154
  const res = yield this.baseRequest.post(`/users/external-wallets/login/v2`, {
149
155
  externalWallet,
150
- shouldTrackUser
156
+ shouldTrackUser,
157
+ chainId,
158
+ uri
151
159
  });
152
160
  return res.data;
153
161
  });
154
- this.verifyNewAccount = (userId, body) => __async(this, null, function* () {
155
- const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
162
+ this.verifyAccount = (userId, body) => __async(this, null, function* () {
163
+ const res = yield this.baseRequest.post(
164
+ `/users/${userId}/verify`,
165
+ body
166
+ );
167
+ return res.data;
168
+ });
169
+ // POST /users/send-login-code
170
+ this.sendLoginVerificationCode = (auth, isRecovery) => __async(this, null, function* () {
171
+ const res = yield this.baseRequest.post(`/users/send-login-code`, __spreadProps(__spreadValues({}, auth), { isRecovery }));
156
172
  return res.data;
157
173
  });
158
174
  this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
@@ -212,7 +228,10 @@ class Client {
212
228
  return res;
213
229
  });
214
230
  this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
215
- const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify/v2`, body);
231
+ const res = yield this.baseRequest.post(
232
+ `/users/${userId}/external-wallets/verify/v2`,
233
+ body
234
+ );
216
235
  return res.data;
217
236
  });
218
237
  // POST /users/:userId/biometrics/key
@@ -258,11 +277,36 @@ class Client {
258
277
  const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
259
278
  return res.data;
260
279
  });
261
- // GET /session/origin
280
+ // POST /sessions/portal-verification
281
+ this.sessionAddPortalVerification = () => __async(this, null, function* () {
282
+ const res = yield this.baseRequest.post(`/sessions/portal-verification`);
283
+ return res.data;
284
+ });
285
+ // GET /sessions/:sessionLookupId/origin
262
286
  this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
263
287
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
264
288
  return res.data;
265
289
  });
290
+ // GET /sessions/:sessionLookupId/login-method
291
+ this.sessionLoginMethod = (sessionLookupId) => __async(this, null, function* () {
292
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/login-method`);
293
+ return res.data;
294
+ });
295
+ // GET /sessions/:sessionLookupId/auth-verified
296
+ this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
297
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
298
+ return res.data;
299
+ });
300
+ // GET /sessions/:sessionLookupId/auth
301
+ this.sessionAuth = (sessionLookupId) => __async(this, null, function* () {
302
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth`);
303
+ return res.data;
304
+ });
305
+ // GET /sessions/:sessionLookupId/siwe-message
306
+ this.sessionSIWEMessage = (sessionLookupId) => __async(this, null, function* () {
307
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/siwe-message`);
308
+ return res.data;
309
+ });
266
310
  // POST /biometrics/verify
267
311
  this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
268
312
  const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
@@ -419,12 +463,112 @@ class Client {
419
463
  const res = yield this.baseRequest.post(`/auth/jwt`, { keyIndex });
420
464
  return res.data;
421
465
  });
466
+ this.getProfileBalance = (_0) => __async(this, [_0], function* ({
467
+ config,
468
+ wallets,
469
+ refetch
470
+ }) {
471
+ const res = yield this.baseRequest.post(`/assets/balances`, {
472
+ config: __spreadProps(__spreadValues({}, config != null ? config : { displayType: "AGGREGATED" }), { isComprehensive: true }),
473
+ wallets,
474
+ refetch
475
+ });
476
+ return res.data;
477
+ });
478
+ this.getAssetInfo = () => __async(this, null, function* () {
479
+ const res = yield this.baseRequest.get(`/assets`);
480
+ return res.data;
481
+ });
422
482
  this.trackError = (opts) => __async(this, null, function* () {
423
483
  yield this.baseRequest.post("/errors/sdk", opts);
424
484
  });
425
485
  this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
426
486
  yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
427
487
  });
488
+ // ENCLAVE METHODS
489
+ /**
490
+ * Get the enclave's public key for encryption
491
+ */
492
+ this.getEnclavePublicKey = () => __async(this, null, function* () {
493
+ const res = yield this.baseRequest.get(
494
+ "/enclave/public-key"
495
+ );
496
+ return res.data;
497
+ });
498
+ /**
499
+ * Persist encrypted key shares to the enclave
500
+ * @param encryptedPayload JSON string containing the encrypted ECIES payload
501
+ */
502
+ this.persistEnclaveShares = (_0) => __async(this, [_0], function* ({
503
+ encryptedPayload,
504
+ hasNoShares
505
+ }) {
506
+ const body = { encryptedPayload, hasNoShares };
507
+ const res = yield this.baseRequest.post("/enclave/key-shares", body);
508
+ return res.data;
509
+ });
510
+ /**
511
+ * Retrieve encrypted key shares from the enclave
512
+ * @param encryptedPayload JSON string containing the encrypted ECIES query
513
+ */
514
+ this.retrieveEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
515
+ const res = yield this.baseRequest.get(
516
+ `/enclave/key-shares?encryptedPayload=${encodeURIComponent(encryptedPayload)}`
517
+ );
518
+ return res.data;
519
+ });
520
+ this.issueEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
521
+ const res = yield this.baseRequest.post(`/enclave/jwt/issue`, { encryptedPayload });
522
+ return res.data;
523
+ });
524
+ this.refreshEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
525
+ const res = yield this.baseRequest.post(`/enclave/jwt/refresh`, { encryptedPayload });
526
+ return res.data;
527
+ });
528
+ this.deleteEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
529
+ const res = yield this.baseRequest.delete(`/enclave/key-shares`, {
530
+ data: { encryptedPayload }
531
+ });
532
+ return res.data;
533
+ });
534
+ this.getUserPreferences = (userId) => __async(this, null, function* () {
535
+ const res = yield this.baseRequest.get(`/users/${userId}/preferences`);
536
+ return res.data;
537
+ });
538
+ this.updateUserPreferences = (userId, preferences) => __async(this, null, function* () {
539
+ const res = yield this.baseRequest.patch(`/users/${userId}/preferences`, { preferences });
540
+ return res.data;
541
+ });
542
+ this.estimateSendTransaction = (_0) => __async(this, [_0], function* ({
543
+ userId,
544
+ walletId,
545
+ opts
546
+ }) {
547
+ const res = yield this.baseRequest.post(
548
+ `/users/${userId}/wallets/${walletId}/transactions/estimate`,
549
+ opts
550
+ );
551
+ return res.data;
552
+ });
553
+ this.broadcastSendTransaction = (_0) => __async(this, [_0], function* ({
554
+ userId,
555
+ walletId,
556
+ opts
557
+ }) {
558
+ const res = yield this.baseRequest.post(
559
+ `/users/${userId}/wallets/${walletId}/transactions/broadcast`,
560
+ opts
561
+ );
562
+ return res.data;
563
+ });
564
+ this.trackExternalWalletConnections = (_0) => __async(this, [_0], function* ({
565
+ wallets
566
+ }) {
567
+ const res = yield this.baseRequest.post("/users/external-wallets/track-connections", {
568
+ wallets
569
+ });
570
+ return { success: res.data.success };
571
+ });
428
572
  const headers = __spreadValues(__spreadValues({}, apiKey && { [import_consts.API_KEY_HEADER_NAME]: apiKey }), partnerId && { [import_consts.PARTNER_ID_HEADER_NAME]: partnerId });
429
573
  const axiosConfig = {
430
574
  baseURL: userManagementHost,
@@ -600,8 +744,8 @@ class Client {
600
744
  });
601
745
  }
602
746
  getFarcasterAuthStatus() {
603
- return __async(this, null, function* () {
604
- const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`);
747
+ return __async(this, arguments, function* ({ sessionLookupId } = {}) {
748
+ const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`, { sessionLookupId });
605
749
  return res.data;
606
750
  });
607
751
  }
@@ -911,6 +1055,17 @@ class Client {
911
1055
  return res.data;
912
1056
  });
913
1057
  }
1058
+ getSupportedAuthMethodsV2(auth) {
1059
+ return __async(this, null, function* () {
1060
+ const res = yield this.baseRequest.get(
1061
+ "/users/supported-auth-methods/v2",
1062
+ {
1063
+ params: __spreadValues({}, auth)
1064
+ }
1065
+ );
1066
+ return res.data;
1067
+ });
1068
+ }
914
1069
  getPasswords(auth) {
915
1070
  return __async(this, null, function* () {
916
1071
  const res = yield this.baseRequest.get("/users/passwords", {
@@ -930,9 +1085,9 @@ class Client {
930
1085
  return res;
931
1086
  });
932
1087
  }
933
- getEncryptedWalletPrivateKey(passwordId) {
1088
+ getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
934
1089
  return __async(this, null, function* () {
935
- const query = new URLSearchParams({ passwordId }).toString();
1090
+ const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
936
1091
  const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
937
1092
  return res;
938
1093
  });
package/dist/cjs/index.js CHANGED
@@ -32,15 +32,15 @@ __export(src_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(src_exports);
34
34
  __reExport(src_exports, require("./client.js"), module.exports);
35
- __reExport(src_exports, require("./types/index.js"), module.exports);
36
35
  __reExport(src_exports, require("./utils.js"), module.exports);
37
36
  __reExport(src_exports, require("./error.js"), module.exports);
37
+ __reExport(src_exports, require("@getpara/shared"), module.exports);
38
38
  var import_client = __toESM(require("./client.js"));
39
39
  var src_default = import_client.default;
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
42
  ...require("./client.js"),
43
- ...require("./types/index.js"),
44
43
  ...require("./utils.js"),
45
- ...require("./error.js")
44
+ ...require("./error.js"),
45
+ ...require("@getpara/shared")
46
46
  });
@@ -55,9 +55,13 @@ class Client {
55
55
  });
56
56
  return res.data;
57
57
  });
58
- this.verifyTelegram = (authObject) => __async(this, null, function* () {
58
+ this.verifyTelegram = (_0) => __async(this, [_0], function* ({
59
+ authObject,
60
+ sessionLookupId
61
+ }) {
59
62
  return (yield this.baseRequest.post("/users/telegram/v2", {
60
- authObject
63
+ authObject,
64
+ sessionLookupId
61
65
  })).data;
62
66
  });
63
67
  this.verifyOAuth = () => __async(this, null, function* () {
@@ -66,16 +70,28 @@ class Client {
66
70
  });
67
71
  this.loginExternalWallet = (_0) => __async(this, [_0], function* ({
68
72
  externalWallet,
69
- shouldTrackUser
73
+ shouldTrackUser,
74
+ chainId,
75
+ uri
70
76
  }) {
71
77
  const res = yield this.baseRequest.post(`/users/external-wallets/login/v2`, {
72
78
  externalWallet,
73
- shouldTrackUser
79
+ shouldTrackUser,
80
+ chainId,
81
+ uri
74
82
  });
75
83
  return res.data;
76
84
  });
77
- this.verifyNewAccount = (userId, body) => __async(this, null, function* () {
78
- const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
85
+ this.verifyAccount = (userId, body) => __async(this, null, function* () {
86
+ const res = yield this.baseRequest.post(
87
+ `/users/${userId}/verify`,
88
+ body
89
+ );
90
+ return res.data;
91
+ });
92
+ // POST /users/send-login-code
93
+ this.sendLoginVerificationCode = (auth, isRecovery) => __async(this, null, function* () {
94
+ const res = yield this.baseRequest.post(`/users/send-login-code`, __spreadProps(__spreadValues({}, auth), { isRecovery }));
79
95
  return res.data;
80
96
  });
81
97
  this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
@@ -135,7 +151,10 @@ class Client {
135
151
  return res;
136
152
  });
137
153
  this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
138
- const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify/v2`, body);
154
+ const res = yield this.baseRequest.post(
155
+ `/users/${userId}/external-wallets/verify/v2`,
156
+ body
157
+ );
139
158
  return res.data;
140
159
  });
141
160
  // POST /users/:userId/biometrics/key
@@ -181,11 +200,36 @@ class Client {
181
200
  const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
182
201
  return res.data;
183
202
  });
184
- // GET /session/origin
203
+ // POST /sessions/portal-verification
204
+ this.sessionAddPortalVerification = () => __async(this, null, function* () {
205
+ const res = yield this.baseRequest.post(`/sessions/portal-verification`);
206
+ return res.data;
207
+ });
208
+ // GET /sessions/:sessionLookupId/origin
185
209
  this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
186
210
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
187
211
  return res.data;
188
212
  });
213
+ // GET /sessions/:sessionLookupId/login-method
214
+ this.sessionLoginMethod = (sessionLookupId) => __async(this, null, function* () {
215
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/login-method`);
216
+ return res.data;
217
+ });
218
+ // GET /sessions/:sessionLookupId/auth-verified
219
+ this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
220
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
221
+ return res.data;
222
+ });
223
+ // GET /sessions/:sessionLookupId/auth
224
+ this.sessionAuth = (sessionLookupId) => __async(this, null, function* () {
225
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth`);
226
+ return res.data;
227
+ });
228
+ // GET /sessions/:sessionLookupId/siwe-message
229
+ this.sessionSIWEMessage = (sessionLookupId) => __async(this, null, function* () {
230
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/siwe-message`);
231
+ return res.data;
232
+ });
189
233
  // POST /biometrics/verify
190
234
  this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
191
235
  const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
@@ -342,12 +386,112 @@ class Client {
342
386
  const res = yield this.baseRequest.post(`/auth/jwt`, { keyIndex });
343
387
  return res.data;
344
388
  });
389
+ this.getProfileBalance = (_0) => __async(this, [_0], function* ({
390
+ config,
391
+ wallets,
392
+ refetch
393
+ }) {
394
+ const res = yield this.baseRequest.post(`/assets/balances`, {
395
+ config: __spreadProps(__spreadValues({}, config != null ? config : { displayType: "AGGREGATED" }), { isComprehensive: true }),
396
+ wallets,
397
+ refetch
398
+ });
399
+ return res.data;
400
+ });
401
+ this.getAssetInfo = () => __async(this, null, function* () {
402
+ const res = yield this.baseRequest.get(`/assets`);
403
+ return res.data;
404
+ });
345
405
  this.trackError = (opts) => __async(this, null, function* () {
346
406
  yield this.baseRequest.post("/errors/sdk", opts);
347
407
  });
348
408
  this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
349
409
  yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
350
410
  });
411
+ // ENCLAVE METHODS
412
+ /**
413
+ * Get the enclave's public key for encryption
414
+ */
415
+ this.getEnclavePublicKey = () => __async(this, null, function* () {
416
+ const res = yield this.baseRequest.get(
417
+ "/enclave/public-key"
418
+ );
419
+ return res.data;
420
+ });
421
+ /**
422
+ * Persist encrypted key shares to the enclave
423
+ * @param encryptedPayload JSON string containing the encrypted ECIES payload
424
+ */
425
+ this.persistEnclaveShares = (_0) => __async(this, [_0], function* ({
426
+ encryptedPayload,
427
+ hasNoShares
428
+ }) {
429
+ const body = { encryptedPayload, hasNoShares };
430
+ const res = yield this.baseRequest.post("/enclave/key-shares", body);
431
+ return res.data;
432
+ });
433
+ /**
434
+ * Retrieve encrypted key shares from the enclave
435
+ * @param encryptedPayload JSON string containing the encrypted ECIES query
436
+ */
437
+ this.retrieveEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
438
+ const res = yield this.baseRequest.get(
439
+ `/enclave/key-shares?encryptedPayload=${encodeURIComponent(encryptedPayload)}`
440
+ );
441
+ return res.data;
442
+ });
443
+ this.issueEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
444
+ const res = yield this.baseRequest.post(`/enclave/jwt/issue`, { encryptedPayload });
445
+ return res.data;
446
+ });
447
+ this.refreshEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
448
+ const res = yield this.baseRequest.post(`/enclave/jwt/refresh`, { encryptedPayload });
449
+ return res.data;
450
+ });
451
+ this.deleteEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
452
+ const res = yield this.baseRequest.delete(`/enclave/key-shares`, {
453
+ data: { encryptedPayload }
454
+ });
455
+ return res.data;
456
+ });
457
+ this.getUserPreferences = (userId) => __async(this, null, function* () {
458
+ const res = yield this.baseRequest.get(`/users/${userId}/preferences`);
459
+ return res.data;
460
+ });
461
+ this.updateUserPreferences = (userId, preferences) => __async(this, null, function* () {
462
+ const res = yield this.baseRequest.patch(`/users/${userId}/preferences`, { preferences });
463
+ return res.data;
464
+ });
465
+ this.estimateSendTransaction = (_0) => __async(this, [_0], function* ({
466
+ userId,
467
+ walletId,
468
+ opts
469
+ }) {
470
+ const res = yield this.baseRequest.post(
471
+ `/users/${userId}/wallets/${walletId}/transactions/estimate`,
472
+ opts
473
+ );
474
+ return res.data;
475
+ });
476
+ this.broadcastSendTransaction = (_0) => __async(this, [_0], function* ({
477
+ userId,
478
+ walletId,
479
+ opts
480
+ }) {
481
+ const res = yield this.baseRequest.post(
482
+ `/users/${userId}/wallets/${walletId}/transactions/broadcast`,
483
+ opts
484
+ );
485
+ return res.data;
486
+ });
487
+ this.trackExternalWalletConnections = (_0) => __async(this, [_0], function* ({
488
+ wallets
489
+ }) {
490
+ const res = yield this.baseRequest.post("/users/external-wallets/track-connections", {
491
+ wallets
492
+ });
493
+ return { success: res.data.success };
494
+ });
351
495
  const headers = __spreadValues(__spreadValues({}, apiKey && { [API_KEY_HEADER_NAME]: apiKey }), partnerId && { [PARTNER_ID_HEADER_NAME]: partnerId });
352
496
  const axiosConfig = {
353
497
  baseURL: userManagementHost,
@@ -523,8 +667,8 @@ class Client {
523
667
  });
524
668
  }
525
669
  getFarcasterAuthStatus() {
526
- return __async(this, null, function* () {
527
- const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`);
670
+ return __async(this, arguments, function* ({ sessionLookupId } = {}) {
671
+ const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`, { sessionLookupId });
528
672
  return res.data;
529
673
  });
530
674
  }
@@ -834,6 +978,17 @@ class Client {
834
978
  return res.data;
835
979
  });
836
980
  }
981
+ getSupportedAuthMethodsV2(auth) {
982
+ return __async(this, null, function* () {
983
+ const res = yield this.baseRequest.get(
984
+ "/users/supported-auth-methods/v2",
985
+ {
986
+ params: __spreadValues({}, auth)
987
+ }
988
+ );
989
+ return res.data;
990
+ });
991
+ }
837
992
  getPasswords(auth) {
838
993
  return __async(this, null, function* () {
839
994
  const res = yield this.baseRequest.get("/users/passwords", {
@@ -853,9 +1008,9 @@ class Client {
853
1008
  return res;
854
1009
  });
855
1010
  }
856
- getEncryptedWalletPrivateKey(passwordId) {
1011
+ getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
857
1012
  return __async(this, null, function* () {
858
- const query = new URLSearchParams({ passwordId }).toString();
1013
+ const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
859
1014
  const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
860
1015
  return res;
861
1016
  });
package/dist/esm/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import "./chunk-BBZEL7EG.js";
2
2
  export * from "./client.js";
3
- export * from "./types/index.js";
4
3
  export * from "./utils.js";
5
4
  export * from "./error.js";
5
+ export * from "@getpara/shared";
6
6
  import Client from "./client.js";
7
7
  var src_default = Client;
8
8
  export {