public async Task connection_store_works() { var host = this.CreateWebHost(); var sent_code = new TLSentCode() { Flags = 0, PhoneCodeHash = "hiushi", Type = new TLSentCodeTypeSms { Length = 4, } }; sent_code.ToByteArray(); //MTObjectSerializer.Serialize(sent_code); var f = DateTimeHelper.CurrentMsecsFromEpoch(); //var host = this.CreateWebHost(); using (var store = host.Services.GetService <IConnectionStore>()) { var data = store.Upsert(new ConnectionData { ConnectionId = "babak" }); var data_read = store.GetConnectionId("babak"); } var d = new SessionData { ClientNonce = "nonce" }.Upsert(); }
private async Task <object> ProcessAuthSendCode(IMTSession session, InnerMessage message) { var result = await Task.FromResult <object>(null); using (var stream = new MemoryStream(message.Content)) using (var reader = new BinaryReader(stream)) { var o = session.Services.Serialization().Deserialize(message.Content) as MTObject; //o.ToByteArray(); //var type = reader.ReadUInt32(); //var flags = reader.ReadUInt32(); //var phone = StringSerializer.Deserialize(reader); /// /// auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; /// this.logger.LogInformation("************************SendCode"); var hash = new byte[8]; new Random().NextBytes(hash); var code = "1234"; //this.SentCode = true; var sent_code = new TLSentCode() { Flags = 4, PhoneCodeHash = "phonehash", Type = new TLSentCodeTypeSms { Length = 4, }, Timeout = 40000 }; var ss = sent_code.ToByteArray(); result = new MTRpcResult { ReqMsgId = (long)message.msg_id, Result = new MTGzipPacked { PackedData = Utils.compress(sent_code.ToByteArray()) } }; session.AddMessage(result as MTObject, false, true); } return(result); }