check length on isHex32().

fixes https://github.com/nbd-wtf/nostr-tools/issues/540
This commit is contained in:
fiatjaf
2026-07-29 16:30:48 -03:00
parent fed4a55613
commit 5609bab1ac
+1
View File
@@ -128,6 +128,7 @@ export function mergeReverseSortedLists(list1: NostrEvent[], list2: NostrEvent[]
* Checks if a string is a 64-char lowercase hex string as most Nostr ids and pubkeys.
*/
export function isHex32(input: string): boolean {
if (input.length !== 64) return false
for (let i = 0; i < 64; i++) {
let cc = input.charCodeAt(i)
if (isNaN(cc) || cc < 48 || cc > 102 || (cc > 57 && cc < 97)) {