diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 3fc99d66..e30b7e47 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -97,18 +97,6 @@ #include namespace td { -namespace { -DbKey as_db_key(string key) { - // Database will still be effectively not encrypted, but - // 1. sqlite db will be protected from corruption, because that's how sqlcipher works - // 2. security through obscurity - // 3. no need for reencryption of sqlite db - if (key.empty()) { - return DbKey::raw_key("cucumber"); - } - return DbKey::raw_key(std::move(key)); -} -} // namespace void Td::ResultHandler::set_td(Td *new_td) { CHECK(td == nullptr); @@ -3208,6 +3196,17 @@ td_api::object_ptr Td::get_fake_authorization_state_ } } +DbKey Td::as_db_key(string key) { + // Database will still be effectively not encrypted, but + // 1. sqlite db will be protected from corruption, because that's how sqlcipher works + // 2. security through obscurity + // 3. no need for reencryption of sqlite db + if (key.empty()) { + return DbKey::raw_key("cucumber"); + } + return DbKey::raw_key(std::move(key)); +} + void Td::request(uint64 id, tl_object_ptr function) { if (id == 0) { LOG(ERROR) << "Ignore request with id == 0: " << to_string(function); @@ -3516,10 +3515,6 @@ void Td::on_authorization_lost() { destroy(); } -static td_api::object_ptr make_error(int32 code, CSlice error) { - return td_api::make_object(code, error.str()); -} - void Td::start_up() { always_wait_for_mailbox(); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index d63e3fc5..e18d22d1 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -939,12 +939,17 @@ class Td final : public NetQueryCallback { static td_api::object_ptr do_static_request(const td_api::getLanguagePackString &request); static td_api::object_ptr do_static_request(const td_api::testSetLogTagVerbosityLevel &request); + static DbKey as_db_key(string key); Status init(DbKey key) TD_WARN_UNUSED_RESULT; void clear(); void close_impl(bool destroy_flag); - Status fix_parameters(TdParameters ¶meters) TD_WARN_UNUSED_RESULT; + static Status fix_parameters(TdParameters ¶meters) TD_WARN_UNUSED_RESULT; Status set_parameters(td_api::object_ptr parameters) TD_WARN_UNUSED_RESULT; + static td_api::object_ptr make_error(int32 code, CSlice error) { + return td_api::make_object(code, error.str()); + } + // Actor void start_up() override; void tear_down() override;