@getpara/user-management-client 2.0.0-alpha.6 → 2.0.0-alpha.61

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* () {
@@ -151,8 +155,57 @@ class Client {
151
155
  });
152
156
  return res.data;
153
157
  });
154
- this.verifyNewAccount = (userId, body) => __async(this, null, function* () {
155
- const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
158
+ this.verifyAccount = (userId, body) => __async(this, null, function* () {
159
+ const res = yield this.baseRequest.post(
160
+ `/users/${userId}/verify`,
161
+ body
162
+ );
163
+ return res.data;
164
+ });
165
+ // POST /users/send-login-code
166
+ this.sendLoginVerificationCode = (auth, isRecovery) => __async(this, null, function* () {
167
+ const res = yield this.baseRequest.post(`/users/send-login-code`, __spreadProps(__spreadValues({}, auth), { isRecovery }));
168
+ return res.data;
169
+ });
170
+ this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
171
+ userId,
172
+ withMetadata = false
173
+ }) {
174
+ const res = yield this.baseRequest.get(
175
+ `/users/${userId}/linked-accounts`,
176
+ ...withMetadata ? [
177
+ {
178
+ params: { withMetadata }
179
+ }
180
+ ] : []
181
+ );
182
+ return { accounts: (0, import_utils.fromLinkedAccounts)(res.data.accounts) };
183
+ });
184
+ this.linkAccount = (_a) => __async(this, null, function* () {
185
+ var _b = _a, { userId } = _b, opts = __objRest(_b, ["userId"]);
186
+ const res = yield this.baseRequest.post(`/users/${userId}/linked-accounts`, opts);
187
+ return res.data;
188
+ });
189
+ this.verifyLink = (_c) => __async(this, null, function* () {
190
+ var _d = _c, {
191
+ linkedAccountId,
192
+ userId
193
+ } = _d, opts = __objRest(_d, [
194
+ "linkedAccountId",
195
+ "userId"
196
+ ]);
197
+ const res = yield this.baseRequest.post(
198
+ `/users/${userId}/linked-accounts/${linkedAccountId}/verify`,
199
+ opts
200
+ );
201
+ if ("isConflict" in res.data) {
202
+ return res.data;
203
+ }
204
+ const { accounts } = res.data;
205
+ return { accounts: (0, import_utils.fromLinkedAccounts)(accounts) };
206
+ });
207
+ this.unlinkAccount = (_0) => __async(this, [_0], function* ({ linkedAccountId, userId }) {
208
+ const res = yield this.baseRequest.delete(`/users/${userId}/linked-accounts/${linkedAccountId}`);
156
209
  return res.data;
157
210
  });
158
211
  // POST /users/:userId/verify-email
@@ -171,7 +224,10 @@ class Client {
171
224
  return res;
172
225
  });
173
226
  this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
174
- const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify/v2`, body);
227
+ const res = yield this.baseRequest.post(
228
+ `/users/${userId}/external-wallets/verify/v2`,
229
+ body
230
+ );
175
231
  return res.data;
176
232
  });
177
233
  // POST /users/:userId/biometrics/key
@@ -217,11 +273,26 @@ class Client {
217
273
  const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
218
274
  return res.data;
219
275
  });
220
- // GET /session/origin
276
+ // GET /sessions/:sessionLookupId/origin
221
277
  this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
222
278
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
223
279
  return res.data;
224
280
  });
281
+ // GET /sessions/:sessionLookupId/login-method
282
+ this.sessionLoginMethod = (sessionLookupId) => __async(this, null, function* () {
283
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/login-method`);
284
+ return res.data;
285
+ });
286
+ // GET /sessions/:sessionLookupId/auth-verified
287
+ this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
288
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
289
+ return res.data;
290
+ });
291
+ // GET /sessions/:sessionLookupId/auth
292
+ this.sessionAuth = (sessionLookupId) => __async(this, null, function* () {
293
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth`);
294
+ return res.data;
295
+ });
225
296
  // POST /biometrics/verify
226
297
  this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
227
298
  const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
@@ -334,8 +405,8 @@ class Client {
334
405
  const res = yield this.baseRequest.post("/recovery", body);
335
406
  return res;
336
407
  });
337
- this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc) => __async(this, null, function* () {
338
- const body = { message, scheme, cosmosSignDoc };
408
+ this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc, protocolId) => __async(this, null, function* () {
409
+ const body = { message, scheme, cosmosSignDoc, protocolId };
339
410
  const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/messages/sign`, body);
340
411
  return res.data;
341
412
  });
