Re: #1290: Add a lotus wallet verify API and CLI command

- The command takes an address, message, and signature, and returns true if the sig is valid
This commit is contained in:
Aayush Rajasekaran
2020-02-28 15:56:15 -08:00
parent f6bda96d5a
commit fe8db295e7
6 changed files with 82 additions and 1 deletions
+5
View File
@@ -2,6 +2,7 @@ package full
import (
"context"
"github.com/filecoin-project/lotus/lib/sigs"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/stmgr"
@@ -53,6 +54,10 @@ func (a *WalletAPI) WalletSignMessage(ctx context.Context, k address.Address, ms
}, nil
}
func (a *WalletAPI) WalletVerify(ctx context.Context, k address.Address, msg []byte, sig *types.Signature) bool {
return sigs.Verify(sig, k, msg) == nil
}
func (a *WalletAPI) WalletDefaultAddress(ctx context.Context) (address.Address, error) {
return a.Wallet.GetDefault()
}