public void SendCodeAsync(TLString phoneNumber, TLSmsType smsType, Action <TLSentCodeBase> callback, Action <int> attemptFailed = null, Action <TLRPCError> faultCallback = null) { var obj = new TLSendCode { PhoneNumber = phoneNumber, SmsType = smsType, ApiId = new TLInt(Constants.ApiId), ApiHash = new TLString(Constants.ApiHash), LangCode = new TLString(Utils.CurrentUICulture()) }; SendInformativeMessage("auth.sendCode", obj, callback, faultCallback, 3); }
private static byte[] ComposeSendCodeRequest(TLString phone, TLSmsType type, int apiId, TLString apiHash) { TLUtils.WriteLine("--Compose TLSendCode request--"); var signature = new byte[] { 0x72, 0xf3, 0x6f, 0xd1 }; TLUtils.WriteLine("Phone: " + phone.ToString()); TLUtils.WriteLine("Phone serialized: " + BitConverter.ToString(phone.ToBytes())); TLUtils.WriteLine("ApiHash: " + apiHash.ToString()); TLUtils.WriteLine("ApiHash serialized: " + BitConverter.ToString(apiHash.ToBytes())); return(signature .Concat(phone.ToBytes()) .Concat(BitConverter.GetBytes((int)type)) .Concat(BitConverter.GetBytes(apiId)) .Concat(apiHash.ToBytes()) .ToArray()); }
public static TLResponse SendSendCodeRequest(int seqNo, TLString phone, TLSmsType type) { return(RequestHelper.Send("auth.sendCode", seqNo, () => ComposeSendCodeRequest(phone, type, Constants.ApiId, new TLString(Constants.ApiHash)))); }