From 88a07a35043fdb3df38e7f9d20f305121011c75f Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 5 Sep 2024 14:43:34 -0300 Subject: [PATCH] update go-nostr and nostr-sdk to fix bad nevent/naddr parsing bug. --- decode.go | 7 +++++-- go.mod | 8 ++++---- go.sum | 8 ++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/decode.go b/decode.go index 95aa1b8..dac7260 100644 --- a/decode.go +++ b/decode.go @@ -59,8 +59,11 @@ var decode = &cli.Command{ } else if pp := sdk.InputToProfile(ctx, input); pp != nil { decodeResult = DecodeResult{ProfilePointer: pp} } else if prefix, value, err := nip19.Decode(input); err == nil && prefix == "naddr" { - ep := value.(nostr.EntityPointer) - decodeResult = DecodeResult{EntityPointer: &ep} + if ep, ok := value.(nostr.EntityPointer); ok { + decodeResult = DecodeResult{EntityPointer: &ep} + } else { + ctx = lineProcessingError(ctx, "couldn't decode naddr: %s", err) + } } else if prefix, value, err := nip19.Decode(input); err == nil && prefix == "nsec" { decodeResult.PrivateKey.PrivateKey = value.(string) decodeResult.PrivateKey.PublicKey, _ = nostr.GetPublicKey(value.(string)) diff --git a/go.mod b/go.mod index 83d8374..17b4743 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/fiatjaf/nak -go 1.22 +go 1.23 -toolchain go1.22.4 +toolchain go1.23.0 require ( github.com/bep/debounce v1.2.1 @@ -15,8 +15,8 @@ require ( github.com/fiatjaf/khatru v0.7.5 github.com/mailru/easyjson v0.7.7 github.com/markusmobius/go-dateparser v1.2.3 - github.com/nbd-wtf/go-nostr v0.34.10 - github.com/nbd-wtf/nostr-sdk v0.5.0 + github.com/nbd-wtf/go-nostr v0.34.14 + github.com/nbd-wtf/nostr-sdk v0.5.3 golang.org/x/exp v0.0.0-20240707233637-46b078467d37 ) diff --git a/go.sum b/go.sum index 1347bd0..c3151aa 100644 --- a/go.sum +++ b/go.sum @@ -113,10 +113,10 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/nbd-wtf/go-nostr v0.34.10 h1:scJH45sFk5LOzHJNLw0EFTknCCKfKlo3tK+vdpTHz3Q= -github.com/nbd-wtf/go-nostr v0.34.10/go.mod h1:NZQkxl96ggbO8rvDpVjcsojJqKTPwqhP4i82O7K5DJs= -github.com/nbd-wtf/nostr-sdk v0.5.0 h1:zrMxcvMSxkw29RyfXEdF3XW5rUWLuT5Q9oBAhd5dyew= -github.com/nbd-wtf/nostr-sdk v0.5.0/go.mod h1:MJ7gYv3XiZKU6MHSM0N7oHqQAQhbvpgGQk4Q+XUdIUs= +github.com/nbd-wtf/go-nostr v0.34.14 h1:o4n2LkuAtdIjNYJ23sFbcx68UXLnji4j8hYR1Sd2wgI= +github.com/nbd-wtf/go-nostr v0.34.14/go.mod h1:NZQkxl96ggbO8rvDpVjcsojJqKTPwqhP4i82O7K5DJs= +github.com/nbd-wtf/nostr-sdk v0.5.3 h1:jaiT7xm2h3iksM96PQKlbl5zDpMuZFF3fVj8TknWoJU= +github.com/nbd-wtf/nostr-sdk v0.5.3/go.mod h1:9zlqzVbIczMHeN3fy3Ib2/fStRupTPVLvy54Htd9FCE= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=