Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/mtkruto/mod.ts>ClientEncrypted

Cross-runtime JavaScript library for building Telegram clients
Latest
class ClientEncrypted
extends ClientAbstract
Re-export
import { ClientEncrypted } from "https://deno.land/x/mtkruto@0.6.3/mod.ts";

An MTProto client for making encrypted connections. Most users won't need to interact with this. Used internally by Client.

There are a few things to note:

  • This is a bare client and it stores nothing.
  • It expects an authorization key to be present before invoking any method.
  • Authorization must be set using setAuthKey.
  • Incoming packets that aren't a reply to a specific call are passed to the assigned handlers.
  • It doesn't uncompress compressed packets.

Constructors

new
ClientEncrypted(params?: ClientAbstractParams)

Properties

readonly
authKey: Uint8Array
handlers: Handlers
serverSalt: bigint

Methods

connect(): Promise<void>
invoke<T extends Api.AnyObject, R = T extends Api.AnyGenericFunction<infer X> ? Api.ReturnType<X> : T["_"] extends keyof Api.Functions ? Api.ReturnType<T> extends never ? Api.ReturnType<Api.Functions[T["_"]]> : never : never>(function_: T, noWait?: boolean): Promise<R | void>
setAuthKey(key: Uint8Array)