@getpara/user-management-client 2.0.0-alpha.5 → 2.0.0-alpha.51

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,7 +130,7 @@ 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
135
  this.verifyTelegram = (authObject) => __async(this, null, function* () {
136
136
  return (yield this.baseRequest.post("/users/telegram/v2", {
@@ -151,10 +151,56 @@ class Client {
151
151
  });
152
152
  return res.data;
153
153
  });
154
- this.verifyNewAccount = (userId, body) => __async(this, null, function* () {
154
+ this.verifyAccount = (userId, body) => __async(this, null, function* () {
155
155
  const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
156
156
  return res.data;
157
157
  });
158
+ // POST /users/send-login-code
159
+ this.sendLoginVerificationCode = (auth, isRecovery) => __async(this, null, function* () {
160
+ const res = yield this.baseRequest.post(`/users/send-login-code`, __spreadProps(__spreadValues({}, auth), { isRecovery }));
161
+ return res.data;
162
+ });
163
+ this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
164
+ userId,
165
+ withMetadata = false
166
+ }) {
167
+ const res = yield this.baseRequest.get(
168
+ `/users/${userId}/linked-accounts`,
169
+ ...withMetadata ? [
170
+ {
171
+ params: { withMetadata }
172
+ }
173
+ ] : []
174
+ );
175
+ return { accounts: (0, import_utils.fromLinkedAccounts)(res.data.accounts) };
176
+ });
177
+ this.linkAccount = (_a) => __async(this, null, function* () {
178
+ var _b = _a, { userId } = _b, opts = __objRest(_b, ["userId"]);
179
+ const res = yield this.baseRequest.post(`/users/${userId}/linked-accounts`, opts);
180
+ return res.data;
181
+ });
182
+ this.verifyLink = (_c) => __async(this, null, function* () {
183
+ var _d = _c, {
184
+ linkedAccountId,
185
+ userId
186
+ } = _d, opts = __objRest(_d, [
187
+ "linkedAccountId",
188
+ "userId"
189
+ ]);
190
+ const res = yield this.baseRequest.post(
191
+ `/users/${userId}/linked-accounts/${linkedAccountId}/verify`,
192
+ opts
193
+ );
194
+ if ("isConflict" in res.data) {
195
+ return res.data;
196
+ }
197
+ const { accounts } = res.data;
198
+ return { accounts: (0, import_utils.fromLinkedAccounts)(accounts) };
199
+ });
200
+ this.unlinkAccount = (_0) => __async(this, [_0], function* ({ linkedAccountId, userId }) {
201
+ const res = yield this.baseRequest.delete(`/users/${userId}/linked-accounts/${linkedAccountId}`);
202
+ return res.data;
203
+ });
158
204
  // POST /users/:userId/verify-email
159
205
  /**
160
206
  * @deprecated
@@ -171,7 +217,10 @@ class Client {
171
217
  return res;
172
218
  });
173
219
  this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
174
- const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify/v2`, body);
220
+ const res = yield this.baseRequest.post(
221
+ `/users/${userId}/external-wallets/verify/v2`,
222
+ body
223
+ );
175
224
  return res.data;
176
225
  });
177
226
  // POST /users/:userId/biometrics/key
@@ -217,11 +266,16 @@ class Client {
217
266
  const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
218
267
  return res.data;
219
268
  });
220
- // GET /session/origin
269
+ // GET /sessions/:sessionLookupId/origin
221
270
  this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
222
271
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
223
272
  return res.data;
224
273
  });
274
+ // GET /sessions/:sessionLookupId/auth-verified
275
+ this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
276
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
277
+ return res.data;
278
+ });
225
279
  // POST /biometrics/verify
226
280
  this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
227
281
  const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
@@ -334,8 +388,8 @@ class Client {
334
388
  const res = yield this.baseRequest.post("/recovery", body);
335
389
  return res;
336
390
  });
337
- this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc) => __async(this, null, function* () {
338
- const body = { message, scheme, cosmosSignDoc };
391
+ this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc, protocolId) => __async(this, null, function* () {
392
+ const body = { message, scheme, cosmosSignDoc, protocolId };
339
393
  const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/messages/sign`, body);
340
394
  return res.data;
341
395
  });
@@ -374,9 +428,16 @@ class Client {
374
428
  });
375
429
  return res.data;
376
430
  });
431
+ this.issueJwt = (..._0) => __async(this, [..._0], function* ({ keyIndex = 0 } = {}) {
432
+ const res = yield this.baseRequest.post(`/auth/jwt`, { keyIndex });
433
+ return res.data;
434
+ });
377
435
  this.trackError = (opts) => __async(this, null, function* () {
378
436
  yield this.baseRequest.post("/errors/sdk", opts);
379
437
  });
438
+ this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
439
+ yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
440
+ });
380
441
  const headers = __spreadValues(__spreadValues({}, apiKey && { [import_consts.API_KEY_HEADER_NAME]: apiKey }), partnerId && { [import_consts.PARTNER_ID_HEADER_NAME]: partnerId });
381
442
  const axiosConfig = {
382
443
  baseURL: userManagementHost,
@@ -495,17 +556,17 @@ class Client {
495
556
  });
496
557
  }
497
558
  // POST '/users/:userId/resend-verification-code
498
- resendVerificationCode(_a) {
559
+ resendVerificationCode(_e) {
499
560
  return __async(this, null, function* () {
500
- var _b = _a, { userId } = _b, rest = __objRest(_b, ["userId"]);
561
+ var _f = _e, { userId } = _f, rest = __objRest(_f, ["userId"]);
501
562
  const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest);
502
563
  return res;
503
564
  });
504
565
  }
505
566
  // POST '/users/:userId/resend-verification-code-by-phone
506
- resendVerificationCodeByPhone(_c) {
567
+ resendVerificationCodeByPhone(_g) {
507
568
  return __async(this, null, function* () {
508
- var _d = _c, { userId } = _d, rest = __objRest(_d, ["userId"]);
569
+ var _h = _g, { userId } = _h, rest = __objRest(_h, ["userId"]);
509
570
  const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest);
510
571
  return res;
511
572
  });
@@ -546,9 +607,9 @@ class Client {
546
607
  }
547
608
  // POST /auth/farcaster/init
548
609
  initializeFarcasterLogin() {
549
- return __async(this, null, function* () {
550
- const res = yield this.baseRequest.post(`/auth/farcaster/init`);
551
- return res;
610
+ return __async(this, arguments, function* ({ appScheme } = {}) {
611
+ const res = yield this.baseRequest.post(`/auth/farcaster/init`, { appScheme });
612
+ return res.data;
552
613
  });
553
614
  }
554
615
  getFarcasterAuthStatus() {
@@ -655,12 +716,12 @@ class Client {
655
716
  return res.data;
656
717
  });
657
718
  }
658
- createOnRampPurchase(_e) {
719
+ createOnRampPurchase(_i) {
659
720
  return __async(this, null, function* () {
660
- var _f = _e, {
721
+ var _j = _i, {
661
722
  userId,
662
723
  params
663
- } = _f, walletParams = __objRest(_f, [
724
+ } = _j, walletParams = __objRest(_j, [
664
725
  "userId",
665
726
  "params"
666
727
  ]);
@@ -670,13 +731,13 @@ class Client {
670
731
  return res.data;
671
732
  });
672
733
  }
673
- updateOnRampPurchase(_g) {
734
+ updateOnRampPurchase(_k) {
674
735
  return __async(this, null, function* () {
675
- var _h = _g, {
736
+ var _l = _k, {
676
737
  userId,
677
738
  purchaseId,
678
739
  updates
679
- } = _h, params = __objRest(_h, [
740
+ } = _l, params = __objRest(_l, [
680
741
  "userId",
681
742
  "purchaseId",
682
743
  "updates"
@@ -690,12 +751,12 @@ class Client {
690
751
  return res.data;
691
752
  });
692
753
  }
693
- getOnRampPurchase(_i) {
754
+ getOnRampPurchase(_m) {
694
755
  return __async(this, null, function* () {
695
- var _j = _i, {
756
+ var _n = _m, {
696
757
  userId,
697
758
  purchaseId
698
- } = _j, params = __objRest(_j, [
759
+ } = _n, params = __objRest(_n, [
699
760
  "userId",
700
761
  "purchaseId"
701
762
  ]);
@@ -769,12 +830,12 @@ class Client {
769
830
  return res.data;
770
831
  });
771
832
  }
772
- distributeParaShare(_k) {
833
+ distributeParaShare(_o) {
773
834
  return __async(this, null, function* () {
774
- var _l = _k, {
835
+ var _p = _o, {
775
836
  userId,
776
837
  walletId
777
- } = _l, rest = __objRest(_l, [
838
+ } = _p, rest = __objRest(_p, [
778
839
  "userId",
779
840
  "walletId"
780
841
  ]);
@@ -863,6 +924,17 @@ class Client {
863
924
  return res.data;
864
925
  });
865
926
  }
927
+ getSupportedAuthMethodsV2(auth) {
928
+ return __async(this, null, function* () {
929
+ const res = yield this.baseRequest.get(
930
+ "/users/supported-auth-methods/v2",
931
+ {
932
+ params: __spreadValues({}, auth)
933
+ }
934
+ );
935
+ return res.data;
936
+ });
937
+ }
866
938
  getPasswords(auth) {
867
939
  return __async(this, null, function* () {
868
940
  const res = yield this.baseRequest.get("/users/passwords", {
@@ -882,9 +954,9 @@ class Client {
882
954
  return res;
883
955
  });
884
956
  }
885
- getEncryptedWalletPrivateKey(passwordId) {
957
+ getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
886
958
  return __async(this, null, function* () {
887
- const query = new URLSearchParams({ passwordId }).toString();
959
+ const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
888
960
  const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
889
961
  return res;
890
962
  });
@@ -21,6 +21,8 @@ __export(auth_exports, {
21
21
  AuthMethod: () => AuthMethod,
22
22
  EncryptorType: () => EncryptorType,
23
23
  KeyShareType: () => KeyShareType,
24
+ LINKED_ACCOUNT_TYPES: () => LINKED_ACCOUNT_TYPES,
25
+ LegacyAuthMethod: () => LegacyAuthMethod,
24
26
  OAUTH_METHODS: () => OAUTH_METHODS,
25
27
  OAuthMethod: () => OAuthMethod,
26
28
  PasswordStatus: () => PasswordStatus,
@@ -79,17 +81,37 @@ var OAuthMethod = /* @__PURE__ */ ((OAuthMethod2) => {
79
81
  return OAuthMethod2;
80
82
  })(OAuthMethod || {});
81
83
  const OAUTH_METHODS = ["GOOGLE", "TWITTER", "APPLE", "DISCORD", "FACEBOOK", "FARCASTER", "TELEGRAM"];
84
+ const LINKED_ACCOUNT_TYPES = [
85
+ "EMAIL",
86
+ "PHONE",
87
+ "GOOGLE",
88
+ "FACEBOOK",
89
+ "APPLE",
90
+ "TWITTER",
91
+ "DISCORD",
92
+ "TELEGRAM",
93
+ "FARCASTER",
94
+ "EXTERNAL_WALLET"
95
+ ];
82
96
  var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
83
97
  AuthMethod2["PASSWORD"] = "PASSWORD";
84
98
  AuthMethod2["PASSKEY"] = "PASSKEY";
99
+ AuthMethod2["PIN"] = "PIN";
85
100
  return AuthMethod2;
86
101
  })(AuthMethod || {});
