From 29fab5560f678eda337350e68aee5b5dd035fe52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Thu, 27 May 2021 15:33:00 -0400
Subject: [PATCH] dhtrunner: add getPublicKey()

---
 include/opendht/dhtrunner.h | 1 +
 src/dhtrunner.cpp           | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/opendht/dhtrunner.h b/include/opendht/dhtrunner.h
index 31d3ae26..47695381 100644
--- a/include/opendht/dhtrunner.h
+++ b/include/opendht/dhtrunner.h
@@ -303,6 +303,7 @@ public:
      * Get the public key fingerprint if an identity is used with this node, 0 otherwise.
      */
     InfoHash getId() const;
+    std::shared_ptr<crypto::PublicKey> getPublicKey() const;
 
     /**
      * Get the ID of the DHT node.
diff --git a/src/dhtrunner.cpp b/src/dhtrunner.cpp
index b43854be..a145d4f3 100644
--- a/src/dhtrunner.cpp
+++ b/src/dhtrunner.cpp
@@ -406,6 +406,14 @@ DhtRunner::getId() const
     return {};
 }
 
+std::shared_ptr<crypto::PublicKey>
+DhtRunner::getPublicKey() const
+{
+    if (auto dht = activeDht())
+        return dht->getPublicKey();
+    return {};
+}
+
 InfoHash
 DhtRunner::getNodeId() const
 {
-- 
GitLab