@getpara/core-sdk 2.12.0 → 2.13.0

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.
Files changed (197) hide show
  1. package/dist/cjs/ParaCore.js +793 -2003
  2. package/dist/cjs/constants.js +4 -1
  3. package/dist/cjs/services/AuthService.js +787 -0
  4. package/dist/cjs/services/BaseAuthFlowService.js +78 -0
  5. package/dist/cjs/services/ExternalWalletService.js +386 -0
  6. package/dist/cjs/services/LoginFlowService.js +163 -0
  7. package/dist/cjs/services/PollingService.js +448 -0
  8. package/dist/cjs/services/PortalUrlService.js +379 -0
  9. package/dist/cjs/services/PregenWalletService.js +442 -0
  10. package/dist/cjs/services/SessionManagementService.js +280 -0
  11. package/dist/cjs/services/SignupFlowService.js +185 -0
  12. package/dist/cjs/services/VerificationFlowService.js +242 -0
  13. package/dist/cjs/services/WalletService.js +577 -0
  14. package/dist/cjs/services/types/AuthServiceTypes.js +15 -0
  15. package/dist/cjs/services/types/BaseAuthFlowServiceTypes.js +15 -0
  16. package/dist/cjs/services/types/ExternalWalletServiceTypes.js +15 -0
  17. package/dist/cjs/services/types/LoginFlowServiceTypes.js +15 -0
  18. package/dist/cjs/services/types/PollingServiceTypes.js +15 -0
  19. package/dist/cjs/services/types/PortalUrlServiceTypes.js +15 -0
  20. package/dist/cjs/services/types/PregenWalletServiceTypes.js +15 -0
  21. package/dist/cjs/services/types/SessionManagementServiceTypes.js +15 -0
  22. package/dist/cjs/services/types/SignupFlowServiceTypes.js +15 -0
  23. package/dist/cjs/services/types/VerificationFlowServiceTypes.js +15 -0
  24. package/dist/cjs/services/types/WalletServiceTypes.js +15 -0
  25. package/dist/cjs/services/types/index.js +15 -0
  26. package/dist/cjs/state/CoreStateManager.js +297 -0
  27. package/dist/cjs/state/actors/authenticateWithEmailOrPhone.js +50 -0
  28. package/dist/cjs/state/actors/authenticateWithExternalWallet.js +50 -0
  29. package/dist/cjs/state/actors/authenticateWithFarcaster.js +50 -0
  30. package/dist/cjs/state/actors/authenticateWithFarcasterLegacy.js +50 -0
  31. package/dist/cjs/state/actors/authenticateWithTelegram.js +50 -0
  32. package/dist/cjs/state/actors/authenticateWithTelegramLegacy.js +50 -0
  33. package/dist/cjs/state/actors/checkUserState.js +53 -0
  34. package/dist/cjs/state/actors/claimWallets.js +56 -0
  35. package/dist/cjs/state/actors/connectExternalConnectors.js +54 -0
  36. package/dist/cjs/state/actors/connectExternalWallet.js +50 -0
  37. package/dist/cjs/state/actors/createGuestWallets.js +50 -0
  38. package/dist/cjs/state/actors/createWallets.js +73 -0
  39. package/dist/cjs/state/actors/polling.js +91 -0
  40. package/dist/cjs/state/actors/processAuthentication.js +50 -0
  41. package/dist/cjs/state/actors/setupAfterLogin.js +52 -0
  42. package/dist/cjs/state/actors/setupPara.js +50 -0
  43. package/dist/cjs/state/actors/signExternalWalletVerification.js +79 -0
  44. package/dist/cjs/state/actors/switchExternalWallet.js +50 -0
  45. package/dist/cjs/state/actors/verifyExternalWallet.js +50 -0
  46. package/dist/cjs/state/actors/verifyNewAccount.js +50 -0
  47. package/dist/cjs/state/actors/waitForExternalWalletProviders.js +54 -0
  48. package/dist/cjs/state/machines/authStateMachine.helpers.js +137 -0
  49. package/dist/cjs/state/machines/authStateMachine.js +1084 -0
  50. package/dist/cjs/state/machines/coreStateMachine.js +383 -0
  51. package/dist/cjs/state/machines/walletStateMachine.js +437 -0
  52. package/dist/cjs/state/types/auth.js +15 -0
  53. package/dist/cjs/state/types/core.js +15 -0
  54. package/dist/cjs/state/types/wallet.js +15 -0
  55. package/dist/cjs/types/{auth.js → accountLinking.js} +3 -3
  56. package/dist/cjs/types/authState.js +15 -0
  57. package/dist/cjs/types/coreApi.js +3 -1
  58. package/dist/cjs/types/index.js +2 -2
  59. package/dist/cjs/types/serviceInterfaces.js +15 -0
  60. package/dist/cjs/types/util.js +15 -0
  61. package/dist/cjs/utils/formatting.js +6 -0
  62. package/dist/cjs/utils/retryBackoff.js +30 -0
  63. package/dist/cjs/utils/stateErrorHelpers.js +60 -0
  64. package/dist/cjs/utils/stateListener.js +129 -0
  65. package/dist/esm/ParaCore.js +796 -2031
  66. package/dist/esm/constants.js +3 -1
  67. package/dist/esm/services/AuthService.js +717 -0
  68. package/dist/esm/services/BaseAuthFlowService.js +25 -0
  69. package/dist/esm/services/ExternalWalletService.js +327 -0
  70. package/dist/esm/services/LoginFlowService.js +97 -0
  71. package/dist/esm/services/PollingService.js +389 -0
  72. package/dist/esm/services/PortalUrlService.js +320 -0
  73. package/dist/esm/services/PregenWalletService.js +393 -0
  74. package/dist/esm/services/SessionManagementService.js +236 -0
  75. package/dist/esm/services/SignupFlowService.js +119 -0
  76. package/dist/esm/services/VerificationFlowService.js +178 -0
  77. package/dist/esm/services/WalletService.js +514 -0
  78. package/dist/esm/services/types/AuthServiceTypes.js +0 -0
  79. package/dist/esm/services/types/BaseAuthFlowServiceTypes.js +0 -0
  80. package/dist/esm/services/types/ExternalWalletServiceTypes.js +0 -0
  81. package/dist/esm/services/types/LoginFlowServiceTypes.js +0 -0
  82. package/dist/esm/services/types/PollingServiceTypes.js +0 -0
  83. package/dist/esm/services/types/PortalUrlServiceTypes.js +0 -0
  84. package/dist/esm/services/types/PregenWalletServiceTypes.js +0 -0
  85. package/dist/esm/services/types/SessionManagementServiceTypes.js +0 -0
  86. package/dist/esm/services/types/SignupFlowServiceTypes.js +0 -0
  87. package/dist/esm/services/types/VerificationFlowServiceTypes.js +0 -0
  88. package/dist/esm/services/types/WalletServiceTypes.js +0 -0
  89. package/dist/esm/services/types/index.js +0 -0
  90. package/dist/esm/state/CoreStateManager.js +261 -0
  91. package/dist/esm/state/actors/authenticateWithEmailOrPhone.js +10 -0
  92. package/dist/esm/state/actors/authenticateWithExternalWallet.js +10 -0
  93. package/dist/esm/state/actors/authenticateWithFarcaster.js +10 -0
  94. package/dist/esm/state/actors/authenticateWithFarcasterLegacy.js +10 -0
  95. package/dist/esm/state/actors/authenticateWithTelegram.js +10 -0
  96. package/dist/esm/state/actors/authenticateWithTelegramLegacy.js +10 -0
  97. package/dist/esm/state/actors/checkUserState.js +13 -0
  98. package/dist/esm/state/actors/claimWallets.js +16 -0
  99. package/dist/esm/state/actors/connectExternalConnectors.js +14 -0
  100. package/dist/esm/state/actors/connectExternalWallet.js +10 -0
  101. package/dist/esm/state/actors/createGuestWallets.js +10 -0
  102. package/dist/esm/state/actors/createWallets.js +20 -0
  103. package/dist/esm/state/actors/polling.js +55 -0
  104. package/dist/esm/state/actors/processAuthentication.js +10 -0
  105. package/dist/esm/state/actors/setupAfterLogin.js +12 -0
  106. package/dist/esm/state/actors/setupPara.js +10 -0
  107. package/dist/esm/state/actors/signExternalWalletVerification.js +15 -0
  108. package/dist/esm/state/actors/switchExternalWallet.js +10 -0
  109. package/dist/esm/state/actors/verifyExternalWallet.js +10 -0
  110. package/dist/esm/state/actors/verifyNewAccount.js +10 -0
  111. package/dist/esm/state/actors/waitForExternalWalletProviders.js +14 -0
  112. package/dist/esm/state/machines/authStateMachine.helpers.js +92 -0
  113. package/dist/esm/state/machines/authStateMachine.js +1039 -0
  114. package/dist/esm/state/machines/coreStateMachine.js +343 -0
  115. package/dist/esm/state/machines/walletStateMachine.js +382 -0
  116. package/dist/esm/state/types/auth.js +0 -0
  117. package/dist/esm/state/types/core.js +0 -0
  118. package/dist/esm/state/types/wallet.js +0 -0
  119. package/dist/esm/types/authState.js +0 -0
  120. package/dist/esm/types/coreApi.js +3 -1
  121. package/dist/esm/types/index.js +1 -1
  122. package/dist/esm/types/serviceInterfaces.js +0 -0
  123. package/dist/esm/types/util.js +0 -0
  124. package/dist/esm/utils/formatting.js +6 -0
  125. package/dist/esm/utils/retryBackoff.js +7 -0
  126. package/dist/esm/utils/stateErrorHelpers.js +37 -0
  127. package/dist/esm/utils/stateListener.js +106 -0
  128. package/dist/types/ParaCore.d.ts +190 -119
  129. package/dist/types/PlatformUtils.d.ts +23 -0
  130. package/dist/types/constants.d.ts +1 -0
  131. package/dist/types/index.d.ts +4 -2
  132. package/dist/types/services/AuthService.d.ts +72 -0
  133. package/dist/types/services/BaseAuthFlowService.d.ts +28 -0
  134. package/dist/types/services/ExternalWalletService.d.ts +44 -0
  135. package/dist/types/services/LoginFlowService.d.ts +9 -0
  136. package/dist/types/services/PollingService.d.ts +35 -0
  137. package/dist/types/services/PortalUrlService.d.ts +26 -0
  138. package/dist/types/services/PregenWalletService.d.ts +38 -0
  139. package/dist/types/services/SessionManagementService.d.ts +28 -0
  140. package/dist/types/services/SignupFlowService.d.ts +10 -0
  141. package/dist/types/services/VerificationFlowService.d.ts +17 -0
  142. package/dist/types/services/WalletService.d.ts +54 -0
  143. package/dist/types/services/types/AuthServiceTypes.d.ts +147 -0
  144. package/dist/types/services/types/BaseAuthFlowServiceTypes.d.ts +4 -0
  145. package/dist/types/services/types/ExternalWalletServiceTypes.d.ts +67 -0
  146. package/dist/types/services/types/LoginFlowServiceTypes.d.ts +19 -0
  147. package/dist/types/services/types/PollingServiceTypes.d.ts +82 -0
  148. package/dist/types/services/types/PortalUrlServiceTypes.d.ts +46 -0
  149. package/dist/types/services/types/PregenWalletServiceTypes.d.ts +73 -0
  150. package/dist/types/services/types/SessionManagementServiceTypes.d.ts +27 -0
  151. package/dist/types/services/types/SignupFlowServiceTypes.d.ts +18 -0
  152. package/dist/types/services/types/VerificationFlowServiceTypes.d.ts +90 -0
  153. package/dist/types/services/types/WalletServiceTypes.d.ts +109 -0
  154. package/dist/types/services/types/index.d.ts +11 -0
  155. package/dist/types/state/CoreStateManager.d.ts +36 -0
  156. package/dist/types/state/actors/authenticateWithEmailOrPhone.d.ts +8 -0
  157. package/dist/types/state/actors/authenticateWithExternalWallet.d.ts +8 -0
  158. package/dist/types/state/actors/authenticateWithFarcaster.d.ts +3 -0
  159. package/dist/types/state/actors/authenticateWithFarcasterLegacy.d.ts +3 -0
  160. package/dist/types/state/actors/authenticateWithTelegram.d.ts +3 -0
  161. package/dist/types/state/actors/authenticateWithTelegramLegacy.d.ts +8 -0
  162. package/dist/types/state/actors/checkUserState.d.ts +6 -0
  163. package/dist/types/state/actors/claimWallets.d.ts +8 -0
  164. package/dist/types/state/actors/connectExternalConnectors.d.ts +4 -0
  165. package/dist/types/state/actors/connectExternalWallet.d.ts +3 -0
  166. package/dist/types/state/actors/createGuestWallets.d.ts +3 -0
  167. package/dist/types/state/actors/createWallets.d.ts +10 -0
  168. package/dist/types/state/actors/polling.d.ts +3 -0
  169. package/dist/types/state/actors/processAuthentication.d.ts +10 -0
  170. package/dist/types/state/actors/setupAfterLogin.d.ts +5 -0
  171. package/dist/types/state/actors/setupPara.d.ts +2 -0
  172. package/dist/types/state/actors/signExternalWalletVerification.d.ts +7 -0
  173. package/dist/types/state/actors/switchExternalWallet.d.ts +3 -0
  174. package/dist/types/state/actors/verifyExternalWallet.d.ts +8 -0
  175. package/dist/types/state/actors/verifyNewAccount.d.ts +8 -0
  176. package/dist/types/state/actors/waitForExternalWalletProviders.d.ts +2 -0
  177. package/dist/types/state/machines/authStateMachine.d.ts +2570 -0
  178. package/dist/types/state/machines/authStateMachine.helpers.d.ts +57 -0
  179. package/dist/types/state/machines/coreStateMachine.d.ts +22033 -0
  180. package/dist/types/state/machines/walletStateMachine.d.ts +1049 -0
  181. package/dist/types/state/types/auth.d.ts +113 -0
  182. package/dist/types/state/types/core.d.ts +114 -0
  183. package/dist/types/state/types/wallet.d.ts +76 -0
  184. package/dist/types/types/authState.d.ts +66 -0
  185. package/dist/types/types/config.d.ts +5 -0
  186. package/dist/types/types/coreApi.d.ts +148 -298
  187. package/dist/types/types/index.d.ts +3 -1
  188. package/dist/types/types/methods.d.ts +1 -191
  189. package/dist/types/types/serviceInterfaces.d.ts +125 -0
  190. package/dist/types/types/util.d.ts +43 -0
  191. package/dist/types/types/wallet.d.ts +3 -1
  192. package/dist/types/utils/retryBackoff.d.ts +2 -0
  193. package/dist/types/utils/stateErrorHelpers.d.ts +2 -0
  194. package/dist/types/utils/stateListener.d.ts +47 -0
  195. package/package.json +5 -4
  196. /package/dist/esm/types/{auth.js → accountLinking.js} +0 -0
  197. /package/dist/types/types/{auth.d.ts → accountLinking.d.ts} +0 -0
