nip49: fix secret key return values.

This commit is contained in:
fiatjaf
2025-04-21 18:09:44 -03:00
parent bf436be0f7
commit b92e70270d

View File

@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"math" "math"
"fiatjaf.com/nostr"
"github.com/btcsuite/btcd/btcutil/bech32" "github.com/btcsuite/btcd/btcutil/bech32"
"golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/chacha20poly1305"
"golang.org/x/crypto/scrypt" "golang.org/x/crypto/scrypt"
@@ -54,9 +55,9 @@ func Encrypt(secretKey [32]byte, password string, logn uint8, ksb KeySecurityByt
return bech32.Encode("ncryptsec", bits5) return bech32.Encode("ncryptsec", bits5)
} }
func Decrypt(bech32string string, password string) (secretKey [32]byte, err error) { func Decrypt(bech32string string, password string) (secretKey nostr.SecretKey, err error) {
secb, err := DecryptToBytes(bech32string, password) secb, err := DecryptToBytes(bech32string, password)
return [32]byte(secb), err return nostr.SecretKey(secb), err
} }
func DecryptToBytes(bech32string string, password string) (secretKey []byte, err error) { func DecryptToBytes(bech32string string, password string) (secretKey []byte, err error) {