test all bech32encoding and fix bugs

This commit is contained in:
2025-06-26 15:17:17 +01:00
parent ed1ca7e3e3
commit 2b2408cbc6
6 changed files with 310 additions and 3 deletions

View File

@@ -157,8 +157,8 @@ func Decode(bech32string []byte) (prefix []byte, value any, err error) {
// EncodeNote encodes a standard nostr NIP-19 note entity (mostly meaning a
// nostr kind 1 short text note)
func EncodeNote(eventIDHex []byte) (s []byte, err error) {
var b []byte
if _, err = hex.DecBytes(b, eventIDHex); chk.D(err) {
b, err := hex.Dec(string(eventIDHex))
if chk.D(err) {
err = log.E.Err("failed to decode event id hex: %w", err)
return
}