Drop useless encoding (#110)

* drop asec private key encoding

* remove pubkey/relaykey/url encoding in common pkg

* fix pubkey encoding

* remove SecKey
This commit is contained in:
Louis Singer
2024-02-20 17:35:11 +01:00
committed by GitHub
parent ffcf08420f
commit 936f9c5f51
9 changed files with 27 additions and 471 deletions

View File

@@ -6,7 +6,6 @@ import (
"strings"
arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1"
"github.com/ark-network/ark/common"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/decred/dcrd/dcrec/secp256k1/v4"
"github.com/urfave/cli/v2"
@@ -108,16 +107,7 @@ func initWallet(ctx *cli.Context, key, password string) error {
privateKey = secp256k1.PrivKeyFromBytes(privKeyBytes)
}
cypher := NewAES128Cypher()
arkNetwork, _ := getNetwork()
publicKey, err := common.EncodePubKey(arkNetwork.PubKey, privateKey.PubKey())
if err != nil {
return err
}
encryptedPrivateKey, err := cypher.Encrypt(privateKey.Serialize(), []byte(password))
encryptedPrivateKey, err := NewAES128Cypher().Encrypt(privateKey.Serialize(), []byte(password))
if err != nil {
return err
}
@@ -127,7 +117,7 @@ func initWallet(ctx *cli.Context, key, password string) error {
state := map[string]string{
"encrypted_private_key": hex.EncodeToString(encryptedPrivateKey),
"password_hash": hex.EncodeToString(passwordHash),
"public_key": publicKey,
"public_key": hex.EncodeToString(privateKey.PubKey().SerializeCompressed()),
}
if err := setState(state); err != nil {