I was testing telegram-mtproto with a script derived from example.
Node.JS version 7.7.3
Library version telegram-mtproto@beta latest
'use strict';
const MTProto = require('telegram-mtproto').MTProto
const repl = require('repl');
const api = {
invokeWithLayer: 0xda9b0d0d,
layer: 62,
initConnection: 0x69796de9,
api_id: 24275
}
const server = {
dev: false
}
const schema = require('./tlscheme/api-62.json')
global.client = MTProto({server, api, schema, app: {}})
/* client('auth.importBotAuthorization', {
api_id:[scrubbed],
api_hash:'[scrubbed]',
bot_auth_token:'[scrubbed]:[scrubbed]'
})
.then((auth) => {
//global.auth = auth
console.log(auth)
})
*/
client('auth.sendCode', {
api_id:[scrubbed],
api_hash:'[scrubbed]',
phone_number: '[scrubbed]',
current_number: false
})
.then((phone_code_hash) => {
//global.auth = auth
console.log(phone_code_hash)
})
repl.start('MTProto> ')
brainbush@brainbush-linode:~/wfjsw/telegram-mtproto-test$ DEBUG=* node index
MTProto> [0.430] mtpAuth
[0.432] Send req_pq 2340af17ba0f16a2c23e2c054059d3a9
follow-redirects options { maxRedirects: 21,
protocol: 'http:',
hostname: '149.154.167.51',
port: null,
path: '/apiw1',
method: 'post',
headers: { 'User-Agent': 'axios/0.15.3', 'Content-Length': 40 },
agent: undefined,
auth: undefined } +0ms
telegram-mtproto:tl:types [int] auth_key_id:long[low] 0 0 +562ms
telegram-mtproto:tl:types [int] auth_key_id:long[high] 0 0 +3ms
telegram-mtproto:tl:types [int] msg_id:long[low] e4ecf001 3840733185 +1ms
telegram-mtproto:tl:types [int] msg_id:long[high] 58cd5ec2 1489854146 +0ms
telegram-mtproto:tl:types [int] msg_len:int 40 64 +0ms
telegram-mtproto:tl:types [int] ResPQ[id] 5162463 85337187 +1ms
telegram-mtproto:tl:types [int] ResPQ[resPQ][server_public_key_fingerprints][id] 1cb5c415 481674261 +4ms
telegram-mtproto:tl:types [int] ResPQ[resPQ][server_public_key_fingerprints][count] 1 1 +0ms
telegram-mtproto:tl:types [int] ResPQ[resPQ][server_public_key_fingerprints][0]:long[low] 6ce86b21 1827171105 +1ms
telegram-mtproto:tl:types [int] ResPQ[resPQ][server_public_key_fingerprints][0]:long[high] c3b42b02 3283364610 +0ms
[1.024] Got ResPQ 10e04bd1438bb49eadda4ba41d80483c 1b27c1d042a62881 [ '14101943622620965665' ]
[1.026] PQ factorization start Uint8Array [ 27, 39, 193, 208, 66, 166, 40, 129 ]
[3.561] PQ factorization done 62952
[3.589] Send req_DH_params
follow-redirects options { maxRedirects: 21,
protocol: 'http:',
hostname: '149.154.167.51',
port: null,
path: '/apiw1',
method: 'post',
headers: { 'User-Agent': 'axios/0.15.3', 'Content-Length': 340 },
agent: undefined,
auth: undefined } +3s
telegram-mtproto:tl [int bytes] [1.021] 2340af17ba0f16a2c23e2c054059d3a9 ResPQ[resPQ][nonce]:int128 +9ms
telegram-mtproto:tl [int bytes] [1.023] 10e04bd1438bb49eadda4ba41d80483c ResPQ[resPQ][server_nonce]:int128 +1ms
telegram-mtproto:tl [bytes] [1.023] 1b27c1d042a62881 ResPQ[resPQ][pq]:bytes +0ms
telegram-mtproto:tl:types [int] auth_key_id:long[low] 0 0 +535ms
telegram-mtproto:tl:types [int] auth_key_id:long[high] 0 0 +3ms
telegram-mtproto:tl:types [int] msg_id:long[low] 8189801 135829505 +1ms
telegram-mtproto:tl:types [int] msg_id:long[high] 58cd5ec6 1489854150 +0ms
telegram-mtproto:tl:types [int] msg_len:int 278 632 +0ms
telegram-mtproto:tl:types [int] RESPONSE[id] d0e8075c 3504867164 +1ms
telegram-mtproto:tl:types [int] Server_DH_inner_data[id] b5890dba 3045658042 +16ms
telegram-mtproto:tl:types [int] Server_DH_inner_data[server_DH_inner_data][g]:int 3 3 +14ms
telegram-mtproto:tl:types [int] Server_DH_inner_data[server_DH_inner_data][server_time]:int 58cd5ec6 1489854150 +9ms
[4.181] Done decrypting answer
[4.182] Verifying DH params
[4.182] dhPrime cmp OK
[4.191] 2^{2048-64} < gA < dhPrime-2^{2048-64} OK
[4.193] Apply server time 1489854150 1489854250632 -100 true
[4.821] Send set_client_DH_params
follow-redirects options { maxRedirects: 21,
protocol: 'http:',
hostname: '149.154.167.51',
port: null,
path: '/apiw1',
method: 'post',
headers: { 'User-Agent': 'axios/0.15.3', 'Content-Length': 396 },
agent: undefined,
auth: undefined } +643ms
telegram-mtproto:tl [int bytes] [4.140] 2340af17ba0f16a2c23e2c054059d3a9 RESPONSE[server_DH_params_ok][nonce]:int128 +2ms
telegram-mtproto:tl [int bytes] [4.141] 10e04bd1438bb49eadda4ba41d80483c RESPONSE[server_DH_params_ok][server_nonce]:int128 +0ms
telegram-mtproto:tl [bytes] [4.142] 891a9882ad4f06311ebaad3b467ac1ed0c338bab7d88e6c1b3 RESPONSE[server_DH_params_ok][encrypted_answer]:by +1ms
telegram-mtproto:tl [int bytes] [4.158] 2340af17ba0f16a2c23e2c054059d3a9 Server_DH_inner_data[server_DH_inner_data][nonce]: +0ms
telegram-mtproto:tl [int bytes] [4.159] 10e04bd1438bb49eadda4ba41d80483c Server_DH_inner_data[server_DH_inner_data][server_ +0ms
telegram-mtproto:tl [bytes] [4.171] c71caeb9c6b1c9048e6c522f70f13f73980d40238e3e21c149 Server_DH_inner_data[server_DH_inner_data][dh_prim +1ms
telegram-mtproto:tl [bytes] [4.172] 7b7d3b8ab9cf40815f38a13026b2049a22cfca64f57a790a99 Server_DH_inner_data[server_DH_inner_data][g_a]:by +0ms
telegram-mtproto:tl:types [int] auth_key_id:long[low] 0 0 +732ms
telegram-mtproto:tl:types [int] auth_key_id:long[high] 0 0 +0ms
telegram-mtproto:tl:types [int] msg_id:long[low] 73062401 1929782273 +0ms
telegram-mtproto:tl:types [int] msg_id:long[high] 58cd5ec7 1489854151 +0ms
telegram-mtproto:tl:types [int] msg_len:int 34 52 +0ms
telegram-mtproto:tl:types [int] Set_client_DH_params_answer[id] 3bcbf734 1003222836 +1ms
[6.007] Got Set_client_DH_params_answer dh_gen_ok
follow-redirects options { maxRedirects: 21,
protocol: 'http:',
hostname: '149.154.167.51',
port: null,
path: '/apiw1',
method: 'post',
headers: { 'User-Agent': 'axios/0.15.3', 'Content-Length': 184 },
agent: undefined,
auth: undefined } +464ms
telegram-mtproto:tl [int bytes] [5.559] 2340af17ba0f16a2c23e2c054059d3a9 Set_client_DH_params_answer[dh_gen_ok][nonce]:int1 +2ms
telegram-mtproto:tl [int bytes] [5.559] 10e04bd1438bb49eadda4ba41d80483c Set_client_DH_params_answer[dh_gen_ok][server_nonc +1ms
telegram-mtproto:tl [int bytes] [5.560] f96b408acd831f0527852a241c1c07cf Set_client_DH_params_answer[dh_gen_ok][new_nonce_h +0ms
telegram-mtproto:networker [Api call] [6.018] help.getNearestDc {} 6398874859608284188 1 { dcID: 2,
createNetworker: true,
resultType: 'NearestDc',
messageID: '6398874859608284188' } +192ms
telegram-mtproto:networker [Container] [6.020] 6398874859608284188,6398874859614735564 6398874859614851332 4 +2ms
telegram-mtproto:tl:types [int] message_id:long[low] 9c998001 2627305473 +510ms
telegram-mtproto:tl:types [int] message_id:long[high] 58cd5ec8 1489854152 +0ms
telegram-mtproto:tl:types [int] seq_no:int 4 4 +0ms
telegram-mtproto:tl:types [int] message_data[length]:int 60 96 +1ms
telegram-mtproto:tl:types [int] INPUT[id] 73f1f8dc 1945237724 +2ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][count] 2 2 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][msg_id]:long[low] 74ed1401 1961694209 +1ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][msg_id]:long[high] 58cd5ec8 1489854152 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][seqno]:int 1 1 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][bytes]:int 1c 28 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][body][id] 9ec20908 2663516424 +1ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][body][new_session_created][first_msg_id]:long[low] 39211c1c 958471196 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][body][new_session_created][first_msg_id]:long[high] 58cd5ec8 1489854152 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][body][new_session_created][unique_id]:long[low] 7c99f3ab 2090464171 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][body][new_session_created][unique_id]:long[high] be2f31a8 3190763944 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][body][new_session_created][server_salt]:long[low] 6c21dafe 1814158078 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][0][message][body][new_session_created][server_salt]:long[high] cc4d2b6f 3427609455 +1ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][1][message][msg_id]:long[low] 75ef9801 1978636289 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][1][message][msg_id]:long[high] 58cd5ec8 1489854152 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][1][message][seqno]:int 3 3 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][1][message][bytes]:int 1c 28 +1ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][1][message][body][id] f35c6d01 4082920705 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][1][message][body][rpc_result][req_msg_id]:long[low] 39211c1c 958471196 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][1][message][body][rpc_result][req_msg_id]:long[high] 58cd5ec8 1489854152 +0ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][1][message][body][rpc_result][result][id] 8e1a1775 2384074613 +1ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][1][message][body][rpc_result][result][nearestDc][this_dc]:int 2 2 +1ms
telegram-mtproto:tl:types [int] INPUT[msg_container][messages][1][message][body][rpc_result][result][nearestDc][nearest_dc]:int 5 5 +0ms
Unhandled rejection Error: MT[401] AUTH_KEY_EMPTY:
at ApiManager._ref2 (/home/brainbush/wfjsw/telegram-mtproto-test/node_modules/telegram-mtproto/lib/service/api-manager/index.js:129:43)
at _ref2.next (<anonymous>)
at step (/home/brainbush/wfjsw/telegram-mtproto-test/node_modules/telegram-mtproto/lib/service/api-manager/index.js:70:202)
at /home/brainbush/wfjsw/telegram-mtproto-test/node_modules/telegram-mtproto/lib/service/api-manager/index.js:70:383
at tryCatcher (/home/brainbush/wfjsw/telegram-mtproto-test/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/brainbush/wfjsw/telegram-mtproto-test/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/brainbush/wfjsw/telegram-mtproto-test/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/home/brainbush/wfjsw/telegram-mtproto-test/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/home/brainbush/wfjsw/telegram-mtproto-test/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/home/brainbush/wfjsw/telegram-mtproto-test/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/home/brainbush/wfjsw/telegram-mtproto-test/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:666:20)
at tryOnImmediate (timers.js:639:5)
at processImmediate [as _immediateCallback] (timers.js:611:5)