diff --git a/include/opendht/default_types.h b/include/opendht/default_types.h index f6469d8d..73547447 100644 --- a/include/opendht/default_types.h +++ b/include/opendht/default_types.h @@ -77,7 +77,7 @@ public: return [](const Value& v){ return v.isSigned(); }; } - Sp owner; + Sp owner; dht::InfoHash from; }; diff --git a/include/opendht/securedht.h b/include/opendht/securedht.h index c944e568..237dfb50 100644 --- a/include/opendht/securedht.h +++ b/include/opendht/securedht.h @@ -126,13 +126,13 @@ public: Value decrypt(const Value& v); void findCertificate(const InfoHash& node, const std::function)>& cb); - void findPublicKey(const InfoHash& node, const std::function)>& cb); + void findPublicKey(const InfoHash& node, const std::function)>& cb); - const Sp registerCertificate(const InfoHash& node, const Blob& cert); + Sp registerCertificate(const InfoHash& node, const Blob& cert); void registerCertificate(Sp& cert); - const Sp getCertificate(const InfoHash& node) const; - const Sp getPublicKey(const InfoHash& node) const; + Sp getCertificate(const InfoHash& node) const; + Sp getPublicKey(const InfoHash& node) const; /** * Allows to set a custom callback called by the library to find a locally-stored certificate. @@ -354,7 +354,7 @@ private: // our certificate cache std::map> nodesCertificates_ {}; - std::map> nodesPubKeys_ {}; + std::map> nodesPubKeys_ {}; std::atomic_bool forward_all_ {false}; bool enableCache_ {false}; diff --git a/include/opendht/value.h b/include/opendht/value.h index 70539bb8..a9936370 100644 --- a/include/opendht/value.h +++ b/include/opendht/value.h @@ -356,7 +356,7 @@ struct OPENDHT_PUBLIC Value void sign(const crypto::PrivateKey& key) { if (isEncrypted()) throw DhtException("Can't sign encrypted data."); - owner = std::make_shared(key.getPublicKey()); + owner = std::make_shared(key.getPublicKey()); signature = key.sign(getToSign()); } @@ -368,8 +368,8 @@ struct OPENDHT_PUBLIC Value return isSigned() and owner->checkSignature(getToSign(), signature); } - std::shared_ptr getOwner() const { - return std::static_pointer_cast(owner); + std::shared_ptr getOwner() const { + return std::static_pointer_cast(owner); } /** @@ -594,7 +594,7 @@ struct OPENDHT_PUBLIC Value /** * Public key of the signer. */ - std::shared_ptr owner {}; + std::shared_ptr owner {}; /** * Hash of the recipient (optional). diff --git a/src/securedht.cpp b/src/securedht.cpp index bf471d5d..407c86b2 100644 --- a/src/securedht.cpp +++ b/src/securedht.cpp @@ -118,7 +118,7 @@ SecureDht::secureType(ValueType&& type) return type; } -const Sp +Sp SecureDht::getCertificate(const InfoHash& node) const { if (node == getId()) @@ -130,7 +130,7 @@ SecureDht::getCertificate(const InfoHash& node) const return it->second; } -const Sp +Sp SecureDht::getPublicKey(const InfoHash& node) const { if (node == getId()) @@ -142,7 +142,7 @@ SecureDht::getPublicKey(const InfoHash& node) const return it->second; } -const Sp +Sp SecureDht::registerCertificate(const InfoHash& node, const Blob& data) { Sp crt; @@ -220,7 +220,7 @@ SecureDht::findCertificate(const InfoHash& node, const std::function)>& cb) +SecureDht::findPublicKey(const InfoHash& node, const std::function)>& cb) { auto pk = getPublicKey(node); if (pk && *pk) { @@ -405,7 +405,7 @@ SecureDht::putEncrypted(const InfoHash& hash, const InfoHash& to, Sp val, callback(false, {}); return; } - findPublicKey(to, [=](const Sp& pk) { + findPublicKey(to, [this, hash, val = std::move(val), callback = std::move(callback), permanent](const Sp& pk) { if(!pk || !*pk) { if (callback) callback(false, {}); diff --git a/src/value.cpp b/src/value.cpp index f6e2b1a9..5ea34384 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -163,7 +163,7 @@ Value::msgpack_unpack_body(const msgpack::object& o) throw msgpack::type_error(); crypto::PublicKey new_owner; new_owner.msgpack_unpack(*rowner); - owner = std::make_shared(std::move(new_owner)); + owner = std::make_shared(std::move(new_owner)); if (auto rrecipient = findMapValue(*rbody, VALUE_KEY_TO)) { recipient = rrecipient->as(); } @@ -193,7 +193,7 @@ Value::Value(const Json::Value& json) if (jowner.isString()) { auto ownerStr = jowner.asString(); auto ownerBlob = std::vector(ownerStr.begin(), ownerStr.end()); - owner = std::make_shared(ownerBlob); + owner = std::make_shared(ownerBlob); } const auto& jto = json[VALUE_KEY_TO]; if (jto.isString())