mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-07-28 20:22:12 +02:00
nip19: fix decoding faulty kind from tlv.
This commit is contained in:
@@ -84,7 +84,11 @@ func Decode(bech32string string) (prefix string, value any, err error) {
|
||||
}
|
||||
result.Author = hex.EncodeToString(v)
|
||||
case TLVKind:
|
||||
result.Kind = int(binary.BigEndian.Uint32(v))
|
||||
if len(v) == 4 {
|
||||
result.Kind = int(binary.BigEndian.Uint32(v))
|
||||
} else {
|
||||
return prefix, nil, fmt.Errorf("invalid uint32 value for integer (%v)", v)
|
||||
}
|
||||
default:
|
||||
// ignore
|
||||
}
|
||||
|
Reference in New Issue
Block a user