mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 20:24:21 +01:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user