lots of login dialog and nostr subsription relate updates

This commit is contained in:
padreug 2025-02-12 02:19:32 +01:00
parent ed1b4cb22a
commit d694f9b645
8 changed files with 323 additions and 189 deletions

View file

@ -105,4 +105,19 @@ export function npubToHex(npub: string): string {
export function hexToNpub(hex: string): string {
return window.NostrTools.nip19.npubEncode(hex)
}
export function isValidPrivateKey(key: string): boolean {
try {
if (!/^[0-9a-fA-F]{64}$/.test(key)) {
return false
}
return true
} catch {
return false
}
}
export function formatPrivateKey(key: string): string {
return key.trim().toLowerCase()
}