@@ -1,6 +1,12 @@
1
1
  import { BackupKitEmailProps, TPregenIdentifierType, TWalletType, SDKType } from '@getpara/user-management-client';
2
2
  import { Ctx, PopupType, SignatureRes } from './types/index.js';
3
3
  import { StorageUtils } from './StorageUtils.js';
4
+ export type EventType = 'TELEGRAM_LOGIN' | 'TELEGRAM_SUCCESS' | 'TELEGRAM_FAILED' | 'FARCASTER_LOGIN' | 'FARCASTER_SUCCESS' | 'FARCASTER_FAILED' | string;
5
+ export interface EventData<T = any> {
6
+ type: EventType;
7
+ payload?: T;
8
+ }
9
+ export type EventHandler<T = any> = (data: T) => void;
4
10
  export interface PlatformUtils {
5
11
  sdkType: SDKType;
6
12
  getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
@@ -44,4 +50,21 @@ export interface PlatformUtils {
44
50
  type: PopupType;
45
51
  }): Promise<Window>;
46
52
  initializeWorker(ctx: Ctx): Promise<void>;
53
+ addEventListener<T = EventData>(_: {
54
+ ctx: Ctx;
55
+ event: string;
56
+ handler: EventHandler<T>;
57
+ }): void;
58
+ removeEventListener<T = EventData>(_: {
59
+ event: string;
60
+ handler: EventHandler<T>;
61
+ }): void;
62
+ postMessage?(_: {
63
+ data: EventData;
64
+ target?: string;
65
+ }): void;
66
+ emitEvent?<T = EventData>(_: {
67
+ event: string;
68
+ data: T;
69
+ }): void;
47
70
  }
