fix secret key hex parsing zero-filler.

This commit is contained in:
fiatjaf
2025-04-21 15:44:22 -03:00
parent aaf0740513
commit bf436be0f7

View File

@@ -31,7 +31,7 @@ func (sk SecretKey) Public() PubKey { return GetPublicKey(sk) }
func SecretKeyFromHex(skh string) (SecretKey, error) { func SecretKeyFromHex(skh string) (SecretKey, error) {
id := SecretKey{} id := SecretKey{}
if len(skh) > 64 { if len(skh) < 64 {
skh = strings.Repeat("0", 64-len(skh)) + skh skh = strings.Repeat("0", 64-len(skh)) + skh
} else if len(skh) > 64 { } else if len(skh) > 64 {
return id, fmt.Errorf("pubkey should be at most 64-char hex, got '%s'", skh) return id, fmt.Errorf("pubkey should be at most 64-char hex, got '%s'", skh)