Merge pull request #5068 from filecoin-project/zen/ledger-sign-print

Ledger signature verification
This commit is contained in:
Łukasz Magiera 2020-12-01 09:59:36 +01:00 committed by GitHub
commit 2be9836196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
ledgerfil "github.com/whyrusleeping/ledger-filecoin-go" ledgerfil "github.com/whyrusleeping/ledger-filecoin-go"
@ -242,13 +243,16 @@ var ledgerSignTestCmd = &cli.Command{
if err != nil { if err != nil {
return err return err
} }
fmt.Printf("Message: %x\n", b.RawData())
sig, err := fl.SignSECP256K1(p, b.RawData()) sig, err := fl.SignSECP256K1(p, b.RawData())
if err != nil { if err != nil {
return err return err
} }
fmt.Println(sig.SignatureBytes()) sigBytes := append([]byte{byte(crypto.SigTypeSecp256k1)}, sig.SignatureBytes()...)
fmt.Printf("Signature: %x\n", sigBytes)
return nil return nil
}, },