summaryrefslogtreecommitdiff
path: root/protocols/Telegram/tdlib/td/td/telegram/AuthManager.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/tdlib/td/td/telegram/AuthManager.hpp')
-rw-r--r--protocols/Telegram/tdlib/td/td/telegram/AuthManager.hpp130
1 files changed, 1 insertions, 129 deletions
diff --git a/protocols/Telegram/tdlib/td/td/telegram/AuthManager.hpp b/protocols/Telegram/tdlib/td/td/telegram/AuthManager.hpp
index 60cddc8c28..376510df71 100644
--- a/protocols/Telegram/tdlib/td/td/telegram/AuthManager.hpp
+++ b/protocols/Telegram/tdlib/td/td/telegram/AuthManager.hpp
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -8,12 +8,6 @@
#include "td/telegram/AuthManager.h"
-#include "td/telegram/logevent/LogEventHelper.h"
-#include "td/telegram/SendCodeHelper.hpp"
-#include "td/telegram/Version.h"
-
-#include "td/utils/format.h"
-#include "td/utils/SliceBuilder.h"
#include "td/utils/tl_helpers.h"
namespace td {
@@ -48,126 +42,4 @@ void AuthManager::WaitPasswordState::parse(ParserT &parser) {
parse(has_secure_values_, parser);
}
-template <class StorerT>
-void AuthManager::DbState::store(StorerT &storer) const {
- using td::store;
- bool has_terms_of_service = !terms_of_service_.get_id().empty();
- bool is_pbkdf2_supported = true;
- bool is_srp_supported = true;
- bool is_wait_registration_supported = true;
- bool is_wait_registration_stores_phone_number = true;
- bool is_wait_qr_code_confirmation_supported = true;
- bool is_time_store_supported = true;
- bool is_reset_email_address_supported = true;
- BEGIN_STORE_FLAGS();
- STORE_FLAG(has_terms_of_service);
- STORE_FLAG(is_pbkdf2_supported);
- STORE_FLAG(is_srp_supported);
- STORE_FLAG(is_wait_registration_supported);
- STORE_FLAG(is_wait_registration_stores_phone_number);
- STORE_FLAG(is_wait_qr_code_confirmation_supported);
- STORE_FLAG(allow_apple_id_);
- STORE_FLAG(allow_google_id_);
- STORE_FLAG(is_time_store_supported);
- STORE_FLAG(is_reset_email_address_supported);
- END_STORE_FLAGS();
- store(state_, storer);
- store(api_id_, storer);
- store(api_hash_, storer);
- store_time(expires_at_, storer);
-
- if (has_terms_of_service) {
- store(terms_of_service_, storer);
- }
-
- if (state_ == State::WaitEmailAddress) {
- store(send_code_helper_, storer);
- } else if (state_ == State::WaitEmailCode) {
- store(send_code_helper_, storer);
- store(email_address_, storer);
- store(email_code_info_, storer);
- store(reset_available_period_, storer);
- store(reset_pending_date_, storer);
- } else if (state_ == State::WaitCode) {
- store(send_code_helper_, storer);
- } else if (state_ == State::WaitQrCodeConfirmation) {
- store(other_user_ids_, storer);
- store(login_token_, storer);
- store_time(login_token_expires_at_, storer);
- } else if (state_ == State::WaitPassword) {
- store(wait_password_state_, storer);
- } else if (state_ == State::WaitRegistration) {
- store(send_code_helper_, storer);
- } else {
- UNREACHABLE();
- }
-}
-
-template <class ParserT>
-void AuthManager::DbState::parse(ParserT &parser) {
- using td::parse;
- bool has_terms_of_service = false;
- bool is_pbkdf2_supported = false;
- bool is_srp_supported = false;
- bool is_wait_registration_supported = false;
- bool is_wait_registration_stores_phone_number = false;
- bool is_wait_qr_code_confirmation_supported = false;
- bool is_time_store_supported = false;
- bool is_reset_email_address_supported = false;
- if (parser.version() >= static_cast<int32>(Version::AddTermsOfService)) {
- BEGIN_PARSE_FLAGS();
- PARSE_FLAG(has_terms_of_service);
- PARSE_FLAG(is_pbkdf2_supported);
- PARSE_FLAG(is_srp_supported);
- PARSE_FLAG(is_wait_registration_supported);
- PARSE_FLAG(is_wait_registration_stores_phone_number);
- PARSE_FLAG(is_wait_qr_code_confirmation_supported);
- PARSE_FLAG(allow_apple_id_);
- PARSE_FLAG(allow_google_id_);
- PARSE_FLAG(is_time_store_supported);
- PARSE_FLAG(is_reset_email_address_supported);
- END_PARSE_FLAGS();
- }
- if (!is_reset_email_address_supported) {
- return parser.set_error("Have no reset email address support");
- }
- CHECK(is_pbkdf2_supported);
- CHECK(is_srp_supported);
- CHECK(is_wait_registration_supported);
- CHECK(is_wait_registration_stores_phone_number);
- CHECK(is_wait_qr_code_confirmation_supported);
- CHECK(is_time_store_supported);
-
- parse(state_, parser);
- parse(api_id_, parser);
- parse(api_hash_, parser);
- parse_time(expires_at_, parser);
-
- if (has_terms_of_service) {
- parse(terms_of_service_, parser);
- }
-
- if (state_ == State::WaitEmailAddress) {
- parse(send_code_helper_, parser);
- } else if (state_ == State::WaitEmailCode) {
- parse(send_code_helper_, parser);
- parse(email_address_, parser);
- parse(email_code_info_, parser);
- parse(reset_available_period_, parser);
- parse(reset_pending_date_, parser);
- } else if (state_ == State::WaitCode) {
- parse(send_code_helper_, parser);
- } else if (state_ == State::WaitQrCodeConfirmation) {
- parse(other_user_ids_, parser);
- parse(login_token_, parser);
- parse_time(login_token_expires_at_, parser);
- } else if (state_ == State::WaitPassword) {
- parse(wait_password_state_, parser);
- } else if (state_ == State::WaitRegistration) {
- parse(send_code_helper_, parser);
- } else {
- parser.set_error(PSTRING() << "Unexpected " << tag("state", static_cast<int32>(state_)));
- }
-}
-
} // namespace td