@@ -374,9 +445,69 @@ class Client {
374
445
  });
375
446
  return res.data;
376
447
  });
448
+ this.issueJwt = (..._0) => __async(this, [..._0], function* ({ keyIndex = 0 } = {}) {
449
+ const res = yield this.baseRequest.post(`/auth/jwt`, { keyIndex });
450
+ return res.data;
451
+ });
452
+ this.getProfileBalance = (_0) => __async(this, [_0], function* ({
453
+ config,
454
+ wallets,
455
+ refetch
456
+ }) {
457
+ const res = yield this.baseRequest.post(`/assets/balances`, {
458
+ config,
459
+ wallets,
460
+ refetch
461
+ });
462
+ return res.data;
463
+ });
464
+ this.getAssetInfo = () => __async(this, null, function* () {
465
+ const res = yield this.baseRequest.get(`/assets`);
466
+ return res.data;
467
+ });
377
468
  this.trackError = (opts) => __async(this, null, function* () {
378
469
  yield this.baseRequest.post("/errors/sdk", opts);
379
470
  });
471
+ this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
472
+ yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
473
+ });
474
+ // ENCLAVE METHODS
475
+ /**
476
+ * Get the enclave's public key for encryption
477
+ */
478
+ this.getEnclavePublicKey = () => __async(this, null, function* () {
479
+ const res = yield this.baseRequest.get(
480
+ "/enclave/public-key"
481
+ );
482
+ return res.data;
483
+ });
484
+ /**
485
+ * Persist encrypted key shares to the enclave
486
+ * @param encryptedPayload JSON string containing the encrypted ECIES payload
487
+ */
488
+ this.persistEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
489
+ const body = { encryptedPayload };
490
+ const res = yield this.baseRequest.post("/enclave/key-shares", body);
491
+ return res.data;
492
+ });
493
+ /**
494
+ * Retrieve encrypted key shares from the enclave
495
+ * @param encryptedPayload JSON string containing the encrypted ECIES query
496
+ */
497
+ this.retrieveEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
498
+ const res = yield this.baseRequest.get(
499
+ `/enclave/key-shares?encryptedPayload=${encodeURIComponent(encryptedPayload)}`
500
+ );
501
+ return res.data;
502
+ });
503
+ this.issueEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
504
+ const res = yield this.baseRequest.post(`/enclave/jwt/issue`, { encryptedPayload });
505
+ return res.data;
506
+ });
507
+ this.refreshEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
508
+ const res = yield this.baseRequest.post(`/enclave/jwt/refresh`, { encryptedPayload });
509
+ return res.data;
510
+ });
380
511
  const headers = __spreadValues(__spreadValues({}, apiKey && { [import_consts.API_KEY_HEADER_NAME]: apiKey }), partnerId && { [import_consts.PARTNER_ID_HEADER_NAME]: partnerId });
381
512
  const axiosConfig = {
382
513
  baseURL: userManagementHost,
@@ -495,17 +626,17 @@ class Client {
495
626
  });
496
627
  }
497
628
  // POST '/users/:userId/resend-verification-code
498
- resendVerificationCode(_a) {
629
+ resendVerificationCode(_e) {
499
630
  return __async(this, null, function* () {
500
- var _b = _a, { userId } = _b, rest = __objRest(_b, ["userId"]);
631
+ var _f = _e, { userId } = _f, rest = __objRest(_f, ["userId"]);
501
632
  const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest);
502
633
  return res;
503
634
  });
504
635
  }
505
636
  // POST '/users/:userId/resend-verification-code-by-phone
