@getpara/user-management-client 2.0.0-alpha.53 → 2.0.0-alpha.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -132,9 +132,13 @@ class Client {
132
132
  });
133
133
  return res.data;
134
134
  });
135
- this.verifyTelegram = (authObject) => __async(this, null, function* () {
135
+ this.verifyTelegram = (_0) => __async(this, [_0], function* ({
136
+ authObject,
137
+ sessionLookupId
138
+ }) {
136
139
  return (yield this.baseRequest.post("/users/telegram/v2", {
137
- authObject
140
+ authObject,
141
+ sessionLookupId
138
142
  })).data;
139
143
  });
140
144
  this.verifyOAuth = () => __async(this, null, function* () {
@@ -152,7 +156,10 @@ class Client {
152
156
  return res.data;
153
157
  });
154
158
  this.verifyAccount = (userId, body) => __async(this, null, function* () {
155
- const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
159
+ const res = yield this.baseRequest.post(
160
+ `/users/${userId}/verify`,
161
+ body
162
+ );
156
163
  return res.data;
157
164
  });
158
165
  // POST /users/send-login-code
@@ -271,11 +278,21 @@ class Client {
271
278
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
272
279
  return res.data;
273
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
+ });
274
286
  // GET /sessions/:sessionLookupId/auth-verified
275
287
  this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
276
288
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
277
289
  return res.data;
278
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
+ });
279
296
  // POST /biometrics/verify
280
297
  this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
281
298
  const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
@@ -432,12 +449,65 @@ class Client {
432
449
  const res = yield this.baseRequest.post(`/auth/jwt`, { keyIndex });
433
450
  return res.data;
434
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
+ });
435
468
  this.trackError = (opts) => __async(this, null, function* () {
436
469
  yield this.baseRequest.post("/errors/sdk", opts);
437
470
  });
438
471
  this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
439
472
  yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
440
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
+ });
441
511
  const headers = __spreadValues(__spreadValues({}, apiKey && { [import_consts.API_KEY_HEADER_NAME]: apiKey }), partnerId && { [import_consts.PARTNER_ID_HEADER_NAME]: partnerId });
442
512
  const axiosConfig = {
443
513
  baseURL: userManagementHost,
@@ -613,8 +683,8 @@ class Client {
613
683
  });
614
684
  }
615
685
  getFarcasterAuthStatus() {
616
- return __async(this, null, function* () {
617
- 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 });
618
688
  return res.data;
619
689
  });
620
690
  }
@@ -55,9 +55,13 @@ class Client {
55
55
  });
56
56
  return res.data;
57
57
  });
58
- this.verifyTelegram = (authObject) => __async(this, null, function* () {
58
+ this.verifyTelegram = (_0) => __async(this, [_0], function* ({
59
+ authObject,
60
+ sessionLookupId
61
+ }) {
59
62
  return (yield this.baseRequest.post("/users/telegram/v2", {
60
- authObject
63
+ authObject,
64
+ sessionLookupId
61
65
  })).data;
62
66
  });
63
67
  this.verifyOAuth = () => __async(this, null, function* () {
@@ -75,7 +79,10 @@ class Client {
75
79
  return res.data;
76
80
  });
77
81
  this.verifyAccount = (userId, body) => __async(this, null, function* () {
78
- const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
82
+ const res = yield this.baseRequest.post(
83
+ `/users/${userId}/verify`,
84
+ body
85
+ );
79
86
  return res.data;
80
87
  });
81
88
  // POST /users/send-login-code
@@ -194,11 +201,21 @@ class Client {
194
201
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
195
202
  return res.data;
196
203
  });
204
+ // GET /sessions/:sessionLookupId/login-method
205
+ this.sessionLoginMethod = (sessionLookupId) => __async(this, null, function* () {
206
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/login-method`);
207
+ return res.data;
208
+ });
197
209
  // GET /sessions/:sessionLookupId/auth-verified
198
210
  this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
199
211
  const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
200
212
  return res.data;
201
213
  });
214
+ // GET /sessions/:sessionLookupId/auth
215
+ this.sessionAuth = (sessionLookupId) => __async(this, null, function* () {
216
+ const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth`);
217
+ return res.data;
218
+ });
202
219
  // POST /biometrics/verify
203
220
  this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
204
221
  const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
@@ -355,12 +372,65 @@ class Client {
355
372
  const res = yield this.baseRequest.post(`/auth/jwt`, { keyIndex });
356
373
  return res.data;
357
374
  });
375
+ this.getProfileBalance = (_0) => __async(this, [_0], function* ({
376
+ config,
377
+ wallets,
378
+ refetch
379
+ }) {
380
+ const res = yield this.baseRequest.post(`/assets/balances`, {
381
+ config,
382
+ wallets,
383
+ refetch
384
+ });
385
+ return res.data;
386
+ });
387
+ this.getAssetInfo = () => __async(this, null, function* () {
388
+ const res = yield this.baseRequest.get(`/assets`);
389
+ return res.data;
390
+ });
358
391
  this.trackError = (opts) => __async(this, null, function* () {
359
392
  yield this.baseRequest.post("/errors/sdk", opts);
360
393
  });
