📖 API Reference
Platform-agnostic MTProto implementation and auxiliary utilities.
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)
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}`)