diff --git a/nip46/client.go b/nip46/client.go index 202224b..dc8e012 100644 --- a/nip46/client.go +++ b/nip46/client.go @@ -30,6 +30,9 @@ type BunkerClient struct { // memoized getPublicKeyResponse string + + // SkipSignatureCheck can be set if you don't want to double-check incoming signatures + SkipSignatureCheck bool } // ConnectBunker establishes an RPC connection to a NIP-46 signer using the relays and secret provided in the bunkerURL. @@ -178,6 +181,15 @@ func (bunker *BunkerClient) SignEvent(ctx context.Context, evt *nostr.Event) err if err == nil { err = easyjson.Unmarshal([]byte(resp), evt) } + + if !bunker.SkipSignatureCheck { + if ok := evt.CheckID(); !ok { + return fmt.Errorf("sign_event response from bunker has invalid id") + } + if ok, _ := evt.CheckSignature(); !ok { + return fmt.Errorf("sign_event response from bunker has invalid signature") + } + } return err }