import { Environment } from '@imtbl/config'; import { Auth, UserProfile, DeviceTokenResponse } from '@imtbl/auth'; import type { DirectLoginOptions } from '@imtbl/auth'; import { ZkEvmProvider } from '@imtbl/wallet'; import type { LinkWalletParams, LinkedWallet } from '@imtbl/wallet'; import { PassportModuleConfiguration, ConnectEvmArguments, LoginArguments } from './types'; import { PassportConfiguration } from './config'; export declare const buildPrivateVars: (passportModuleConfiguration: PassportModuleConfiguration) => { passportConfig: PassportConfiguration; auth: Auth; environment: Environment; }; export declare class Passport { private readonly auth; private readonly multiRollupApiClients; private readonly environment; private readonly passportConfig; constructor(passportModuleConfiguration: PassportModuleConfiguration); /** * Connects to EVM and optionally announces the provider. * @param {Object} options - Configuration options * @param {boolean} options.announceProvider - Whether to announce the provider via EIP-6963 for wallet discovery (defaults to true) * @returns {Promise} The EVM provider instance */ connectEvm(options?: ConnectEvmArguments): Promise; /** * Logs in the user. * @param {Object} [options] - Login options * @param {boolean} [options.useCachedSession] - If true, attempts to use a cached session without user interaction. * @param {boolean} [options.useSilentLogin] - If true, attempts silent authentication without user interaction. * Note: This takes precedence over useCachedSession if both are true * @param {boolean} [options.useRedirectFlow] - If true, uses redirect flow instead of popup flow * @param {DirectLoginOptions} [options.directLoginOptions] - If provided, contains login method and marketing consent options * @param {string} [options.directLoginOptions.directLoginMethod] - The login method to use (e.g., 'google', 'apple', 'email') * @param {MarketingConsentStatus} [options.directLoginOptions.marketingConsentStatus] - Marketing consent status ('opted_in' | 'unsubscribed' | 'subscribed') * @param {string} [options.directLoginOptions.email] - Required when directLoginMethod is 'email' * @returns {Promise} A promise that resolves to the user profile if logged in, null otherwise * @throws {Error} If retrieving the cached user session fails (except for "Unknown or invalid refresh token" errors) * and useCachedSession is true */ login(options?: LoginArguments): Promise; /** * Handles the login callback from the authentication service. * @returns {Promise} A promise that resolves when the login callback is handled */ loginCallback(): Promise; /** * Logs out the user. * @returns {Promise} A promise that resolves when the user is logged out */ logout(): Promise; /** * Retrieves the current user's information. * @returns {Promise} A promise that resolves to the user profile if logged in, undefined otherwise */ getUserInfo(): Promise; /** * Retrieves the ID token. * @returns {Promise} A promise that resolves to the ID token if available, undefined otherwise */ getIdToken(): Promise; /** * Retrieves the access token. * @returns {Promise} A promise that resolves to the access token if available, undefined otherwise */ getAccessToken(): Promise; /** * Retrieves the PKCE authorization URL for the login flow. * Uses: Auth class * @param {DirectLoginOptions} [directLoginOptions] - Optional direct login options * @param {string} [imPassportTraceId] - Optional trace ID * @returns {Promise} A promise that resolves to the authorization URL */ loginWithPKCEFlow(directLoginOptions?: DirectLoginOptions, imPassportTraceId?: string): Promise; /** * Handles the PKCE login callback. * Uses: Auth class * @param {string} authorizationCode - The authorization code from the OAuth provider * @param {string} state - The state parameter for CSRF protection * @returns {Promise} A promise that resolves to the user profile */ loginWithPKCEFlowCallback(authorizationCode: string, state: string): Promise; /** * Stores the provided tokens and retrieves the user profile. * Uses: Auth class * @param {DeviceTokenResponse} tokenResponse - The token response from device flow * @returns {Promise} A promise that resolves to the user profile */ storeTokens(tokenResponse: DeviceTokenResponse): Promise; /** * Retrieves the logout URL. * @returns {Promise} A promise that resolves to the logout URL, or undefined if not available */ getLogoutUrl(): Promise; /** * Handles the silent logout callback. * @param {string} url - The URL containing the logout information * @returns {Promise} A promise that resolves when the silent logout callback is handled */ logoutSilentCallback(url: string): Promise; /** * Retrieves the addresses linked to the current user's account. * @returns {Promise} A promise that resolves to an array of linked addresses */ getLinkedAddresses(): Promise; /** * Links an external wallet to the user's Passport account. * @param {LinkWalletParams} params - Parameters for linking the wallet * @returns {Promise} A promise that resolves to the linked wallet information * @throws {PassportError} If the user is not logged in (NOT_LOGGED_IN_ERROR) * - If the user is not registered (USER_NOT_REGISTERED_ERROR) * - If the wallet is already linked (LINK_WALLET_ALREADY_LINKED_ERROR) * - If the maximum number of wallets are linked (LINK_WALLET_MAX_WALLETS_LINKED_ERROR) * - Duplicate nonce used (LINK_WALLET_DUPLICATE_NONCE_ERROR) * - Validation fails (LINK_WALLET_VALIDATION_ERROR) * - Other generic errors (LINK_WALLET_GENERIC_ERROR) */ linkExternalWallet(params: LinkWalletParams): Promise; }