diff --git a/src/Encryption.cs b/src/Encryption.cs index a3a3eaf..03b72c0 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -388,14 +388,12 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB internal static async Task Check2FA(Account_Password accountPassword, Func> getPassword) { - bool newPassword = false; if (accountPassword.current_algo is not PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) if (accountPassword.current_algo == null && (algo = accountPassword.new_algo as PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) != null) { int salt1len = algo.salt1.Length; Array.Resize(ref algo.salt1, salt1len + 32); RNG.GetBytes(algo.salt1, salt1len, 32); - newPassword = true; } else throw new ApplicationException("2FA authentication uses an unsupported algo: " + accountPassword.current_algo?.GetType().Name); @@ -431,7 +429,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB var x = BigEndianInteger(sha256.Hash); var v = BigInteger.ModPow(g, x, p); - if (newPassword) + if (accountPassword.current_algo == null) // we're computing a new password { await validTask; return new InputCheckPasswordSRP { A = v.To256Bytes() }; diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 2c6f5b8..be79d66 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading.Tasks; using System.Web; namespace TL @@ -34,6 +35,11 @@ namespace TL /// The structure having a users public static void CollectUsersChats(this IPeerResolver structure, Dictionary users, Dictionary chats) => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); + + public static Task Messages_GetChats(this WTelegram.Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllChats"); + public static Task Channels_GetChannels(this WTelegram.Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllChats"); + public static Task Users_GetUsers(this WTelegram.Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllDialogs"); + public static Task Messages_GetMessages(this WTelegram.Client _) => throw new ApplicationException("If you want to get the messages from a chat, use Messages_GetHistory"); } public static class Markdown