alina sireneva
6d84499d50
All checks were successful
Tests / test-deno (push) Successful in 1m42s
Tests / test-node (node18) (push) Successful in 1m53s
Tests / test-node (node20) (push) Successful in 1m52s
Tests / test-node (node22) (push) Successful in 1m52s
Tests / test-bun (push) Successful in 1m50s
Tests / test-web (chromium) (push) Successful in 1m48s
Tests / test-web (firefox) (push) Successful in 59s
Docs / build (push) Successful in 6m3s
Tests / lint (push) Successful in 6m49s
Tests / e2e (push) Successful in 49s
Tests / e2e-deno (push) Successful in 53s
|
||
---|---|---|
.. | ||
scripts | ||
src | ||
.gitignore | ||
build.config.js | ||
package.json | ||
README.md | ||
tsconfig.json |
@mtcute/core
Platform-agnostic MTProto implementation and auxiliary utilities.
Features
- MTProto 2.0: Implements the full MTProto protocol, including all the encryption and serialization
- 2FA support: Provides utilities for 2-step verification
- Hackable: Bring your own storage, transport, and other components to customize the library to your needs
- Magical: Handles reconnections, connection pooling, DC redirections and other stuff for you
- Updates handling: Implements proper updates handling, including ordering and gap recovery (learn more)
- High-level: Includes a high-level API that wrap the MTProto APIs and provide a clean interface
- Tree-shaking: You can import just the methods you need, and the rest will not be included into the bundle
Usage
import { BaseTelegramClient } from '@mtcute/core/client.js'
const tg = new BaseTelegramClient({
apiId: 12345,
apiHash: '0123456789abcdef0123456789abcdef',
crypto: new MyCryptoProvider(),
storage: new MyStorage(),
transport: () => new MyTransport(),
})
tg.call({ _: 'help.getConfig' })
.then(console.log)
Usage with high-level API
import { TelegramClient } from '@mtcute/core/client.js'
const tg = new TelegramClient({
// ... same options as above
})
const self = await tg.start({
phone: '+1234567890',
code: () => prompt('Enter the code:'),
password: 'my-password',
})
console.log(`✨ logged in as ${self.displayName}`)