From 7379263fefadb8604c225170a93e5a3f29dc8077 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sat, 9 Nov 2019 18:34:34 +0000 Subject: [PATCH] extended signature in cli --- .../groovy/com/muwire/clilanterna/SearchModel.groovy | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cli-lanterna/src/main/groovy/com/muwire/clilanterna/SearchModel.groovy b/cli-lanterna/src/main/groovy/com/muwire/clilanterna/SearchModel.groovy index 573a82ad..8279ffbc 100644 --- a/cli-lanterna/src/main/groovy/com/muwire/clilanterna/SearchModel.groovy +++ b/cli-lanterna/src/main/groovy/com/muwire/clilanterna/SearchModel.groovy @@ -7,6 +7,7 @@ import com.muwire.core.search.QueryEvent import com.muwire.core.search.SearchEvent import com.muwire.core.search.UIResultBatchEvent import com.muwire.core.search.UIResultEvent +import com.muwire.core.util.DataUtil import net.i2p.crypto.DSAEngine import net.i2p.data.Base64 @@ -45,13 +46,16 @@ class SearchModel { def searchEvent byte [] payload + UUID uuid = UUID.randomUUID() + long timestamp = System.currentTimeMillis() + byte [] sig2 = DataUtil.signUUID(uuid, timestamp, core.spk) if (hashSearch) { - searchEvent = new SearchEvent(searchHash : root, uuid : UUID.randomUUID(), oobInfohash : true, compressedResults : true) + searchEvent = new SearchEvent(searchHash : root, uuid : uuid, oobInfohash : true, compressedResults : true) payload = root } else { def nonEmpty = SplitPattern.termify(query) payload = String.join(" ", nonEmpty).getBytes(StandardCharsets.UTF_8) - searchEvent = new SearchEvent(searchTerms : nonEmpty, uuid : UUID.randomUUID(), oobInfohash: true, + searchEvent = new SearchEvent(searchTerms : nonEmpty, uuid : uuid, oobInfohash: true, searchComments : core.muOptions.searchComments, compressedResults : true) } @@ -61,7 +65,7 @@ class SearchModel { core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : firstHop, replyTo: core.me.destination, receivedOn: core.me.destination, - originator : core.me, sig: sig.data)) + originator : core.me, sig: sig.data, queryTime : timestamp, sig2 : sig2)) } void unregister() {