From d3fb25441ab3c4d709d67b3d4bb322d344c205cb Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 20 May 2025 23:21:39 -0300 Subject: [PATCH] nip19: EncodeNsec should not return an error. --- nip19/nip19.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nip19/nip19.go b/nip19/nip19.go index 50c9969..84e7d81 100644 --- a/nip19/nip19.go +++ b/nip19/nip19.go @@ -139,13 +139,10 @@ func Decode(bech32string string) (prefix string, value any, err error) { return prefix, data, fmt.Errorf("unknown tag %s", prefix) } -func EncodeNsec(sk [32]byte) (string, error) { - bits5, err := bech32.ConvertBits(sk[:], 8, 5, true) - if err != nil { - return "", err - } - - return bech32.Encode("nsec", bits5) +func EncodeNsec(sk [32]byte) string { + bits5, _ := bech32.ConvertBits(sk[:], 8, 5, true) + nsec, _ := bech32.Encode("nsec", bits5) + return nsec } func EncodeNpub(pk nostr.PubKey) string {