102
+ var LegacyAuthMethod = /* @__PURE__ */ ((LegacyAuthMethod2) => {
103
+ LegacyAuthMethod2["PASSWORD"] = "PASSWORD";
104
+ LegacyAuthMethod2["BIOMETRIC"] = "BIOMETRIC";
105
+ return LegacyAuthMethod2;
106
+ })(LegacyAuthMethod || {});
87
107
  // Annotate the CommonJS export names for ESM import in node:
88
108
  0 && (module.exports = {
89
109
  AUTH_TYPES,
90
110
  AuthMethod,
91
111
  EncryptorType,
92
112
  KeyShareType,
113
+ LINKED_ACCOUNT_TYPES,
114
+ LegacyAuthMethod,
93
115
  OAUTH_METHODS,
94
116
  OAuthMethod,
95
117
  PasswordStatus,
@@ -40,6 +40,7 @@ var OnRampAsset = /* @__PURE__ */ ((OnRampAsset2) => {
40
40
  OnRampAsset2["CUSD"] = "CUSD";
41
41
  OnRampAsset2["CEUR"] = "CEUR";
42
42
  OnRampAsset2["CREAL"] = "CREAL";
43
+ OnRampAsset2["BERA"] = "BERA";
43
44
  return OnRampAsset2;
44
45
  })(OnRampAsset || {});
45
46
  var OnRampPurchaseStatus = /* @__PURE__ */ ((OnRampPurchaseStatus2) => {
@@ -17,10 +17,14 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var wallet_exports = {};
19
19
  __export(wallet_exports, {
20
+ COSMOS_WALLETS: () => COSMOS_WALLETS,
20
21
  Chain: () => Chain,
22
+ EVM_WALLETS: () => EVM_WALLETS,
23
+ EXTERNAL_WALLET_TYPES: () => EXTERNAL_WALLET_TYPES,
21
24
  NON_ED25519: () => NON_ED25519,
22
25
  Network: () => Network,
23
26
  PREGEN_IDENTIFIER_TYPES: () => PREGEN_IDENTIFIER_TYPES,
27
+ SOLANA_WALLETS: () => SOLANA_WALLETS,
24
28
  WALLET_SCHEMES: () => WALLET_SCHEMES,
25
29
  WALLET_TYPES: () => WALLET_TYPES,
26
30
  WalletScheme: () => WalletScheme,
@@ -59,6 +63,7 @@ var Network = /* @__PURE__ */ ((Network2) => {
59
63
  Network2["CELO"] = "CELO";
60
64
  Network2["NOBLE"] = "NOBLE";
61
65
  Network2["SOLANA_DEVNET"] = "SOLANA_DEVNET";
66
+ Network2["BERACHAIN"] = "BERACHAIN";
62
67
  return Network2;
63
68
  })(Network || {});
64
69
  const PREGEN_IDENTIFIER_TYPES = [
@@ -72,12 +77,34 @@ const PREGEN_IDENTIFIER_TYPES = [
72
77
  "FARCASTER"
73
78
  ];
74
79
  const NON_ED25519 = ["DKLS", "CGGMP"];
80
+ const EVM_WALLETS = [
81
+ "METAMASK",
82
+ "RAINBOW",
83
+ "COINBASE",
84
+ "WALLETCONNECT",
85
+ "FARCASTER",
86
+ "ZERION",
87
+ "SAFE",
88
+ "RABBY",
89
+ "OKX",
90
+ "HAHA",
91
+ "BACKPACK",
92
+ "PHANTOM",
93
+ "VALORA"
94
+ ];
95
+ const SOLANA_WALLETS = ["PHANTOM", "GLOW", "BACKPACK", "SOLFLARE"];
96
+ const COSMOS_WALLETS = ["KEPLR", "LEAP", "COSMOSTATION"];
97
+ const EXTERNAL_WALLET_TYPES = [.../* @__PURE__ */ new Set([...EVM_WALLETS, ...SOLANA_WALLETS, ...COSMOS_WALLETS])];
75
98
  // Annotate the CommonJS export names for ESM import in node:
76
99
  0 && (module.exports = {
100
+ COSMOS_WALLETS,
77
101
  Chain,
102
+ EVM_WALLETS,
103
+ EXTERNAL_WALLET_TYPES,
78
104
  NON_ED25519,
79
105
  Network,
80
106
  PREGEN_IDENTIFIER_TYPES,
107
+ SOLANA_WALLETS,
81
108
  WALLET_SCHEMES,
82
109
  WALLET_TYPES,
83
110
  WalletScheme,
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,
@@ -5,7 +5,7 @@ import {
5
5
  __spreadValues
6
6
  } from "./chunk-BBZEL7EG.js";
7
7
  import axios from "axios";
8
- import { extractWalletRef, fromAccountMetadata } from "./utils.js";
8
+ import { extractWalletRef, fromAccountMetadata, fromLinkedAccounts } from "./utils.js";
9
9
  import { SESSION_COOKIE_HEADER_NAME, VERSION_HEADER_NAME, PARTNER_ID_HEADER_NAME, API_KEY_HEADER_NAME } from "./consts.js";
10
10
  import { ParaApiError } from "./error.js";
11
11
  const handleResponseSuccess = (response) => {
@@ -53,7 +53,7 @@ class Client {
53
53
  const res = yield this.baseRequest.get("/users/exists", {
54
54
  params: __spreadValues({}, auth)
55
55
  });
56
- return res;
56
+ return res.data;
57
57
  });
58
58
  this.verifyTelegram = (authObject) => __async(this, null, function* () {
59
59
  return (yield this.baseRequest.post("/users/telegram/v2", {
@@ -74,10 +74,56 @@ class Client {
74
74
  });
75
75
  return res.data;
76
76
  });
77
- this.verifyNewAccount = (userId, body) => __async(this, null, function* () {
77
+ this.verifyAccount = (userId, body) => __async(this, null, function* () {
78
78
  const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
79
79
  return res.data;
80
80
  });
81
+ // POST /users/send-login-code
82
+ this.sendLoginVerificationCode = (auth, isRecovery) => __async(this, null, function* () {
83
+ const res = yield this.baseRequest.post(`/users/send-login-code`, __spreadProps(__spreadValues({}, auth), { isRecovery }));
84
+ return res.data;
85
+ });
86
+ this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
87
+ userId,
88
+ withMetadata = false
89
+ }) {
90
+ const res = yield this.baseRequest.get(
91
+ `/users/${userId}/linked-accounts`,
92
+ ...withMetadata ? [
93
+ {
94
+ params: { withMetadata }
95
+ }
96
+ ] : []
97
+ );
98
+ return { accounts: fromLinkedAccounts(res.data.accounts) };
99
+ });
100
+ this.linkAccount = (_a) => __async(this, null, function* () {
101
+ var _b = _a, { userId } = _b, opts = __objRest(_b, ["userId"]);
102
+ const res = yield this.baseRequest.post(`/users/${userId}/linked-accounts`, opts);
103
+ return res.data;
104
+ });
105
+ this.verifyLink = (_c) => __async(this, null, function* () {
106
+ var _d = _c, {
107
+ linkedAccountId,
108
+ userId
109
+ } = _d, opts = __objRest(_d, [
110
+ "linkedAccountId",
111
+ "userId"
112
+ ]);
113
+ const res = yield this.baseRequest.post(
114
+ `/users/${userId}/linked-accounts/${linkedAccountId}/verify`,
115
+ opts
116
+ );
117
+ if ("isConflict" in res.data) {
118
+ return res.data;
119
+ }
120
+ const { accounts } = res.data;
121
+ return { accounts: fromLinkedAccounts(accounts) };
122
+ });
123
+ this.unlinkAccount = (_0) => __async(this, [_0], function* ({ linkedAccountId, userId }) {
124
+ const res = yield this.baseRequest.delete(`/users/${userId}/linked-accounts/${linkedAccountId}`);
125
+ return res.data;
126
+ });
81
127
  // POST /users/:userId/verify-email
82
128
  /**
83
129
  * @deprecated
@@ -94,7 +140,10 @@ class Client {
94
140
  return res;
95
141
  });
96
142
  this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
97
- const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify/v2`, body);
143
+ const res = yield this.baseRequest.post(
144
+ `/users/${userId}/external-wallets/verify/v2`,
145
+ body
146
+ );
98
147
  return res.data;
99
148
  });
100
149
  // POST /users/:userId/biometrics/key
@@ -140,11 +189,16 @@ class Client {
140
189
  const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
141
190
  return res.data;
142
191
  });
143
- // GET /session/origin
192
+ // GET /sessions/:sessionLookupId/origin
144
193
  this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
145
194
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
146
195
  return res.data;
147
196
  });
197
+ // GET /sessions/:sessionLookupId/auth-verified
198
+ this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
199
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
200
+ return res.data;
201
+ });
148
202
  // POST /biometrics/verify
149
203
  this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
150
204
  const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
@@ -257,8 +311,8 @@ class Client {
257
311
  const res = yield this.baseRequest.post("/recovery", body);
258
312
  return res;
259
313
  });
260
- this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc) => __async(this, null, function* () {
261
- const body = { message, scheme, cosmosSignDoc };
314
+ this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc, protocolId) => __async(this, null, function* () {
315
+ const body = { message, scheme, cosmosSignDoc, protocolId };
262
316
  const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/messages/sign`, body);
263
317
  return res.data;
264
318
  });
@@ -297,9 +351,16 @@ class Client {
297
351
  });
298
352
  return res.data;
299
353
  });
354
+ this.issueJwt = (..._0) => __async(this, [..._0], function* ({ keyIndex = 0 } = {}) {
355
+ const res = yield this.baseRequest.post(`/auth/jwt`, { keyIndex });
356
+ return res.data;
357
+ });
300
358
  this.trackError = (opts) => __async(this, null, function* () {
301
359
  yield this.baseRequest.post("/errors/sdk", opts);
302
360
  });
361
+ this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
362
+ yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
363
+ });
303
364
  const headers = __spreadValues(__spreadValues({}, apiKey && { [API_KEY_HEADER_NAME]: apiKey }), partnerId && { [PARTNER_ID_HEADER_NAME]: partnerId });
304
365
  const axiosConfig = {
305
366
  baseURL: userManagementHost,
@@ -418,17 +479,17 @@ class Client {
418
479
  });
419
480
  }
420
481
  // POST '/users/:userId/resend-verification-code
421
- resendVerificationCode(_a) {
482
+ resendVerificationCode(_e) {
422
483
  return __async(this, null, function* () {
423
- var _b = _a, { userId } = _b, rest = __objRest(_b, ["userId"]);
484
+ var _f = _e, { userId } = _f, rest = __objRest(_f, ["userId"]);
424
485
  const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest);
425
486
  return res;
426
487
  });
427
488
  }
428
489
  // POST '/users/:userId/resend-verification-code-by-phone
429
- resendVerificationCodeByPhone(_c) {
490
+ resendVerificationCodeByPhone(_g) {
430
491
  return __async(this, null, function* () {
431
- var _d = _c, { userId } = _d, rest = __objRest(_d, ["userId"]);
492
+ var _h = _g, { userId } = _h, rest = __objRest(_h, ["userId"]);
432
493
  const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest);
433
494
  return res;
434
495
  });
@@ -469,9 +530,9 @@ class Client {
469
530
  }
470
531
  // POST /auth/farcaster/init
471
532
  initializeFarcasterLogin() {
472
- return __async(this, null, function* () {
473
- const res = yield this.baseRequest.post(`/auth/farcaster/init`);
474
- return res;
533
+ return __async(this, arguments, function* ({ appScheme } = {}) {
534
+ const res = yield this.baseRequest.post(`/auth/farcaster/init`, { appScheme });
535
+ return res.data;
475
536
  });
476
537
  }
477
538
  getFarcasterAuthStatus() {
@@ -578,12 +639,12 @@ class Client {
578
639
  return res.data;
579
640
  });
580
641
  }
581
- createOnRampPurchase(_e) {
642
+ createOnRampPurchase(_i) {
582
643
  return __async(this, null, function* () {
583
- var _f = _e, {
644
+ var _j = _i, {
584
645
  userId,
585
646
  params
586
- } = _f, walletParams = __objRest(_f, [
647
+ } = _j, walletParams = __objRest(_j, [
587
648
  "userId",
588
649
  "params"
589
650
  ]);
@@ -593,13 +654,13 @@ class Client {
593
654
  return res.data;
594
655
  });
595
656
  }
596
- updateOnRampPurchase(_g) {
657
+ updateOnRampPurchase(_k) {
597
658
  return __async(this, null, function* () {
598
- var _h = _g, {
659
+ var _l = _k, {
599
660
  userId,
600
661
  purchaseId,
601
662
  updates
602
- } = _h, params = __objRest(_h, [
663
+ } = _l, params = __objRest(_l, [
603
664
  "userId",
604
665
  "purchaseId",
605
666
  "updates"
@@ -613,12 +674,12 @@ class Client {
613
674
  return res.data;
614
675
  });
615
676
  }
616
- getOnRampPurchase(_i) {
677
+ getOnRampPurchase(_m) {
617
678
  return __async(this, null, function* () {
618
- var _j = _i, {
679
+ var _n = _m, {
619
680
  userId,
620
681
  purchaseId
621
- } = _j, params = __objRest(_j, [
682
+ } = _n, params = __objRest(_n, [
622
683
  "userId",
623
684
  "purchaseId"
624
685
  ]);
@@ -692,12 +753,12 @@ class Client {
692
753
  return res.data;
693
754
  });
694
755
  }
695
- distributeParaShare(_k) {
756
+ distributeParaShare(_o) {
696
757
  return __async(this, null, function* () {
697
- var _l = _k, {
758
+ var _p = _o, {
698
759
  userId,
699
760
  walletId
700
- } = _l, rest = __objRest(_l, [
761
+ } = _p, rest = __objRest(_p, [
701
762
  "userId",
702
763
  "walletId"
703
764
  ]);
@@ -786,6 +847,17 @@ class Client {
786
847
  return res.data;
787
848
  });
788
849
  }
850
+ getSupportedAuthMethodsV2(auth) {
851
+ return __async(this, null, function* () {
852
+ const res = yield this.baseRequest.get(
853
+ "/users/supported-auth-methods/v2",
854
+ {
855
+ params: __spreadValues({}, auth)
856
+ }
857
+ );
858
+ return res.data;
859
+ });
860
+ }
789
861
  getPasswords(auth) {
790
862
  return __async(this, null, function* () {
791
863
  const res = yield this.baseRequest.get("/users/passwords", {
@@ -805,9 +877,9 @@ class Client {
805
877
  return res;
806
878
  });
807
879
  }
808
- getEncryptedWalletPrivateKey(passwordId) {
880
+ getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
809
881
  return __async(this, null, function* () {
810
- const query = new URLSearchParams({ passwordId }).toString();
882
+ const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
811
883
  const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
812
884
  return res;
813
885
  });
@@ -50,16 +50,36 @@ var OAuthMethod = /* @__PURE__ */ ((OAuthMethod2) => {
50
50
  return OAuthMethod2;
51
51
  })(OAuthMethod || {});
52
52
  const OAUTH_METHODS = ["GOOGLE", "TWITTER", "APPLE", "DISCORD", "FACEBOOK", "FARCASTER", "TELEGRAM"];
53
+ const LINKED_ACCOUNT_TYPES = [
54
+ "EMAIL",
55
+ "PHONE",
56
+ "GOOGLE",
57
+ "FACEBOOK",
58
+ "APPLE",
59
+ "TWITTER",
60
+ "DISCORD",
61
+ "TELEGRAM",
62
+ "FARCASTER",
63
+ "EXTERNAL_WALLET"
64
+ ];
53
65
  var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
54
66
  AuthMethod2["PASSWORD"] = "PASSWORD";
55
67
  AuthMethod2["PASSKEY"] = "PASSKEY";
68
+ AuthMethod2["PIN"] = "PIN";
56
69
  return AuthMethod2;
57
70
  })(AuthMethod || {});
71
+ var LegacyAuthMethod = /* @__PURE__ */ ((LegacyAuthMethod2) => {
72
+ LegacyAuthMethod2["PASSWORD"] = "PASSWORD";
73
+ LegacyAuthMethod2["BIOMETRIC"] = "BIOMETRIC";
74
+ return LegacyAuthMethod2;
75
+ })(LegacyAuthMethod || {});
58
76
  export {
59
77
  AUTH_TYPES,
60
78
  AuthMethod,
61
79
  EncryptorType,
62
80
  KeyShareType,
81
+ LINKED_ACCOUNT_TYPES,
82
+ LegacyAuthMethod,
63
83
  OAUTH_METHODS,
64
84
  OAuthMethod,
65
85
  PasswordStatus,
@@ -16,6 +16,7 @@ var OnRampAsset = /* @__PURE__ */ ((OnRampAsset2) => {
16
16
  OnRampAsset2["CUSD"] = "CUSD";
17
17
  OnRampAsset2["CEUR"] = "CEUR";
18
18
  OnRampAsset2["CREAL"] = "CREAL";
19
+ OnRampAsset2["BERA"] = "BERA";
19
20
  return OnRampAsset2;
20
21
  })(OnRampAsset || {});
21
22
  var OnRampPurchaseStatus = /* @__PURE__ */ ((OnRampPurchaseStatus2) => {
@@ -31,6 +31,7 @@ var Network = /* @__PURE__ */ ((Network2) => {
31
31
  Network2["CELO"] = "CELO";
32
32
  Network2["NOBLE"] = "NOBLE";
33
33
  Network2["SOLANA_DEVNET"] = "SOLANA_DEVNET";
34
+ Network2["BERACHAIN"] = "BERACHAIN";
34
35
  return Network2;
35
36
  })(Network || {});
36
37
  const PREGEN_IDENTIFIER_TYPES = [
@@ -44,11 +45,33 @@ const PREGEN_IDENTIFIER_TYPES = [
44
45
  "FARCASTER"
45
46
  ];
46
47
  const NON_ED25519 = ["DKLS", "CGGMP"];
48
+ const EVM_WALLETS = [
49
+ "METAMASK",
50
+ "RAINBOW",
51
+ "COINBASE",
52
+ "WALLETCONNECT",
53
+ "FARCASTER",
54
+ "ZERION",
55
+ "SAFE",
56
+ "RABBY",
57
+ "OKX",
58
+ "HAHA",
59
+ "BACKPACK",
60
+ "PHANTOM",
61
+ "VALORA"
62
+ ];
63
+ const SOLANA_WALLETS = ["PHANTOM", "GLOW", "BACKPACK", "SOLFLARE"];
64
+ const COSMOS_WALLETS = ["KEPLR", "LEAP", "COSMOSTATION"];
65
+ const EXTERNAL_WALLET_TYPES = [.../* @__PURE__ */ new Set([...EVM_WALLETS, ...SOLANA_WALLETS, ...COSMOS_WALLETS])];
47
66
  export {
67
+ COSMOS_WALLETS,
48
68
  Chain,
69
+ EVM_WALLETS,
70
+ EXTERNAL_WALLET_TYPES,
49
71
  NON_ED25519,
50
72
  Network,
51
73
  PREGEN_IDENTIFIER_TYPES,
74
+ SOLANA_WALLETS,
52
75
  WALLET_SCHEMES,
53
76
  WALLET_TYPES,
54
77
  WalletScheme,
package/dist/esm/utils.js CHANGED
@@ -179,10 +179,21 @@ function fromAccountMetadata(obj) {
179
179
  {}
180
180
  );
181
181
  }
182
+ function fromLinkedAccounts({ primary, linked }) {
183
+ return {
184
+ primary: primary.map((account) => __spreadProps(__spreadValues({}, account), {
185
+ date: new Date(account.date)
186
+ })),
187
+ linked: linked.map((account) => __spreadProps(__spreadValues({}, account), {
188
+ date: new Date(account.date)
189
+ }))
190
+ };
191
+ }
182
192
  export {
183
193
  extractAuthInfo,
184
194
  extractWalletRef,
185
195
  fromAccountMetadata,
196
+ fromLinkedAccounts,
186
197
  isCustomId,
187
198
  isDiscord,
188
199
  isEmail,
@@ -1,5 +1,5 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { AccountMetadata, Auth, AuthIdentifier, AuthMethod, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, ExternalWalletInfo, LoginExternalWalletResponse, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, PasswordStatus, PregenIds, PrimaryAuth, PublicKeyStatus, PublicKeyType, ServerAuthStateSignup, SessionInfo, Setup2faResponse, SignUpOrLogInResponse, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, VerifiedAuth, VerifyFarcasterResponse, VerifyTelegramResponse, VerifyThirdPartyAuth, WalletEntity, WalletParams, TWalletScheme, TWalletType, VerifyExternalWalletParams } from './types/index.js';
2
+ import { AccountMetadata, Auth, AuthIdentifier, AuthMethod, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, ExternalWalletInfo, LoginExternalWalletResponse, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, PasswordStatus, PregenIds, PrimaryAuth, PublicKeyStatus, PublicKeyType, ServerAuthStateSignup, SessionInfo, Setup2faResponse, SignUpOrLogInResponse, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, VerifiedAuth, VerifyFarcasterResponse, VerifyTelegramResponse, VerifyThirdPartyAuth, WalletEntity, WalletParams, TWalletScheme, TWalletType, VerifyExternalWalletParams, IssueJwtParams, IssueJwtResponse, LinkAccountParams, LinkedAccounts, ResendVerificationCodeParams, LegacyAuthMethod, PrimaryAuthInfo, ServerAuthStateLogin } from './types/index.js';
3
3
  interface ConfigOpts {
4
4
  useFetchAdapter?: boolean;
5
5
  }
@@ -18,6 +18,7 @@ interface createUserIdRes {
18
18
  }
19
19
  interface verifyBody {
20
20
  verificationCode: string;
21
+ sessionLookupId?: string;
21
22
  }
22
23
  interface getWebChallengeRes {
23
24
  challenge: string;
@@ -67,6 +68,7 @@ interface PasswordEntity {
67
68
  status: PasswordStatus;
68
69
  sigDerivedPublicKey: string;
69
70
  salt: string;
71
+ isPIN?: boolean;
70
72
  }
71
73
  interface createWalletBody {
72
74
  useTwoSigners?: boolean;
@@ -99,11 +101,13 @@ interface claimPreGenWalletsBody {
99
101
  interface signTransactionBody {
100
102
  transaction: string;
101
103
  chainId: string;
104
+ protocolId?: string;
102
105
  }
103
106
  interface sendTransactionBody {
104
107
  transaction: string;
105
108
  chain?: Chain;
106
109
  chainId?: string;
110
+ protocolId?: string;
107
111
  }
108
112
  interface AcceptScopesBody {
109
113
  scopeIds: string[];
@@ -115,6 +119,15 @@ interface sessionPasswordBody {
115
119
  salt?: string;
116
120
  encryptedWalletPrivateKey?: string;
117
121
  encryptionKeyHash?: string;
122
+ isPIN?: boolean;
123
+ }
124
+ interface EncryptedWalletPrivateKey {
125
+ id: string;
126
+ userId: string;
127
+ encryptedPrivateKey: string;
128
+ encryptionKeyHash: string;
129
+ biometricPublicKey?: string;
130
+ passwordId?: string;
118
131
  }
119
132
  export type SDKType = 'WEB' | 'SERVER' | 'BRIDGE' | 'REACT_NATIVE';
120
133
  export type VerifyTelegramRes = {
@@ -144,7 +157,38 @@ declare class Client {
144
157
  externalWallet: ExternalWalletInfo;
145
158
  shouldTrackUser?: boolean;
146
159
  }) => Promise<LoginExternalWalletResponse>;
147
- verifyNewAccount: (userId: string, body: verifyBody) => Promise<ServerAuthStateSignup>;
160
+ verifyAccount: (userId: string, body: verifyBody) => Promise<ServerAuthStateSignup | ServerAuthStateLogin>;
161
+ sendLoginVerificationCode: (auth: PrimaryAuthInfo, isRecovery?: boolean) => Promise<{
162
+ userId: string;
163
+ }>;
164
+ getLinkedAccounts: ({ userId, withMetadata, }: {
165
+ userId: string;
166
+ withMetadata?: boolean;
167
+ }) => Promise<{
168
+ accounts: LinkedAccounts;
169
+ }>;
170
+ linkAccount: ({ userId, ...opts }: LinkAccountParams & {
171
+ userId: string;
172
+ }) => Promise<{
173
+ linkedAccountId: string;
174
+ signatureVerificationMessage?: string;
175
+ } | {
176
+ isConflict: true;
177
+ }>;
178
+ verifyLink: ({ linkedAccountId, userId, ...opts }: {
179
+ linkedAccountId: string;
180
+ userId: string;
181
+ telegramAuthResponse?: TelegramAuthResponse;
182
+ verificationCode?: string;
183
+ } & Partial<VerifyExternalWalletParams>) => Promise<{
184
+ accounts: LinkedAccounts;
185
+ } | {
186
+ isConflict: true;
187
+ }>;
188
+ unlinkAccount: ({ linkedAccountId, userId }: {
189
+ linkedAccountId: string;
190
+ userId: string;
191
+ }) => Promise<LinkedAccounts>;
148
192
  /**
149
193
  * @deprecated
150
194
  */
@@ -153,7 +197,7 @@ declare class Client {
153
197
  * @deprecated
154
198
  */
155
199
  verifyPhone: (userId: string, body: verifyBody) => Promise<any>;
156
- verifyExternalWallet: (userId: string, body: VerifyExternalWalletParams) => Promise<ServerAuthStateSignup>;
200
+ verifyExternalWallet: (userId: string, body: VerifyExternalWalletParams) => Promise<ServerAuthStateSignup | ServerAuthStateLogin>;
157
201
  addSessionPublicKey: (userId: string, body: sessionPublicKeyBody) => Promise<any>;
158
202
  getSessionPublicKeys: (userId: string) => Promise<any>;
159
203
  getBiometricLocationHints: (auth: PrimaryAuth) => Promise<BiometricLocationHint[]>;
@@ -164,6 +208,9 @@ declare class Client {
164
208
  sessionOrigin: (sessionLookupId: string) => Promise<{
165
209
  origin?: string;
166
210
  }>;
211
+ sessionAuthVerified: (sessionLookupId: string) => Promise<{
212
+ authVerified?: boolean;
213
+ }>;
167
214
  verifyWebChallenge: (partnerId: string, body: verifyWebChallengeBody) => Promise<any>;
168
215
  getSessionChallenge: (userId: string) => Promise<any>;
169
216
  verifySessionChallenge: (userId: string, body: verifySessionChallengeBody) => Promise<any>;
@@ -189,7 +236,7 @@ declare class Client {
189
236
  logout: () => Promise<any>;
190
237
  recoveryVerification: (email: string, verificationCode: string) => Promise<any>;
191
238
  recoveryInit: (email: string) => Promise<any>;
192
- preSignMessage: (userId: string, walletId: string, message: string, scheme?: TWalletScheme, cosmosSignDoc?: string) => Promise<any>;
239
+ preSignMessage: (userId: string, walletId: string, message: string, scheme?: TWalletScheme, cosmosSignDoc?: string, protocolId?: string) => Promise<any>;
193
240
  deleteSelf: (userId: string) => Promise<any>;
194
241
  uploadKeyshares(userId: string, walletId: string, encryptedKeyshares: EncryptedKeyShare[]): Promise<any>;
195
242
  uploadUserKeyShares(userId: string, encryptedKeyshares: (EncryptedKeyShare & {
@@ -207,9 +254,7 @@ declare class Client {
207
254
  getTransmissionKeyshares(userId: string, sessionLookupId: string): Promise<any>;
208
255
  getParaShare: (userId: string, walletId: string) => Promise<string>;
209
256
  getBackupKit: (userId: string, walletId: string) => Promise<any>;
210
- resendVerificationCode({ userId, ...rest }: {
211
- userId: string;
212
- } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
257
+ resendVerificationCode({ userId, ...rest }: ResendVerificationCodeParams): Promise<AxiosResponse<any, any>>;
213
258
  resendVerificationCodeByPhone({ userId, ...rest }: {
214
259
  userId: string;
215
260
  } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
@@ -218,7 +263,9 @@ declare class Client {
218
263
  enable2FA(userId: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
219
264
  setup2FA(userId: string): Promise<Setup2faResponse>;
220
265
  initializeRecovery(email: string): Promise<AxiosResponse<any, any>>;
221
- initializeFarcasterLogin(): Promise<AxiosResponse<any, any>>;
266
+ initializeFarcasterLogin({ appScheme }?: {
267
+ appScheme?: string;
268
+ }): Promise<any>;
222
269
  getFarcasterAuthStatus(): Promise<VerifyFarcasterResponse>;
223
270
  initializeRecoveryForPhone(phone: string, countryCode: string): Promise<AxiosResponse<any, any>>;
224
271
  finalizeRecovery(userId: string, walletId: string): Promise<AxiosResponse<any, any>>;
@@ -317,8 +364,12 @@ declare class Client {
317
364
  publicKey: string;
318
365
  }[];
319
366
  }>;
320
- uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey?: string, passwordId?: string): Promise<any>;
321
- getEncryptedWalletPrivateKeys(userId: string, encryptionKeyHash: string): Promise<any>;
367
+ uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey?: string, passwordId?: string): Promise<{
368
+ encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
369
+ }>;
370
+ getEncryptedWalletPrivateKeys(userId: string, encryptionKeyHash: string): Promise<{
371
+ encryptedPrivateKeys: EncryptedWalletPrivateKey[];
372
+ }>;
322
373
  getConversionRate(chainId: string, symbol: string, currency: string): Promise<any>;
323
374
  getGasEstimate(chainId: string, totalGasPrice: string): Promise<any>;
324
375
  getGasOracle(chainId: string): Promise<any>;
@@ -328,10 +379,20 @@ declare class Client {
328
379
  deletePendingTransaction(userId: string, pendingTransactionId: string): Promise<any>;
329
380
  addSessionPasswordPublicKey(userId: string, body: sessionPasswordBody): Promise<any>;
330
381
  patchSessionPassword: (partnerId: string, userId: string, passwordId: string, body: sessionPasswordBody) => Promise<any>;
331
- getSupportedAuthMethods(auth: Auth): Promise<any>;
382
+ getSupportedAuthMethods(auth: Auth): Promise<{
383
+ supportedAuthMethods: LegacyAuthMethod[];
384
+ }>;
385
+ getSupportedAuthMethodsV2(auth: Auth): Promise<{
386
+ supportedAuthMethods: AuthMethod[];
387
+ hasPasswordWithoutPIN: boolean;
388
+ }>;
332
389
  getPasswords(auth: Auth): Promise<PasswordEntity[]>;
333
390
  verifyPasswordChallenge(partnerId: string, body: verifyPasswordChallengeBody): Promise<any>;
334
- getEncryptedWalletPrivateKey(passwordId: string): Promise<any>;
391
+ getEncryptedWalletPrivateKey(passwordId: string, sessionLookupId: string): Promise<{
392
+ data: {
393
+ encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
394
+ };
395
+ }>;
335
396
  getUser(userId: string): Promise<any>;
336
397
  getAccountMetadata(userId: string, partnerId: string): Promise<{
337
398
  accountMetadata: AccountMetadata;
@@ -340,6 +401,7 @@ declare class Client {
340
401
  walletId: string;
341
402
  rpcUrl?: string;
342
403
  }) => Promise<GetWalletBalanceRes>;
404
+ issueJwt: ({ keyIndex }?: IssueJwtParams) => Promise<IssueJwtResponse>;
343
405
  trackError: (opts: {
344
406
  methodName: string;
345
407
  error: {
@@ -349,5 +411,9 @@ declare class Client {
349
411
  sdkType: SDKType;
350
412
  userId: string;
351
413
  }) => Promise<void>;
414
+ trackReactSdkAnalytics: (opts: {
415
+ props: object;
416
+ reactSdkVersion: string;
417
+ }) => Promise<void>;
352
418
  }
353
419
  export default Client;
@@ -1,4 +1,4 @@
1
- import { CurrentWalletIds, ExternalWalletType, SupportedWalletTypes } from './wallet.js';
1
+ import { CurrentWalletIds, ExternalWalletType, SupportedWalletTypes, TExternalWallet } from './wallet.js';
2
2
  export declare const AUTH_TYPES: readonly ["email", "phone", "phoneLegacy", "farcaster", "telegram", "userId", "externalWallet", "discord", "x", "customId", "guestId"];
3
3
  export type AuthType = 'email' | 'phone' | 'phoneLegacy' | 'farcaster' | 'telegram' | 'userId' | 'externalWallet' | 'discord' | 'x' | 'customId' | 'guestId';
4
4
  export type PrimaryAuthType = Extract<AuthType, 'email' | 'phone' | 'farcaster' | 'telegram' | 'externalWallet'>;
@@ -112,9 +112,17 @@ export declare enum OAuthMethod {
112
112
  }
113
113
  export declare const OAUTH_METHODS: readonly ["GOOGLE", "TWITTER", "APPLE", "DISCORD", "FACEBOOK", "FARCASTER", "TELEGRAM"];
114
114
  export type TOAuthMethod = (typeof OAUTH_METHODS)[number];
115
+ export declare const LINKED_ACCOUNT_TYPES: readonly ["EMAIL", "PHONE", "GOOGLE", "FACEBOOK", "APPLE", "TWITTER", "DISCORD", "TELEGRAM", "FARCASTER", "EXTERNAL_WALLET"];
116
+ export type TLinkedAccountType = (typeof LINKED_ACCOUNT_TYPES)[number] | 'EXTERNAL_WALLET';
117
+ export type SupportedAccountLinks = (TLinkedAccountType | TExternalWallet)[];
115
118
  export declare enum AuthMethod {
116
119
  PASSWORD = "PASSWORD",
117
- PASSKEY = "PASSKEY"
120
+ PASSKEY = "PASSKEY",
121
+ PIN = "PIN"
122
+ }
123
+ export declare enum LegacyAuthMethod {
124
+ PASSWORD = "PASSWORD",
125
+ BIOMETRIC = "BIOMETRIC"
118
126
  }
119
127
  export type BiometricLocationHint = {
120
128
  useragent?: string;
@@ -142,6 +150,7 @@ export type SessionInfo = {
142
150
  cosmosPrefix?: string;
143
151
  origin?: string;
144
152
  email?: string;
153
+ verifiedExternalWalletAddresses?: string[];
145
154
  };
146
155
  export type ServerAuthStateBase = AuthExtras & {
147
156
  auth: PrimaryAuth;
@@ -159,16 +168,23 @@ export type ServerAuthStateLogin = ServerAuthStateBase & {
159
168
  stage: 'login';
160
169
  biometricHints?: BiometricLocationHint[];
161
170
  loginAuthMethods: AuthMethod[];
171
+ isWalletSelectionNeeded?: boolean;
172
+ hasPasswordWithoutPIN?: boolean;
173
+ signatureVerificationMessage?: string;
162
174
  };
163
175
  export type VerifyThirdPartyAuth = ServerAuthStateSignup | ServerAuthStateLogin;
164
176
  export type ExternalWalletInfo = {
177
+ partnerId: string;
165
178
  address: string;
166
179
  type: ExternalWalletType;
167
180
  provider?: string;
181
+ providerId?: string;
168
182
  addressBech32?: string;
169
183
  withFullParaAuth?: boolean;
170
184
  ensName?: string | null;
171
185
  ensAvatar?: string | null;
186
+ isConnectionOnly?: boolean;
187
+ withVerification?: boolean;
172
188
  };
173
189
  export type VerifyExternalWalletParams = {
174
190
  /**
@@ -213,3 +229,43 @@ export type AccountMetadata = Partial<Record<AccountMetadataKey, {
213
229
  date: Date;
214
230
  metadata: Record<string, any>;
215
231
  }>>;
232
+ export type IssueJwtParams = {
233
+ /**
234
+ * The index of the Para RSA keypair to use for signing the JWT. Defaults to `0`.
235
+ */
236
+ keyIndex?: number;
237
+ };
238
+ export type IssueJwtResponse = {
239
+ /**
240
+ * The Para JWT token.
241
+ */
242
+ token: string;
243
+ /**
244
+ * The `keyid`` / `kid` of the keypair used to sign the JWT.
245
+ */
246
+ keyId: string;
247
+ };
248
+ export type LinkedAccount<D extends Date | string = Date> = {
249
+ id?: string;
250
+ date: D;
251
+ type: TLinkedAccountType;
252
+ identifier: string;
253
+ displayName: string;
254
+ externalWallet?: ExternalWalletInfo;
255
+ metadata?: unknown;
256
+ };
257
+ export type LinkedAccounts<D extends Date | string = Date> = {
258
+ primary: LinkedAccount<D>[];
259
+ linked: LinkedAccount<D>[];
260
+ };
261
+ export type LinkAccountParams = {
262
+ type: TLinkedAccountType;
263
+ identifier?: string;
264
+ externalWallet?: ExternalWalletInfo;
265
+ };
266
+ export type VerifyLinkParams = {
267
+ linkedAccountId: string;
268
+ userId: string;
269
+ telegramAuthResponse?: TelegramAuthResponse;
270
+ verificationCode?: string;
271
+ };
@@ -20,3 +20,8 @@ export interface BackupKitEmailProps {
20
20
  supportUrl?: string;
21
21
  brandColor?: string;
22
22
  }
23
+ export type ResendVerificationCodeParams = VerificationEmailProps & {
24
+ userId: string;
25
+ type?: 'EMAIL' | 'PHONE';
26
+ linkedAccountId?: string;
27
+ };
@@ -14,7 +14,8 @@ export declare enum OnRampAsset {
14
14
  CELO = "CELO",
15
15
  CUSD = "CUSD",
16
16
  CEUR = "CEUR",
17
- CREAL = "CREAL"
17
+ CREAL = "CREAL",
18
+ BERA = "BERA"
18
19
  }
19
20
  export declare enum OnRampPurchaseStatus {
20
21
  INITIATED = "INITIATED",
@@ -1,4 +1,4 @@
1
- import { AuthMethod } from './auth.js';
1
+ import { AuthMethod, SupportedAccountLinks } from './auth.js';
2
2
  import { SupportedWalletTypes } from './wallet.js';
3
3
  export interface PartnerEntity {
4
4
  id: string;
@@ -16,5 +16,6 @@ export interface PartnerEntity {
16
16
  portalUrl?: string;
17
17
  supportedAuthMethods?: AuthMethod[];
18
18
  supportedWalletTypes?: SupportedWalletTypes;
19
+ supportedAccountLinks?: SupportedAccountLinks;
19
20
  cosmosPrefix?: string;
20
21
  }
@@ -31,7 +31,8 @@ export declare enum Network {
31
31
  COSMOS = "COSMOS",
32
32
  CELO = "CELO",
33
33
  NOBLE = "NOBLE",
34
- SOLANA_DEVNET = "SOLANA_DEVNET"
34
+ SOLANA_DEVNET = "SOLANA_DEVNET",
35
+ BERACHAIN = "BERACHAIN"
35
36
  }
36
37
  export type WalletRef = 'walletId' | 'externalWalletAddress';
37
38
  export type WalletParams = Partial<{
@@ -71,3 +72,8 @@ export type SupportedWalletTypes = {
71
72
  type: TWalletType;
72
73
  optional?: boolean;
73
74
  }[];
75
+ export declare const EVM_WALLETS: readonly ["METAMASK", "RAINBOW", "COINBASE", "WALLETCONNECT", "FARCASTER", "ZERION", "SAFE", "RABBY", "OKX", "HAHA", "BACKPACK", "PHANTOM", "VALORA"];
76
+ export declare const SOLANA_WALLETS: readonly ["PHANTOM", "GLOW", "BACKPACK", "SOLFLARE"];
77
+ export declare const COSMOS_WALLETS: readonly ["KEPLR", "LEAP", "COSMOSTATION"];
78
+ export declare const EXTERNAL_WALLET_TYPES: readonly ("FARCASTER" | "METAMASK" | "RAINBOW" | "COINBASE" | "WALLETCONNECT" | "ZERION" | "SAFE" | "RABBY" | "OKX" | "HAHA" | "BACKPACK" | "PHANTOM" | "VALORA" | "GLOW" | "SOLFLARE" | "KEPLR" | "LEAP" | "COSMOSTATION")[];
79
+ export type TExternalWallet = (typeof EXTERNAL_WALLET_TYPES)[number];
@@ -1,5 +1,5 @@
1
1
  import { Auth, AuthInfo, AuthParams, PrimaryAuth, PrimaryAuthInfo, VerifiedAuth, WalletParams, WalletRef } from './types/index.js';
2
- import { AccountMetadata, AccountMetadataKey, PregenAuth, PregenAuthInfo, PregenOrGuestAuth } from './types/auth.js';
2
+ import { AccountMetadata, AccountMetadataKey, LinkedAccounts, PregenAuth, PregenAuthInfo, PregenOrGuestAuth } from './types/auth.js';
3
3
  import { PregenIds, TPregenIdentifierType } from './types/wallet.js';
4
4
  export declare function isWalletId(params: WalletParams): params is {
5
5
  walletId: string;
@@ -55,4 +55,5 @@ export declare function fromAccountMetadata(obj: Partial<Record<AccountMetadataK
55
55
  date: string;
56
56
  metadata: object;
57
57
  }>> | undefined): AccountMetadata;
58
+ export declare function fromLinkedAccounts({ primary, linked }: LinkedAccounts<string>): LinkedAccounts<Date>;
58
59
  export {};
package/package.json CHANGED
@@ -1,30 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/user-management-client",
3
- "version": "2.0.0-alpha.5",
4
- "main": "dist/cjs/index.js",
5
- "module": "dist/esm/index.js",
6
- "types": "dist/types/index.d.ts",
7
- "typings": "dist/types/index.d.ts",
8
- "sideEffects": false,
9
- "scripts": {
10
- "build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
11
- "old-build": "yarn build:cjs && yarn build:esm && yarn build:types",
12
- "build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
13
- "build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
14
- "build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",
15
- "test": "vitest run --coverage"
16
- },
3
+ "version": "2.0.0-alpha.51",
17
4
  "dependencies": {
18
5
  "axios": "^1.8.4",
19
- "libphonenumber-js": "1.11.2"
6
+ "libphonenumber-js": "^1.11.7"
20
7
  },
21
8
  "devDependencies": {
22
- "typescript": "^5.0.4"
9
+ "typescript": "^5.8.3"
23
10
  },
24
- "files": [
25
- "dist",
26
- "package.json"
27
- ],
28
11
  "exports": {
29
12
  ".": {
30
13
  "types": "./dist/types/index.d.ts",
@@ -32,5 +15,22 @@
32
15
  "require": "./dist/cjs/index.js"
33
16
  }
34
17
  },
35
- "gitHead": "3ecfca088f24489f2e8fa5493d0f4459b08880e1"
18
+ "files": [
19
+ "dist",
20
+ "package.json"
21
+ ],
22
+ "gitHead": "f5b6354bac51de2e6988af340d7490dbdb62bc88",
23
+ "main": "dist/cjs/index.js",
24
+ "module": "dist/esm/index.js",
25
+ "scripts": {
26
+ "build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
27
+ "build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
28
+ "build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
29
+ "build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",
30
+ "old-build": "yarn build:cjs && yarn build:esm && yarn build:types",
31
+ "test": "vitest run --coverage"
32
+ },
33
+ "sideEffects": false,
34
+ "types": "dist/types/index.d.ts",
35
+ "typings": "dist/types/index.d.ts"
36
36
  }