@getpara/user-management-client 2.0.0-alpha.38 → 2.0.0-alpha.40

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.
@@ -151,10 +151,15 @@ 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
+ });
158
163
  this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
159
164
  userId,
160
165
  withMetadata = false
@@ -258,11 +263,16 @@ class Client {
258
263
  const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
259
264
  return res.data;
260
265
  });
261
- // GET /session/origin
266
+ // GET /sessions/:sessionLookupId/origin
262
267
  this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
263
268
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
264
269
  return res.data;
265
270
  });
271
+ // GET /sessions/:sessionLookupId/auth-verified
272
+ this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
273
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
274
+ return res.data;
275
+ });
266
276
  // POST /biometrics/verify
267
277
  this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
268
278
  const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
@@ -911,6 +921,17 @@ class Client {
911
921
  return res.data;
912
922
  });
913
923
  }
924
+ getSupportedAuthMethodsV2(auth) {
925
+ return __async(this, null, function* () {
926
+ const res = yield this.baseRequest.get(
927
+ "/users/supported-auth-methods/v2",
928
+ {
929
+ params: __spreadValues({}, auth)
930
+ }
931
+ );
932
+ return res.data;
933
+ });
934
+ }
914
935
  getPasswords(auth) {
915
936
  return __async(this, null, function* () {
916
937
  const res = yield this.baseRequest.get("/users/passwords", {
@@ -930,9 +951,9 @@ class Client {
930
951
  return res;
931
952
  });
932
953
  }
933
- getEncryptedWalletPrivateKey(passwordId) {
954
+ getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
934
955
  return __async(this, null, function* () {
935
- const query = new URLSearchParams({ passwordId }).toString();
956
+ const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
936
957
  const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
937
958
  return res;
938
959
  });
@@ -22,6 +22,7 @@ __export(auth_exports, {
22
22
  EncryptorType: () => EncryptorType,
23
23
  KeyShareType: () => KeyShareType,
24
24
  LINKED_ACCOUNT_TYPES: () => LINKED_ACCOUNT_TYPES,
25
+ LegacyAuthMethod: () => LegacyAuthMethod,
25
26
  OAUTH_METHODS: () => OAUTH_METHODS,
26
27
  OAuthMethod: () => OAuthMethod,
27
28
  PasswordStatus: () => PasswordStatus,
@@ -95,8 +96,14 @@ const LINKED_ACCOUNT_TYPES = [
95
96
  var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
96
97
  AuthMethod2["PASSWORD"] = "PASSWORD";
97
98
  AuthMethod2["PASSKEY"] = "PASSKEY";
99
+ AuthMethod2["PIN"] = "PIN";
98
100
  return AuthMethod2;
99
101
  })(AuthMethod || {});
102
+ var LegacyAuthMethod = /* @__PURE__ */ ((LegacyAuthMethod2) => {
103
+ LegacyAuthMethod2["PASSWORD"] = "PASSWORD";
104
+ LegacyAuthMethod2["BIOMETRIC"] = "BIOMETRIC";
105
+ return LegacyAuthMethod2;
106
+ })(LegacyAuthMethod || {});
100
107
  // Annotate the CommonJS export names for ESM import in node:
101
108
  0 && (module.exports = {
102
109
  AUTH_TYPES,
@@ -104,6 +111,7 @@ var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
104
111
  EncryptorType,
105
112
  KeyShareType,
106
113
  LINKED_ACCOUNT_TYPES,
114
+ LegacyAuthMethod,
107
115
  OAUTH_METHODS,
108
116
  OAuthMethod,
109
117
  PasswordStatus,
@@ -74,10 +74,15 @@ 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
+ });
81
86
  this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
82
87
  userId,
83
88
  withMetadata = false
@@ -181,11 +186,16 @@ class Client {
181
186
  const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
182
187
  return res.data;
183
188
  });
184
- // GET /session/origin
189
+ // GET /sessions/:sessionLookupId/origin
185
190
  this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
186
191
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
187
192
  return res.data;
188
193
  });
194
+ // GET /sessions/:sessionLookupId/auth-verified
195
+ this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
196
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
197
+ return res.data;
198
+ });
189
199
  // POST /biometrics/verify
190
200
  this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
191
201
  const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
@@ -834,6 +844,17 @@ class Client {
834
844
  return res.data;
835
845
  });
836
846
  }
