aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/event.cpp6
-rw-r--r--src/nostr_service.cpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/event.cpp b/src/event.cpp
index 4ba87d2..a24a594 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -13,13 +13,14 @@ using std::hex;
using std::invalid_argument;
using std::setw;
using std::setfill;
+using std::shared_ptr;
using std::string;
using std::stringstream;
using std::time;
namespace nostr
{
-string Event::serialize()
+string Event::serialize(shared_ptr<ISigner> signer)
{
try
{
@@ -40,8 +41,7 @@ string Event::serialize()
};
j["id"] = this->generateId(j.dump());
-
- // TODO: Reach out to a signer to sign the event, then set the signature.
+ j["sig"] = signer->generateSignature(shared_ptr<Event>(this));
json jarr = json::array({ "EVENT", j });
diff --git a/src/nostr_service.cpp b/src/nostr_service.cpp
index 0409a0d..7efc11e 100644
--- a/src/nostr_service.cpp
+++ b/src/nostr_service.cpp
@@ -129,7 +129,7 @@ tuple<RelayList, RelayList> NostrService::publishEvent(Event event)
for (const string& relay : this->_activeRelays)
{
future<tuple<string, bool>> publishFuture = async([this, &relay, &event]() {
- return this->_client->send(event.serialize(), relay);
+ return this->_client->send(event.serialize(this->_signer), relay);
});
publishFutures.push_back(move(publishFuture));