@getpara/user-management-client 2.0.0-alpha.7 → 2.0.0-alpha.70

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.
@@ -130,11 +130,15 @@ class Client {
130
130
  const res = yield this.baseRequest.get("/users/exists", {
131
131
  params: __spreadValues({}, auth)
132
132
  });
133
- return res;
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,69 @@ 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 }));
172
+ return res.data;
173
+ });
174
+ this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
175
+ userId,
176
+ withMetadata = false
177
+ }) {
178
+ const res = yield this.baseRequest.get(
179
+ `/users/${userId}/linked-accounts`,
180
+ ...withMetadata ? [
181
+ {
182
+ params: { withMetadata }
183
+ }
184
+ ] : []
185
+ );
186
+ return { accounts: (0, import_utils.fromLinkedAccounts)(res.data.accounts) };
187
+ });
188
+ this.linkAccount = (_a) => __async(this, null, function* () {
189
+ var _b = _a, { userId } = _b, opts = __objRest(_b, ["userId"]);
190
+ const res = yield this.baseRequest.post(`/users/${userId}/linked-accounts`, opts);
191
+ return res.data;
192
+ });
193
+ this.verifyLink = (_c) => __async(this, null, function* () {
194
+ var _d = _c, {
195
+ linkedAccountId,
196
+ userId
197
+ } = _d, opts = __objRest(_d, [
198
+ "linkedAccountId",
199
+ "userId"
200
+ ]);
201
+ const res = yield this.baseRequest.post(
202
+ `/users/${userId}/linked-accounts/${linkedAccountId}/verify`,
203
+ opts
204
+ );
205
+ if ("isConflict" in res.data) {
206
+ return res.data;
207
+ }
208
+ const { accounts } = res.data;
209
+ return { accounts: (0, import_utils.fromLinkedAccounts)(accounts) };
210
+ });
211
+ this.unlinkAccount = (_0) => __async(this, [_0], function* ({ linkedAccountId, userId }) {
212
+ const res = yield this.baseRequest.delete(`/users/${userId}/linked-accounts/${linkedAccountId}`);
156
213
  return res.data;
157
214
  });
158
215
  // POST /users/:userId/verify-email
@@ -171,7 +228,10 @@ class Client {
171
228
  return res;
172
229
  });
173
230
  this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
174
- 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
+ );
175
235
  return res.data;
176
236
  });
177
237
  // POST /users/:userId/biometrics/key
@@ -217,11 +277,36 @@ class Client {
217
277
  const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
218
278
  return res.data;
219
279
  });
220
- // 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
221
286
  this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
222
287
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
223
288
  return res.data;
224
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
+ });
225
310
  // POST /biometrics/verify
226
311
  this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
227
312
  const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
@@ -334,8 +419,8 @@ class Client {
334
419
  const res = yield this.baseRequest.post("/recovery", body);
335
420
  return res;
336
421
  });
