Skip to content

Commit

Permalink
Upgrage ledger-cosmos-go to v0.13.2 (from v0.11.1)
Browse files Browse the repository at this point in the history
This is support for Ledger HW wallets on macOS Ventura v13.6 with
Xcode v15.0.1 and command-line tools v15.0.0.0.1.1694021235.
  • Loading branch information
pbukva committed Oct 24, 2023
1 parent 5c32260 commit d01ce56
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 45 deletions.
35 changes: 34 additions & 1 deletion crypto/ledger/ledger_real.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,39 @@
package ledger

import ledger "github.com/cosmos/ledger-cosmos-go"
import "errors"

type MyLedgerDevice struct {
ledger *ledger.LedgerCosmos
}

func (d *MyLedgerDevice) Close() error {
return d.ledger.Close()
}

func (d *MyLedgerDevice) GetPublicKeySECP256K1(bip32Path []uint32) ([]byte, error) {
return d.ledger.GetPublicKeySECP256K1(bip32Path)
}

func (d *MyLedgerDevice) GetAddressPubKeySECP256K1(bip32Path []uint32, hrp string) ([]byte, string, error) {
return d.ledger.GetAddressPubKeySECP256K1(bip32Path, hrp)
}

//func (d *MyLedgerDevice) SignSECP256K1(bip32Path []uint32, transaction []byte, p2 byte) ([]byte, error) {
// return d.ledger.SignSECP256K1(bip32Path, transaction, p2)
//}

func (d *MyLedgerDevice) SignSECP256K1(bip32Path []uint32, transaction []byte) ([]byte, error) {
ver, err := d.ledger.GetVersion()
if err != nil {
return nil, err
}

if ver.Major != 1 {
return nil, errors.New("App version is not supported")
}
return d.ledger.SignSECP256K1(bip32Path, transaction, 0)
}

// If ledger support (build tag) has been enabled, which implies a CGO dependency,
// set the discoverLedger function which is responsible for loading the Ledger
Expand All @@ -15,6 +48,6 @@ func init() {
return nil, err
}

return device, nil
return &MyLedgerDevice{device}, nil
}
}
33 changes: 17 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/gogo/gateway v1.1.0
github.com/gogo/protobuf v1.3.3
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/golang/protobuf v1.5.3
github.com/golangci/golangci-lint v1.48.0
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
Expand All @@ -39,17 +39,17 @@ require (
github.com/spf13/cobra v1.5.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.12.0
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.1
github.com/tendermint/btcd v0.1.1
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
github.com/tendermint/go-amino v0.16.0
github.com/tendermint/tendermint v0.34.21
github.com/tendermint/tm-db v0.6.6
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
golang.org/x/crypto v0.14.0
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b
google.golang.org/grpc v1.48.0
google.golang.org/protobuf v1.28.0
google.golang.org/grpc v1.58.3
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v2 v2.4.0
)

Expand Down Expand Up @@ -81,7 +81,6 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/charithe/durationcheck v0.0.9 // indirect
github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4 // indirect
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/daixiang0/gci v0.6.2 // indirect
github.com/danieljoos/wincred v1.0.2 // indirect
Expand Down Expand Up @@ -212,7 +211,7 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.4.0 // indirect
github.com/sylvia7788/contextcheck v1.0.4 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect
Expand All @@ -227,20 +226,21 @@ require (
github.com/uudashr/gocognit v1.0.6 // indirect
github.com/yagipy/maintidx v1.0.0 // indirect
github.com/yeya24/promlinter v0.2.0 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
gitlab.com/bosi/decorder v0.2.3 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.0.0-20220726230323-06994584191e // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.0.0-20220727055044-e65921a090b8 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.6.0 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/tools v0.3.3 // indirect
Expand All @@ -258,7 +258,8 @@ replace (
github.com/confio/ics23/go => ./ics23

// This is to add support for Ledger Nano S-Plus:
github.com/cosmos/ledger-go => github.com/cosmos/ledger-go v0.9.3
//github.com/cosmos/ledger-go => github.com/cosmos/ledger-go v0.9.3
github.com/cosmos/ledger-cosmos-go => github.com/cosmos/ledger-cosmos-go v0.13.2

// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
Expand Down
Loading

0 comments on commit d01ce56

Please sign in to comment.