Add separate key for test DC.
GitOrigin-RevId: 6417cbe9ed98ca7c280e0f5882f11d69610386c1
This commit is contained in:
parent
d542182b07
commit
b06a08b106
@ -280,7 +280,8 @@ ActorOwn<> get_full_config(DcId dc_id, IPAddress ip_address, Promise<FullConfig>
|
||||
|
||||
private:
|
||||
DcId dc_id_;
|
||||
std::shared_ptr<PublicRsaKeyShared> public_rsa_key_ = std::make_shared<PublicRsaKeyShared>(DcId::empty());
|
||||
std::shared_ptr<PublicRsaKeyShared> public_rsa_key_ =
|
||||
std::make_shared<PublicRsaKeyShared>(DcId::empty(), G()->is_test_dc());
|
||||
|
||||
std::vector<unique_ptr<Listener>> auth_key_listeners_;
|
||||
void notify() {
|
||||
|
@ -138,7 +138,7 @@ Status NetQueryDispatcher::wait_dc_init(DcId dc_id, bool force) {
|
||||
if (dc_id.is_internal()) {
|
||||
public_rsa_key = common_public_rsa_key_;
|
||||
} else {
|
||||
public_rsa_key = std::make_shared<PublicRsaKeyShared>(dc_id);
|
||||
public_rsa_key = std::make_shared<PublicRsaKeyShared>(dc_id, G()->is_test_dc());
|
||||
send_closure_later(public_rsa_key_watchdog_, &PublicRsaKeyWatchdog::add_public_rsa_key, public_rsa_key);
|
||||
is_cdn = true;
|
||||
}
|
||||
@ -275,7 +275,7 @@ NetQueryDispatcher::NetQueryDispatcher(std::function<ActorShared<>()> create_ref
|
||||
LOG(INFO) << tag("main_dc_id", main_dc_id_.load(std::memory_order_relaxed));
|
||||
delayer_ = create_actor<NetQueryDelayer>("NetQueryDelayer", create_reference());
|
||||
dc_auth_manager_ = create_actor<DcAuthManager>("DcAuthManager", create_reference());
|
||||
common_public_rsa_key_ = std::make_shared<PublicRsaKeyShared>(DcId::empty());
|
||||
common_public_rsa_key_ = std::make_shared<PublicRsaKeyShared>(DcId::empty(), G()->is_test_dc());
|
||||
public_rsa_key_watchdog_ = create_actor<PublicRsaKeyWatchdog>("PublicRsaKeyWatchdog", create_reference());
|
||||
|
||||
td_guard_ = create_shared_lambda_guard([actor = create_reference()] {});
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
PublicRsaKeyShared::PublicRsaKeyShared(DcId dc_id) : dc_id_(dc_id) {
|
||||
PublicRsaKeyShared::PublicRsaKeyShared(DcId dc_id, bool is_test) : dc_id_(dc_id) {
|
||||
if (!dc_id_.is_empty()) {
|
||||
return;
|
||||
}
|
||||
@ -26,6 +26,20 @@ PublicRsaKeyShared::PublicRsaKeyShared(DcId dc_id) : dc_id_(dc_id) {
|
||||
this->add_rsa(r_rsa.move_as_ok());
|
||||
}
|
||||
};
|
||||
|
||||
if (is_test) {
|
||||
add_pem(
|
||||
"-----BEGIN RSA PUBLIC KEY-----\n"
|
||||
"MIIBCgKCAQEAr4v4wxMDXIaMOh8bayF/NyoYdpcysn5EbjTIOZC0RkgzsRj3SGlu\n"
|
||||
"52QSz+ysO41dQAjpFLgxPVJoOlxXokaOq827IfW0bGCm0doT5hxtedu9UCQKbE8j\n"
|
||||
"lDOk+kWMXHPZFJKWRgKgTu9hcB3y3Vk+JFfLpq3d5ZB48B4bcwrRQnzkx5GhWOFX\n"
|
||||
"x73ZgjO93eoQ2b/lDyXxK4B4IS+hZhjzezPZTI5upTRbs5ljlApsddsHrKk6jJNj\n"
|
||||
"8Ygs/ps8e6ct82jLXbnndC9s8HjEvDvBPH9IPjv5JUlmHMBFZ5vFQIfbpo0u0+1P\n"
|
||||
"n6bkEi5o7/ifoyVv2pAZTRwppTz0EuXD8QIDAQAB\n"
|
||||
"-----END RSA PUBLIC KEY-----");
|
||||
return;
|
||||
}
|
||||
|
||||
//old_key
|
||||
add_pem(
|
||||
"-----BEGIN RSA PUBLIC KEY-----\n"
|
||||
|
@ -20,7 +20,7 @@ namespace td {
|
||||
|
||||
class PublicRsaKeyShared : public PublicRsaKeyInterface {
|
||||
public:
|
||||
explicit PublicRsaKeyShared(DcId dc_id);
|
||||
PublicRsaKeyShared(DcId dc_id, bool is_test);
|
||||
|
||||
class Listener {
|
||||
public:
|
||||
|
@ -175,7 +175,7 @@ class HandshakeContext : public mtproto::AuthKeyHandshakeContext {
|
||||
}
|
||||
|
||||
private:
|
||||
PublicRsaKeyShared public_rsa_key{DcId::empty()};
|
||||
PublicRsaKeyShared public_rsa_key{DcId::empty(), false};
|
||||
};
|
||||
|
||||
class HandshakeTestActor : public Actor {
|
||||
|
Loading…
Reference in New Issue
Block a user