Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface UserAuthParams

For when you want to login as a Api.User
this should handle all needed steps for authorization as a user.
to stop the operation at any point just raise and error with the message AUTH_USER_CANCEL.

Hierarchy

  • UserAuthParams

Index

Properties

phoneNumber: string | (() => Promise<string>)

Either a string or a callback that returns a string for the phone to use to login.

forceSMS?: boolean

whether to send the code through SMS or not.

Methods

  • phoneCode(isCodeViaApp?: boolean): Promise<string>
  • callback that should return the login code that telegram sent.
    has optional bool isCodeViaApp param for whether the code was sent through the app (true) or an SMS (false).

    Parameters

    • Optional isCodeViaApp: boolean

    Returns Promise<string>

  • password(hint?: string): Promise<string>
  • optional string or callback that should return the 2FA password if present.
    the password hint will be sent in the hint param

    Parameters

    • Optional hint: string

    Returns Promise<string>

  • firstAndLastNames(): Promise<[string, string?]>
  • in case of a new account creation this callback should return a first name and last name [first,last].

    Returns Promise<[string, string?]>

  • qrCode(qrCode: { token: Buffer; expires: number }): Promise<void>
  • a qrCode token for login through qrCode.
    this would need a QR code that you should scan with another app to login with.

    Parameters

    • qrCode: { token: Buffer; expires: number }
      • token: Buffer
      • expires: number

    Returns Promise<void>

  • onError(err: Error): void | Promise<boolean>
  • when an error happens during auth this function will be called with the error.
    if this returns true the auth operation will stop.

    Parameters

    • err: Error

    Returns void | Promise<boolean>

Generated using TypeDoc