From f9f3a34ccc3beb165e9106696035e710113043df Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 2 Dec 2023 15:31:26 -0300 Subject: [PATCH] nip46: fix variable name (was using the shared key as the secret key.) --- nip46/signer.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/nip46/signer.go b/nip46/signer.go index 06edd69..359aca6 100644 --- a/nip46/signer.go +++ b/nip46/signer.go @@ -1,7 +1,6 @@ package nip46 import ( - "encoding/hex" "encoding/json" "fmt" @@ -68,10 +67,6 @@ func (s Session) MakeResponse( evt.Kind = nostr.KindNostrConnect evt.Tags = nostr.Tags{nostr.Tag{"p", requester}} - err = evt.Sign(hex.EncodeToString(s.SharedKey)) - if err != nil { - return resp, evt, err - } return resp, evt, nil } @@ -227,5 +222,14 @@ func (p *Signer) HandleRequest(event *nostr.Event) (req Request, resp Response, } resp, eventResponse, err = session.MakeResponse(req.ID, event.PubKey, result, resultErr) + if err != nil { + return req, resp, eventResponse, harmless, err + } + + err = eventResponse.Sign(p.secretKey) + if err != nil { + return req, resp, eventResponse, harmless, err + } + return req, resp, eventResponse, harmless, err }