nip19: fix decoding faulty kind from tlv.

This commit is contained in:
fiatjaf 2024-09-05 14:21:54 -03:00
parent 51e527680e
commit cd145f4fcb

View File

@ -84,7 +84,11 @@ func Decode(bech32string string) (prefix string, value any, err error) {
}
result.Author = hex.EncodeToString(v)
case TLVKind:
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
}