361
394
  this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
362
395
  yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
363
396
  });
397
+ // ENCLAVE METHODS
398
+ /**
399
+ * Get the enclave's public key for encryption
400
+ */
401
+ this.getEnclavePublicKey = () => __async(this, null, function* () {
402
+ const res = yield this.baseRequest.get(
403
+ "/enclave/public-key"
404
+ );
405
+ return res.data;
406
+ });
407
+ /**
408
+ * Persist encrypted key shares to the enclave
409
+ * @param encryptedPayload JSON string containing the encrypted ECIES payload
410
+ */
411
+ this.persistEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
412
+ const body = { encryptedPayload };
413
+ const res = yield this.baseRequest.post("/enclave/key-shares", body);
414
+ return res.data;
415
+ });
416
+ /**
417
+ * Retrieve encrypted key shares from the enclave
418
+ * @param encryptedPayload JSON string containing the encrypted ECIES query
419
+ */
420
+ this.retrieveEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
421
+ const res = yield this.baseRequest.get(
422
+ `/enclave/key-shares?encryptedPayload=${encodeURIComponent(encryptedPayload)}`
423
+ );
424
+ return res.data;
425
+ });
426
+ this.issueEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
427
+ const res = yield this.baseRequest.post(`/enclave/jwt/issue`, { encryptedPayload });
428
+ return res.data;
429
+ });
430
+ this.refreshEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
431
+ const res = yield this.baseRequest.post(`/enclave/jwt/refresh`, { encryptedPayload });
432
+ return res.data;
433
+ });
364
434
  const headers = __spreadValues(__spreadValues({}, apiKey && { [API_KEY_HEADER_NAME]: apiKey }), partnerId && { [PARTNER_ID_HEADER_NAME]: partnerId });
365
435
  const axiosConfig = {
366
436
  baseURL: userManagementHost,
@@ -536,8 +606,8 @@ class Client {
536
606
  });
537
607
  }
538
608
  getFarcasterAuthStatus() {
539
- return __async(this, null, function* () {
540
- const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`);
609
+ return __async(this, arguments, function* ({ sessionLookupId } = {}) {
610
+ const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`, { sessionLookupId });
541
611
  return res.data;
542
612
  });
543
613
  }
@@ -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, AuthMethodStatus, PregenIds, PrimaryAuth, 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 '@getpara/shared';
2
+ import { AccountMetadata, Auth, AuthIdentifier, AuthMethod, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, ExternalWalletInfo, LoginExternalWalletResponse, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, AuthMethodStatus, PregenIds, PrimaryAuth, PublicKeyType, ServerAuthStateSignup, SessionInfo, Setup2faResponse, SignUpOrLogInResponse, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, VerifiedAuth, VerifyFarcasterResponse, VerifyTelegramResponse, VerifyThirdPartyAuth, WalletEntity, WalletParams, TWalletScheme, TWalletType, VerifyExternalWalletParams, IssueJwtParams, IssueJwtResponse, LinkAccountParams, LinkedAccounts, ResendVerificationCodeParams, AssetMetadataIndexed, GetProfileBalanceParams, ProfileBalance, LegacyAuthMethod, PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateDone } from '@getpara/shared';
3
3
  interface ConfigOpts {
4
4
  useFetchAdapter?: boolean;
5
5
  }
