mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-06-22 14:51:55 +02:00
nip19: fix decoding faulty kind from tlv.
This commit is contained in:
parent
51e527680e
commit
cd145f4fcb
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user