Add shared hex normalization for comment flows

This commit is contained in:
thePR0M3TH3AN committed 2025-12-12 13:42:15 -05:00
1 parent af8a5828dd
commit 735d67313c
6 files changed
+102 -89

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
export function normalizeHexString(value) {
if (typeof value !== "string") {
return "";
}
const trimmed = value.trim();
return trimmed ? trimmed.toLowerCase() : "";
}
export const normalizeHexId = normalizeHexString;
export const normalizeHexPubkey = normalizeHexString;
+2 -1
View File
@@ -2,6 +2,7 @@
import { pointerArrayToKey } from "./pointer.js";
import { devLogger } from "./logger.js";
import { normalizeHexPubkey } from "./hex.js";
const DEFAULT_VIDEO_KIND = 30078;
@@ -84,7 +85,7 @@ export function buildVideoAddressPointer(
return "";
}
const pubkey = typeof video.pubkey === "string" ? video.pubkey.trim() : "";
const pubkey = normalizeHexPubkey(video.pubkey);
if (!pubkey) {
return "";
}