337
- this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc) => __async(this, null, function* () {
338
- const body = { message, scheme, cosmosSignDoc };
422
+ this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc, protocolId) => __async(this, null, function* () {
423
+ const body = { message, scheme, cosmosSignDoc, protocolId };
339
424
  const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/messages/sign`, body);
340
425
  return res.data;
341
426
  });
@@ -374,9 +459,80 @@ class Client {
374
459
  });
375
460
  return res.data;
376
461
  });
462
+ this.issueJwt = (..._0) => __async(this, [..._0], function* ({ keyIndex = 0 } = {}) {
463
+ const res = yield this.baseRequest.post(`/auth/jwt`, { keyIndex });
464
+ return res.data;
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,
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
+ });
377
482
  this.trackError = (opts) => __async(this, null, function* () {
378
483
  yield this.baseRequest.post("/errors/sdk", opts);
379
484
  });
485
+ this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
486
+ yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
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.getUserPreferences = (userId) => __async(this, null, function* () {
529
+ const res = yield this.baseRequest.get(`/users/${userId}/preferences`);
530
+ return res.data;
531
+ });
532
+ this.updateUserPreferences = (userId, preferences) => __async(this, null, function* () {
533
+ const res = yield this.baseRequest.patch(`/users/${userId}/preferences`, { preferences });
534
+ return res.data;
535
+ });
380
536
  const headers = __spreadValues(__spreadValues({}, apiKey && { [import_consts.API_KEY_HEADER_NAME]: apiKey }), partnerId && { [import_consts.PARTNER_ID_HEADER_NAME]: partnerId });
381
537
  const axiosConfig = {
382
538
  baseURL: userManagementHost,
@@ -495,17 +651,17 @@ class Client {
495
651
  });
496
652
  }
497
653
  // POST '/users/:userId/resend-verification-code
498
- resendVerificationCode(_a) {
654
+ resendVerificationCode(_e) {
499
655
  return __async(this, null, function* () {
500
- var _b = _a, { userId } = _b, rest = __objRest(_b, ["userId"]);
656
+ var _f = _e, { userId } = _f, rest = __objRest(_f, ["userId"]);
501
657
  const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest);
502
658
  return res;
503
659
  });
504
660
  }
505
661
  // POST '/users/:userId/resend-verification-code-by-phone
506
- resendVerificationCodeByPhone(_c) {
662
+ resendVerificationCodeByPhone(_g) {
507
663
  return __async(this, null, function* () {
508
- var _d = _c, { userId } = _d, rest = __objRest(_d, ["userId"]);
664
+ var _h = _g, { userId } = _h, rest = __objRest(_h, ["userId"]);
509
665
  const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest);
510
666
  return res;
511
667
  });
@@ -546,14 +702,14 @@ class Client {
546
702
  }
547
703
  // POST /auth/farcaster/init
548
704
  initializeFarcasterLogin() {
549
- return __async(this, null, function* () {
550
- const res = yield this.baseRequest.post(`/auth/farcaster/init`);
551
- return res;
705
+ return __async(this, arguments, function* ({ appScheme } = {}) {
706
+ const res = yield this.baseRequest.post(`/auth/farcaster/init`, { appScheme });
707
+ return res.data;
552
708
  });
553
709
  }
554
710
  getFarcasterAuthStatus() {
555
- return __async(this, null, function* () {
556
- const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`);
711
+ return __async(this, arguments, function* ({ sessionLookupId } = {}) {
712
+ const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`, { sessionLookupId });
557
713
  return res.data;
558
714
  });
559
715
  }
@@ -655,12 +811,12 @@ class Client {
655
811
  return res.data;
656
812
  });
657
813
  }
658
- createOnRampPurchase(_e) {
814
+ createOnRampPurchase(_i) {
659
815
  return __async(this, null, function* () {
660
- var _f = _e, {
816
+ var _j = _i, {
661
817
  userId,
662
818
  params
663
- } = _f, walletParams = __objRest(_f, [
819
+ } = _j, walletParams = __objRest(_j, [
664
820
  "userId",
665
821
  "params"
666
822
  ]);
@@ -670,13 +826,13 @@ class Client {
670
826
  return res.data;
671
827
  });
672
828
  }
673
- updateOnRampPurchase(_g) {
829
+ updateOnRampPurchase(_k) {
674
830
  return __async(this, null, function* () {
675
- var _h = _g, {
831
+ var _l = _k, {
676
832
  userId,
677
833
  purchaseId,
678
834
  updates
679
- } = _h, params = __objRest(_h, [
835
+ } = _l, params = __objRest(_l, [
680
836
  "userId",
681
837
  "purchaseId",
682
838
  "updates"
@@ -690,12 +846,12 @@ class Client {
690
846
  return res.data;
691
847
  });
692
848
  }
693
- getOnRampPurchase(_i) {
849
+ getOnRampPurchase(_m) {
694
850
  return __async(this, null, function* () {
695
- var _j = _i, {
851
+ var _n = _m, {
696
852
  userId,
697
853
  purchaseId
698
- } = _j, params = __objRest(_j, [
854
+ } = _n, params = __objRest(_n, [
699
855
  "userId",
700
856
  "purchaseId"
701
857
  ]);
@@ -769,12 +925,12 @@ class Client {
769
925
  return res.data;
770
926
  });
771
927
  }
772
- distributeParaShare(_k) {
928
+ distributeParaShare(_o) {
773
929
  return __async(this, null, function* () {
774
- var _l = _k, {
930
+ var _p = _o, {
775
931
  userId,
776
932
  walletId
777
- } = _l, rest = __objRest(_l, [
933
+ } = _p, rest = __objRest(_p, [
778
934
  "userId",
779
935
  "walletId"
780
936
  ]);
@@ -863,6 +1019,17 @@ class Client {
863
1019
  return res.data;
864
1020
  });
865
1021
  }
1022
+ getSupportedAuthMethodsV2(auth) {
1023
+ return __async(this, null, function* () {
1024
+ const res = yield this.baseRequest.get(
1025
+ "/users/supported-auth-methods/v2",
1026
+ {
1027
+ params: __spreadValues({}, auth)
1028
+ }
1029
+ );
1030
+ return res.data;
1031
+ });
1032
+ }
866
1033
  getPasswords(auth) {
867
1034
  return __async(this, null, function* () {
868
1035
  const res = yield this.baseRequest.get("/users/passwords", {
@@ -882,9 +1049,9 @@ class Client {
882
1049
  return res;
883
1050
  });
884
1051
  }
885
- getEncryptedWalletPrivateKey(passwordId) {
1052
+ getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
886
1053
  return __async(this, null, function* () {
887
- const query = new URLSearchParams({ passwordId }).toString();
1054
+ const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
888
1055
  const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
889
1056
  return res;
890
1057
  });
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
  });
package/dist/cjs/utils.js CHANGED
@@ -47,6 +47,7 @@ __export(utils_exports, {
47
47
  extractAuthInfo: () => extractAuthInfo,
48
48
  extractWalletRef: () => extractWalletRef,
49
49
  fromAccountMetadata: () => fromAccountMetadata,
50
+ fromLinkedAccounts: () => fromLinkedAccounts,
50
51
  isCustomId: () => isCustomId,
51
52
  isDiscord: () => isDiscord,
52
53
  isEmail: () => isEmail,
@@ -244,11 +245,22 @@ function fromAccountMetadata(obj) {
244
245
  {}
245
246
  );
246
247
  }
248
+ function fromLinkedAccounts({ primary, linked }) {
249
+ return {
250
+ primary: primary.map((account) => __spreadProps(__spreadValues({}, account), {
251
+ date: new Date(account.date)
252
+ })),
253
+ linked: linked.map((account) => __spreadProps(__spreadValues({}, account), {
254
+ date: new Date(account.date)
255
+ }))
256
+ };
257
+ }
247
258
  // Annotate the CommonJS export names for ESM import in node:
248
259
  0 && (module.exports = {
249
260
  extractAuthInfo,
250
261
  extractWalletRef,
251
262
  fromAccountMetadata,
263
+ fromLinkedAccounts,
252
264
  isCustomId,
253
265
  isDiscord,
254
266
  isEmail,