847
+ getSupportedAuthMethodsV2(auth) {
848
+ return __async(this, null, function* () {
849
+ const res = yield this.baseRequest.get(
850
+ "/users/supported-auth-methods/v2",
851
+ {
852
+ params: __spreadValues({}, auth)
853
+ }
854
+ );
855
+ return res.data;
856
+ });
857
+ }
837
858
  getPasswords(auth) {
838
859
  return __async(this, null, function* () {
839
860
  const res = yield this.baseRequest.get("/users/passwords", {
@@ -853,9 +874,9 @@ class Client {
853
874
  return res;
854
875
  });
855
876
  }
856
- getEncryptedWalletPrivateKey(passwordId) {
877
+ getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
857
878
  return __async(this, null, function* () {
858
- const query = new URLSearchParams({ passwordId }).toString();
879
+ const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
859
880
  const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
860
881
  return res;
861
882
  });
@@ -65,14 +65,21 @@ const LINKED_ACCOUNT_TYPES = [
65
65
  var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
66
66
  AuthMethod2["PASSWORD"] = "PASSWORD";
67
67
  AuthMethod2["PASSKEY"] = "PASSKEY";
68
+ AuthMethod2["PIN"] = "PIN";
68
69
  return AuthMethod2;
69
70
  })(AuthMethod || {});
71
+ var LegacyAuthMethod = /* @__PURE__ */ ((LegacyAuthMethod2) => {
72
+ LegacyAuthMethod2["PASSWORD"] = "PASSWORD";
73
+ LegacyAuthMethod2["BIOMETRIC"] = "BIOMETRIC";
74
+ return LegacyAuthMethod2;
75
+ })(LegacyAuthMethod || {});
70
76
  export {
71
77
  AUTH_TYPES,
72
78
  AuthMethod,
73
79
  EncryptorType,
74
80
  KeyShareType,
75
81
  LINKED_ACCOUNT_TYPES,
82
+ LegacyAuthMethod,
76
83
  OAUTH_METHODS,
77
84
  OAuthMethod,
78
85
  PasswordStatus,
@@ -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, IssueJwtParams, IssueJwtResponse, LinkAccountParams, LinkedAccounts, ResendVerificationCodeParams } 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;
@@ -117,6 +119,7 @@ interface sessionPasswordBody {
117
119
  salt?: string;
118
120
  encryptedWalletPrivateKey?: string;
119
121
  encryptionKeyHash?: string;
122
+ isPIN?: boolean;
120
123
  }
121
124
  interface EncryptedWalletPrivateKey {
122
125
  id: string;
@@ -154,7 +157,10 @@ declare class Client {
154
157
  externalWallet: ExternalWalletInfo;
155
158
  shouldTrackUser?: boolean;
156
159
  }) => Promise<LoginExternalWalletResponse>;
157
- 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
+ }>;
158
164
  getLinkedAccounts: ({ userId, withMetadata, }: {
159
165
  userId: string;
160
166
  withMetadata?: boolean;
@@ -202,6 +208,9 @@ declare class Client {
202
208
  sessionOrigin: (sessionLookupId: string) => Promise<{
203
209
  origin?: string;
204
210
  }>;
211
+ sessionAuthVerified: (sessionLookupId: string) => Promise<{
212
+ authVerified?: boolean;
213
+ }>;
205
214
  verifyWebChallenge: (partnerId: string, body: verifyWebChallengeBody) => Promise<any>;
206
215
  getSessionChallenge: (userId: string) => Promise<any>;
207
216
  verifySessionChallenge: (userId: string, body: verifySessionChallengeBody) => Promise<any>;
@@ -370,10 +379,16 @@ declare class Client {
370
379
  deletePendingTransaction(userId: string, pendingTransactionId: string): Promise<any>;
371
380
  addSessionPasswordPublicKey(userId: string, body: sessionPasswordBody): Promise<any>;
372
381
  patchSessionPassword: (partnerId: string, userId: string, passwordId: string, body: sessionPasswordBody) => Promise<any>;
373
- 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
+ }>;
374
389
  getPasswords(auth: Auth): Promise<PasswordEntity[]>;
375
390
  verifyPasswordChallenge(partnerId: string, body: verifyPasswordChallengeBody): Promise<any>;
376
- getEncryptedWalletPrivateKey(passwordId: string): Promise<{
391
+ getEncryptedWalletPrivateKey(passwordId: string, sessionLookupId: string): Promise<{
377
392
  data: {
378
393
  encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
379
394
  };
@@ -117,7 +117,12 @@ export type TLinkedAccountType = (typeof LINKED_ACCOUNT_TYPES)[number] | 'EXTERN
117
117
  export type SupportedAccountLinks = (TLinkedAccountType | TExternalWallet)[];
118
118
  export declare enum AuthMethod {
119
119
  PASSWORD = "PASSWORD",
120
- PASSKEY = "PASSKEY"
120
+ PASSKEY = "PASSKEY",
121
+ PIN = "PIN"
122
+ }
123
+ export declare enum LegacyAuthMethod {
124
+ PASSWORD = "PASSWORD",
125
+ BIOMETRIC = "BIOMETRIC"
121
126
  }
122
127
  export type BiometricLocationHint = {
123
128
  useragent?: string;
@@ -164,6 +169,7 @@ export type ServerAuthStateLogin = ServerAuthStateBase & {
164
169
  biometricHints?: BiometricLocationHint[];
165
170
  loginAuthMethods: AuthMethod[];
166
171
  isWalletSelectionNeeded?: boolean;
172
+ hasPasswordWithoutPIN?: boolean;
167
173
  };
168
174
  export type VerifyThirdPartyAuth = ServerAuthStateSignup | ServerAuthStateLogin;
169
175
  export type ExternalWalletInfo = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/user-management-client",
3
- "version": "2.0.0-alpha.38",
3
+ "version": "2.0.0-alpha.40",
4
4
  "dependencies": {
5
5
  "axios": "^1.8.4",
6
6
  "libphonenumber-js": "^1.11.7"
@@ -19,7 +19,7 @@
19
19
  "dist",
20
20
  "package.json"
21
21
  ],
22
- "gitHead": "64c71f82908cef3765f53ffe105bb42ebbbdec28",
22
+ "gitHead": "2506044cd3ed127774fb7d537ae850b43acfe8b7",
23
23
  "main": "dist/cjs/index.js",
24
24
  "module": "dist/esm/index.js",
25
25
  "scripts": {