Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
@mtproto/core
Advanced tools
Telegram API (MTProto) client library for browser
yarn add @mtproto/core -E
You need api_id and api_hash. If you do not have them yet, then get them according to the official instructions: creating your Telegram application.
const MTProto = require('@mtproto/core');
// 1. Create an instance
const mtproto = new MTProto({
api_id: YOU_API_ID,
api_hash: YOU_API_HASH,
// Use test server
test: true,
});
// 2. Log in using phone number
// https://core.telegram.org/api/auth#test-phone-numbers
const phone = '+9996621111';
const code = '22222';
mtproto
.call('auth.sendCode', {
phone_number: phone,
settings: {
_: 'codeSettings',
},
})
.then(result => {
mtproto
.call('auth.signIn', {
phone_code: code,
phone_number: phone,
phone_code_hash: result.phone_code_hash,
})
.then(result => {
console.log(`auth.signIn[result]:`, result);
})
.catch(error => {
if (error.error_message === 'SESSION_PASSWORD_NEEDED') {
// Need use 2FA
}
});
});
const { getSRPParams } = require('@mtproto/core/src/utils');
const password = 'YOU_PASSWORD';
mtproto
.call('account.getPassword')
.then(async result => {
const { srp_id, current_algo, srp_B } = result;
const { salt1, salt2, g, p } = current_algo;
const { A, M1 } = await getSRPParams({
g,
p,
salt1,
salt2,
gB: srp_B,
password,
});
return mtproto.call('auth.checkPassword', {
password: {
_: 'inputCheckPasswordSRP',
srp_id,
A,
M1,
},
});
})
.then(result => {
console.log(`auth.checkPassword[result]:`, result);
});
FAQs
Telegram API JS (MTProto) client library for Node.js and browser
The npm package @mtproto/core receives a total of 706 weekly downloads. As such, @mtproto/core popularity was classified as not popular.
We found that @mtproto/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.