@@ -18,6 +18,7 @@ export declare const LOCAL_STORAGE_ENCLAVE_JWT = "@CAPSULE/enclaveJwt";
18
18
  export declare const LOCAL_STORAGE_ENCLAVE_REFRESH_JWT = "@CAPSULE/enclaveRefreshJwt";
19
19
  export declare const LOCAL_STORAGE_IS_ENCLAVE_USER = "@CAPSULE/isEnclaveUser";
20
20
  export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = "@CAPSULE/loginEncryptionKeyPair";
21
+ export declare const LOCAL_STORAGE_IS_IMPORTED_SESSION = "@CAPSULE/isImportedSession";
21
22
  export declare const POLLING_INTERVAL_MS = 1000;
22
23
  export declare const SHORT_POLLING_INTERVAL_MS = 750;
23
24
  export declare const POLLING_TIMEOUT_MS = 300000;
@@ -1,6 +1,6 @@
1
1
  import { ParaCore } from './ParaCore.js';
2
2
  export { type Auth, type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, type VerifiedAuth, AuthMethod, type TAuthMethod, AuthMethodStatus, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, type TNetwork, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, type TOnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAssets, type OnRampPurchase, type OnRampAssetInfo, type ProviderAssetInfo, OnRampMethod, type Theme, OAuthMethod, type TOAuthMethod, type TLinkedAccountType, type SupportedAccountLinks, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, type LinkedAccount, type LinkedAccounts, type TExternalWallet, type ExternalWalletInfo, type PregenAuth, type Setup2faResponse, type TelegramAuthResponse, type VerifyExternalWalletParams, type AssetMetadata, type AssetMetadataIndexed, type AssetValue, type BalancesConfig, type WalletBalance, type ProfileBalance, type OfframpDepositRequest, type WalletWithMetadata, RecoveryStatus, ThemeMode, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, LINKED_ACCOUNT_TYPES, EXTERNAL_WALLET_TYPES, EVM_WALLETS, SOLANA_WALLETS, COSMOS_WALLETS, formatAssetQuantity, formatCurrency, type EstimateTransactionOpts, type EstimateTransactionResult, type BroadcastTransactionOpts, type BroadcastTransactionResult, } from '@getpara/user-management-client';
3
- export { PopupType, PregenIdentifierType, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type Wallet, type AvailableWallet, type GetWalletBalanceParams, type AccountLinkInProgress, AccountLinkError, type InternalInterface, } from './types/index.js';
3
+ export { PopupType, PregenIdentifierType, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type Wallet, type AvailableWallet, type AccountLinkInProgress, AccountLinkError, type InternalInterface, type Verify2faParams, type Verify2faResponse, type StorageType, type TelegramParams, } from './types/index.js';
4
4
  export * from './types/coreApi.js';
5
5
  export * from './types/events.js';
6
6
  export * from './types/config.js';
