diff --git a/src/Client.cs b/src/Client.cs index ab7c483..4b5ee27 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -139,6 +139,12 @@ namespace WTelegram /// A string starting with -----BEGIN RSA PUBLIC KEY----- public static void LoadPublicKey(string pem) => Encryption.LoadPublicKey(pem); + /// Builds a structure that is used to validate a 2FA password + /// Password validation configuration. You can obtain this though an Update event as part of the login process + /// The password to validate + public static Task InputCheckPassword(Account_Password accountPassword, string password) + => Check2FA(accountPassword, () => Task.FromResult(password)); + public void Dispose() { Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client"); @@ -1045,6 +1051,7 @@ namespace WTelegram catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") { var accountPassword = await this.Account_GetPassword(); + OnUpdate(accountPassword); var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); authorization = await this.Auth_CheckPassword(checkPasswordSRP); }