GramJS

auth.BindTempAuthKey

Binds a temporary authorization key temp\_auth\_key\_id to the permanent authorization key perm\_auth\_key\_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one.

Example

const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result = await client.invoke(
    new Api.auth.BindTempAuthKey({
      permAuthKeyId: BigInt("-4156887774564"),
      nonce: BigInt("-4156887774564"),
      expiresAt: 43,
      encryptedMessage: Buffer.from("arbitrary data here"),
    })
  );
  console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result: Api.Bool = await client.invoke(
    new Api.auth.BindTempAuthKey({
      permAuthKeyId: BigInt("-4156887774564"),
      nonce: BigInt("-4156887774564"),
      expiresAt: 43,
      encryptedMessage: Buffer.from("arbitrary data here"),
    })
  );
  console.log(result); // prints the result
})();

Parameters

NameTypeDescription
permAuthKeyIdlongNo description found
noncelongNo description found
expiresAtintNo description found
encryptedMessagebytesNo description found

Result

Bool

Possible errors

CodeTypeDescription

Can bots use this method?

Yes

Perfect Forward Secrecy

Binding temporary authorization key to permanent ones.

long

A basic bare type, elements of which correspond to two-element sequences, representing 64-bit signed numbers (little-endian).

int

A basic bare type, the values of which correspond to single-element sequences, i.e. numbers from -2^31 to 2^31-1 which in this case represent themselves.

´╗┐Mobile Protocol: Detailed Description

Additional options for calling methods.

Calling API Methods

Additional options for calling methods.

initConnection

Initialize connection