506
- resendVerificationCodeByPhone(_c) {
637
+ resendVerificationCodeByPhone(_g) {
507
638
  return __async(this, null, function* () {
508
- var _d = _c, { userId } = _d, rest = __objRest(_d, ["userId"]);
639
+ var _h = _g, { userId } = _h, rest = __objRest(_h, ["userId"]);
509
640
  const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest);
510
641
  return res;
511
642
  });
@@ -546,14 +677,14 @@ class Client {
546
677
  }
547
678
  // POST /auth/farcaster/init
548
679
  initializeFarcasterLogin() {
549
- return __async(this, null, function* () {
550
- const res = yield this.baseRequest.post(`/auth/farcaster/init`);
551
- return res;
680
+ return __async(this, arguments, function* ({ appScheme } = {}) {
681
+ const res = yield this.baseRequest.post(`/auth/farcaster/init`, { appScheme });
682
+ return res.data;
552
683
  });
553
684
  }
554
685
  getFarcasterAuthStatus() {
555
- return __async(this, null, function* () {
556
- const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`);
686
+ return __async(this, arguments, function* ({ sessionLookupId } = {}) {
687
+ const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`, { sessionLookupId });
557
688
  return res.data;
558
689
  });
559
690
  }
@@ -655,12 +786,12 @@ class Client {
655
786
  return res.data;
656
787
  });
657
788
  }
658
- createOnRampPurchase(_e) {
789
+ createOnRampPurchase(_i) {
659
790
  return __async(this, null, function* () {
660
- var _f = _e, {
791
+ var _j = _i, {
661
792
  userId,
662
793
  params
663
- } = _f, walletParams = __objRest(_f, [
794
+ } = _j, walletParams = __objRest(_j, [
664
795
  "userId",
665
796
  "params"
666
797
  ]);
@@ -670,13 +801,13 @@ class Client {
670
801
  return res.data;
671
802
  });
672
803
  }
673
- updateOnRampPurchase(_g) {
804
+ updateOnRampPurchase(_k) {
674
805
  return __async(this, null, function* () {
675
- var _h = _g, {
806
+ var _l = _k, {
676
807
  userId,
677
808
  purchaseId,
678
809
  updates
679
- } = _h, params = __objRest(_h, [
810
+ } = _l, params = __objRest(_l, [
680
811
  "userId",
681
812
  "purchaseId",
682
813
  "updates"
@@ -690,12 +821,12 @@ class Client {
690
821
  return res.data;
691
822
  });
692
823
  }
693
- getOnRampPurchase(_i) {
824
+ getOnRampPurchase(_m) {
694
825
  return __async(this, null, function* () {
695
- var _j = _i, {
826
+ var _n = _m, {
696
827
  userId,
697
828
  purchaseId
698
- } = _j, params = __objRest(_j, [
829
+ } = _n, params = __objRest(_n, [
699
830
  "userId",
700
831
  "purchaseId"
701
832
  ]);
@@ -769,12 +900,12 @@ class Client {
769
900
  return res.data;
770
901
  });
771
902
  }
772
- distributeParaShare(_k) {
903
+ distributeParaShare(_o) {
773
904
  return __async(this, null, function* () {
774
- var _l = _k, {
905
+ var _p = _o, {
775
906
  userId,
776
907
  walletId
777
- } = _l, rest = __objRest(_l, [
908
+ } = _p, rest = __objRest(_p, [
778
909
  "userId",
779
910
  "walletId"
780
911
  ]);
@@ -863,6 +994,17 @@ class Client {
863
994
  return res.data;
864
995
  });
865
996
  }
997
+ getSupportedAuthMethodsV2(auth) {
998
+ return __async(this, null, function* () {
999
+ const res = yield this.baseRequest.get(
1000
+ "/users/supported-auth-methods/v2",
1001
+ {
1002
+ params: __spreadValues({}, auth)
1003
+ }
1004
+ );
1005
+ return res.data;
1006
+ });
1007
+ }
866
1008
  getPasswords(auth) {
867
1009
  return __async(this, null, function* () {
868
1010
  const res = yield this.baseRequest.get("/users/passwords", {
@@ -882,9 +1024,9 @@ class Client {
882
1024
  return res;
883
1025
  });
884
1026
  }
885
- getEncryptedWalletPrivateKey(passwordId) {
1027
+ getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
886
1028
  return __async(this, null, function* () {
887
- const query = new URLSearchParams({ passwordId }).toString();
1029
+ const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
888
1030
  const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
889
1031
  return res;
890
1032
  });
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,