summaryrefslogtreecommitdiff
path: root/protocols/Telegram/tdlib/td/td/telegram/net/PublicRsaKeyShared.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/tdlib/td/td/telegram/net/PublicRsaKeyShared.h')
-rw-r--r--protocols/Telegram/tdlib/td/td/telegram/net/PublicRsaKeyShared.h28
1 files changed, 11 insertions, 17 deletions
diff --git a/protocols/Telegram/tdlib/td/td/telegram/net/PublicRsaKeyShared.h b/protocols/Telegram/tdlib/td/td/telegram/net/PublicRsaKeyShared.h
index 453bb7bda1..5533dcde62 100644
--- a/protocols/Telegram/tdlib/td/td/telegram/net/PublicRsaKeyShared.h
+++ b/protocols/Telegram/tdlib/td/td/telegram/net/PublicRsaKeyShared.h
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2018
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
//
// 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,19 +8,17 @@
#include "td/telegram/net/DcId.h"
-#include "td/mtproto/crypto.h"
+#include "td/mtproto/RSA.h"
#include "td/utils/common.h"
#include "td/utils/port/RwMutex.h"
#include "td/utils/Status.h"
-#include <utility>
-
namespace td {
-class PublicRsaKeyShared : public PublicRsaKeyInterface {
+class PublicRsaKeyShared final : public mtproto::PublicRsaKeyInterface {
public:
- explicit PublicRsaKeyShared(DcId dc_id);
+ PublicRsaKeyShared(DcId dc_id, bool is_test);
class Listener {
public:
@@ -33,12 +31,12 @@ class PublicRsaKeyShared : public PublicRsaKeyInterface {
virtual bool notify() = 0;
};
- void add_rsa(RSA rsa);
- Result<std::pair<RSA, int64>> get_rsa(const vector<int64> &fingerprints) override;
- void drop_keys() override;
+ void add_rsa(mtproto::RSA rsa);
+ Result<RsaKey> get_rsa_key(const vector<int64> &fingerprints) final;
+ void drop_keys() final;
bool has_keys();
- void add_listener(std::unique_ptr<Listener> listener);
+ void add_listener(unique_ptr<Listener> listener);
DcId dc_id() const {
return dc_id_;
@@ -46,15 +44,11 @@ class PublicRsaKeyShared : public PublicRsaKeyInterface {
private:
DcId dc_id_;
- struct RsaOption {
- int64 fingerprint;
- RSA rsa;
- };
- std::vector<RsaOption> options_;
- std::vector<std::unique_ptr<Listener>> listeners_;
+ std::vector<RsaKey> keys_;
+ std::vector<unique_ptr<Listener>> listeners_;
RwMutex rw_mutex_;
- RSA *get_rsa_locked(int64 fingerprint);
+ RsaKey *get_rsa_key_unsafe(int64 fingerprint);
void notify();
};