teleproto - v1.229.0
    Preparing search index...

    Class StringSession

    In-memory session storage that keeps all auth and entity data in RAM.

    All data is lost when the process exits. Use StringSession to export the session to a portable string, or StoreSession for persistent on-disk storage.

    Entities are keyed by their peer ID to prevent duplicate accumulation.

    Hierarchy (View Summary)

    Index
    • get authKey(): AuthKey | undefined

      Returns an AuthKey instance associated with the saved data center, or undefined if a new one should be generated.

      Returns AuthKey | undefined

    • set authKey(value: AuthKey | undefined): void

      Returns an AuthKey instance associated with the saved data center, or undefined if a new one should be generated.

      Parameters

      • value: AuthKey | undefined

      Returns void

    • get port(): number

      Returns the port to which the library should connect to.

      Returns number

    • get serverAddress(): string

      Returns the server address where the library should connect to.

      Returns string

    • 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

      • Optionalsession: string

        {string|null}

      Returns StringSession

    • Parameters

      • id: string | BigInteger
      • hash: string | BigInteger
      • username: string
      • phone: string
      • name: string

      Returns (string | BigInteger)[]

    • Processes the input TLObject or list and saves whatever information is relevant (e.g., ID or access hash). May be asynchronous; the library awaits the result where possible, and a storage failure never fails the request that produced it.

      Parameters

      • tlo: any

      Returns 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

        {number}

      • serverAddress: string

        {string}

      • port: number

        {number}

      Returns void

    _key?: Buffer<ArrayBufferLike>