@@ -8,7 +8,7 @@ export { getPortalDomain, dispatchEvent, entityToWallet, constructUrl, shortenUr
8
8
  export { PREFIX as STORAGE_PREFIX, PARA_PREFIX as PARA_STORAGE_PREFIX, LOCAL_STORAGE_CURRENT_WALLET_IDS, LOCAL_STORAGE_WALLETS, } from './constants.js';
9
9
  export { distributeNewShare } from './shares/shareDistribution.js';
10
10
  export { KeyContainer } from './shares/KeyContainer.js';
11
- export type { PlatformUtils } from './PlatformUtils.js';
11
+ export type { PlatformUtils, EventData, EventHandler, EventType } from './PlatformUtils.js';
12
12
  export type { StorageUtils } from './StorageUtils.js';
13
13
  export { getBaseUrl, initClient } from './external/userManagementClient.js';
14
14
  export * as mpcComputationClient from './external/mpcComputationClient.js';
@@ -24,5 +24,7 @@ export { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray
24
24
  export { getPortalBaseURL } from './utils/url.js';
25
25
  export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
26
26
  export type { ShareData } from './shares/enclave.js';
27
+ export type { StateSnapshot, AuthStateInfo } from './state/types/core';
28
+ export type * from './services/types';
27
29
  export declare const paraVersion: string;
28
30
  export default ParaCore;
@@ -0,0 +1,72 @@
1
+ import { CoreAuthInfo } from '../types/index.js';
2
+ import { ParaCore } from '../ParaCore.js';
3
+ import { CoreStateManager } from '../state/CoreStateManager.js';
4
+ import { PortalUrlService } from './PortalUrlService.js';
5
+ import { ExternalWalletService } from './ExternalWalletService.js';
6
+ import { SessionManagementService } from './SessionManagementService.js';
7
+ import { PregenWalletService } from './PregenWalletService.js';
8
+ import { WalletService } from './WalletService.js';
9
+ import type { WaitForLoginMethod } from './types/LoginFlowServiceTypes';
10
+ import type { WaitForSignupMethod, WaitForWalletCreationMethod } from './types/SignupFlowServiceTypes';
11
+ import { PerformVerifyExternalWalletMethod, PerformVerifyFarcasterMethod, PerformVerifyNewAccountMethod, PerformVerifyTelegramMethod, RetryVerifyExternalWalletMethod, VerifyExternalWalletMethod, VerifyFarcasterMethod, VerifyNewAccountMethod, VerifyTelegramMethod } from './types/VerificationFlowServiceTypes.js';
12
+ import type { AddCredentialMethod, AssertIsAuthSetMethod, AssertUserIdMethod, AuthenticateWithEmailOrPhoneMethod, AuthenticateWithOAuthMethod, ConnectExternalWalletMethod, GetNewCredentialAndUrlMethod, LoginExternalWalletMethod, PerformLoginExternalWalletMethod, PerformSignUpOrLogInMethod, PrepareAuthStateMethod, PrepareLoginStateMethod, ResendVerificationCodeMethod, SetAuthMethod, SignExternalWalletVerificationMethod, SignUpOrLogInMethod, SupportedUserAuthMethodsMethod, VerifyOAuthProcessMethod } from './types/AuthServiceTypes.js';
13
+ export declare class AuthService {
14
+ #private;
15
+ userId?: string;
16
+ get isEnclaveUser(): boolean;
17
+ set isEnclaveUser(value: boolean);
18
+ get email(): string | undefined;
19
+ get phone(): `+${number}` | undefined;
20
+ get farcasterUsername(): string | undefined;
21
+ get telegramUserId(): string | undefined;
22
+ get isEmail(): boolean;
23
+ get isPhone(): boolean;
24
+ get isFarcaster(): boolean;
25
+ get isTelegram(): boolean;
26
+ get isExternalWalletAuth(): boolean;
27
+ get isExternalWalletWithVerification(): boolean;
28
+ get authInfo(): CoreAuthInfo | undefined;
29
+ set authInfo(authInfo: CoreAuthInfo | undefined);
30
+ constructor(paraCore: ParaCore);
31
+ init: ({ stateManager, portalUrlService, externalWalletService, sessionManagementService, pregenWalletService, walletService, }: {
32
+ stateManager: CoreStateManager;
33
+ portalUrlService: PortalUrlService;
34
+ externalWalletService: ExternalWalletService;
35
+ sessionManagementService: SessionManagementService;
36
+ pregenWalletService: PregenWalletService;
37
+ walletService: WalletService;
38
+ }) => void;
39
+ prepareLogin: () => Promise<string>;
40
+ setAuth: SetAuthMethod;
41
+ setAuthInfo: (authInfo: CoreAuthInfo) => Promise<void>;
42
+ setUserId: (userId: string) => Promise<void>;
43
+ assertIsAuthSet: AssertIsAuthSetMethod;
44
+ assertUserId: AssertUserIdMethod;
45
+ prepareAuthState: PrepareAuthStateMethod;
46
+ prepareLoginState: PrepareLoginStateMethod;
47
+ performSignUpOrLogIn: PerformSignUpOrLogInMethod;
48
+ signUpOrLogIn: SignUpOrLogInMethod;
49
+ authenticateWithEmailOrPhone: AuthenticateWithEmailOrPhoneMethod;
50
+ performVerifyNewAccount: PerformVerifyNewAccountMethod;
51
+ verifyNewAccount: VerifyNewAccountMethod;
52
+ waitForLogin: WaitForLoginMethod;
53
+ waitForSignup: WaitForSignupMethod;
54
+ waitForWalletCreation: WaitForWalletCreationMethod;
55
+ performVerifyExternalWallet: PerformVerifyExternalWalletMethod;
56
+ verifyExternalWallet: VerifyExternalWalletMethod;
57
+ retryVerifyExternalWallet: RetryVerifyExternalWalletMethod;
58
+ performLoginExternalWallet: PerformLoginExternalWalletMethod;
59
+ loginExternalWallet: LoginExternalWalletMethod;
60
+ connectExternalWallet: ConnectExternalWalletMethod;
61
+ signExternalWalletVerification: SignExternalWalletVerificationMethod;
62
+ verifyOAuthProcess: VerifyOAuthProcessMethod;
63
+ authenticateWithOAuth: AuthenticateWithOAuthMethod;
64
+ performVerifyTelegram: PerformVerifyTelegramMethod;
65
+ verifyTelegram: VerifyTelegramMethod;
66
+ performVerifyFarcaster: PerformVerifyFarcasterMethod;
67
+ verifyFarcaster: VerifyFarcasterMethod;
68
+ supportedUserAuthMethods: SupportedUserAuthMethodsMethod;
69
+ getNewCredentialAndUrl: GetNewCredentialAndUrlMethod;
70
+ addCredential: AddCredentialMethod;
71
+ resendVerificationCode: ResendVerificationCodeMethod;
72
+ }
@@ -0,0 +1,28 @@
1
+ import { ParaCore } from '../ParaCore.js';
2
+ import { CoreStateManager } from '../state/CoreStateManager.js';
3
+ import { PortalUrlService } from './PortalUrlService.js';
4
+ import { AuthService } from './AuthService.js';
5
+ import { WalletService } from './WalletService.js';
6
+ import { SessionManagementService } from './SessionManagementService.js';
7
+ import { PrepareStateMethod, SetupAuthFromServerStateMethod } from './types/BaseAuthFlowServiceTypes.js';
8
+ import { ExternalWalletService } from './ExternalWalletService.js';
9
+ export declare abstract class BaseAuthFlowService {
10
+ protected paraCoreInterface: ReturnType<ParaCore['getAuthServiceInterface']>;
11
+ protected stateManager: CoreStateManager;
12
+ protected services: {
13
+ portalUrlService: PortalUrlService;
14
+ walletService: WalletService;
15
+ sessionManagementService: SessionManagementService;
16
+ externalWalletService: ExternalWalletService;
17
+ authService: AuthService;
18
+ };
19
+ constructor(paraCoreInterface: ReturnType<ParaCore['getAuthServiceInterface']>, stateManager: CoreStateManager, services: {
20
+ portalUrlService: PortalUrlService;
21
+ walletService: WalletService;
22
+ sessionManagementService: SessionManagementService;
23
+ externalWalletService: ExternalWalletService;
24
+ authService: AuthService;
25
+ });
26
+ protected setupAuthFromServerState: SetupAuthFromServerStateMethod;
27
+ abstract prepareState: PrepareStateMethod;
28
+ }
@@ -0,0 +1,44 @@
1
+ import { ParaCore } from '../ParaCore.js';
2
+ import { Wallet } from '../types/wallet.js';
3
+ import { AuthService } from './AuthService.js';
4
+ import { WalletService } from './WalletService.js';
5
+ import { AddExternalWalletsMethod, BaseExternalWalletProviderInterface, ExternalWalletConnectionType, ExternalWallets, InitExternalWalletProviderMethod, PerformConnectExternalWalletMethod, PerformSwitchExternalWalletMethod, SetExternalWalletMethod, SetExternalWalletsMethod, SignMessageMethod, SwitchExternalWalletMethod } from './types/ExternalWalletServiceTypes.js';
6
+ import { TExternalWalletType } from '@getpara/user-management-client';
7
+ import { CoreStateManager } from '../state/CoreStateManager.js';
8
+ export declare class ExternalWalletService {
9
+ #private;
10
+ externalWalletProviderInterfaces: {
11
+ EVM?: BaseExternalWalletProviderInterface;
12
+ SOLANA?: BaseExternalWalletProviderInterface;
13
+ COSMOS?: BaseExternalWalletProviderInterface;
14
+ };
15
+ get externalWalletWithParaAuth(): Wallet | undefined;
16
+ get externalWallets(): ExternalWallets;
17
+ set externalWallets(value: ExternalWallets);
18
+ get externalWalletConnectionType(): ExternalWalletConnectionType;
19
+ constructor(paraCore: ParaCore);
20
+ init: ({ authService, walletService, stateManager, }: {
21
+ authService: AuthService;
22
+ walletService: WalletService;
23
+ stateManager: CoreStateManager;
24
+ }) => void;
25
+ initExternalWalletProvider: InitExternalWalletProviderMethod;
26
+ waitForProvidersLoading: () => Promise<boolean>;
27
+ assertValidConnection: () => Promise<void>;
28
+ /**
29
+ * Function to perform signing a message with an external wallet
30
+ */
31
+ signMessage: SignMessageMethod;
32
+ connectParaConnectors: () => Promise<void>;
33
+ performSwitchExternalWallet: PerformSwitchExternalWalletMethod;
34
+ switchExternalWallet: SwitchExternalWalletMethod;
35
+ /**
36
+ * Function to perform connecting an external wallet
37
+ */
38
+ performConnectExternalWallet: PerformConnectExternalWalletMethod;
39
+ disconnectExternalWallet: (type: TExternalWalletType) => Promise<void>;
40
+ disconnectAllExternalWallets: () => Promise<void>;
41
+ setExternalWallet: SetExternalWalletMethod;
42
+ setExternalWallets: SetExternalWalletsMethod;
43
+ addExternalWallets: AddExternalWalletsMethod;
44
+ }
@@ -0,0 +1,9 @@
1
+ import { ServerAuthStateLogin } from '@getpara/user-management-client';
2
+ import { BaseAuthFlowService } from './BaseAuthFlowService.js';
3
+ import type { PrepareStateMethod } from './types/BaseAuthFlowServiceTypes';
4
+ import type { WaitForLoginMethod } from './types/LoginFlowServiceTypes';
5
+ import type { AuthStateLogin } from '../types';
6
+ export declare class LoginFlowService extends BaseAuthFlowService {
7
+ prepareState: PrepareStateMethod<ServerAuthStateLogin, AuthStateLogin>;
8
+ waitForLogin: WaitForLoginMethod;
9
+ }
@@ -0,0 +1,35 @@
1
+ import { ParaCore } from '../ParaCore.js';
2
+ import { AuthService } from './AuthService.js';
3
+ import { PregenWalletService } from './PregenWalletService.js';
4
+ import { WalletService } from './WalletService.js';
5
+ import { PortalUrlService } from './PortalUrlService.js';
6
+ import { SessionManagementService } from './SessionManagementService.js';
7
+ import { InitOAuthPollingMethod, PollFunction, PollingConfig, PollingResult, WaitForFarcasterEventMethod, WaitForOAuthEventMethod, WaitForOAuthMethod, WaitForPregenWalletAddressMethod, WaitForTelegramEventMethod, WaitForWalletAddressMethod, WaitForWalletsMethod } from './types/PollingServiceTypes.js';
8
+ import { WaitForFarcasterAuthMethod } from '../index.js';
9
+ export declare class PollingService {
10
+ #private;
11
+ constructor(paraCore: ParaCore);
12
+ init: ({ authService, pregenWalletService, walletService, portalUrlService, sessionManagementService, }: {
13
+ authService: AuthService;
14
+ pregenWalletService: PregenWalletService;
15
+ walletService: WalletService;
16
+ portalUrlService: PortalUrlService;
17
+ sessionManagementService: SessionManagementService;
18
+ }) => void;
19
+ /**
20
+ * Cancels all active polling operations
21
+ * Useful for cleanup during logout or app shutdown
22
+ */
23
+ cancelAllPolling: () => void;
24
+ poll: <T>(config: PollingConfig<T>) => Promise<PollingResult<T>>;
25
+ waitForOAuthEvent: WaitForOAuthEventMethod;
26
+ waitForTelegramEvent: WaitForTelegramEventMethod;
27
+ waitForFarcasterEvent: WaitForFarcasterEventMethod;
28
+ waitForFarcasterAuth: WaitForFarcasterAuthMethod;
29
+ initOAuthPolling: InitOAuthPollingMethod;
30
+ waitForOAuth: WaitForOAuthMethod;
31
+ waitForSession: PollFunction<null>;
32
+ waitForWallets: WaitForWalletsMethod;
33
+ waitForWalletAddress: WaitForWalletAddressMethod;
34
+ waitForPregenWalletAddress: WaitForPregenWalletAddressMethod;
35
+ }
@@ -0,0 +1,26 @@
1
+ import { ParaCore } from '../ParaCore.js';
2
+ import { AuthService } from './AuthService.js';
3
+ import { PregenWalletService } from './PregenWalletService.js';
4
+ import { WalletService } from './WalletService.js';
5
+ import { SessionManagementService } from './SessionManagementService.js';
6
+ import type { ConstructPortalUrlMethod, GetLoginUrlMethod, GetOAuthUrlMethod } from './types/PortalUrlServiceTypes.js';
7
+ export declare class PortalUrlService {
8
+ #private;
9
+ constructor(paraCore: ParaCore);
10
+ init: ({ authService, pregenWalletService, walletService, sessionManagementService, }: {
11
+ authService: AuthService;
12
+ pregenWalletService: PregenWalletService;
13
+ walletService: WalletService;
14
+ sessionManagementService: SessionManagementService;
15
+ }) => void;
16
+ getPartnerURL: () => Promise<string | undefined>;
17
+ /**
18
+ * URL of the portal, which can be associated with a partner id
19
+ * @param partnerId: string - id of the partner to get the portal URL for
20
+ * @returns - portal URL
21
+ */
22
+ getPortalURL: (isLegacy?: boolean) => Promise<string>;
23
+ constructPortalUrl: ConstructPortalUrlMethod;
24
+ getLoginUrl: GetLoginUrlMethod;
25
+ getOAuthUrl: GetOAuthUrlMethod;
26
+ }
@@ -0,0 +1,38 @@
1
+ import { CurrentWalletIds, PregenIds, TWalletType } from '@getpara/user-management-client';
2
+ import { ParaCore } from '../ParaCore.js';
3
+ import { Wallet } from '../types/wallet.js';
4
+ import { AuthService } from './AuthService.js';
5
+ import { WalletService } from './WalletService.js';
6
+ import { PollingService } from './PollingService.js';
7
+ import type { ClaimPregenWalletsMethod, CreateGuestWalletsMethod, CreatePregenWalletMethod, CreatePregenWalletPerTypeMethod, FetchPregenWalletsFromOverrideMethod, GetPregenWalletsMethod, HasPregenWalletMethod, PerformClaimPregenWalletsMethod, UpdatePregenWalletIdentifierMethod } from './types/PregenWalletServiceTypes.js';
8
+ import { CoreStateManager } from '../state/CoreStateManager.js';
9
+ export declare class PregenWalletService {
10
+ #private;
11
+ /**
12
+ * A map of pre-generated wallet identifiers that can be claimed in the current instance.
13
+ */
14
+ get pregenIds(): PregenIds;
15
+ get guestWalletIds(): CurrentWalletIds;
16
+ get guestWalletIdsArray(): [string, TWalletType][];
17
+ get isGuestMode(): boolean;
18
+ constructor(paraCore: ParaCore);
19
+ init: ({ authService, walletService, pollingService, stateManager, }: {
20
+ authService: AuthService;
21
+ walletService: WalletService;
22
+ pollingService: PollingService;
23
+ stateManager: CoreStateManager;
24
+ }) => void;
25
+ isPregenWalletUnclaimed: (wallet: Wallet) => boolean;
26
+ isPregenWalletClaimable: (wallet: Wallet) => boolean;
27
+ fetchPregenWalletsFromOverride: FetchPregenWalletsFromOverrideMethod;
28
+ performClaimPregenWallets: PerformClaimPregenWalletsMethod;
29
+ claimPregenWallets: ClaimPregenWalletsMethod;
30
+ getPregenWallets: GetPregenWalletsMethod;
31
+ private populatePregenWalletAddresses;
32
+ createPregenWallet: CreatePregenWalletMethod;
33
+ createPregenWalletPerType: CreatePregenWalletPerTypeMethod;
34
+ updatePregenWalletIdentifier: UpdatePregenWalletIdentifierMethod;
35
+ hasPregenWallet: HasPregenWalletMethod;
36
+ performCreateGuestWallets: CreateGuestWalletsMethod;
37
+ createGuestWallets: CreateGuestWalletsMethod;
38
+ }
@@ -0,0 +1,28 @@
1
+ import { ParaCore } from '../ParaCore.js';
2
+ import { AuthService } from './AuthService.js';
3
+ import { PortalUrlService } from './PortalUrlService.js';
4
+ import { WalletService } from './WalletService.js';
5
+ import { ExternalWalletService } from './ExternalWalletService.js';
6
+ import { PregenWalletService } from './PregenWalletService.js';
7
+ import type { GetVerificationTokenMethod, IsFullyLoggedInMethod, IsSessionActiveMethod, IssueJwtMethod, KeepSessionAliveMethod, RefreshSessionMethod, TouchSessionMethod } from './types/SessionManagementServiceTypes.js';
8
+ export declare class SessionManagementService {
9
+ #private;
10
+ sessionCookie?: string;
11
+ get isImportedSession(): boolean;
12
+ set isImportedSession(value: boolean);
13
+ constructor(paraCore: ParaCore);
14
+ init: ({ authService, portalUrlService, walletService, externalWalletService, pregenWalletService, }: {
15
+ authService: AuthService;
16
+ portalUrlService: PortalUrlService;
17
+ walletService: WalletService;
18
+ externalWalletService: ExternalWalletService;
19
+ pregenWalletService: PregenWalletService;
20
+ }) => void;
21
+ touchSession: TouchSessionMethod;
22
+ isSessionActive: IsSessionActiveMethod;
23
+ isFullyLoggedIn: IsFullyLoggedInMethod;
24
+ refreshSession: RefreshSessionMethod;
25
+ keepSessionAlive: KeepSessionAliveMethod;
26
+ getVerificationToken: GetVerificationTokenMethod;
27
+ issueJwt: IssueJwtMethod;
28
+ }
@@ -0,0 +1,10 @@
1
+ import { ServerAuthStateSignup } from '@getpara/user-management-client';
2
+ import { BaseAuthFlowService } from './BaseAuthFlowService.js';
3
+ import { AuthStateSignup } from '../types/index.js';
4
+ import type { PrepareStateMethod } from './types/BaseAuthFlowServiceTypes';
5
+ import { WaitForSignupMethod, WaitForWalletCreationMethod } from './types/SignupFlowServiceTypes.js';
6
+ export declare class SignupFlowService extends BaseAuthFlowService {
7
+ prepareState: PrepareStateMethod<ServerAuthStateSignup, AuthStateSignup>;
8
+ waitForSignup: WaitForSignupMethod;
9
+ waitForWalletCreation: WaitForWalletCreationMethod;
10
+ }
@@ -0,0 +1,17 @@
1
+ import { ServerAuthStateVerify } from '@getpara/user-management-client';
2
+ import { BaseAuthFlowService } from './BaseAuthFlowService.js';
3
+ import type { AuthStateVerify } from '../types/index.js';
4
+ import type { PrepareStateMethod } from './types/BaseAuthFlowServiceTypes';
5
+ import { PerformVerifyExternalWalletMethod, PerformVerifyFarcasterMethod, PerformVerifyNewAccountMethod, PerformVerifyTelegramMethod, RetryVerifyExternalWalletMethod, VerifyExternalWalletMethod, VerifyFarcasterMethod, VerifyNewAccountMethod, VerifyTelegramMethod } from './types/VerificationFlowServiceTypes.js';
6
+ export declare class VerificationFlowService extends BaseAuthFlowService {
7
+ prepareState: PrepareStateMethod<ServerAuthStateVerify, AuthStateVerify>;
8
+ performVerifyNewAccount: PerformVerifyNewAccountMethod;
9
+ verifyNewAccount: VerifyNewAccountMethod;
10
+ performVerifyExternalWallet: PerformVerifyExternalWalletMethod;
11
+ verifyExternalWallet: VerifyExternalWalletMethod;
12
+ retryVerifyExternalWallet: RetryVerifyExternalWalletMethod;
13
+ performVerifyTelegram: PerformVerifyTelegramMethod;
14
+ verifyTelegram: VerifyTelegramMethod;
15
+ performVerifyFarcaster: PerformVerifyFarcasterMethod;
16
+ verifyFarcaster: VerifyFarcasterMethod;
17
+ }
@@ -0,0 +1,54 @@
1
+ import { CurrentWalletIds, TWalletType } from '@getpara/user-management-client';
2
+ import { ParaCore } from '../ParaCore.js';
3
+ import { AvailableWallet, Wallet } from '../types/wallet.js';
4
+ import { AuthService } from './AuthService.js';
5
+ import { PollingService } from './PollingService.js';
6
+ import { PregenWalletService } from './PregenWalletService.js';
7
+ import { ExternalWalletService } from './ExternalWalletService.js';
8
+ import type { AssertIsValidWalletIdMethod, AssertIsValidWalletTypeMethod, CreateWalletMethod, CreateWalletPerTypeMethod, DistributeNewWalletShareMethod, FetchWalletsMethod, FindWalletByAddressMethod, FindWalletIdMethod, FindWalletMethod, GetDisplayAddressMethod, GetIdenticonHashMethod, GetTypesToCreateMethod, GetUserShareMethod, GetWalletBalanceMethod, GetWalletsByTypeMethod, IsWalletOwnedMethod, IsWalletSupportedMethod, IsWalletUsableMethod, RefreshShareMethod, SetCurrentWalletIdsMethod, SetUserShareMethod, SetWalletsMethod } from './types/WalletServiceTypes.js';
9
+ export declare class WalletService {
10
+ #private;
11
+ get wallets(): Record<string, Wallet>;
12
+ set wallets(value: Record<string, Wallet>);
13
+ get currentWalletIds(): CurrentWalletIds;
14
+ set currentWalletIds(value: CurrentWalletIds);
15
+ get currentWalletIdsArray(): [string, TWalletType][];
16
+ get currentWalletIdsUnique(): string[];
17
+ get isWalletTypeEnabled(): Partial<Record<TWalletType, boolean>>;
18
+ get availableWallets(): AvailableWallet[];
19
+ constructor(paraCore: ParaCore);
20
+ init: ({ authService, pollingService, pregenWalletService, externalWalletService, }: {
21
+ authService: AuthService;
22
+ pollingService: PollingService;
23
+ pregenWalletService: PregenWalletService;
24
+ externalWalletService: ExternalWalletService;
25
+ }) => void;
26
+ setWallets: SetWalletsMethod;
27
+ refreshShare: RefreshShareMethod;
28
+ getTypesToCreate: GetTypesToCreateMethod;
29
+ populateWalletAddresses: () => Promise<void>;
30
+ addToCurrentWalletIds: (walletIds: CurrentWalletIds, options?: {
31
+ needsWallet?: boolean;
32
+ sessionLookupId?: string;
33
+ newDeviceSessionLookupId?: string;
34
+ }) => Promise<void>;
35
+ setCurrentWalletIds: SetCurrentWalletIdsMethod;
36
+ createWallet: CreateWalletMethod;
37
+ createWalletPerType: CreateWalletPerTypeMethod;
38
+ findWalletId: FindWalletIdMethod;
39
+ findWalletByAddress: FindWalletByAddressMethod;
40
+ findWallet: FindWalletMethod;
41
+ getDisplayAddress: GetDisplayAddressMethod;
42
+ getIdenticonHash: GetIdenticonHashMethod;
43
+ isWalletSupported: IsWalletSupportedMethod;
44
+ isWalletOwned: IsWalletOwnedMethod;
45
+ isWalletUsable: IsWalletUsableMethod;
46
+ getWalletsByType: GetWalletsByTypeMethod;
47
+ assertIsValidWalletId: AssertIsValidWalletIdMethod;
48
+ assertIsValidWalletType: AssertIsValidWalletTypeMethod;
49
+ fetchWallets: FetchWalletsMethod;
50
+ getWalletBalance: GetWalletBalanceMethod;
51
+ getUserShare: GetUserShareMethod;
52
+ setUserShare: SetUserShareMethod;
53
+ distributeNewWalletShare: DistributeNewWalletShareMethod;
54
+ }
@@ -0,0 +1,147 @@
1
+ import type { Auth, AuthExtras, AuthMethod, AuthType, ExternalWalletInfo, PrimaryAuth, PrimaryAuthInfo, ServerAuthState, ServerAuthStateLogin, TAuthMethod, Theme, TOAuthMethod } from '@getpara/user-management-client';
2
+ import type { AuthState, AuthStateDone, AuthStateLogin, AuthStateSignup, AuthStateVerify, CoreAuthInfo, WithCustomTheme, WithSessionLookupId, WithShorten, WithUseShortUrls } from '../../types/index.js';
3
+ import type { InitOAuthPollingParams, PollingCallbacks } from './PollingServiceTypes.js';
4
+ import { PerformConnectExternalWalletResponse, ExternalSignMessageParams } from './ExternalWalletServiceTypes.js';
5
+ import { BaseVerifyExternalWalletParams } from './VerificationFlowServiceTypes.js';
6
+ export type AuthFlow = 'signup' | 'login';
7
+ export type AuthenticateResponse = {
8
+ authInfo: CoreAuthInfo;
9
+ hasCreatedWallets: boolean;
10
+ recoverySecret?: string;
11
+ };
12
+ export interface OAuthRedirectCallbacks {
13
+ /**
14
+ * Called when an OAuth popup window is opened.
15
+ * If this is provided onOAuthUrl will not be called.
16
+ */
17
+ onOAuthPopup?: (window: Window) => void;
18
+ /**
19
+ * Called when an OAuth URL is generated for redirect.
20
+ * If this is provided onOAuthPopup will not be called.
21
+ */
22
+ onOAuthUrl?: (url: string) => void;
23
+ }
24
+ export type SetAuthMethod = (_: PrimaryAuth, __?: {
25
+ extras?: AuthExtras;
26
+ userId?: string;
27
+ }) => Promise<CoreAuthInfo>;
28
+ export type AssertIsAuthSetMethod = (allowed?: AuthType[]) => PrimaryAuthInfo;
29
+ export type AssertUserIdMethod = (options?: {
30
+ allowGuestMode?: boolean;
31
+ }) => string;
32
+ export type PrepareAuthStateMethod = <T extends ServerAuthState>(serverAuthState: T, opts?: WithCustomTheme & WithUseShortUrls & WithSessionLookupId & {
33
+ isFromExternalWallet?: boolean;
34
+ }) => Promise<AuthState>;
35
+ export type PrepareLoginStateMethod = (loginState: ServerAuthStateLogin, options: {
36
+ useShortUrls?: boolean;
37
+ portalTheme?: Theme;
38
+ sessionLookupId: string;
39
+ }) => Promise<AuthStateLogin>;
40
+ export interface AuthenticateWithEmailOrPhoneParams extends SignUpOrLogInParams {
41
+ /**
42
+ * Callbacks fired while polling for session status.
43
+ */
44
+ sessionPollingCallbacks?: PollingCallbacks;
45
+ }
46
+ export type AuthenticateWithEmailOrPhoneResponse = AuthenticateResponse;
47
+ export type AuthenticateWithEmailOrPhoneMethod = (_: AuthenticateWithEmailOrPhoneParams) => Promise<AuthenticateWithEmailOrPhoneResponse>;
48
+ export interface SignUpOrLogInParams extends WithCustomTheme, WithUseShortUrls {
49
+ /**
50
+ * The user's email address or phone number, in the form `{ email: '...' } | { phone: '+1...' }`}
51
+ */
52
+ auth: Auth<'email'> | Auth<'phone'>;
53
+ }
54
+ export type SignUpOrLogInResponse = AuthStateVerify | AuthStateLogin;
55
+ export type SignUpOrLogInMethod = (_: SignUpOrLogInParams) => Promise<SignUpOrLogInResponse>;
56
+ export interface PerformSignUpOrLogInParams extends SignUpOrLogInParams {
57
+ }
58
+ export interface PerformSignUpOrLogInResponse {
59
+ authState: ServerAuthState;
60
+ opts: WithCustomTheme & WithUseShortUrls;
61
+ }
62
+ export type PerformSignUpOrLogInMethod = (_: PerformSignUpOrLogInParams) => Promise<PerformSignUpOrLogInResponse>;
63
+ export interface BaseLoginExternalWalletParams {
64
+ /**
65
+ * The external wallet information to use for login.
66
+ */
67
+ externalWallet: ExternalWalletInfo | ExternalWalletInfo[];
68
+ /**
69
+ * The chain ID used to generate the SIWE message.
70
+ */
71
+ chainId?: string;
72
+ /**
73
+ * The URI used to generate the SIWE message.
74
+ */
75
+ uri?: string;
76
+ }
77
+ export interface LoginExternalWalletParams extends WithCustomTheme, WithUseShortUrls, BaseLoginExternalWalletParams {
78
+ }
79
+ export type LoginExternalWalletResponse = AuthStateVerify | AuthStateLogin;
80
+ export type LoginExternalWalletMethod = (_: LoginExternalWalletParams) => Promise<LoginExternalWalletResponse>;
81
+ export interface ConnectExternalWalletParams {
82
+ /**
83
+ * The callback that is called to connect to the external wallet.
84
+ */
85
+ connect: () => Promise<PerformConnectExternalWalletResponse>;
86
+ }
87
+ export type ConnectExternalWalletResponse = AuthStateVerify | AuthStateLogin;
88
+ export type ConnectExternalWalletMethod = (_: ConnectExternalWalletParams) => Promise<ConnectExternalWalletResponse>;
89
+ export type SignExternalWalletVerificationMethod = (_: ExternalSignMessageParams) => Promise<BaseVerifyExternalWalletParams>;
90
+ interface PerformLoginExternalWalletResponse {
91
+ authState: ServerAuthState;
92
+ opts: WithCustomTheme & WithUseShortUrls;
93
+ }
94
+ export type PerformLoginExternalWalletMethod = (_: LoginExternalWalletParams) => Promise<PerformLoginExternalWalletResponse>;
95
+ export interface VerifyOAuthProcessParams extends PollingCallbacks, InitOAuthPollingParams {
96
+ }
97
+ export type VerifyOAuthProcessResponse = AuthStateLogin | AuthStateSignup | AuthStateDone;
98
+ export type VerifyOAuthProcessMethod = (_: VerifyOAuthProcessParams) => Promise<VerifyOAuthProcessResponse>;
99
+ export interface AuthenticateWithOAuthParams extends WithCustomTheme, WithUseShortUrls {
100
+ /**
101
+ * The third-party OAuth service.
102
+ */
103
+ method: TOAuthMethod;
104
+ /**
105
+ * The app scheme to redirect to after OAuth is complete.
106
+ */
107
+ appScheme?: string;
108
+ /**
109
+ * Callbacks for OAuth popup/redirect handling.
110
+ */
111
+ redirectCallbacks?: OAuthRedirectCallbacks;
112
+ /**
113
+ * Callbacks fired while polling for session status.
114
+ */
115
+ sessionPollingCallbacks?: PollingCallbacks;
116
+ /**
117
+ * Callbacks fired while polling for OAuth status.
118
+ */
119
+ oAuthPollingCallbacks?: PollingCallbacks;
120
+ }
121
+ export type AuthenticateWithOAuthResponse = AuthenticateResponse;
122
+ export type AuthenticateWithOAuthMethod = (_: AuthenticateWithOAuthParams) => Promise<AuthenticateWithOAuthResponse>;
123
+ export interface GetNewCredentialAndUrlParams extends WithCustomTheme, WithShorten {
124
+ /**
125
+ * Whether the URL is meant to add a passkey for a previous user on a new device. Defaults to `false`.
126
+ */
127
+ isForNewDevice?: boolean;
128
+ /**
129
+ * The authentication method to add.
130
+ */
131
+ authMethod?: TAuthMethod;
132
+ }
133
+ export interface GetNewCredentialAndUrlResponse {
134
+ credentialId: string;
135
+ url?: string;
136
+ }
137
+ export type GetNewCredentialAndUrlMethod = (_?: GetNewCredentialAndUrlParams) => Promise<GetNewCredentialAndUrlResponse>;
138
+ export interface AddCredentialParams {
139
+ authMethod?: TAuthMethod;
140
+ }
141
+ export type AddCredentialMethod = (_: AddCredentialParams) => Promise<string | undefined>;
142
+ export type SupportedUserAuthMethodsMethod = () => Promise<Set<AuthMethod>>;
143
+ export interface ResendVerificationCodeParams {
144
+ type?: 'SIGNUP' | 'LINK_ACCOUNT' | 'LOGIN';
145
+ }
146
+ export type ResendVerificationCodeMethod = (_: ResendVerificationCodeParams) => Promise<void>;
147
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ServerAuthState } from '@getpara/user-management-client';
2
+ import type { AuthState, WithCustomTheme, WithSessionLookupId, WithUseShortUrls } from '../../types/index';
3
+ export type SetupAuthFromServerStateMethod = (_: ServerAuthState) => Promise<void>;
4
+ export type PrepareStateMethod<P = ServerAuthState, R = AuthState> = (serverState: P, opts: WithUseShortUrls & WithCustomTheme & WithSessionLookupId) => Promise<R>;