Browse Source

Fix testcases, all looks OK

pull/1782/head
Christopher Goes 7 years ago
parent
commit
e25a64fdf1
2 changed files with 7 additions and 4 deletions
  1. +6
    -3
      ledger.go
  2. +1
    -1
      signature.go

+ 6
- 3
ledger.go View File

@ -3,7 +3,7 @@ package crypto
import (
"github.com/pkg/errors"
// secp256k1 "github.com/btcsuite/btcd/btcec"
secp256k1 "github.com/btcsuite/btcd/btcec"
ledger "github.com/zondax/ledger-goclient"
)
@ -23,13 +23,16 @@ func signLedger(device *ledger.Ledger, msg []byte) (pub PubKey, sig Signature, e
if err != nil {
return pub, sig, err
}
sig = SignatureSecp256k1FromBytes(bsig)
key, err := device.GetPublicKey()
if err != nil {
return pub, sig, err
}
var p PubKeySecp256k1
copy(p[:], key)
return p, SignatureSecp256k1FromBytes(bsig), nil
// Reserialize in the 33-byte compressed format
cmp, err := secp256k1.ParsePubKey(key[:], secp256k1.S256())
copy(p[:], cmp.SerializeCompressed())
return p, sig, nil
}
// PrivKeyLedgerSecp256k1 implements PrivKey, calling the ledger nano


+ 1
- 1
signature.go View File

@ -81,7 +81,7 @@ func (sig SignatureSecp256k1) Equals(other Signature) bool {
}
func SignatureSecp256k1FromBytes(data []byte) Signature {
var sig SignatureSecp256k1
sig := make(SignatureSecp256k1, len(data))
copy(sig[:], data)
return sig
}

Loading…
Cancel
Save