diff --git a/cmd/zetaclientd/hsm.go b/cmd/zetaclientd/hsm.go index 045d516769..d15ac3b1bd 100644 --- a/cmd/zetaclientd/hsm.go +++ b/cmd/zetaclientd/hsm.go @@ -2,13 +2,13 @@ package main import ( "fmt" - "github.com/zeta-chain/zetacore/zetaclient/hsm" "github.com/pkg/errors" "github.com/spf13/cobra" keystone "github.com/zeta-chain/keystone/keys" "github.com/zeta-chain/zetacore/cmd" "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/zetaclient/hsm" ) var HsmCmd = &cobra.Command{ diff --git a/zetaclient/broadcast.go b/zetaclient/broadcast.go index 84ac896cce..d69c6c2778 100644 --- a/zetaclient/broadcast.go +++ b/zetaclient/broadcast.go @@ -2,11 +2,12 @@ package zetaclient import ( "fmt" - "github.com/zeta-chain/zetacore/zetaclient/hsm" "regexp" "strconv" "strings" + "github.com/zeta-chain/zetacore/zetaclient/hsm" + "github.com/cosmos/cosmos-sdk/client" clienttx "github.com/cosmos/cosmos-sdk/client/tx" sdktypes "github.com/cosmos/cosmos-sdk/types" diff --git a/zetaclient/hsm/hsm_signer.go b/zetaclient/hsm/hsm_signer.go index 756c8fab08..06cb9e092b 100644 --- a/zetaclient/hsm/hsm_signer.go +++ b/zetaclient/hsm/hsm_signer.go @@ -18,8 +18,8 @@ const hsmPath = "HSM_PATH" const hsmPIN = "HSM_PIN" const hsmLabel = "HSM_LABEL" -// HsmSign Generates signature of msg using the key indexed by the label through the HSM defined in the config -func HsmSign(config *crypto11.Config, msg []byte, label string) (signature []byte, err error) { +// Sign Generates signature of msg using the key indexed by the label through the HSM defined in the config +func Sign(config *crypto11.Config, msg []byte, label string) (signature []byte, err error) { keyring, err := keystone.NewPkcs11(config) if err != nil { return @@ -131,7 +131,7 @@ func SignWithHSM( } // Sign those bytes - sigBytes, err := HsmSign(hsmCfg, bytesToSign, name) + sigBytes, err := Sign(hsmCfg, bytesToSign, name) if err != nil { return err } diff --git a/zetaclient/hsm/hsm_signer_test.go b/zetaclient/hsm/hsm_signer_test.go index 2ac44f770c..5c7ba38099 100644 --- a/zetaclient/hsm/hsm_signer_test.go +++ b/zetaclient/hsm/hsm_signer_test.go @@ -36,7 +36,7 @@ func TestSignSecp256k1(t *testing.T) { //Create sample message msg := []byte("Signing this plaintext tells me what exactly?") - signature, err := HsmSign(config, msg, string(label)) + signature, err := Sign(config, msg, string(label)) require.NoError(t, err) require.NotNil(t, signature) require.Equal(t, key.KeyType(), keystone.KEYGEN_SECP256K1)