@getpara/user-management-client 2.0.0-dev.0 → 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, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, PasswordStatus, PregenIds, PrimaryAuth, PublicKeyStatus, PublicKeyType, SessionInfo, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, VerifiedAuth, WalletEntity, WalletParams, WalletScheme, WalletType } 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;
@@ -146,19 +142,62 @@ export declare const handleResponseError: (error: any) => never;
146
142
  declare class Client {
147
143
  private baseRequest;
148
144
  constructor({ userManagementHost, apiKey, partnerId, version, opts, retrieveSessionCookie, persistSessionCookie, }: ClientConfig);
145
+ signUpOrLogIn: (body: VerifiedAuth & VerificationEmailProps) => Promise<SignUpOrLogInResponse>;
146
+ /**
147
+ * @deprecated
148
+ */
149
149
  createUser: (body: VerifiedAuth & VerificationEmailProps) => Promise<createUserIdRes>;
150
150
  checkUserExists: (auth: VerifiedAuth) => Promise<any>;
151
- verifyTelegram: (authObject: TelegramAuthResponse) => Promise<VerifyTelegramRes>;
152
- externalWalletLogin: (body: ExternalWalletLoginBody) => Promise<ExternalWalletLoginRes>;
151
+ verifyTelegram: (authObject: TelegramAuthResponse) => Promise<VerifyTelegramResponse>;
152
+ verifyOAuth: () => Promise<VerifyThirdPartyAuth | null>;
153
+ loginExternalWallet: ({ externalWallet, shouldTrackUser, }: {
154
+ externalWallet: ExternalWalletInfo;
155
+ shouldTrackUser?: boolean;
156
+ }) => Promise<LoginExternalWalletResponse>;
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>;
186
+ /**
187
+ * @deprecated
188
+ */
153
189
  verifyEmail: (userId: string, body: verifyBody) => Promise<any>;
190
+ /**
191
+ * @deprecated
192
+ */
154
193
  verifyPhone: (userId: string, body: verifyBody) => Promise<any>;
155
- verifyExternalWallet: (userId: string, body: verifyExternalWalletBody) => Promise<any>;
194
+ verifyExternalWallet: (userId: string, body: VerifyExternalWalletParams) => Promise<ServerAuthStateSignup>;
156
195
  addSessionPublicKey: (userId: string, body: sessionPublicKeyBody) => Promise<any>;
157
196
  getSessionPublicKeys: (userId: string) => Promise<any>;
158
197
  getBiometricLocationHints: (auth: PrimaryAuth) => Promise<BiometricLocationHint[]>;
159
198
  getSessionPublicKey: (userId: string, biometricId: string) => Promise<any>;
160
199
  patchSessionPublicKey: (partnerId: string, userId: string, biometricId: string, body: sessionPublicKeyBody) => Promise<any>;
161
- getWebChallenge: (auth?: PrimaryAuth) => Promise<getWebChallengeRes>;
200
+ getWebChallenge: (auth?: PrimaryAuth | Auth<"userId">) => Promise<getWebChallengeRes>;
162
201
  touchSession: (regenerate?: boolean) => Promise<SessionInfo>;
163
202
  sessionOrigin: (sessionLookupId: string) => Promise<{
164
203
  origin?: string;
@@ -168,12 +207,12 @@ declare class Client {
168
207
  verifySessionChallenge: (userId: string, body: verifySessionChallengeBody) => Promise<any>;
169
208
  createWallet: (userId: string, body?: createWalletBody) => Promise<createWalletRes>;
170
209
  createPregenWallet: (body?: createPregenWalletBody) => Promise<createWalletRes>;
171
- getPregenWallets: <ReturnType = {
210
+ getPregenWallets: (pregenIds: PregenIds, isPortal?: boolean, userId?: string) => Promise<{
172
211
  wallets: WalletEntity[];
173
- }>(pregenIds: PregenIds, isPortal?: boolean, userId?: string) => Promise<ReturnType>;
174
- claimPregenWallets: <ReturnType = {
175
- walletIds?: string[];
176
- }>(body?: claimPreGenWalletsBody) => Promise<ReturnType>;
212
+ }>;
213
+ claimPregenWallets: (body?: claimPreGenWalletsBody) => Promise<{
214
+ walletIds: string[];
215
+ }>;
177
216
  sendTransaction: (userId: string, walletId: string, body: sendTransactionBody) => Promise<any>;
178
217
  signTransaction: (userId: string, walletId: string, body: signTransactionBody) => Promise<any>;
179
218
  refreshKeys: (userId: string, walletId: string, oldPartnerId?: string, newPartnerId?: string, keyShareProtocolId?: string) => Promise<any>;
@@ -188,7 +227,7 @@ declare class Client {
188
227
  logout: () => Promise<any>;
189
228
  recoveryVerification: (email: string, verificationCode: string) => Promise<any>;
190
229
  recoveryInit: (email: string) => Promise<any>;
191
- 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>;
192
231
  deleteSelf: (userId: string) => Promise<any>;
193
232
  uploadKeyshares(userId: string, walletId: string, encryptedKeyshares: EncryptedKeyShare[]): Promise<any>;
194
233
  uploadUserKeyShares(userId: string, encryptedKeyshares: (EncryptedKeyShare & {
@@ -205,20 +244,20 @@ declare class Client {
205
244
  }[]): Promise<any>;
206
245
  getTransmissionKeyshares(userId: string, sessionLookupId: string): Promise<any>;
207
246
  getParaShare: (userId: string, walletId: string) => Promise<string>;
208
- getBackupKit: (userId: string) => Promise<any>;
209
- resendVerificationCode({ userId, ...rest }: {
210
- userId: string;
211
- } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
247
+ getBackupKit: (userId: string, walletId: string) => Promise<any>;
248
+ resendVerificationCode({ userId, ...rest }: ResendVerificationCodeParams): Promise<AxiosResponse<any, any>>;
212
249
  resendVerificationCodeByPhone({ userId, ...rest }: {
213
250
  userId: string;
214
251
  } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
215
252
  cancelRecoveryAttempt(email: string): Promise<AxiosResponse<any, any>>;
216
253
  check2FAStatus(userId: string): Promise<AxiosResponse<any, any>>;
217
254
  enable2FA(userId: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
218
- setup2FA(userId: string): Promise<AxiosResponse<any, any>>;
255
+ setup2FA(userId: string): Promise<Setup2faResponse>;
219
256
  initializeRecovery(email: string): Promise<AxiosResponse<any, any>>;
220
- initializeFarcasterLogin(): Promise<AxiosResponse<any, any>>;
221
- getFarcasterAuthStatus(): Promise<AxiosResponse<any, any>>;
257
+ initializeFarcasterLogin({ appScheme }?: {
258
+ appScheme?: string;
259
+ }): Promise<any>;
260
+ getFarcasterAuthStatus(): Promise<VerifyFarcasterResponse>;
222
261
  initializeRecoveryForPhone(phone: string, countryCode: string): Promise<AxiosResponse<any, any>>;
223
262
  finalizeRecovery(userId: string, walletId: string): Promise<AxiosResponse<any, any>>;
224
263
  recoverUserShares(userId: string, walletId: string): Promise<AxiosResponse<{
@@ -237,7 +276,10 @@ declare class Client {
237
276
  }, any>>;
238
277
  verifyEmailForRecovery(email: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
239
278
  verifyPhoneForRecovery(phone: string, countryCode: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
240
- verify2FA(email: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
279
+ verify2FA(auth: VerifiedAuth, verificationCode: string): Promise<any>;
280
+ /**
281
+ * @deprecated
282
+ */
241
283
  verify2FAForPhone(phone: AuthIdentifier<'phone'>, verificationCode: string): Promise<AxiosResponse<any, any>>;
242
284
  tempTrasmissionInit(message: string, userId?: string): Promise<AxiosResponse<any, any>>;
243
285
  tempTrasmission(id: string): Promise<AxiosResponse<any, any>>;
@@ -246,7 +288,7 @@ declare class Client {
246
288
  getPendingTransaction(userId: string, pendingTransactionId: string): Promise<AxiosResponse<any, any>>;
247
289
  acceptPendingTransaction(userId: string, pendingTransactionId: string): Promise<AxiosResponse<any, any>>;
248
290
  getOnRampConfig(): Promise<OnRampConfig>;
249
- createOnRampPurchase({ userId, params: { type, walletType, address, provider, networks, assets, defaultNetwork, defaultAsset, fiat, fiatQuantity, testMode, }, ...params }: {
291
+ createOnRampPurchase({ userId, params, ...walletParams }: {
250
292
  userId: string;
251
293
  params: OnRampPurchaseCreateParams;
252
294
  } & WalletParams): Promise<OnRampPurchase>;
@@ -261,7 +303,7 @@ declare class Client {
261
303
  } & WalletParams): Promise<AxiosResponse<OnRampPurchase, any>>;
262
304
  signMoonPayUrl(userId: string, { url, type, cosmosPrefix, testMode, walletId, externalWalletAddress, }: {
263
305
  url: string;
264
- type: WalletType;
306
+ type: TWalletType;
265
307
  cosmosPrefix: string;
266
308
  testMode?: boolean;
267
309
  walletId?: string;
@@ -271,6 +313,7 @@ declare class Client {
271
313
  }, any>>;
272
314
  generateOffRampTx<ReturnType = {
273
315
  tx: string;
316
+ message?: string;
274
317
  asset: OnRampAsset;
275
318
  network: Network;
276
319
  }>(userId: string, { provider, chainId, contractAddress, testMode, walletId, walletType, destinationAddress, sourceAddress, assetQuantity, }: {
@@ -279,19 +322,20 @@ declare class Client {
279
322
  contractAddress?: string;
280
323
  testMode?: boolean;
281
324
  walletId: string;
282
- walletType: WalletType;
325
+ walletType: TWalletType;
283
326
  destinationAddress: string;
284
327
  sourceAddress?: string;
285
328
  assetQuantity: string | number;
286
329
  }): Promise<ReturnType>;
287
330
  sendOffRampTx<ReturnType = {
288
331
  txHash: string;
289
- }>(userId: string, { tx, signature, network, walletId, walletType, }: {
332
+ }>(userId: string, { tx, signature, sourceAddress, network, walletId, walletType, }: {
290
333
  tx: string;
291
334
  signature: string;
335
+ sourceAddress?: string;
292
336
  network: Network;
293
337
  walletId: string;
294
- walletType: WalletType;
338
+ walletType: TWalletType;
295
339
  }): Promise<ReturnType>;
296
340
  distributeParaShare({ userId, walletId, ...rest }: {
297
341
  userId: string;
@@ -311,8 +355,12 @@ declare class Client {
311
355
  publicKey: string;
312
356
  }[];
313
357
  }>;
314
- uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey?: string, passwordId?: string): Promise<any>;
315
- 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
+ }>;
316
364
  getConversionRate(chainId: string, symbol: string, currency: string): Promise<any>;
317
365
  getGasEstimate(chainId: string, totalGasPrice: string): Promise<any>;
318
366
  getGasOracle(chainId: string): Promise<any>;
@@ -325,7 +373,32 @@ declare class Client {
325
373
  getSupportedAuthMethods(auth: Auth): Promise<any>;
326
374
  getPasswords(auth: Auth): Promise<PasswordEntity[]>;
327
375
  verifyPasswordChallenge(partnerId: string, body: verifyPasswordChallengeBody): Promise<any>;
328
- getEncryptedWalletPrivateKey(passwordId: string): Promise<any>;
376
+ getEncryptedWalletPrivateKey(passwordId: string): Promise<{
377
+ data: {
378
+ encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
379
+ };
380
+ }>;
329
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>;
330
403
  }
331
404
  export default Client;
@@ -1,5 +1,6 @@
1
1
  export * from './client.js';
2
2
  export * from './types/index.js';
3
3
  export * from './utils.js';
4
+ export * from './error.js';
4
5
  import Client from './client.js';
5
6
  export default Client;
@@ -1,7 +1,9 @@
1
- import { CurrentWalletIds, SupportedWalletTypes } from './wallet.js';
2
- export type AuthType = 'email' | 'phone' | 'phoneLegacy' | 'farcaster' | 'telegram' | 'userId' | 'externalWallet';
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';
3
4
  export type PrimaryAuthType = Extract<AuthType, 'email' | 'phone' | 'farcaster' | 'telegram' | 'externalWallet'>;
4
- export type VerifiedAuthType = Extract<PrimaryAuthType, 'email' | 'phone'>;
5
+ export type VerifiedAuthType = Extract<PrimaryAuthType, 'email' | 'phone' | 'externalWallet'>;
6
+ export type PregenAuthType = Exclude<PrimaryAuthType, 'externalWallet'> | Extract<AuthType, 'discord' | 'x' | 'customId'>;
5
7
  export type AuthIdentifier<T extends AuthType | never> = T extends 'phone' ? `+${number}` : string;
6
8
  export type AuthInfo<T extends Exclude<AuthType, 'phoneLegacy'> = Exclude<AuthType, 'phoneLegacy'>> = {
7
9
  auth: Auth<T>;
@@ -10,6 +12,7 @@ export type AuthInfo<T extends Exclude<AuthType, 'phoneLegacy'> = Exclude<AuthTy
10
12
  };
11
13
  export type PrimaryAuthInfo = AuthInfo<PrimaryAuthType>;
12
14
  export type VerifiedAuthInfo = AuthInfo<VerifiedAuthType>;
15
+ export type PregenAuthInfo = AuthInfo<PregenAuthType>;
13
16
  export type AuthParams = Record<string, any> & {
14
17
  email?: string;
15
18
  phone?: string;
@@ -31,12 +34,40 @@ export type Auth<T extends AuthType = AuthType> = T extends 'email' ? {
31
34
  } : T extends 'telegram' ? {
32
35
  telegramUserId: AuthIdentifier<'telegram'>;
33
36
  } : T extends 'externalWallet' ? {
34
- externalWalletAddress: string;
37
+ externalWalletAddress: AuthIdentifier<'externalWallet'>;
38
+ } : T extends 'x' ? {
39
+ xUsername: AuthIdentifier<'x'>;
40
+ } : T extends 'discord' ? {
41
+ discordUsername: AuthIdentifier<'discord'>;
42
+ } : T extends 'customId' ? {
43
+ customId: AuthIdentifier<'customId'>;
44
+ } : T extends 'guestId' ? {
45
+ guestId: AuthIdentifier<'guestId'>;
35
46
  } : {
36
- userId: string;
47
+ userId: AuthIdentifier<'userId'>;
37
48
  };
38
49
  export type PrimaryAuth = Auth<PrimaryAuthType>;
39
50
  export type VerifiedAuth = Auth<VerifiedAuthType>;
51
+ export type PregenAuth = Auth<PregenAuthType>;
52
+ export type PregenOrGuestAuth = Auth<PregenAuthType | 'guestId'>;
53
+ export type AuthExtras = {
54
+ /**
55
+ * The current user's third-party username.
56
+ */
57
+ username?: string;
58
+ /**
59
+ * The current user's third-party display name.
60
+ */
61
+ displayName?: string;
62
+ /**
63
+ * The current user's third-party profile picture URL.
64
+ */
65
+ pfpUrl?: string;
66
+ /**
67
+ * The current user's external wallet information.
68
+ */
69
+ externalWallet?: ExternalWalletInfo;
70
+ };
40
71
  export declare enum EncryptorType {
41
72
  USER = "USER",
42
73
  RECOVERY = "RECOVERY",
@@ -69,6 +100,7 @@ export interface EncryptedKeyShare {
69
100
  partnerId?: string;
70
101
  protocolId?: string;
71
102
  }
103
+ /** @deprecated use the string union type `TOAuthMethod` instead */
72
104
  export declare enum OAuthMethod {
73
105
  GOOGLE = "GOOGLE",
74
106
  TWITTER = "TWITTER",
@@ -78,6 +110,11 @@ export declare enum OAuthMethod {
78
110
  FARCASTER = "FARCASTER",
79
111
  TELEGRAM = "TELEGRAM"
80
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)[];
81
118
  export declare enum AuthMethod {
82
119
  PASSWORD = "PASSWORD",
83
120
  PASSKEY = "PASSKEY"
@@ -108,4 +145,119 @@ export type SessionInfo = {
108
145
  cosmosPrefix?: string;
109
146
  origin?: string;
110
147
  email?: string;
148
+ verifiedExternalWalletAddresses?: string[];
149
+ };
150
+ export type ServerAuthStateBase = AuthExtras & {
151
+ auth: PrimaryAuth;
152
+ userId: string;
153
+ };
154
+ export type ServerAuthStateVerify = ServerAuthStateBase & {
155
+ stage: 'verify';
156
+ signatureVerificationMessage?: string;
157
+ };
158
+ export type ServerAuthStateSignup = ServerAuthStateBase & {
159
+ stage: 'signup';
160
+ signupAuthMethods: AuthMethod[];
161
+ };
162
+ export type ServerAuthStateLogin = ServerAuthStateBase & {
163
+ stage: 'login';
164
+ biometricHints?: BiometricLocationHint[];
165
+ loginAuthMethods: AuthMethod[];
166
+ isWalletSelectionNeeded?: boolean;
167
+ };
168
+ export type VerifyThirdPartyAuth = ServerAuthStateSignup | ServerAuthStateLogin;
169
+ export type ExternalWalletInfo = {
170
+ address: string;
171
+ type: ExternalWalletType;
172
+ provider?: string;
173
+ providerId?: TExternalWallet;
174
+ addressBech32?: string;
175
+ withFullParaAuth?: boolean;
176
+ ensName?: string | null;
177
+ ensAvatar?: string | null;
178
+ isConnectionOnly?: boolean;
179
+ withVerification?: boolean;
180
+ };
181
+ export type VerifyExternalWalletParams = {
182
+ /**
183
+ * The external wallet information to verify.
184
+ */
185
+ externalWallet: ExternalWalletInfo;
186
+ /**
187
+ * The signature of the signed verification string.
188
+ */
189
+ signedMessage: string;
190
+ /**
191
+ * For Cosmos wallets, the wallet's public key as a hex string.
192
+ */
193
+ cosmosPublicKeyHex?: string;
194
+ /**
195
+ * For Cosmos wallets, the base64 signer string.
196
+ */
197
+ cosmosSigner?: string;
198
+ };
199
+ export type LoginExternalWalletResponse = ServerAuthStateLogin | (ServerAuthStateVerify & {
200
+ signatureVerificationMessage: string;
201
+ });
202
+ export type VerifyTelegramResponse = VerifyThirdPartyAuth;
203
+ export type VerifyFarcasterResponse = VerifyThirdPartyAuth | Record<string, never>;
204
+ export type ServerAuthState = ServerAuthStateVerify | ServerAuthStateSignup | ServerAuthStateLogin;
205
+ export type SignUpOrLogInResponse = ServerAuthStateVerify | ServerAuthStateLogin;
206
+ export type Setup2faResponse = {
207
+ /**
208
+ * Indicates whether 2FA has already been set up for the current user.
209
+ */
210
+ isSetup: true;
211
+ uri: undefined;
212
+ } | {
213
+ isSetup?: false;
214
+ /**
215
+ * A URI for the user to set up two-factor authentication.
216
+ */
217
+ uri: string;
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;
111
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,8 +1,9 @@
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;
5
5
  displayName: string;
6
+ apiKey?: string;
6
7
  logoUrl?: string;
7
8
  iconUrl?: string;
8
9
  portalHeaderLogoUrl?: string;
@@ -15,5 +16,6 @@ export interface PartnerEntity {
15
16
  portalUrl?: string;
16
17
  supportedAuthMethods?: AuthMethod[];
17
18
  supportedWalletTypes?: SupportedWalletTypes;
19
+ supportedAccountLinks?: SupportedAccountLinks;
18
20
  cosmosPrefix?: string;
19
21
  }
@@ -1,15 +1,20 @@
1
- import { OAuthMethod } from './auth.js';
2
1
  import { PartnerEntity } from './partner.js';
2
+ /** @deprecated use the string union type `TWalletScheme` instead */
3
3
  export declare enum WalletScheme {
4
4
  DKLS = "DKLS",
5
5
  CGGMP = "CGGMP",
6
6
  ED25519 = "ED25519"
7
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 */
8
11
  export declare enum WalletType {
9
12
  EVM = "EVM",
10
13
  SOLANA = "SOLANA",
11
14
  COSMOS = "COSMOS"
12
15
  }
16
+ export declare const WALLET_TYPES: readonly ["EVM", "SOLANA", "COSMOS"];
17
+ export type TWalletType = (typeof WALLET_TYPES)[number];
13
18
  export declare enum Chain {
14
19
  ETH = "ETH",
15
20
  CELO = "CELO",
@@ -25,14 +30,18 @@ export declare enum Network {
25
30
  SOLANA = "SOLANA",
26
31
  COSMOS = "COSMOS",
27
32
  CELO = "CELO",
28
- NOBLE = "NOBLE"
33
+ NOBLE = "NOBLE",
34
+ SOLANA_DEVNET = "SOLANA_DEVNET",
35
+ BERACHAIN = "BERACHAIN"
29
36
  }
30
37
  export type WalletRef = 'walletId' | 'externalWalletAddress';
31
38
  export type WalletParams = Partial<{
32
39
  walletId?: string;
33
40
  externalWalletAddress?: string;
34
41
  }>;
35
- export declare const PREGEN_IDENTIFIER_TYPES: readonly ["EMAIL", "PHONE", "CUSTOM_ID", OAuthMethod.DISCORD, OAuthMethod.TWITTER, OAuthMethod.TELEGRAM];
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"];
36
45
  export type TPregenIdentifierType = (typeof PREGEN_IDENTIFIER_TYPES)[number];
37
46
  export type PregenIds = Partial<Record<TPregenIdentifierType, string[]>>;
38
47
  export interface WalletEntity {
@@ -48,16 +57,23 @@ export interface WalletEntity {
48
57
  partner?: PartnerEntity;
49
58
  publicKey: string | null;
50
59
  scheme: string;
51
- type: WalletType;
60
+ type: TWalletType;
52
61
  updatedAt: string;
53
62
  userId: string | null;
54
63
  lastUsedAt: string | null;
55
64
  lastUsedPartnerId?: string;
56
65
  lastUsedPartner?: PartnerEntity;
66
+ ensName?: string | null;
67
+ ensAvatar?: string | null;
57
68
  }
58
- export type CurrentWalletIds = Partial<Record<WalletType, string[]>>;
59
- export declare const NON_ED25519: WalletScheme[];
69
+ export type CurrentWalletIds = Partial<Record<TWalletType, string[]>>;
70
+ export declare const NON_ED25519: string[];
60
71
  export type SupportedWalletTypes = {
61
- type: WalletType;
72
+ type: TWalletType;
62
73
  optional?: boolean;
63
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];