diff --git a/src/jamidht/channel_handler.h b/src/jamidht/channel_handler.h index a0c448f059298e42bdfeb30fb6830fddb4b6da3f..18f919ab805ebfccb8d1910141a5106a7414b7a2 100644 --- a/src/jamidht/channel_handler.h +++ b/src/jamidht/channel_handler.h @@ -46,19 +46,19 @@ public: /** * Determine if we accept or not the request. Called when ConnectionManager receives a request - * @param deviceId Device who asked + * @param peer Peer who asked * @param name The name of the channel * @return if we accept or not */ - virtual bool onRequest(const DeviceId& deviceId, const std::string& name) = 0; + virtual bool onRequest(const std::shared_ptr<dht::crypto::Certificate>& peer, const std::string& name) = 0; /** * Called when ConnectionManager has a new channel ready - * @param deviceId Related device + * @param peer Connected peer * @param name The name of the channel * @param channel Channel to handle */ - virtual void onReady(const DeviceId& deviceId, + virtual void onReady(const std::shared_ptr<dht::crypto::Certificate>& peer, const std::string& name, std::shared_ptr<ChannelSocket> channel) = 0; diff --git a/src/jamidht/connectionmanager.cpp b/src/jamidht/connectionmanager.cpp index ae92b4f6a314335ce2980ef1177d2157666338e6..62c2857b7ff6a50be6e95d5c5692cf95e9ffef4b 100644 --- a/src/jamidht/connectionmanager.cpp +++ b/src/jamidht/connectionmanager.cpp @@ -957,10 +957,10 @@ ConnectionManager::Impl::addNewMultiplexedSocket(const DeviceId& deviceId, const sthis->connReadyCb_(deviceId, socket->name(), socket); }); info->socket_->setOnRequest( - [w = weak()](const DeviceId& deviceId, const uint16_t&, const std::string& name) { + [w = weak()](const std::shared_ptr<dht::crypto::Certificate>& peer, const uint16_t&, const std::string& name) { if (auto sthis = w.lock()) if (sthis->channelReqCb_) - return sthis->channelReqCb_(deviceId, name); + return sthis->channelReqCb_(peer, name); return false; }); info->socket_->onShutdown([w = weak(), deviceId, vid]() { diff --git a/src/jamidht/connectionmanager.h b/src/jamidht/connectionmanager.h index 7a7c95c5769ea7ac399f760b0eeb407c16dda7ae..71015624dedd52f504f96f70c28f2dbfcbd2b52b 100644 --- a/src/jamidht/connectionmanager.h +++ b/src/jamidht/connectionmanager.h @@ -56,7 +56,7 @@ using onICERequestCallback = std::function<bool(const DeviceId&)>; /** * Used to accept or decline an incoming channel request */ -using ChannelRequestCallback = std::function<bool(const DeviceId&, const std::string& /* name */)>; +using ChannelRequestCallback = std::function<bool(const std::shared_ptr<dht::crypto::Certificate>&, const std::string& /* name */)>; /** * Used by connectDevice, when the socket is ready */ diff --git a/src/jamidht/conversation_channel_handler.cpp b/src/jamidht/conversation_channel_handler.cpp index ef8c37e09772c027bba64dc028340a9299a38aae..28e41e53fc267722921623ea8006bc2d72d7ee8c 100644 --- a/src/jamidht/conversation_channel_handler.cpp +++ b/src/jamidht/conversation_channel_handler.cpp @@ -46,7 +46,7 @@ ConversationChannelHandler::connect(const DeviceId& deviceId, } bool -ConversationChannelHandler::onRequest(const DeviceId&, const std::string& name) +ConversationChannelHandler::onRequest(const std::shared_ptr<dht::crypto::Certificate>&, const std::string& name) { // Pre-check before acceptance. Sometimes, another device can start a conversation // which is still not synced. So, here we decline channel's request in this case @@ -63,7 +63,7 @@ ConversationChannelHandler::onRequest(const DeviceId&, const std::string& name) } void -ConversationChannelHandler::onReady(const DeviceId&, +ConversationChannelHandler::onReady(const std::shared_ptr<dht::crypto::Certificate>&, const std::string&, std::shared_ptr<ChannelSocket>) {} diff --git a/src/jamidht/conversation_channel_handler.h b/src/jamidht/conversation_channel_handler.h index b9418fb8e82d610d6aa8dfab87af3b309e2b5885..18176229606621bc0619fa1fc8414bb3e3efbcb5 100644 --- a/src/jamidht/conversation_channel_handler.h +++ b/src/jamidht/conversation_channel_handler.h @@ -49,12 +49,12 @@ public: * @param name name asked * @return if the channel is for a valid conversation and device not banned */ - bool onRequest(const DeviceId& deviceId, const std::string& name) override; + bool onRequest(const std::shared_ptr<dht::crypto::Certificate>& peer, const std::string& name) override; /** * TODO, this needs to extract gitservers from JamiAccount */ - void onReady(const DeviceId& deviceId, + void onReady(const std::shared_ptr<dht::crypto::Certificate>& peer, const std::string& name, std::shared_ptr<ChannelSocket> channel) override; diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index d84fc2d252835d4dba04c78454a19f51cd94b0f7..4ff129e99de9a4232d441d2825895c4989b7085b 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -2168,26 +2168,20 @@ JamiAccount::doRegister_() return result; }); connectionManager_->onChannelRequest( - [this](const DeviceId& deviceId, const std::string& name) { - JAMI_WARN("[Account %s] New channel asked from %s with name %s", + [this](const std::shared_ptr<dht::crypto::Certificate>& cert, const std::string& name) { + JAMI_WARN("[Account %s] New channel asked with name %s", getAccountID().c_str(), - deviceId.to_c_str(), name.c_str()); auto uri = Uri(name); auto itHandler = channelHandlers_.find(uri.scheme()); if (itHandler != channelHandlers_.end() && itHandler->second) - return itHandler->second->onRequest(deviceId, name); + return itHandler->second->onRequest(cert, name); // TODO replace auto isFile = name.substr(0, 7) == FILE_URI; auto isVCard = name.substr(0, 8) == VCARD_URI; auto isDataTransfer = name.substr(0, 16) == DATA_TRANSFER_URI; - auto cert = tls::CertificateStore::instance().getCertificate(deviceId.toString()); - if (!cert || !cert->issuer) - return false; - auto issuer = cert->issuer->getId().toString(); - if (name == "sip") { return true; } else if (isFile or isVCard) { @@ -2270,7 +2264,7 @@ JamiAccount::doRegister_() auto accountId = this->accountID_; JAMI_WARN("[Account %s] Git server requested for conversation %s, device %s, " "channel %u", - getAccountID().c_str(), + accountId.c_str(), conversationId.c_str(), deviceId.to_c_str(), channel->channel()); @@ -2299,7 +2293,7 @@ JamiAccount::doRegister_() auto uri = Uri(name); auto itHandler = channelHandlers_.find(uri.scheme()); if (itHandler != channelHandlers_.end() && itHandler->second) - itHandler->second->onReady(deviceId, name, std::move(channel)); + itHandler->second->onReady(cert, name, std::move(channel)); } } }); diff --git a/src/jamidht/multiplexed_socket.cpp b/src/jamidht/multiplexed_socket.cpp index 3f6121416803cb290931fe4d881a910bf649f03c..882845adfdb10c894f1d0079f28af5221b440ab3 100644 --- a/src/jamidht/multiplexed_socket.cpp +++ b/src/jamidht/multiplexed_socket.cpp @@ -356,7 +356,7 @@ MultiplexedSocket::Impl::onVersion(int version) void MultiplexedSocket::Impl::onRequest(const std::string& name, uint16_t channel) { - auto accept = onRequest_(deviceId, channel, name); + auto accept = onRequest_(endpoint->peerCertificate(), channel, name); std::shared_ptr<ChannelSocket> channelSocket; if (accept) { std::lock_guard<std::mutex> lkSockets(socketsMutex); diff --git a/src/jamidht/multiplexed_socket.h b/src/jamidht/multiplexed_socket.h index 2ec10d08ac3c64465f4f7295565229edc891b0a6..8a42a0e06def02e577b5a467b2b6f7444b45a8fb 100644 --- a/src/jamidht/multiplexed_socket.h +++ b/src/jamidht/multiplexed_socket.h @@ -29,9 +29,9 @@ class TlsSocketEndpoint; using DeviceId = dht::PkId; using OnConnectionRequestCb = std::function< - bool(const DeviceId& /* device id */, const uint16_t& /* id */, const std::string& /* name */)>; + bool(const std::shared_ptr<dht::crypto::Certificate>& /* peer */, const uint16_t& /* id */, const std::string& /* name */)>; using OnConnectionReadyCb - = std::function<void(const DeviceId& /* device id */, const std::shared_ptr<ChannelSocket>&)>; + = std::function<void(const DeviceId& /* deviceId */, const std::shared_ptr<ChannelSocket>&)>; using ChannelReadyCb = std::function<void(void)>; using OnShutdownCb = std::function<void(void)>; diff --git a/src/jamidht/sync_channel_handler.cpp b/src/jamidht/sync_channel_handler.cpp index c75123a09af4dcad73aea5e0a4045559e674c2ae..c8daa55925dee11ee90d53f6bfe55b491b6eca2a 100644 --- a/src/jamidht/sync_channel_handler.cpp +++ b/src/jamidht/sync_channel_handler.cpp @@ -51,25 +51,23 @@ SyncChannelHandler::connect(const DeviceId& deviceId, const std::string&, Connec } bool -SyncChannelHandler::onRequest(const DeviceId& deviceId, const std::string& /* name */) +SyncChannelHandler::onRequest(const std::shared_ptr<dht::crypto::Certificate>& cert, const std::string& /* name */) { - auto cert = tls::CertificateStore::instance().getCertificate(deviceId.toString()); auto acc = account_.lock(); - if (!cert || !acc) + if (!cert || !cert->issuer || !acc) return false; - return cert->getIssuerUID() == acc->getUsername(); + return cert->issuer->getId().toString() == acc->getUsername(); } void -SyncChannelHandler::onReady(const DeviceId& deviceId, +SyncChannelHandler::onReady(const std::shared_ptr<dht::crypto::Certificate>& cert, const std::string&, std::shared_ptr<ChannelSocket> channel) { - auto cert = tls::CertificateStore::instance().getCertificate(deviceId.toString()); auto acc = account_.lock(); - if (!cert || !acc || !acc->syncModule()) + if (!cert || !cert->issuer || !acc || !acc->syncModule()) return; - acc->syncModule()->cacheSyncConnection(std::move(channel), cert->getIssuerUID(), deviceId); + acc->syncModule()->cacheSyncConnection(std::move(channel), cert->issuer->getId().toString(), cert->getLongId()); } } // namespace jami \ No newline at end of file diff --git a/src/jamidht/sync_channel_handler.h b/src/jamidht/sync_channel_handler.h index 5e6f72e03af9c8eb2ebe5b513227df1a35ae1dc3..42e21250c54ae0fbeaea907b194b1faad11a13d6 100644 --- a/src/jamidht/sync_channel_handler.h +++ b/src/jamidht/sync_channel_handler.h @@ -49,7 +49,7 @@ public: * @param name Name asked * @return if the channel is for a valid conversation and device not banned */ - bool onRequest(const DeviceId& deviceId, const std::string& name) override; + bool onRequest(const std::shared_ptr<dht::crypto::Certificate>& peer, const std::string& name) override; /** * Launch sync process @@ -57,7 +57,7 @@ public: * @param name Name asked * @param channel Channel used to sync */ - void onReady(const DeviceId& deviceId, + void onReady(const std::shared_ptr<dht::crypto::Certificate>& peer, const std::string& name, std::shared_ptr<ChannelSocket> channel) override; diff --git a/src/jamidht/transfer_channel_handler.cpp b/src/jamidht/transfer_channel_handler.cpp index 824f308ef43364876a3137730a673daf075f2f80..f126270c540dbf3e8c640e7bc920cd3e9f366b17 100644 --- a/src/jamidht/transfer_channel_handler.cpp +++ b/src/jamidht/transfer_channel_handler.cpp @@ -45,10 +45,9 @@ TransferChannelHandler::connect(const DeviceId& deviceId, {} bool -TransferChannelHandler::onRequest(const DeviceId& deviceId, const std::string& name) +TransferChannelHandler::onRequest(const std::shared_ptr<dht::crypto::Certificate>& cert, const std::string& name) { auto acc = account_.lock(); - auto cert = tls::CertificateStore::instance().getCertificate(deviceId.toString()); if (!acc || !cert || !cert->issuer) return false; auto uri = cert->issuer->getId().toString(); @@ -83,7 +82,7 @@ TransferChannelHandler::onRequest(const DeviceId& deviceId, const std::string& n } void -TransferChannelHandler::onReady(const DeviceId&, +TransferChannelHandler::onReady(const std::shared_ptr<dht::crypto::Certificate>&, const std::string& name, std::shared_ptr<ChannelSocket> channel) { diff --git a/src/jamidht/transfer_channel_handler.h b/src/jamidht/transfer_channel_handler.h index 62c777ef896c902d4aeb55fe6ef024825098d5a9..0776e22081937af8f786f201d0a086bee9f56fbb 100644 --- a/src/jamidht/transfer_channel_handler.h +++ b/src/jamidht/transfer_channel_handler.h @@ -50,7 +50,7 @@ public: * @param name name asked * @return if we accept or not */ - bool onRequest(const DeviceId& deviceId, const std::string& name) override; + bool onRequest(const std::shared_ptr<dht::crypto::Certificate>& peer, const std::string& name) override; /** * Handle socket ready @@ -58,7 +58,7 @@ public: * @param name Name of the handler * @param channel Channel to handle */ - void onReady(const DeviceId& deviceId, + void onReady(const std::shared_ptr<dht::crypto::Certificate>& peer, const std::string& name, std::shared_ptr<ChannelSocket> channel) override; diff --git a/test/unitTest/connectionManager/connectionManager.cpp b/test/unitTest/connectionManager/connectionManager.cpp index 6c5a52496772bbc052b94981c65f3cc7c8663cae..25871b5f5b50e533b44a8f25245ee0ea745e70fd 100644 --- a/test/unitTest/connectionManager/connectionManager.cpp +++ b/test/unitTest/connectionManager/connectionManager.cpp @@ -131,7 +131,8 @@ ConnectionManagerTest::testConnectDevice() bool successfullyReceive = false; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive, &cvReceive](const DeviceId&, const std::string& name) { + [&successfullyReceive, &cvReceive](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string& name) { successfullyReceive = name == "git://*"; cvReceive.notify_one(); return true; @@ -169,7 +170,8 @@ ConnectionManagerTest::testAcceptConnection() bool receiverConnected = false; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string& name) { + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string& name) { successfullyReceive = name == "git://*"; return true; }); @@ -214,7 +216,7 @@ ConnectionManagerTest::testMultipleChannels() int receiverConnected = 0; bobAccount->connectionManager().onChannelRequest( - [](const DeviceId&, const std::string&) { return true; }); + [](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { return true; }); bobAccount->connectionManager().onConnectionReady( [&receiverConnected](const DeviceId&, @@ -268,7 +270,7 @@ ConnectionManagerTest::testMultipleChannelsSameName() int receiverConnected = 0; bobAccount->connectionManager().onChannelRequest( - [](const DeviceId&, const std::string&) { return true; }); + [](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { return true; }); bobAccount->connectionManager().onConnectionReady( [&receiverConnected](const DeviceId&, @@ -325,7 +327,8 @@ ConnectionManagerTest::testSendReceiveData() bool dataOk = false, dataOk2 = false; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string&) { + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string&) { successfullyReceive = true; return true; }); @@ -399,7 +402,8 @@ ConnectionManagerTest::testDeclineConnection() bool receiverConnected = false; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string&) { + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string&) { successfullyReceive = true; return false; }); @@ -444,7 +448,7 @@ ConnectionManagerTest::testAcceptsICERequest() bool receiverConnected = false; bobAccount->connectionManager().onChannelRequest( - [](const DeviceId&, const std::string&) { return true; }); + [](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { return true; }); bobAccount->connectionManager().onICERequest([&](const DeviceId&) { successfullyReceive = true; return true; @@ -489,7 +493,7 @@ ConnectionManagerTest::testDeclineICERequest() bool receiverConnected = false; bobAccount->connectionManager().onChannelRequest( - [](const DeviceId&, const std::string&) { return true; }); + [](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { return true; }); bobAccount->connectionManager().onICERequest([&](const DeviceId&) { successfullyReceive = true; return false; @@ -537,7 +541,7 @@ ConnectionManagerTest::testChannelRcvShutdown() std::shared_ptr<ChannelSocket> bobSock; bobAccount->connectionManager().onChannelRequest( - [](const DeviceId&, const std::string&) { return true; }); + [](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { return true; }); bobAccount->connectionManager().onConnectionReady( [&](const DeviceId& did, const std::string& name, std::shared_ptr<ChannelSocket> socket) { @@ -587,7 +591,8 @@ ConnectionManagerTest::testChannelSenderShutdown() bool shutdownReceived = false; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string& name) { + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string& name) { successfullyReceive = name == "git://*"; return true; }); @@ -641,7 +646,8 @@ ConnectionManagerTest::testCloseConnectionWithDevice() bool receiverConnected = false; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string& name) { + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string& name) { successfullyReceive = name == "git://*"; return true; }); @@ -698,7 +704,8 @@ ConnectionManagerTest::testShutdownCallbacks() bool receiverConnected = false; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive, &chan2cv](const DeviceId&, const std::string& name) { + [&successfullyReceive, &chan2cv](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string& name) { if (name == "1") { successfullyReceive = true; } else { @@ -760,7 +767,8 @@ ConnectionManagerTest::testFloodSocket() bool receiverConnected = false; std::shared_ptr<ChannelSocket> rcvSock1, rcvSock2, rcvSock3, sendSock, sendSock2, sendSock3; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string& name) { + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string& name) { successfullyReceive = name == "1"; return true; }); @@ -866,7 +874,8 @@ ConnectionManagerTest::testDestroyWhileSending() bool receiverConnected = false; std::shared_ptr<ChannelSocket> rcvSock1, rcvSock2, rcvSock3, sendSock, sendSock2, sendSock3; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string& name) { + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string& name) { successfullyReceive = name == "1"; return true; }); @@ -957,12 +966,13 @@ ConnectionManagerTest::testIsConnecting() std::condition_variable cv; bool successfullyConnected = false, successfullyReceive = false; - bobAccount->connectionManager().onChannelRequest([&](const DeviceId&, const std::string&) { - successfullyReceive = true; - cv.notify_one(); - std::this_thread::sleep_for(std::chrono::seconds(2)); - return true; - }); + bobAccount->connectionManager().onChannelRequest( + [&](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { + successfullyReceive = true; + cv.notify_one(); + std::this_thread::sleep_for(std::chrono::seconds(2)); + return true; + }); CPPUNIT_ASSERT(!aliceAccount->connectionManager().isConnecting(bobDeviceId, "sip")); aliceAccount->connectionManager().connectDevice(bobDeviceId, @@ -1000,7 +1010,7 @@ ConnectionManagerTest::testCanSendBeacon() std::shared_ptr<MultiplexedSocket> aliceSocket, bobSocket; bobAccount->connectionManager().onChannelRequest( - [&](const DeviceId&, const std::string&) { return true; }); + [&](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { return true; }); bobAccount->connectionManager().onConnectionReady( [&](const DeviceId&, const std::string&, std::shared_ptr<ChannelSocket> socket) { if (socket && socket->name() == "sip") @@ -1042,7 +1052,7 @@ ConnectionManagerTest::testCannotSendBeacon() std::shared_ptr<MultiplexedSocket> aliceSocket, bobSocket; bobAccount->connectionManager().onChannelRequest( - [&](const DeviceId&, const std::string&) { return true; }); + [&](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { return true; }); bobAccount->connectionManager().onConnectionReady( [&](const DeviceId&, const std::string&, std::shared_ptr<ChannelSocket> socket) { if (socket && socket->name() == "sip") @@ -1092,7 +1102,7 @@ ConnectionManagerTest::testConnectivityChangeTriggerBeacon() std::shared_ptr<MultiplexedSocket> aliceSocket, bobSocket; bobAccount->connectionManager().onChannelRequest( - [&](const DeviceId&, const std::string&) { return true; }); + [&](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { return true; }); bobAccount->connectionManager().onConnectionReady( [&](const DeviceId&, const std::string&, std::shared_ptr<ChannelSocket> socket) { if (socket && socket->name() == "sip") @@ -1141,7 +1151,7 @@ ConnectionManagerTest::testOnNoBeaconTriggersShutdown() std::shared_ptr<MultiplexedSocket> aliceSocket, bobSocket; bobAccount->connectionManager().onChannelRequest( - [&](const DeviceId&, const std::string&) { return true; }); + [&](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { return true; }); bobAccount->connectionManager().onConnectionReady( [&](const DeviceId&, const std::string&, std::shared_ptr<ChannelSocket> socket) { if (socket && socket->name() == "sip") diff --git a/test/unitTest/conversation/compability.cpp b/test/unitTest/conversation/compability.cpp index cbc55dbe622b9747c79285dadf39253be0dc9249..2a408751835181b67540ac8ba0ee497bc03080eb 100644 --- a/test/unitTest/conversation/compability.cpp +++ b/test/unitTest/conversation/compability.cpp @@ -343,11 +343,12 @@ CompabilityTest::testSendFileCompatibility() } cv.notify_one(); })); - bobAccount->connectionManager().onChannelRequest([&](const DeviceId&, const std::string& name) { - successfullyReceive = name.find("file://") == 0; - cv.notify_one(); - return true; - }); + bobAccount->connectionManager().onChannelRequest( + [&](const std::shared_ptr<dht::crypto::Certificate>&, const std::string& name) { + successfullyReceive = name.find("file://") == 0; + cv.notify_one(); + return true; + }); DRing::registerSignalHandlers(confHandlers); aliceAccount->sendTrustRequest(bobUri, {}); CPPUNIT_ASSERT(cv.wait_for(lk, std::chrono::seconds(5), [&]() { return !convId.empty(); })); diff --git a/test/unitTest/conversationRepository/conversationRepository.cpp b/test/unitTest/conversationRepository/conversationRepository.cpp index b688cbe0c125fd65c0796ccd1457b625ba839f3b..b260de84699d102b87376e8a5a5a719c0e7ede35 100644 --- a/test/unitTest/conversationRepository/conversationRepository.cpp +++ b/test/unitTest/conversationRepository/conversationRepository.cpp @@ -206,13 +206,15 @@ ConversationRepositoryTest::testCloneViaChannelSocket() std::shared_ptr<ChannelSocket> sendSocket = nullptr; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string& name) { + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string& name) { successfullyReceive = name == "git://*"; return true; }); aliceAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string&) { return true; }); + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, + const std::string&) { return true; }); bobAccount->connectionManager().onConnectionReady( [&](const DeviceId&, const std::string& name, std::shared_ptr<ChannelSocket> socket) { @@ -387,14 +389,15 @@ ConversationRepositoryTest::testFetch() std::shared_ptr<ChannelSocket> channelSocket = nullptr; std::shared_ptr<ChannelSocket> sendSocket = nullptr; - bobAccount->connectionManager().onChannelRequest([&](const DeviceId&, const std::string& name) { - successfullyReceive = name == "git://*"; - ccv.notify_one(); - return true; - }); + bobAccount->connectionManager().onChannelRequest( + [&](const std::shared_ptr<dht::crypto::Certificate>&, const std::string& name) { + successfullyReceive = name == "git://*"; + ccv.notify_one(); + return true; + }); aliceAccount->connectionManager().onChannelRequest( - [&](const DeviceId&, const std::string&) { return true; }); + [&](const std::shared_ptr<dht::crypto::Certificate>&, const std::string&) { return true; }); bobAccount->connectionManager().onConnectionReady( [&](const DeviceId&, const std::string& name, std::shared_ptr<ChannelSocket> socket) { @@ -789,13 +792,13 @@ DIR_SEPARATOR_STR + bobAccount->getAccountID() std::shared_ptr<ChannelSocket> sendSocket = nullptr; bobAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string& name) { - successfullyReceive = name == "git://*"; - return true; + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, const std::string& +name) { successfullyReceive = name == "git://*"; return true; }); aliceAccount->connectionManager().onChannelRequest( - [&successfullyReceive](const DeviceId&, const std::string& name) { return true; }); + [&successfullyReceive](const std::shared_ptr<dht::crypto::Certificate>&, const std::string& +name) { return true; }); bobAccount->connectionManager().onConnectionReady( [&](const DeviceId&, const std::string& name, std::shared_ptr<ChannelSocket> socket) {