@getpara/user-management-client 2.0.0-dev.1 → 2.0.0-dev.2

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.
@@ -1,5 +1,5 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { 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, WalletScheme, WalletType, 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 } from './types/index.js';
3
3
  interface ConfigOpts {
4
4
  useFetchAdapter?: boolean;
5
5
  }
@@ -12,18 +12,6 @@ type ClientConfig = {
12
12
  retrieveSessionCookie?: () => string | undefined;
13
13
  persistSessionCookie?: (cookie: string) => void;
14
14
  };
15
- interface ExternalWalletLoginBody {
16
- externalAddress: string;
17
- type: 'EVM' | 'SOLANA' | 'COSMOS';
18
- externalWalletProvider?: string;
19
- shouldTrackUser?: boolean;
20
- }
21
- export interface ExternalWalletLoginRes {
22
- userId: string;
23
- userExists: boolean;
24
- isVerified: boolean;
25
- signatureVerificationMessage: string;
26
- }
27
15
  interface createUserIdRes {
28
16
  protocolId: string;
29
17
  userId: string;
@@ -31,12 +19,6 @@ interface createUserIdRes {
31
19
  interface verifyBody {
32
20
  verificationCode: string;
33
21
  }
34
- interface verifyExternalWalletBody {
35
- address: string;
36
- signedMessage: string;
37
- cosmosPublicKeyHex?: string;
38
- cosmosSigner?: string;
39
- }
40
22
  interface getWebChallengeRes {
41
23
  challenge: string;
42
24
  allowedPublicKeys?: string[];
@@ -88,8 +70,8 @@ interface PasswordEntity {
88
70
  }
89
71
  interface createWalletBody {
90
72
  useTwoSigners?: boolean;
91
- scheme: WalletScheme;
92
- type: WalletType;
73
+ scheme: TWalletScheme;
74
+ type: TWalletType;
93
75
  cosmosPrefix?: string;
94
76
  }
95
77
  interface updatePregenWalletBody {
@@ -100,11 +82,14 @@ interface createWalletRes {
100
82
  protocolId: string;
101
83
  walletId: string;
102
84
  }
85
+ interface GetWalletBalanceRes {
86
+ balance: string;
87
+ }
103
88
  interface createPregenWalletBody {
104
89
  pregenIdentifier: string;
105
90
  pregenIdentifierType: TPregenIdentifierType;
106
- scheme?: WalletScheme;
107
- type: WalletType;
91
+ scheme?: TWalletScheme;
92
+ type: TWalletType;
108
93
  cosmosPrefix?: string;
109
94
  }
110
95
  interface claimPreGenWalletsBody {
@@ -114,11 +99,13 @@ interface claimPreGenWalletsBody {
114
99
  interface signTransactionBody {
115
100
  transaction: string;
116
101
  chainId: string;
102
+ protocolId?: string;
117
103
  }
118
104
  interface sendTransactionBody {
119
105
  transaction: string;
120
106
  chain?: Chain;
121
107
  chainId?: string;
108
+ protocolId?: string;
122
109
  }
123
110
  interface AcceptScopesBody {
124
111
  scopeIds: string[];
@@ -131,6 +118,15 @@ interface sessionPasswordBody {
131
118
  encryptedWalletPrivateKey?: string;
132
119
  encryptionKeyHash?: string;
133
120
  }
121
+ interface EncryptedWalletPrivateKey {
122
+ id: string;
123
+ userId: string;
124
+ encryptedPrivateKey: string;
125
+ encryptionKeyHash: string;
126
+ biometricPublicKey?: string;
127
+ passwordId?: string;
128
+ }
129
+ export type SDKType = 'WEB' | 'SERVER' | 'BRIDGE' | 'REACT_NATIVE';
134
130
  export type VerifyTelegramRes = {
135
131
  isValid: true;
136
132
  userId: string;
@@ -152,18 +148,41 @@ declare class Client {
152
148
  */
153
149
  createUser: (body: VerifiedAuth & VerificationEmailProps) => Promise<createUserIdRes>;
154
150
  checkUserExists: (auth: VerifiedAuth) => Promise<any>;
155
- checkUserExistsV2: (auth: VerifiedAuth) => Promise<{
156
- exists: boolean;
157
- }>;
158
- verifyTelegram: (authObject: TelegramAuthResponse) => Promise<VerifyTelegramRes>;
159
- verifyTelegramV2: (authObject: TelegramAuthResponse) => Promise<VerifyTelegramResponse>;
151
+ verifyTelegram: (authObject: TelegramAuthResponse) => Promise<VerifyTelegramResponse>;
160
152
  verifyOAuth: () => Promise<VerifyThirdPartyAuth | null>;
161
- externalWalletLogin: (body: ExternalWalletLoginBody) => Promise<ExternalWalletLoginRes>;
162
- loginExternalWalletV2: ({ externalWallet, shouldTrackUser, }: {
153
+ loginExternalWallet: ({ externalWallet, shouldTrackUser, }: {
163
154
  externalWallet: ExternalWalletInfo;
164
155
  shouldTrackUser?: boolean;
165
156
  }) => Promise<LoginExternalWalletResponse>;
166
157
  verifyNewAccount: (userId: string, body: verifyBody) => Promise<ServerAuthStateSignup>;
158
+ getLinkedAccounts: ({ userId, withMetadata, }: {
159
+ userId: string;
160
+ withMetadata?: boolean;
161
+ }) => Promise<{
162
+ accounts: LinkedAccounts;
163
+ }>;
164
+ linkAccount: ({ userId, ...opts }: LinkAccountParams & {
165
+ userId: string;
166
+ }) => Promise<{
167
+ linkedAccountId: string;
168
+ signatureVerificationMessage?: string;
169
+ } | {
170
+ isConflict: true;
171
+ }>;
172
+ verifyLink: ({ linkedAccountId, userId, ...opts }: {
173
+ linkedAccountId: string;
174
+ userId: string;
175
+ telegramAuthResponse?: TelegramAuthResponse;
176
+ verificationCode?: string;
177
+ } & Partial<VerifyExternalWalletParams>) => Promise<{
178
+ accounts: LinkedAccounts;
179
+ } | {
180
+ isConflict: true;
181
+ }>;
182
+ unlinkAccount: ({ linkedAccountId, userId }: {
183
+ linkedAccountId: string;
184
+ userId: string;
185
+ }) => Promise<LinkedAccounts>;
167
186
  /**
168
187
  * @deprecated
169
188
  */
@@ -172,14 +191,13 @@ declare class Client {
172
191
  * @deprecated
173
192
  */
174
193
  verifyPhone: (userId: string, body: verifyBody) => Promise<any>;
175
- verifyExternalWallet: (userId: string, body: verifyExternalWalletBody) => Promise<any>;
176
- verifyExternalWalletV2: (userId: string, body: VerifyExternalWalletParams) => Promise<ServerAuthStateSignup>;
194
+ verifyExternalWallet: (userId: string, body: VerifyExternalWalletParams) => Promise<ServerAuthStateSignup>;
177
195
  addSessionPublicKey: (userId: string, body: sessionPublicKeyBody) => Promise<any>;
178
196
  getSessionPublicKeys: (userId: string) => Promise<any>;
179
197
  getBiometricLocationHints: (auth: PrimaryAuth) => Promise<BiometricLocationHint[]>;
180
198
  getSessionPublicKey: (userId: string, biometricId: string) => Promise<any>;
181
199
  patchSessionPublicKey: (partnerId: string, userId: string, biometricId: string, body: sessionPublicKeyBody) => Promise<any>;
182
- getWebChallenge: (auth?: PrimaryAuth) => Promise<getWebChallengeRes>;
200
+ getWebChallenge: (auth?: PrimaryAuth | Auth<"userId">) => Promise<getWebChallengeRes>;
183
201
  touchSession: (regenerate?: boolean) => Promise<SessionInfo>;
184
202
  sessionOrigin: (sessionLookupId: string) => Promise<{
185
203
  origin?: string;
@@ -189,16 +207,10 @@ declare class Client {
189
207
  verifySessionChallenge: (userId: string, body: verifySessionChallengeBody) => Promise<any>;
190
208
  createWallet: (userId: string, body?: createWalletBody) => Promise<createWalletRes>;
191
209
  createPregenWallet: (body?: createPregenWalletBody) => Promise<createWalletRes>;
192
- getPregenWallets: <ReturnType = {
193
- wallets: WalletEntity[];
194
- }>(pregenIds: PregenIds, isPortal?: boolean, userId?: string) => Promise<ReturnType>;
195
- getPregenWalletsV2: (pregenIds: PregenIds, isPortal?: boolean, userId?: string) => Promise<{
210
+ getPregenWallets: (pregenIds: PregenIds, isPortal?: boolean, userId?: string) => Promise<{
196
211
  wallets: WalletEntity[];
197
212
  }>;
198
- claimPregenWallets: <ReturnType = {
199
- walletIds?: string[];
200
- }>(body?: claimPreGenWalletsBody) => Promise<ReturnType>;
201
- claimPregenWalletsV2: (body?: claimPreGenWalletsBody) => Promise<{
213
+ claimPregenWallets: (body?: claimPreGenWalletsBody) => Promise<{
202
214
  walletIds: string[];
203
215
  }>;
204
216
  sendTransaction: (userId: string, walletId: string, body: sendTransactionBody) => Promise<any>;
@@ -215,7 +227,7 @@ declare class Client {
215
227
  logout: () => Promise<any>;
216
228
  recoveryVerification: (email: string, verificationCode: string) => Promise<any>;
217
229
  recoveryInit: (email: string) => Promise<any>;
218
- preSignMessage: (userId: string, walletId: string, message: string, scheme?: WalletScheme, cosmosSignDoc?: string) => Promise<any>;
230
+ preSignMessage: (userId: string, walletId: string, message: string, scheme?: TWalletScheme, cosmosSignDoc?: string, protocolId?: string) => Promise<any>;
219
231
  deleteSelf: (userId: string) => Promise<any>;
220
232
  uploadKeyshares(userId: string, walletId: string, encryptedKeyshares: EncryptedKeyShare[]): Promise<any>;
221
233
  uploadUserKeyShares(userId: string, encryptedKeyshares: (EncryptedKeyShare & {
@@ -232,22 +244,20 @@ declare class Client {
232
244
  }[]): Promise<any>;
233
245
  getTransmissionKeyshares(userId: string, sessionLookupId: string): Promise<any>;
234
246
  getParaShare: (userId: string, walletId: string) => Promise<string>;
235
- getBackupKit: (userId: string) => Promise<any>;
236
- resendVerificationCode({ userId, ...rest }: {
237
- userId: string;
238
- } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
247
+ getBackupKit: (userId: string, walletId: string) => Promise<any>;
248
+ resendVerificationCode({ userId, ...rest }: ResendVerificationCodeParams): Promise<AxiosResponse<any, any>>;
239
249
  resendVerificationCodeByPhone({ userId, ...rest }: {
240
250
  userId: string;
241
251
  } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
242
252
  cancelRecoveryAttempt(email: string): Promise<AxiosResponse<any, any>>;
243
253
  check2FAStatus(userId: string): Promise<AxiosResponse<any, any>>;
244
254
  enable2FA(userId: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
245
- setup2FA(userId: string): Promise<AxiosResponse<any, any>>;
246
- setup2FAV2(userId: string): Promise<Setup2faResponse>;
255
+ setup2FA(userId: string): Promise<Setup2faResponse>;
247
256
  initializeRecovery(email: string): Promise<AxiosResponse<any, any>>;
248
- initializeFarcasterLogin(): Promise<AxiosResponse<any, any>>;
249
- getFarcasterAuthStatus(): Promise<AxiosResponse<any, any>>;
250
- getFarcasterAuthStatusV2(): Promise<VerifyFarcasterResponse>;
257
+ initializeFarcasterLogin({ appScheme }?: {
258
+ appScheme?: string;
259
+ }): Promise<any>;
260
+ getFarcasterAuthStatus(): Promise<VerifyFarcasterResponse>;
251
261
  initializeRecoveryForPhone(phone: string, countryCode: string): Promise<AxiosResponse<any, any>>;
252
262
  finalizeRecovery(userId: string, walletId: string): Promise<AxiosResponse<any, any>>;
253
263
  recoverUserShares(userId: string, walletId: string): Promise<AxiosResponse<{
@@ -266,8 +276,7 @@ declare class Client {
266
276
  }, any>>;
267
277
  verifyEmailForRecovery(email: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
268
278
  verifyPhoneForRecovery(phone: string, countryCode: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
269
- verify2FA(email: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
270
- verify2FAV2(auth: VerifiedAuth, verificationCode: string): Promise<any>;
279
+ verify2FA(auth: VerifiedAuth, verificationCode: string): Promise<any>;
271
280
  /**
272
281
  * @deprecated
273
282
  */
@@ -279,7 +288,7 @@ declare class Client {
279
288
  getPendingTransaction(userId: string, pendingTransactionId: string): Promise<AxiosResponse<any, any>>;
280
289
  acceptPendingTransaction(userId: string, pendingTransactionId: string): Promise<AxiosResponse<any, any>>;
281
290
  getOnRampConfig(): Promise<OnRampConfig>;
282
- createOnRampPurchase({ userId, params: { type, walletType, address, provider, networks, assets, defaultNetwork, defaultAsset, fiat, fiatQuantity, testMode, }, ...params }: {
291
+ createOnRampPurchase({ userId, params, ...walletParams }: {
283
292
  userId: string;
284
293
  params: OnRampPurchaseCreateParams;
285
294
  } & WalletParams): Promise<OnRampPurchase>;
@@ -294,7 +303,7 @@ declare class Client {
294
303
  } & WalletParams): Promise<AxiosResponse<OnRampPurchase, any>>;
295
304
  signMoonPayUrl(userId: string, { url, type, cosmosPrefix, testMode, walletId, externalWalletAddress, }: {
296
305
  url: string;
297
- type: WalletType;
306
+ type: TWalletType;
298
307
  cosmosPrefix: string;
299
308
  testMode?: boolean;
300
309
  walletId?: string;
@@ -304,6 +313,7 @@ declare class Client {
304
313
  }, any>>;
305
314
  generateOffRampTx<ReturnType = {
306
315
  tx: string;
316
+ message?: string;
307
317
  asset: OnRampAsset;
308
318
  network: Network;
309
319
  }>(userId: string, { provider, chainId, contractAddress, testMode, walletId, walletType, destinationAddress, sourceAddress, assetQuantity, }: {
@@ -312,19 +322,20 @@ declare class Client {
312
322
  contractAddress?: string;
313
323
  testMode?: boolean;
314
324
  walletId: string;
315
- walletType: WalletType;
325
+ walletType: TWalletType;
316
326
  destinationAddress: string;
317
327
  sourceAddress?: string;
318
328
  assetQuantity: string | number;
319
329
  }): Promise<ReturnType>;
320
330
  sendOffRampTx<ReturnType = {
321
331
  txHash: string;
322
- }>(userId: string, { tx, signature, network, walletId, walletType, }: {
332
+ }>(userId: string, { tx, signature, sourceAddress, network, walletId, walletType, }: {
323
333
  tx: string;
324
334
  signature: string;
335
+ sourceAddress?: string;
325
336
  network: Network;
326
337
  walletId: string;
327
- walletType: WalletType;
338
+ walletType: TWalletType;
328
339
  }): Promise<ReturnType>;
329
340
  distributeParaShare({ userId, walletId, ...rest }: {
330
341
  userId: string;
@@ -344,8 +355,12 @@ declare class Client {
344
355
  publicKey: string;
345
356
  }[];
346
357
  }>;
347
- uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey?: string, passwordId?: string): Promise<any>;
348
- getEncryptedWalletPrivateKeys(userId: string, encryptionKeyHash: string): Promise<any>;
358
+ uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey?: string, passwordId?: string): Promise<{
359
+ encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
360
+ }>;
361
+ getEncryptedWalletPrivateKeys(userId: string, encryptionKeyHash: string): Promise<{
362
+ encryptedPrivateKeys: EncryptedWalletPrivateKey[];
363
+ }>;
349
364
  getConversionRate(chainId: string, symbol: string, currency: string): Promise<any>;
350
365
  getGasEstimate(chainId: string, totalGasPrice: string): Promise<any>;
351
366
  getGasOracle(chainId: string): Promise<any>;
@@ -358,7 +373,32 @@ declare class Client {
358
373
  getSupportedAuthMethods(auth: Auth): Promise<any>;
359
374
  getPasswords(auth: Auth): Promise<PasswordEntity[]>;
360
375
  verifyPasswordChallenge(partnerId: string, body: verifyPasswordChallengeBody): Promise<any>;
361
- getEncryptedWalletPrivateKey(passwordId: string): Promise<any>;
376
+ getEncryptedWalletPrivateKey(passwordId: string): Promise<{
377
+ data: {
378
+ encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
379
+ };
380
+ }>;
362
381
  getUser(userId: string): Promise<any>;
382
+ getAccountMetadata(userId: string, partnerId: string): Promise<{
383
+ accountMetadata: AccountMetadata;
384
+ }>;
385
+ getWalletBalance: ({ walletId, rpcUrl }: {
386
+ walletId: string;
387
+ rpcUrl?: string;
388
+ }) => Promise<GetWalletBalanceRes>;
389
+ issueJwt: ({ keyIndex }?: IssueJwtParams) => Promise<IssueJwtResponse>;
390
+ trackError: (opts: {
391
+ methodName: string;
392
+ error: {
393
+ name: string;
394
+ message: string;
395
+ };
396
+ sdkType: SDKType;
397
+ userId: string;
398
+ }) => Promise<void>;
399
+ trackReactSdkAnalytics: (opts: {
400
+ props: object;
401
+ reactSdkVersion: string;
402
+ }) => Promise<void>;
363
403
  }
364
404
  export default Client;
@@ -1,6 +1,6 @@
1
- import { CurrentWalletIds, ExternalWalletType, SupportedWalletTypes } from './wallet.js';
2
- export declare const AUTH_TYPES: readonly ["email", "phone", "phoneLegacy", "farcaster", "telegram", "userId", "externalWallet", "discord", "x", "customId"];
3
- export type AuthType = 'email' | 'phone' | 'phoneLegacy' | 'farcaster' | 'telegram' | 'userId' | 'externalWallet' | 'discord' | 'x' | 'customId';
1
+ import { CurrentWalletIds, ExternalWalletType, SupportedWalletTypes, TExternalWallet } from './wallet.js';
2
+ export declare const AUTH_TYPES: readonly ["email", "phone", "phoneLegacy", "farcaster", "telegram", "userId", "externalWallet", "discord", "x", "customId", "guestId"];
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'>;
5
5
  export type VerifiedAuthType = Extract<PrimaryAuthType, 'email' | 'phone' | 'externalWallet'>;
6
6
  export type PregenAuthType = Exclude<PrimaryAuthType, 'externalWallet'> | Extract<AuthType, 'discord' | 'x' | 'customId'>;
@@ -41,12 +41,15 @@ export type Auth<T extends AuthType = AuthType> = T extends 'email' ? {
41
41
  discordUsername: AuthIdentifier<'discord'>;
42
42
  } : T extends 'customId' ? {
43
43
  customId: AuthIdentifier<'customId'>;
44
+ } : T extends 'guestId' ? {
45
+ guestId: AuthIdentifier<'guestId'>;
44
46
  } : {
45
47
  userId: AuthIdentifier<'userId'>;
46
48
  };
47
49
  export type PrimaryAuth = Auth<PrimaryAuthType>;
48
50
  export type VerifiedAuth = Auth<VerifiedAuthType>;
49
51
  export type PregenAuth = Auth<PregenAuthType>;
52
+ export type PregenOrGuestAuth = Auth<PregenAuthType | 'guestId'>;
50
53
  export type AuthExtras = {
51
54
  /**
52
55
  * The current user's third-party username.
@@ -97,6 +100,7 @@ export interface EncryptedKeyShare {
97
100
  partnerId?: string;
98
101
  protocolId?: string;
99
102
  }
103
+ /** @deprecated use the string union type `TOAuthMethod` instead */
100
104
  export declare enum OAuthMethod {
101
105
  GOOGLE = "GOOGLE",
102
106
  TWITTER = "TWITTER",
@@ -106,6 +110,11 @@ export declare enum OAuthMethod {
106
110
  FARCASTER = "FARCASTER",
107
111
  TELEGRAM = "TELEGRAM"
108
112
  }
113
+ export declare const OAUTH_METHODS: readonly ["GOOGLE", "TWITTER", "APPLE", "DISCORD", "FACEBOOK", "FARCASTER", "TELEGRAM"];
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)[];
109
118
  export declare enum AuthMethod {
110
119
  PASSWORD = "PASSWORD",
111
120
  PASSKEY = "PASSKEY"
@@ -136,6 +145,7 @@ export type SessionInfo = {
136
145
  cosmosPrefix?: string;
137
146
  origin?: string;
138
147
  email?: string;
148
+ verifiedExternalWalletAddresses?: string[];
139
149
  };
140
150
  export type ServerAuthStateBase = AuthExtras & {
141
151
  auth: PrimaryAuth;
@@ -153,14 +163,20 @@ export type ServerAuthStateLogin = ServerAuthStateBase & {
153
163
  stage: 'login';
154
164
  biometricHints?: BiometricLocationHint[];
155
165
  loginAuthMethods: AuthMethod[];
166
+ isWalletSelectionNeeded?: boolean;
156
167
  };
157
168
  export type VerifyThirdPartyAuth = ServerAuthStateSignup | ServerAuthStateLogin;
158
169
  export type ExternalWalletInfo = {
159
170
  address: string;
160
171
  type: ExternalWalletType;
161
172
  provider?: string;
173
+ providerId?: TExternalWallet;
162
174
  addressBech32?: string;
163
175
  withFullParaAuth?: boolean;
176
+ ensName?: string | null;
177
+ ensAvatar?: string | null;
178
+ isConnectionOnly?: boolean;
179
+ withVerification?: boolean;
164
180
  };
165
181
  export type VerifyExternalWalletParams = {
166
182
  /**
@@ -200,3 +216,48 @@ export type Setup2faResponse = {
200
216
  */
201
217
  uri: string;
202
218
  };
219
+ export type AccountMetadataKey = Lowercase<Exclude<TOAuthMethod, 'TWITTER'> | 'X'>;
220
+ export type AccountMetadata = Partial<Record<AccountMetadataKey, {
221
+ date: Date;
222
+ metadata: Record<string, any>;
223
+ }>>;
224
+ export type IssueJwtParams = {
225
+ /**
226
+ * The index of the Para RSA keypair to use for signing the JWT. Defaults to `0`.
227
+ */
228
+ keyIndex?: number;
229
+ };
230
+ export type IssueJwtResponse = {
231
+ /**
232
+ * The Para JWT token.
233
+ */
234
+ token: string;
235
+ /**
236
+ * The `keyid`` / `kid` of the keypair used to sign the JWT.
237
+ */
238
+ keyId: string;
239
+ };
240
+ export type LinkedAccount<D extends Date | string = Date> = {
241
+ id?: string;
242
+ date: D;
243
+ type: TLinkedAccountType;
244
+ identifier: string;
245
+ displayName: string;
246
+ externalWallet?: ExternalWalletInfo;
247
+ metadata?: unknown;
248
+ };
249
+ export type LinkedAccounts<D extends Date | string = Date> = {
250
+ primary: LinkedAccount<D>[];
251
+ linked: LinkedAccount<D>[];
252
+ };
253
+ export type LinkAccountParams = {
254
+ type: TLinkedAccountType;
255
+ identifier?: string;
256
+ externalWallet?: ExternalWalletInfo;
257
+ };
258
+ export type VerifyLinkParams = {
259
+ linkedAccountId: string;
260
+ userId: string;
261
+ telegramAuthResponse?: TelegramAuthResponse;
262
+ verificationCode?: string;
263
+ };
@@ -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
+ };
@@ -1,4 +1,4 @@
1
- import { Network, WalletType } from './wallet.js';
1
+ import { Network, TWalletType } from './wallet.js';
2
2
  export declare enum OnRampProvider {
3
3
  RAMP = "RAMP",
4
4
  STRIPE = "STRIPE",
@@ -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",
@@ -30,7 +31,7 @@ export interface OnRampPurchase {
30
31
  userId: string;
31
32
  type?: OnRampPurchaseType;
32
33
  walletId?: string | null;
33
- walletType?: WalletType;
34
+ walletType?: TWalletType;
34
35
  externalWalletAddress?: string | null;
35
36
  address?: string | null;
36
37
  status?: OnRampPurchaseStatus;
@@ -51,7 +52,7 @@ export type OnRampPurchaseCreateParams = Omit<OnRampPurchase, 'id' | 'userId'> &
51
52
  };
52
53
  export type OnRampPurchaseUpdateParams = Omit<OnRampPurchase, 'id' | 'userId'>;
53
54
  type ProviderAssetInfo = [string, Partial<Record<OnRampPurchaseType, boolean>>];
54
- export type OnRampAssetInfo = Record<WalletType, Partial<Record<Network, Partial<Record<OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>>>>>>;
55
+ export type OnRampAssetInfo = Record<TWalletType, Partial<Record<Network, Partial<Record<OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>>>>>>;
55
56
  export type OnRampAllowedAssets = Partial<Record<Network, true | OnRampAsset[]>>;
56
57
  export type OnRampConfig = {
57
58
  isBuyEnabled: boolean;
@@ -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
  }
@@ -1,14 +1,20 @@
1
1
  import { PartnerEntity } from './partner.js';
2
+ /** @deprecated use the string union type `TWalletScheme` instead */
2
3
  export declare enum WalletScheme {
3
4
  DKLS = "DKLS",
4
5
  CGGMP = "CGGMP",
5
6
  ED25519 = "ED25519"
6
7
  }
8
+ export declare const WALLET_SCHEMES: readonly ["DKLS", "CGGMP", "ED25519"];
9
+ export type TWalletScheme = (typeof WALLET_SCHEMES)[number];
10
+ /** @deprecated use the string union type `TWalletType` instead */
7
11
  export declare enum WalletType {
8
12
  EVM = "EVM",
9
13
  SOLANA = "SOLANA",
10
14
  COSMOS = "COSMOS"
11
15
  }
16
+ export declare const WALLET_TYPES: readonly ["EVM", "SOLANA", "COSMOS"];
17
+ export type TWalletType = (typeof WALLET_TYPES)[number];
12
18
  export declare enum Chain {
13
19
  ETH = "ETH",
14
20
  CELO = "CELO",
@@ -24,16 +30,18 @@ export declare enum Network {
24
30
  SOLANA = "SOLANA",
25
31
  COSMOS = "COSMOS",
26
32
  CELO = "CELO",
27
- NOBLE = "NOBLE"
33
+ NOBLE = "NOBLE",
34
+ SOLANA_DEVNET = "SOLANA_DEVNET",
35
+ BERACHAIN = "BERACHAIN"
28
36
  }
29
37
  export type WalletRef = 'walletId' | 'externalWalletAddress';
30
38
  export type WalletParams = Partial<{
31
39
  walletId?: string;
32
40
  externalWalletAddress?: string;
33
41
  }>;
34
- export type EmbeddedWalletType = Exclude<WalletType, never>;
35
- export type ExternalWalletType = Exclude<WalletType, never>;
36
- export declare const PREGEN_IDENTIFIER_TYPES: readonly ["EMAIL", "PHONE", "CUSTOM_ID", "DISCORD", "TWITTER", "TELEGRAM", "FARCASTER"];
42
+ export type EmbeddedWalletType = Exclude<TWalletType, never>;
43
+ export type ExternalWalletType = Exclude<TWalletType, never>;
44
+ export declare const PREGEN_IDENTIFIER_TYPES: readonly ["EMAIL", "PHONE", "CUSTOM_ID", "GUEST_ID", "DISCORD", "TWITTER", "TELEGRAM", "FARCASTER"];
37
45
  export type TPregenIdentifierType = (typeof PREGEN_IDENTIFIER_TYPES)[number];
38
46
  export type PregenIds = Partial<Record<TPregenIdentifierType, string[]>>;
39
47
  export interface WalletEntity {
@@ -49,16 +57,23 @@ export interface WalletEntity {
49
57
  partner?: PartnerEntity;
50
58
  publicKey: string | null;
51
59
  scheme: string;
52
- type: WalletType;
60
+ type: TWalletType;
53
61
  updatedAt: string;
54
62
  userId: string | null;
55
63
  lastUsedAt: string | null;
56
64
  lastUsedPartnerId?: string;
57
65
  lastUsedPartner?: PartnerEntity;
66
+ ensName?: string | null;
67
+ ensAvatar?: string | null;
58
68
  }
59
- export type CurrentWalletIds = Partial<Record<WalletType, string[]>>;
60
- export declare const NON_ED25519: WalletScheme[];
69
+ export type CurrentWalletIds = Partial<Record<TWalletType, string[]>>;
70
+ export declare const NON_ED25519: string[];
61
71
  export type SupportedWalletTypes = {
62
- type: WalletType;
72
+ type: TWalletType;
63
73
  optional?: boolean;
64
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 { PregenAuth, PregenAuthInfo } 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;
@@ -17,6 +17,7 @@ export declare function isExternalWallet(params: AuthParams | undefined): params
17
17
  export declare function isX(params: AuthParams | undefined): params is Auth<'x'>;
18
18
  export declare function isDiscord(params: AuthParams | undefined): params is Auth<'discord'>;
19
19
  export declare function isCustomId(params: AuthParams | undefined): params is Auth<'customId'>;
20
+ export declare function isGuestId(params: AuthParams | undefined): params is Auth<'guestId'>;
20
21
  export declare function isUserId(params: AuthParams | undefined): params is Auth<'userId'>;
21
22
  export declare function isPrimary(params: AuthParams | undefined): params is PrimaryAuth;
22
23
  export declare function isVerifiedAuth(params: AuthParams | undefined): params is VerifiedAuth;
@@ -48,6 +49,11 @@ export declare function extractAuthInfo(obj: AuthParams, opts: ExtractAuthOpts &
48
49
  allowPregen: true;
49
50
  isRequired: true;
50
51
  }): PregenAuthInfo;
51
- export declare function toPregenTypeAndId(auth: PregenAuth): [TPregenIdentifierType, string];
52
+ export declare function toPregenTypeAndId(auth: PregenOrGuestAuth): [TPregenIdentifierType, string];
52
53
  export declare function toPregenIds(auth: PregenAuth): PregenIds;
54
+ export declare function fromAccountMetadata(obj: Partial<Record<AccountMetadataKey, {
55
+ date: string;
56
+ metadata: object;
57
+ }>> | undefined): AccountMetadata;
58
+ export declare function fromLinkedAccounts({ primary, linked }: LinkedAccounts<string>): LinkedAccounts<Date>;
53
59
  export {};
package/package.json CHANGED
@@ -1,31 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/user-management-client",
3
- "version": "2.0.0-dev.1",
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-dev.2",
17
4
  "dependencies": {
18
- "axios": "^1.6.3",
19
- "libphonenumber-js": "1.11.2",
20
- "qs": "^6.12.0"
5
+ "axios": "^1.8.4",
6
+ "libphonenumber-js": "^1.11.7"
21
7
  },
22
8
  "devDependencies": {
23
- "typescript": "^5.0.4"
9
+ "typescript": "^5.8.3"
24
10
  },
25
- "files": [
26
- "dist",
27
- "package.json"
28
- ],
29
11
  "exports": {
30
12
  ".": {
31
13
  "types": "./dist/types/index.d.ts",
@@ -33,5 +15,22 @@
33
15
  "require": "./dist/cjs/index.js"
34
16
  }
35
17
  },
36
- "gitHead": "426e843bd6084fb2e5f30ab87b02c79fc2f52832"
18
+ "files": [
19
+ "dist",
20
+ "package.json"
21
+ ],
22
+ "gitHead": "77d818539daa181c839a40f0ad5362af4058844e",
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"
37
36
  }