Skip to content

Commit

Permalink
nip46: fix variable name (was using the shared key as the secret key.)
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Dec 2, 2023
1 parent 15f026d commit f9f3a34
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions nip46/signer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package nip46

import (
"encoding/hex"
"encoding/json"
"fmt"

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

0 comments on commit f9f3a34

Please sign in to comment.