import { MaybePromise } from '../../../types/utils.js'; import { ITelegramClient } from '../../client.types.js'; import { SentCode } from '../../types/auth/sent-code.js'; import { MaybeDynamic } from '../../types/utils.js'; import { InputStringSessionData } from '../../utils/string-session.js'; import { tl } from '../../../tl/index.js'; import { User } from '../../types/peers/user.js'; /** * Start the client in an interactive and declarative manner, * by providing callbacks for authorization details. * * This method handles both login and sign up, and also handles 2FV * * All parameters are `MaybeDynamic`, meaning you * can either supply `T`, or a function that returns `MaybePromise` * * This method is intended for *interactive* login. * If you are building some kind of headless service, you will most likely * want to use the underlying authorization methods directly. */ export declare function start(client: ITelegramClient, params: { /** * String session exported using {@link TelegramClient.exportSession}. * * This simply calls {@link TelegramClient.importSession} before anything else. * * Note that passed session will be ignored in case storage already * contains authorization. */ session?: string | InputStringSessionData; /** * Whether to overwrite existing session. */ sessionForce?: boolean; /** * When passed, [QR login flow](https://core.telegram.org/api/qr-login) * will be used instead of the regular login flow. * * This function will be called whenever the login URL is changed, * and the app is expected to display it as a QR code to the user. */ qrCodeHandler?: (url: string, expires: Date) => void; /** * Phone number of the account. * If account does not exist, it will be created */ phone?: MaybeDynamic; /** * Bot token to use. Ignored if `phone` is supplied. */ botToken?: MaybeDynamic; /** * 2FA password. Ignored if `botToken` is supplied */ password?: MaybeDynamic; /** * Code sent to the phone (either sms, call, flash call or other). * Ignored if `botToken` is supplied, must be present if `phone` is supplied. */ code?: MaybeDynamic; /** * If passed, this function will be called if provided code or 2FA password * was invalid. New code/password will be requested later. * * If provided `code`/`password` is a constant string, providing an * invalid one will interrupt authorization flow. */ invalidCodeCallback?: (type: 'code' | 'password') => MaybePromise; /** * Whether to force code delivery through SMS */ forceSms?: boolean; /** * Custom method that is called when a code is sent. Can be used * to show a GUI alert of some kind. * * This method is called *before* {@link start.params.code}. * * @param code * @default `console.log`. */ codeSentCallback?: (code: SentCode) => MaybePromise; /** Saved future auth tokens, if any */ futureAuthTokens?: Uint8Array[]; /** Additional code settings to pass to the server */ codeSettings?: Omit; /** Abort signal */ abortSignal?: AbortSignal; }): Promise;