@getpara/user-management-client 1.8.0 → 2.0.0-alpha.3

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.
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { AccountMetadata, Auth, AuthMethod, AuthParams, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, PasswordStatus, PregenIds, PublicKeyStatus, PublicKeyType, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, WalletEntity, WalletParams, WalletScheme, WalletType } from './types/index.js';
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';
3
3
  interface ConfigOpts {
4
4
  useFetchAdapter?: boolean;
5
5
  }
@@ -7,30 +7,11 @@ type ClientConfig = {
7
7
  userManagementHost: string;
8
8
  version?: string;
9
9
  partnerId?: string;
10
- apiKey?: string;
10
+ apiKey: string;
11
11
  opts?: ConfigOpts;
12
12
  retrieveSessionCookie?: () => string | undefined;
13
13
  persistSessionCookie?: (cookie: string) => void;
14
14
  };
15
- interface createUserBody {
16
- email: string;
17
- }
18
- interface createUserBodyForPhone {
19
- phone: string;
20
- countryCode: string;
21
- }
22
- interface ExternalWalletLoginBody {
23
- externalAddress: string;
24
- type: 'EVM' | 'SOLANA' | 'COSMOS';
25
- externalWalletProvider?: string;
26
- shouldTrackUser?: boolean;
27
- }
28
- export interface ExternalWalletLoginRes {
29
- userId: string;
30
- userExists: boolean;
31
- isVerified: boolean;
32
- signatureVerificationMessage: string;
33
- }
34
15
  interface createUserIdRes {
35
16
  protocolId: string;
36
17
  userId: string;
@@ -38,12 +19,6 @@ interface createUserIdRes {
38
19
  interface verifyBody {
39
20
  verificationCode: string;
40
21
  }
41
- interface verifyExternalWalletBody {
42
- address: string;
43
- signedMessage: string;
44
- cosmosPublicKeyHex?: string;
45
- cosmosSigner?: string;
46
- }
47
22
  interface getWebChallengeRes {
48
23
  challenge: string;
49
24
  allowedPublicKeys?: string[];
@@ -107,9 +82,6 @@ interface createWalletRes {
107
82
  protocolId: string;
108
83
  walletId: string;
109
84
  }
110
- interface GetWalletBalanceRes {
111
- balance: string;
112
- }
113
85
  interface createPregenWalletBody {
114
86
  pregenIdentifier: string;
115
87
  pregenIdentifierType: TPregenIdentifierType;
@@ -141,7 +113,6 @@ interface sessionPasswordBody {
141
113
  encryptedWalletPrivateKey?: string;
142
114
  encryptionKeyHash?: string;
143
115
  }
144
- type BiometricLocationHintParams = AuthParams;
145
116
  export type VerifyTelegramRes = {
146
117
  isValid: true;
147
118
  userId: string;
@@ -157,20 +128,35 @@ export declare const handleResponseError: (error: any) => never;
157
128
  declare class Client {
158
129
  private baseRequest;
159
130
  constructor({ userManagementHost, apiKey, partnerId, version, opts, retrieveSessionCookie, persistSessionCookie, }: ClientConfig);
160
- createUser: (body: (createUserBody | createUserBodyForPhone) & VerificationEmailProps) => Promise<createUserIdRes>;
161
- checkUserExists: (auth: Auth<"email" | "phone">) => Promise<any>;
162
- verifyTelegram: (authObject: TelegramAuthResponse) => Promise<VerifyTelegramRes>;
163
- externalWalletLogin: (body: ExternalWalletLoginBody) => Promise<ExternalWalletLoginRes>;
131
+ signUpOrLogIn: (body: VerifiedAuth & VerificationEmailProps) => Promise<SignUpOrLogInResponse>;
132
+ /**
133
+ * @deprecated
134
+ */
135
+ createUser: (body: VerifiedAuth & VerificationEmailProps) => Promise<createUserIdRes>;
136
+ checkUserExists: (auth: VerifiedAuth) => Promise<any>;
137
+ verifyTelegram: (authObject: TelegramAuthResponse) => Promise<VerifyTelegramResponse>;
138
+ verifyOAuth: () => Promise<VerifyThirdPartyAuth | null>;
139
+ loginExternalWallet: ({ externalWallet, shouldTrackUser, }: {
140
+ externalWallet: ExternalWalletInfo;
141
+ shouldTrackUser?: boolean;
142
+ }) => Promise<LoginExternalWalletResponse>;
143
+ verifyNewAccount: (userId: string, body: verifyBody) => Promise<ServerAuthStateSignup>;
144
+ /**
145
+ * @deprecated
146
+ */
164
147
  verifyEmail: (userId: string, body: verifyBody) => Promise<any>;
148
+ /**
149
+ * @deprecated
150
+ */
165
151
  verifyPhone: (userId: string, body: verifyBody) => Promise<any>;
166
- verifyExternalWallet: (userId: string, body: verifyExternalWalletBody) => Promise<any>;
152
+ verifyExternalWallet: (userId: string, body: VerifyExternalWalletParams) => Promise<ServerAuthStateSignup>;
167
153
  addSessionPublicKey: (userId: string, body: sessionPublicKeyBody) => Promise<any>;
168
154
  getSessionPublicKeys: (userId: string) => Promise<any>;
169
- getBiometricLocationHints: (params: BiometricLocationHintParams) => Promise<BiometricLocationHint[]>;
155
+ getBiometricLocationHints: (auth: PrimaryAuth) => Promise<BiometricLocationHint[]>;
170
156
  getSessionPublicKey: (userId: string, biometricId: string) => Promise<any>;
171
157
  patchSessionPublicKey: (partnerId: string, userId: string, biometricId: string, body: sessionPublicKeyBody) => Promise<any>;
172
- getWebChallenge: (auth?: Auth) => Promise<getWebChallengeRes>;
173
- touchSession: (regenerate?: boolean) => Promise<any>;
158
+ getWebChallenge: (auth?: PrimaryAuth | Auth<"userId">) => Promise<getWebChallengeRes>;
159
+ touchSession: (regenerate?: boolean) => Promise<SessionInfo>;
174
160
  sessionOrigin: (sessionLookupId: string) => Promise<{
175
161
  origin?: string;
176
162
  }>;
@@ -179,12 +165,12 @@ declare class Client {
179
165
  verifySessionChallenge: (userId: string, body: verifySessionChallengeBody) => Promise<any>;
180
166
  createWallet: (userId: string, body?: createWalletBody) => Promise<createWalletRes>;
181
167
  createPregenWallet: (body?: createPregenWalletBody) => Promise<createWalletRes>;
182
- getPregenWallets: <ReturnType = {
168
+ getPregenWallets: (pregenIds: PregenIds, isPortal?: boolean, userId?: string) => Promise<{
183
169
  wallets: WalletEntity[];
184
- }>(pregenIds: PregenIds, isPortal?: boolean, userId?: string) => Promise<ReturnType>;
185
- claimPregenWallets: <ReturnType = {
186
- walletIds?: string[];
187
- }>(body?: claimPreGenWalletsBody) => Promise<ReturnType>;
170
+ }>;
171
+ claimPregenWallets: (body?: claimPreGenWalletsBody) => Promise<{
172
+ walletIds: string[];
173
+ }>;
188
174
  sendTransaction: (userId: string, walletId: string, body: sendTransactionBody) => Promise<any>;
189
175
  signTransaction: (userId: string, walletId: string, body: signTransactionBody) => Promise<any>;
190
176
  refreshKeys: (userId: string, walletId: string, oldPartnerId?: string, newPartnerId?: string, keyShareProtocolId?: string) => Promise<any>;
@@ -216,7 +202,7 @@ declare class Client {
216
202
  }[]): Promise<any>;
217
203
  getTransmissionKeyshares(userId: string, sessionLookupId: string): Promise<any>;
218
204
  getParaShare: (userId: string, walletId: string) => Promise<string>;
219
- getBackupKit: (userId: string, walletId: string) => Promise<any>;
205
+ getBackupKit: (userId: string) => Promise<any>;
220
206
  resendVerificationCode({ userId, ...rest }: {
221
207
  userId: string;
222
208
  } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
@@ -226,10 +212,10 @@ declare class Client {
226
212
  cancelRecoveryAttempt(email: string): Promise<AxiosResponse<any, any>>;
227
213
  check2FAStatus(userId: string): Promise<AxiosResponse<any, any>>;
228
214
  enable2FA(userId: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
229
- setup2FA(userId: string): Promise<AxiosResponse<any, any>>;
215
+ setup2FA(userId: string): Promise<Setup2faResponse>;
230
216
  initializeRecovery(email: string): Promise<AxiosResponse<any, any>>;
231
217
  initializeFarcasterLogin(): Promise<AxiosResponse<any, any>>;
232
- getFarcasterAuthStatus(): Promise<AxiosResponse<any, any>>;
218
+ getFarcasterAuthStatus(): Promise<VerifyFarcasterResponse>;
233
219
  initializeRecoveryForPhone(phone: string, countryCode: string): Promise<AxiosResponse<any, any>>;
234
220
  finalizeRecovery(userId: string, walletId: string): Promise<AxiosResponse<any, any>>;
235
221
  recoverUserShares(userId: string, walletId: string): Promise<AxiosResponse<{
@@ -248,8 +234,11 @@ declare class Client {
248
234
  }, any>>;
249
235
  verifyEmailForRecovery(email: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
250
236
  verifyPhoneForRecovery(phone: string, countryCode: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
251
- verify2FA(email: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
252
- verify2FAForPhone(phone: string, countryCode: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
237
+ verify2FA(auth: VerifiedAuth, verificationCode: string): Promise<any>;
238
+ /**
239
+ * @deprecated
240
+ */
241
+ verify2FAForPhone(phone: AuthIdentifier<'phone'>, verificationCode: string): Promise<AxiosResponse<any, any>>;
253
242
  tempTrasmissionInit(message: string, userId?: string): Promise<AxiosResponse<any, any>>;
254
243
  tempTrasmission(id: string): Promise<AxiosResponse<any, any>>;
255
244
  getPartner(partnerId: string): Promise<AxiosResponse<any, any>>;
@@ -338,13 +327,5 @@ declare class Client {
338
327
  verifyPasswordChallenge(partnerId: string, body: verifyPasswordChallengeBody): Promise<any>;
339
328
  getEncryptedWalletPrivateKey(passwordId: string): Promise<any>;
340
329
  getUser(userId: string): Promise<any>;
341
- getAccountMetadata(userId: string, partnerId: string): Promise<{
342
- accountMetadata: AccountMetadata;
343
- }>;
344
- getWalletBalance: ({ userId, walletId, rpcUrl, }: {
345
- userId: string;
346
- walletId: string;
347
- rpcUrl?: string;
348
- }) => Promise<GetWalletBalanceRes>;
349
330
  }
350
331
  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,11 +1,18 @@
1
- export type AuthType = 'email' | 'phone' | 'farcaster' | 'telegram' | 'userId' | 'externalWallet';
2
- export type $ExtractAuth<T extends AuthType> = {
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';
4
+ export type PrimaryAuthType = Extract<AuthType, 'email' | 'phone' | 'farcaster' | 'telegram' | 'externalWallet'>;
5
+ export type VerifiedAuthType = Extract<PrimaryAuthType, 'email' | 'phone' | 'externalWallet'>;
6
+ export type PregenAuthType = Exclude<PrimaryAuthType, 'externalWallet'> | Extract<AuthType, 'discord' | 'x' | 'customId'>;
7
+ export type AuthIdentifier<T extends AuthType | never> = T extends 'phone' ? `+${number}` : string;
8
+ export type AuthInfo<T extends Exclude<AuthType, 'phoneLegacy'> = Exclude<AuthType, 'phoneLegacy'>> = {
3
9
  auth: Auth<T>;
4
10
  authType: T;
5
- identifier: string;
6
- publicKeyIdentifier: string;
11
+ identifier: AuthIdentifier<T>;
7
12
  };
8
- export type ExtractAuth = $ExtractAuth<'email'> | $ExtractAuth<'phone'> | $ExtractAuth<'farcaster'> | $ExtractAuth<'telegram'> | $ExtractAuth<'userId'> | $ExtractAuth<'externalWallet'>;
13
+ export type PrimaryAuthInfo = AuthInfo<PrimaryAuthType>;
14
+ export type VerifiedAuthInfo = AuthInfo<VerifiedAuthType>;
15
+ export type PregenAuthInfo = AuthInfo<PregenAuthType>;
9
16
  export type AuthParams = Record<string, any> & {
10
17
  email?: string;
11
18
  phone?: string;
@@ -17,17 +24,46 @@ export type AuthParams = Record<string, any> & {
17
24
  };
18
25
  export type Auth<T extends AuthType = AuthType> = T extends 'email' ? {
19
26
  email: string;
20
- } : T extends 'phone' ? {
27
+ } : T extends 'phoneLegacy' ? {
21
28
  phone: string;
22
29
  countryCode: string;
30
+ } : T extends 'phone' ? {
31
+ phone: AuthIdentifier<'phone'>;
23
32
  } : T extends 'farcaster' ? {
24
- farcasterUsername: string;
33
+ farcasterUsername: AuthIdentifier<'farcaster'>;
25
34
  } : T extends 'telegram' ? {
26
- telegramUserId: string;
35
+ telegramUserId: AuthIdentifier<'telegram'>;
27
36
  } : T extends 'externalWallet' ? {
28
- 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'>;
29
44
  } : {
30
- userId: string;
45
+ userId: AuthIdentifier<'userId'>;
46
+ };
47
+ export type PrimaryAuth = Auth<PrimaryAuthType>;
48
+ export type VerifiedAuth = Auth<VerifiedAuthType>;
49
+ export type PregenAuth = Auth<PregenAuthType>;
50
+ export type AuthExtras = {
51
+ /**
52
+ * The current user's third-party username.
53
+ */
54
+ username?: string;
55
+ /**
56
+ * The current user's third-party display name.
57
+ */
58
+ displayName?: string;
59
+ /**
60
+ * The current user's third-party profile picture URL.
61
+ */
62
+ pfpUrl?: string;
63
+ /**
64
+ * The current user's external wallet information.
65
+ */
66
+ externalWallet?: ExternalWalletInfo;
31
67
  };
32
68
  export declare enum EncryptorType {
33
69
  USER = "USER",
@@ -87,8 +123,80 @@ export type TelegramAuthResponse = {
87
123
  photo_url?: string;
88
124
  username?: string;
89
125
  };
90
- export type AccountMetadataKey = Lowercase<Exclude<OAuthMethod, OAuthMethod.TWITTER> | 'X'>;
91
- export type AccountMetadata = Partial<Record<AccountMetadataKey, {
92
- date: Date;
93
- metadata: Record<string, any>;
94
- }>>;
126
+ export type SessionInfo = {
127
+ userId?: string;
128
+ sessionId?: string;
129
+ sessionLookupId?: string;
130
+ partnerId: string;
131
+ biometricVerifiedAt?: number;
132
+ currentWalletIds?: CurrentWalletIds;
133
+ needsWallet?: boolean;
134
+ isAuthenticated?: boolean;
135
+ supportedWalletTypes: SupportedWalletTypes;
136
+ cosmosPrefix?: string;
137
+ origin?: string;
138
+ email?: string;
139
+ };
140
+ export type ServerAuthStateBase = AuthExtras & {
141
+ auth: PrimaryAuth;
142
+ userId: string;
143
+ };
144
+ export type ServerAuthStateVerify = ServerAuthStateBase & {
145
+ stage: 'verify';
146
+ signatureVerificationMessage?: string;
147
+ };
148
+ export type ServerAuthStateSignup = ServerAuthStateBase & {
149
+ stage: 'signup';
150
+ signupAuthMethods: AuthMethod[];
151
+ };
152
+ export type ServerAuthStateLogin = ServerAuthStateBase & {
153
+ stage: 'login';
154
+ biometricHints?: BiometricLocationHint[];
155
+ loginAuthMethods: AuthMethod[];
156
+ };
157
+ export type VerifyThirdPartyAuth = ServerAuthStateSignup | ServerAuthStateLogin;
158
+ export type ExternalWalletInfo = {
159
+ address: string;
160
+ type: ExternalWalletType;
161
+ provider?: string;
162
+ addressBech32?: string;
163
+ withFullParaAuth?: boolean;
164
+ };
165
+ export type VerifyExternalWalletParams = {
166
+ /**
167
+ * The external wallet information to verify.
168
+ */
169
+ externalWallet: ExternalWalletInfo;
170
+ /**
171
+ * The signature of the signed verification string.
172
+ */
173
+ signedMessage: string;
174
+ /**
175
+ * For Cosmos wallets, the wallet's public key as a hex string.
176
+ */
177
+ cosmosPublicKeyHex?: string;
178
+ /**
179
+ * For Cosmos wallets, the base64 signer string.
180
+ */
181
+ cosmosSigner?: string;
182
+ };
183
+ export type LoginExternalWalletResponse = ServerAuthStateLogin | (ServerAuthStateVerify & {
184
+ signatureVerificationMessage: string;
185
+ });
186
+ export type VerifyTelegramResponse = VerifyThirdPartyAuth;
187
+ export type VerifyFarcasterResponse = VerifyThirdPartyAuth | Record<string, never>;
188
+ export type ServerAuthState = ServerAuthStateVerify | ServerAuthStateSignup | ServerAuthStateLogin;
189
+ export type SignUpOrLogInResponse = ServerAuthStateVerify | ServerAuthStateLogin;
190
+ export type Setup2faResponse = {
191
+ /**
192
+ * Indicates whether 2FA has already been set up for the current user.
193
+ */
194
+ isSetup: true;
195
+ uri: undefined;
196
+ } | {
197
+ isSetup?: false;
198
+ /**
199
+ * A URI for the user to set up two-factor authentication.
200
+ */
201
+ uri: string;
202
+ };
@@ -1,6 +1,9 @@
1
+ import { AuthMethod } from './auth.js';
2
+ import { SupportedWalletTypes } from './wallet.js';
1
3
  export interface PartnerEntity {
2
4
  id: string;
3
5
  displayName: string;
6
+ apiKey?: string;
4
7
  logoUrl?: string;
5
8
  iconUrl?: string;
6
9
  portalHeaderLogoUrl?: string;
@@ -10,4 +13,8 @@ export interface PartnerEntity {
10
13
  accentColor?: string;
11
14
  font?: string;
12
15
  themeMode?: 'light' | 'dark';
16
+ portalUrl?: string;
17
+ supportedAuthMethods?: AuthMethod[];
18
+ supportedWalletTypes?: SupportedWalletTypes;
19
+ cosmosPrefix?: string;
13
20
  }
@@ -1,4 +1,3 @@
1
- import { OAuthMethod } from './auth.js';
2
1
  import { PartnerEntity } from './partner.js';
3
2
  export declare enum WalletScheme {
4
3
  DKLS = "DKLS",
@@ -32,7 +31,9 @@ export type WalletParams = Partial<{
32
31
  walletId?: string;
33
32
  externalWalletAddress?: string;
34
33
  }>;
35
- export declare const PREGEN_IDENTIFIER_TYPES: readonly ["EMAIL", "PHONE", "CUSTOM_ID", OAuthMethod.DISCORD, OAuthMethod.TWITTER, OAuthMethod.TELEGRAM];
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"];
36
37
  export type TPregenIdentifierType = (typeof PREGEN_IDENTIFIER_TYPES)[number];
37
38
  export type PregenIds = Partial<Record<TPregenIdentifierType, string[]>>;
38
39
  export interface WalletEntity {
@@ -54,8 +55,10 @@ export interface WalletEntity {
54
55
  lastUsedAt: string | null;
55
56
  lastUsedPartnerId?: string;
56
57
  lastUsedPartner?: PartnerEntity;
57
- ensName?: string | null;
58
- ensAvatar?: string | null;
59
58
  }
60
59
  export type CurrentWalletIds = Partial<Record<WalletType, string[]>>;
61
60
  export declare const NON_ED25519: WalletScheme[];
61
+ export type SupportedWalletTypes = {
62
+ type: WalletType;
63
+ optional?: boolean;
64
+ }[];
@@ -1,4 +1,6 @@
1
- import { Auth, AuthParams, ExtractAuth, WalletParams, WalletRef } from './types/index.js';
1
+ import { Auth, AuthInfo, AuthParams, PrimaryAuth, PrimaryAuthInfo, VerifiedAuth, WalletParams, WalletRef } from './types/index.js';
2
+ import { PregenAuth, PregenAuthInfo } from './types/auth.js';
3
+ import { PregenIds, TPregenIdentifierType } from './types/wallet.js';
2
4
  export declare function isWalletId(params: WalletParams): params is {
3
5
  walletId: string;
4
6
  };
@@ -6,18 +8,46 @@ export declare function isExternalWalletAddress(params: WalletParams): params is
6
8
  externalWalletAddress: string;
7
9
  };
8
10
  export declare function extractWalletRef(params: WalletParams): [WalletRef, string];
9
- export declare function isEmail(params: AuthParams): params is Auth<'email'>;
10
- export declare function isPhone(params: AuthParams): params is Auth<'phone'>;
11
- export declare function isFarcaster(params: AuthParams): params is Auth<'farcaster'>;
12
- export declare function isTelegram(params: AuthParams): params is Auth<'telegram'>;
13
- export declare function isUserId(params: AuthParams): params is Auth<'userId'>;
14
- export declare function isExternalWallet(params: AuthParams): params is Auth<'externalWallet'>;
11
+ export declare function isEmail(params: AuthParams | undefined): params is Auth<'email'>;
12
+ export declare function isPhone(params: AuthParams | undefined): params is Auth<'phone'>;
13
+ export declare function isPhoneLegacy(params: AuthParams | undefined): params is Auth<'phoneLegacy'>;
14
+ export declare function isFarcaster(params: AuthParams | undefined): params is Auth<'farcaster'>;
15
+ export declare function isTelegram(params: AuthParams | undefined): params is Auth<'telegram'>;
16
+ export declare function isExternalWallet(params: AuthParams | undefined): params is Auth<'externalWallet'>;
17
+ export declare function isX(params: AuthParams | undefined): params is Auth<'x'>;
18
+ export declare function isDiscord(params: AuthParams | undefined): params is Auth<'discord'>;
19
+ export declare function isCustomId(params: AuthParams | undefined): params is Auth<'customId'>;
20
+ export declare function isUserId(params: AuthParams | undefined): params is Auth<'userId'>;
21
+ export declare function isPrimary(params: AuthParams | undefined): params is PrimaryAuth;
22
+ export declare function isVerifiedAuth(params: AuthParams | undefined): params is VerifiedAuth;
23
+ export declare function isPregenAuth(params: AuthParams | undefined): params is PregenAuth;
15
24
  type ExtractAuthOpts = {
16
25
  allowUserId?: boolean;
26
+ allowPregen?: boolean;
17
27
  isRequired?: boolean;
18
28
  };
29
+ export declare function extractAuthInfo(obj: AuthParams): PrimaryAuthInfo | undefined;
19
30
  export declare function extractAuthInfo(obj: AuthParams, opts: ExtractAuthOpts & {
31
+ allowUserId: false | undefined;
32
+ }): PrimaryAuthInfo | undefined;
33
+ export declare function extractAuthInfo(obj: AuthParams, opts: ExtractAuthOpts & {
34
+ isRequired: true;
35
+ allowPregen?: undefined | false;
36
+ }): PrimaryAuthInfo;
37
+ export declare function extractAuthInfo(obj: AuthParams, opts: ExtractAuthOpts & {
38
+ allowUserId: true;
39
+ }): PrimaryAuthInfo | AuthInfo<'userId'> | undefined;
40
+ export declare function extractAuthInfo(obj: AuthParams, opts: ExtractAuthOpts & {
41
+ allowUserId: true;
42
+ isRequired: true;
43
+ }): PrimaryAuthInfo | AuthInfo<'userId'>;
44
+ export declare function extractAuthInfo(obj: AuthParams, opts: ExtractAuthOpts & {
45
+ allowPregen: true;
46
+ }): PregenAuthInfo | undefined;
47
+ export declare function extractAuthInfo(obj: AuthParams, opts: ExtractAuthOpts & {
48
+ allowPregen: true;
20
49
  isRequired: true;
21
- }): ExtractAuth;
22
- export declare function extractAuthInfo(obj: AuthParams, opts?: ExtractAuthOpts): ExtractAuth | undefined;
50
+ }): PregenAuthInfo;
51
+ export declare function toPregenTypeAndId(auth: PregenAuth): [TPregenIdentifierType, string];
52
+ export declare function toPregenIds(auth: PregenAuth): PregenIds;
23
53
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/user-management-client",
3
- "version": "1.8.0",
3
+ "version": "2.0.0-alpha.3",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "test": "vitest run --coverage"
16
16
  },
17
17
  "dependencies": {
18
- "axios": "^1.8.4",
18
+ "axios": "^1.6.3",
19
19
  "libphonenumber-js": "1.11.2",
20
20
  "qs": "^6.12.0"
21
21
  },
@@ -33,5 +33,5 @@
33
33
  "require": "./dist/cjs/index.js"
34
34
  }
35
35
  },
36
- "gitHead": "ef96e79558695ccbe148d25a8e3611c4596d1954"
36
+ "gitHead": "77a1e04b06258842ca9c81e3db2a2b0092517659"
37
37
  }