nip49: fix decryption error handling.

This commit is contained in:
fiatjaf
2026-01-09 22:35:53 -03:00
parent cf95381d41
commit 428cf33bc1

View File

@@ -57,7 +57,10 @@ func Encrypt(secretKey [32]byte, password string, logn uint8, ksb KeySecurityByt
func Decrypt(bech32string string, password string) (secretKey nostr.SecretKey, err error) { func Decrypt(bech32string string, password string) (secretKey nostr.SecretKey, err error) {
secb, err := DecryptToBytes(bech32string, password) secb, err := DecryptToBytes(bech32string, password)
return nostr.SecretKey(secb), err if err != nil {
return [32]byte{}, err
}
return nostr.SecretKey(secb), nil
} }
func DecryptToBytes(bech32string string, password string) (secretKey []byte, err error) { func DecryptToBytes(bech32string string, password string) (secretKey []byte, err error) {