Skip to content

Commit

Permalink
fix(wallet_test): SignMessage test
Browse files Browse the repository at this point in the history
  • Loading branch information
ZigBalthazar committed Jul 4, 2024
1 parent 986b7bf commit 1a77d54
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions wallet/wallet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"

"github.com/pactus-project/pactus/crypto"
"github.com/pactus-project/pactus/crypto/bls"
"github.com/pactus-project/pactus/genesis"
"github.com/pactus-project/pactus/state"
"github.com/pactus-project/pactus/types/account"
Expand Down Expand Up @@ -575,11 +576,16 @@ func TestSignMessage(t *testing.T) {
defer td.Close()

msg := "pactus"
prvStr := "SECRET1PDRWTLP5PX0FAHDX39GXZJP7FKZFALML0D5U9TT9KVQHDUC99CMGQQJVK67"
sigStr := "923d67a8624cbb7972b29328e15ec76cc846076ccf00a9e94d991c677846f334ae4ba4551396fbcd6d1cab7593baf3b7"

senderInfo, _ := td.wallet.NewBLSAccountAddress("testing addr")
prv, err := bls.PrivateKeyFromString(prvStr)
assert.NoError(t, err)

err = td.wallet.ImportPrivateKey("", prv)
assert.NoError(t, err)

sig, err := td.wallet.SignMessage(msg, td.password, senderInfo.Address)
sig, err := td.wallet.SignMessage(msg, td.password, td.wallet.AllAccountAddresses()[0].Address)
assert.NoError(t, err)
assert.Equal(t, sig, sigStr)
}

0 comments on commit 1a77d54

Please sign in to comment.