New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

bun-mtproto

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bun-mtproto

Status: WIP

latest
Source
npmnpm
Version
0.6.6
Version published
Maintainers
0
Created
Source

MTProto for deno

Status: WIP

basic usage:

import MTProto from "https://deno.land/x/mtproto/mod.ts";
import factory from "https://deno.land/x/mtproto/transport/connection/deno-tcp.ts";
import Abridged from "https://deno.land/x/mtproto/transport/codec/abridged.ts";
import JsonDB from "https://deno.land/x/mtproto/storage/jsondb.ts";
import { sendCode } from "https://deno.land/x/mtproto/auth/user.ts";
import {
  Confirm,
  Input,
  Secret,
} from "https://deno.land/x/cliffy@v0.22.2/prompt/mod.ts";

const db = new JsonDB("diag_mod.json");

const proto = new MTProto({
  api_id: 0, // your api id
  api_hash: "YOUR_API_HASH",
  environment: {
    app_version: "8.6.1",
    device_model: "Unknown",
    system_version: "1.0.0",
  },
  ipv6_policy: "ipv4",
  transport_factory: factory(() => new Abridged()),
  storage: db,
});

await proto.init();

const rpc = await proto.rpc();

// TODO: check if user is logged

await sendCode(proto, {
  async askCode() {
    return await Input.prompt("Phone code");
  },
  async askPassword(hint) {
    return await Secret.prompt(
      "2FA Password" + (hint ? `(hint: ${hint})` : ""),
    );
  },
  async askSignUp() {
    if (await Confirm.prompt("Sign up")) {
      const first_name = await Input.prompt("First name");
      const last_name = await Input.prompt("Last name");
      return { first_name, last_name };
    }
  },
}, await Input.prompt("Phone number"));

FAQs

Package last updated on 06 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts