mirror of
https://github.com/tendermint/tendermint.git
synced 2026-06-04 21:32:36 +00:00
Test ledger calls
This commit is contained in:
@@ -48,7 +48,10 @@ type PrivKeyLedger struct {
|
||||
pubKey crypto.PubKey
|
||||
}
|
||||
|
||||
var _ crypto.PrivKeyInner = &PrivKeyLedger{}
|
||||
func NewPrivKeyLedger() crypto.PrivKey {
|
||||
var pk PrivKeyLedger
|
||||
return pk.Wrap()
|
||||
}
|
||||
|
||||
// AssertIsPrivKeyInner fulfils PrivKey Interface
|
||||
func (pk *PrivKeyLedger) AssertIsPrivKeyInner() {}
|
||||
|
||||
@@ -77,5 +77,13 @@ func TestRealLedger(t *testing.T) {
|
||||
if os.Getenv("WITH_LEDGER") == "" {
|
||||
t.Skip("Set WITH_LEDGER to run code on real ledger")
|
||||
}
|
||||
// let's try for real....
|
||||
|
||||
priv := NewPrivKeyLedger()
|
||||
msg := []byte("kuhehfeohg")
|
||||
|
||||
sig := priv.Sign(msg)
|
||||
pub := priv.PubKey()
|
||||
|
||||
valid := pub.VerifyBytes(msg, sig)
|
||||
assert.True(t, valid)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user