// npub format - decode to hex if (trimmed.startsWith("npub1")) { const decoded = nip19.decode(trimmed); if (decoded.type !== "npub") { thrownew Error("Invalid npub key");
} // Convert Uint8Array to hex string return Array.from(decoded.data as unknown as Uint8Array)
.map((b) => b.toString(16).padStart(2, "0"))
.join("");
}
// Already hex - validate and return lowercase if (!/^[0-9a-fA-F]{64}$/.test(trimmed)) { thrownew Error("Pubkey must be 64 hex characters or npub format");
} return trimmed.toLowerCase();
}
/** *Convertahexpubkeytonpubformat
*/
export function pubkeyToNpub(hexPubkey: string): string { const normalized = normalizePubkey(hexPubkey); // npubEncode expects a hex string, not Uint8Array return nip19.npubEncode(normalized);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet am 2026-06-09)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.