From fdd253063549139383387844e13eb72947eaa610 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Fri, 8 Aug 2025 12:53:24 -0400 Subject: [PATCH] Enable padding in hex_to_bech32 --- src/nostr/coincurve_keys.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nostr/coincurve_keys.py b/src/nostr/coincurve_keys.py index 99604ac..053059f 100644 --- a/src/nostr/coincurve_keys.py +++ b/src/nostr/coincurve_keys.py @@ -27,7 +27,8 @@ class Keys: @staticmethod def hex_to_bech32(key_str: str, prefix: str = "npub") -> str: - data = convertbits(bytes.fromhex(key_str), 8, 5) + # Pad to align with 5-bit groups as expected for Bech32 encoding + data = convertbits(bytes.fromhex(key_str), 8, 5, True) return bech32_encode(prefix, data) @staticmethod