mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 13:05:09 +00:00
Unify local and external keys in keybase interface (#117)
* Return errors on priv.Sign(), priv.PubKey() * Add CreateLedger, CreateOffline * Add switch on .Sign() for Ledger wallets * Add offline signing switch on .Sign() * Use MustUnmarshalBinaryBare() * Add confirmation to delete offline/Ledger keys * Lowercase error message * Add human-readable .GetType() function to Info interface * Rename CryptoAlgo => SignAlgo * assert.Nil(t, err) => assert.NoError(t, err)
This commit is contained in:
committed by
Ismail Khoffi
parent
f6c960c3d3
commit
c21f67c5af
@@ -12,10 +12,12 @@ import (
|
||||
func TestSignAndValidateEd25519(t *testing.T) {
|
||||
|
||||
privKey := GenPrivKeyEd25519()
|
||||
pubKey := privKey.PubKey()
|
||||
pubKey, err := privKey.PubKey()
|
||||
require.Nil(t, err)
|
||||
|
||||
msg := CRandBytes(128)
|
||||
sig := privKey.Sign(msg)
|
||||
sig, err := privKey.Sign(msg)
|
||||
require.Nil(t, err)
|
||||
|
||||
// Test the signature
|
||||
assert.True(t, pubKey.VerifyBytes(msg, sig))
|
||||
@@ -30,10 +32,12 @@ func TestSignAndValidateEd25519(t *testing.T) {
|
||||
|
||||
func TestSignAndValidateSecp256k1(t *testing.T) {
|
||||
privKey := GenPrivKeySecp256k1()
|
||||
pubKey := privKey.PubKey()
|
||||
pubKey, err := privKey.PubKey()
|
||||
require.Nil(t, err)
|
||||
|
||||
msg := CRandBytes(128)
|
||||
sig := privKey.Sign(msg)
|
||||
sig, err := privKey.Sign(msg)
|
||||
require.Nil(t, err)
|
||||
|
||||
assert.True(t, pubKey.VerifyBytes(msg, sig))
|
||||
|
||||
@@ -65,10 +69,12 @@ func TestSignatureEncodings(t *testing.T) {
|
||||
|
||||
for _, tc := range cases {
|
||||
// note we embed them from the beginning....
|
||||
pubKey := tc.privKey.PubKey()
|
||||
pubKey, err := tc.privKey.PubKey()
|
||||
require.Nil(t, err)
|
||||
|
||||
msg := CRandBytes(128)
|
||||
sig := tc.privKey.Sign(msg)
|
||||
sig, err := tc.privKey.Sign(msg)
|
||||
require.Nil(t, err)
|
||||
|
||||
// store as amino
|
||||
bin, err := cdc.MarshalBinaryBare(sig)
|
||||
|
||||
Reference in New Issue
Block a user