Exemple #1
0
        public async Task <TLUser> MakeAuthWithPasswordAsync(TLPassword password, string password_str)
        {
            byte[]             password_Bytes = Encoding.UTF8.GetBytes(password_str);
            IEnumerable <byte> rv             = password.CurrentSalt.Concat(password_Bytes).Concat(password.CurrentSalt);

            SHA256Managed hashstring    = new SHA256Managed();
            var           password_hash = hashstring.ComputeHash(rv.ToArray());

            var request = new TLRequestCheckPassword()
            {
                PasswordHash = password_hash
            };

            await RequestWithDcMigration(request);

            OnUserAuthenticated(((TLUser)request.Response.User));

            return((TLUser)request.Response.User);
        }
Exemple #2
0
        public async Task <TLAbsUser> MakeAuthWithPasswordAsync(TLAbsPassword password, string password_str)
        {
            byte[]             password_bytes = Encoding.UTF8.GetBytes(password_str);
            IEnumerable <byte> rv             = password.ToTLPassword().current_salt.Concat(password_bytes).Concat(password.ToTLPassword().current_salt);

            SHA256Managed hashstring    = new SHA256Managed();
            var           password_hash = hashstring.ComputeHash(rv.ToArray());

            var request = new TLRequestCheckPassword()
            {
                password_hash = password_hash
            };
            await _sender.Send(request);

            await _sender.Receive(request);

            OnUserAuthenticated(((TLAbsUser)request.Response.ToTLAuthorization().user));

            return((TLAbsUser)request.Response.ToTLAuthorization().user);
        }
        public async Task <TLUser> MakeAuthWithPasswordAsync(TLPassword password, string password_str, CancellationToken token = default(CancellationToken))
        {
            token.ThrowIfCancellationRequested();

            byte[]             password_Bytes = Encoding.UTF8.GetBytes(password_str);
            IEnumerable <byte> rv             = password.CurrentSalt.Concat(password_Bytes).Concat(password.CurrentSalt);

            SHA256Managed hashstring    = new SHA256Managed();
            var           password_hash = hashstring.ComputeHash(rv.ToArray());

            var request = new TLRequestCheckPassword()
            {
                PasswordHash = password_hash
            };

            await RequestWithDcMigration(request, token).ConfigureAwait(false);

            OnUserAuthenticated((TLUser)request.Response.User);

            return((TLUser)request.Response.User);
        }