From fc25da37c549c1ecc1bb2466ee3185858ede812d Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 26 May 2016 14:54:33 -0400 Subject: [PATCH] removed GetPrivateKeys from LocalDestination --- Destination.h | 5 ++++- Identity.h | 8 ++------ RouterContext.h | 4 +++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Destination.h b/Destination.h index 4c8bfc80..b42aba3d 100644 --- a/Destination.h +++ b/Destination.h @@ -147,6 +147,8 @@ namespace client bool Start (); bool Stop (); + const i2p::data::PrivateKeys& GetPrivateKeys () const { return m_Keys; }; + // streaming std::shared_ptr CreateStreamingDestination (int port, bool gzip = true); // additional std::shared_ptr GetStreamingDestination (int port = 0) const; @@ -162,9 +164,10 @@ namespace client i2p::datagram::DatagramDestination * CreateDatagramDestination (); // implements LocalDestination - const i2p::data::PrivateKeys& GetPrivateKeys () const { return m_Keys; }; + std::shared_ptr GetIdentity () const { return m_Keys.GetPublic (); }; const uint8_t * GetEncryptionPrivateKey () const { return m_EncryptionPrivateKey; }; const uint8_t * GetEncryptionPublicKey () const { return m_EncryptionPublicKey; }; + void Sign (const uint8_t * buf, int len, uint8_t * signature) const { m_Keys.Sign (buf, len, signature); }; protected: diff --git a/Identity.h b/Identity.h index d8abd6f4..541a7801 100644 --- a/Identity.h +++ b/Identity.h @@ -178,16 +178,12 @@ namespace data public: virtual ~LocalDestination() {}; - virtual const PrivateKeys& GetPrivateKeys () const = 0; virtual const uint8_t * GetEncryptionPrivateKey () const = 0; virtual const uint8_t * GetEncryptionPublicKey () const = 0; + virtual std::shared_ptr GetIdentity () const = 0; + virtual void Sign (const uint8_t * buf, int len, uint8_t * signature) const = 0; - std::shared_ptr GetIdentity () const { return GetPrivateKeys ().GetPublic (); }; const IdentHash& GetIdentHash () const { return GetIdentity ()->GetIdentHash (); }; - void Sign (const uint8_t * buf, int len, uint8_t * signature) const - { - GetPrivateKeys ().Sign (buf, len, signature); - }; }; } } diff --git a/RouterContext.h b/RouterContext.h index 29164f4b..05339847 100644 --- a/RouterContext.h +++ b/RouterContext.h @@ -30,6 +30,7 @@ namespace i2p RouterContext (); void Init (); + const i2p::data::PrivateKeys& GetPrivateKeys () const { return m_Keys; }; i2p::data::RouterInfo& GetRouterInfo () { return m_RouterInfo; }; std::shared_ptr GetSharedRouterInfo () const { @@ -73,9 +74,10 @@ namespace i2p void UpdateStats (); // implements LocalDestination - const i2p::data::PrivateKeys& GetPrivateKeys () const { return m_Keys; }; + std::shared_ptr GetIdentity () const { return m_Keys.GetPublic (); }; const uint8_t * GetEncryptionPrivateKey () const { return m_Keys.GetPrivateKey (); }; const uint8_t * GetEncryptionPublicKey () const { return GetIdentity ()->GetStandardIdentity ().publicKey; }; + void Sign (const uint8_t * buf, int len, uint8_t * signature) const { m_Keys.Sign (buf, len, signature); }; void SetLeaseSetUpdated () {}; // implements GarlicDestination