mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2026-07-30 19:26:14 +00:00
check length on isHex32().
fixes https://github.com/nbd-wtf/nostr-tools/issues/540
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user