@@ -151,13 +151,16 @@ declare class Client {
151
151
  */
152
152
  createUser: (body: VerifiedAuth & VerificationEmailProps) => Promise<createUserIdRes>;
153
153
  checkUserExists: (auth: VerifiedAuth) => Promise<any>;
154
- verifyTelegram: (authObject: TelegramAuthResponse) => Promise<VerifyTelegramResponse>;
154
+ verifyTelegram: ({ authObject, sessionLookupId, }: {
155
+ authObject: TelegramAuthResponse;
156
+ sessionLookupId?: string;
157
+ }) => Promise<VerifyTelegramResponse>;
155
158
  verifyOAuth: () => Promise<VerifyThirdPartyAuth | null>;
156
159
  loginExternalWallet: ({ externalWallet, shouldTrackUser, }: {
157
160
  externalWallet: ExternalWalletInfo;
158
161
  shouldTrackUser?: boolean;
159
162
  }) => Promise<LoginExternalWalletResponse>;
160
- verifyAccount: (userId: string, body: verifyBody) => Promise<ServerAuthStateSignup | ServerAuthStateLogin>;
163
+ verifyAccount: (userId: string, body: verifyBody) => Promise<ServerAuthStateSignup | ServerAuthStateLogin | ServerAuthStateDone>;
161
164
  sendLoginVerificationCode: (auth: PrimaryAuthInfo, isRecovery?: boolean) => Promise<{
162
165
  userId: string;
163
166
  }>;
@@ -208,9 +211,21 @@ declare class Client {
208
211
  sessionOrigin: (sessionLookupId: string) => Promise<{
209
212
  origin?: string;
210
213
  }>;
214
+ sessionLoginMethod: (sessionLookupId: string) => Promise<{
215
+ loginMethod?: string;
216
+ }>;
211
217
  sessionAuthVerified: (sessionLookupId: string) => Promise<{
212
218
  authVerified?: boolean;
213
219
  }>;
220
+ sessionAuth: (sessionLookupId: string) => Promise<{
221
+ userId: string;
222
+ authVerified?: boolean;
223
+ loginAuthMethods: {
224
+ methods: AuthMethod[];
225
+ };
226
+ auth: PrimaryAuth;
227
+ isNewUser: boolean;
228
+ }>;
214
229
  verifyWebChallenge: (partnerId: string, body: verifyWebChallengeBody) => Promise<any>;
215
230
  getSessionChallenge: (userId: string) => Promise<any>;
216
231
  verifySessionChallenge: (userId: string, body: verifySessionChallengeBody) => Promise<any>;
@@ -266,7 +281,9 @@ declare class Client {
266
281
  initializeFarcasterLogin({ appScheme }?: {
267
282
  appScheme?: string;
268
283
  }): Promise<any>;
269
- getFarcasterAuthStatus(): Promise<VerifyFarcasterResponse>;
284
+ getFarcasterAuthStatus({ sessionLookupId }?: {
285
+ sessionLookupId?: string;
286
+ }): Promise<VerifyFarcasterResponse>;
270
287
  initializeRecoveryForPhone(phone: string, countryCode: string): Promise<AxiosResponse<any, any>>;
271
288
  finalizeRecovery(userId: string, walletId: string): Promise<AxiosResponse<any, any>>;
272
289
  recoverUserShares(userId: string, walletId: string): Promise<AxiosResponse<{
@@ -402,6 +419,12 @@ declare class Client {
402
419
  rpcUrl?: string;
403
420
  }) => Promise<GetWalletBalanceRes>;
404
421
  issueJwt: ({ keyIndex }?: IssueJwtParams) => Promise<IssueJwtResponse>;
422
+ getProfileBalance: ({ config, wallets, refetch, }: GetProfileBalanceParams) => Promise<{
423
+ balance: ProfileBalance;
424
+ }>;
425
+ getAssetInfo: () => Promise<{
426
+ assets: AssetMetadataIndexed;
427
+ }>;
405
428
  trackError: (opts: {
406
429
  methodName: string;
407
430
  error: {
@@ -415,5 +438,33 @@ declare class Client {
415
438
  props: object;
416
439
  reactSdkVersion: string;
417
440
  }) => Promise<void>;
441
+ /**
442
+ * Get the enclave's public key for encryption
443
+ */
444
+ getEnclavePublicKey: () => Promise<{
445
+ publicKey: string;
446
+ keyFingerprint: string;
447
+ generatedAt: string;
448
+ }>;
449
+ /**
450
+ * Persist encrypted key shares to the enclave
451
+ * @param encryptedPayload JSON string containing the encrypted ECIES payload
452
+ */
453
+ persistEnclaveShares: (encryptedPayload: string) => Promise<{
454
+ payload: any;
455
+ }>;
456
+ /**
457
+ * Retrieve encrypted key shares from the enclave
458
+ * @param encryptedPayload JSON string containing the encrypted ECIES query
459
+ */
460
+ retrieveEnclaveShares: (encryptedPayload: string) => Promise<{
461
+ payload: any;
462
+ }>;
463
+ issueEnclaveJwt: (encryptedPayload: string) => Promise<{
464
+ payload: string;
465
+ }>;
466
+ refreshEnclaveJwt: (encryptedPayload: string) => Promise<{
467
+ payload: string;
468
+ }>;
418
469
  }
419
470
  export default Client;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@getpara/user-management-client",
3
- "version": "2.0.0-alpha.53",
3
+ "version": "2.0.0-alpha.55",
4
4
  "dependencies": {
5
- "@getpara/shared": "1.0.2",
5
+ "@getpara/shared": "1.1.0",
6
6
  "axios": "^1.8.4",
7
7
  "libphonenumber-js": "^1.11.7"
8
8
  },
@@ -20,7 +20,7 @@
20
20
  "dist",
21
21
  "package.json"
22
22
  ],
23
- "gitHead": "ad18fa268a41b0e4c080fa8349553fb546983513",
23
+ "gitHead": "370bc842fc70118826e3b75815ba923c50f28100",
24
24
  "main": "dist/cjs/index.js",
25
25
  "module": "dist/esm/index.js",
26
26
  "scripts": {