Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
let app = {
id: this.appId,
hash: this.hash,
version: this.version,
langCode: DEFAULT_LANGUAGE_CODE,
deviceModel: '(n/a)',
systemVersion: '(n/a)',
authKey: this.authKey
};
this.client = tg.createClient(app, this.dataCenter, (e) => {
if (e) {
return reject(e);
}
if (this.client.isReady()) {
// Nothing else to do.
return resolve();
}
// Create MTProto auth key before resolving.
this.client.createAuthKey((authKey) => {
this.authKey = authKey;
resolve();
});
});
});