Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StringSession

Hierarchy

Index

Properties

_serverAddress?: string
_dcId: number
_port?: number
_takeoutId: undefined
_entities: Set<any>
_updateStates: {}

Type declaration

    _authKey?: AuthKey
    _key?: Buffer

    Methods

    • setDC(dcId: number, serverAddress: string, port: number): void
    • Sets the information of the data center address and port that the library should connect to, as well as the data center ID, which is currently unused.

      Parameters

      • dcId: number
      • serverAddress: string
      • port: number

      Returns void

    • getAuthKey(dcId?: number): undefined | AuthKey
    • setAuthKey(authKey?: AuthKey, dcId?: number): undefined
    • close(): void
    • delete(): void
    • _entityValuesToRow(id: string | BigInteger, hash: string | BigInteger, username: string, phone: string, name: string): (string | BigInteger)[]
    • _entityToRow(e: any): undefined | (string | BigInteger)[]
    • _entitiesToRows(tlo: any): (string | BigInteger)[][]
    • processEntities(tlo: any): void
    • getEntityRowsByPhone(phone: string): undefined | any[]
    • getEntityRowsByUsername(username: string): undefined | any[]
    • getEntityRowsByName(name: string): undefined | any[]
    • getEntityRowsById(id: string | BigInteger, exact?: boolean): undefined | any[]
    • encode(x: Buffer): string
    • decode(x: string): Buffer
    • load(): Promise<void>
    • save(): string

    Accessors

    • get dcId(): number
    • get serverAddress(): string
    • get port(): number
    • get authKey(): undefined | AuthKey
    • set authKey(value: undefined | AuthKey): void
    • get takeoutId(): undefined
    • set takeoutId(value: undefined): void

    Constructors

    • This session file can be easily saved and loaded as a string. According to the initial design, it contains only the data that is necessary for successful connection and authentication, so takeout ID is not stored.

      It is thought to be used where you don't want to create any on-disk files but would still like to be able to save and load existing sessions by other means.

      You can use custom encode and decode functions, if present:

      encode definition must be function encode(value: Buffer) -> string:. decode definition must be function decode(value: string) -> Buffer:.

      Parameters

      • Optional session: string

      Returns StringSession

    Generated using TypeDoc