Skip to content

Commit

Permalink
Merge branch 'protobuf'
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Aug 16, 2022
2 parents 9c5dd0d + cdeb9ef commit 4968e9a
Show file tree
Hide file tree
Showing 21 changed files with 7,719 additions and 4,216 deletions.
8 changes: 6 additions & 2 deletions README.md
Expand Up @@ -7,11 +7,15 @@ tagging versions.

Clone the [BitBox02 firmware repo](https://github.com/digitalbitbox/bitbox02-firmware):

Make sure you have `protoc` and
[protoc-gen-go](https://developers.google.com/protocol-buffers/docs/reference/go-generated)
installed:

`git clone https://github.com/digitalbitbox/bitbox02-firmware.git`

```sh
rm -rf api/firmware/messages/*
rm -rf api/firmware/messages/{*.pb.go,*.proto}
cp /path/to/bitbox02-firmware/messages/*.proto api/firmware/messages/
rm api/firmware/messages/backup.proto
go generate ./...
./api/firmware/messages/generate.sh
```
6 changes: 3 additions & 3 deletions api/firmware/btc.go
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/digitalbitbox/bitbox02-api-go/api/firmware/messages"
"github.com/digitalbitbox/bitbox02-api-go/util/errp"
"github.com/digitalbitbox/bitbox02-api-go/util/semver"
"github.com/golang/protobuf/proto"
"google.golang.org/protobuf/proto"
)

const multisigNameMaxLen = 30
Expand Down Expand Up @@ -277,7 +277,7 @@ func (device *Device) BTCSign(
switch next.Type {
case messages.BTCSignNextResponse_INPUT:
inputIndex := next.Index
input := *tx.Inputs[inputIndex].Input
input := tx.Inputs[inputIndex].Input

inputIsSchnorr := isTaproot(scriptConfigs[input.ScriptConfigIndex])

Expand All @@ -297,7 +297,7 @@ func (device *Device) BTCSign(
}
next, err = device.queryBtcSign(&messages.Request{
Request: &messages.Request_BtcSignInput{
BtcSignInput: &input,
BtcSignInput: input,
}})
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion api/firmware/btc_test.go
Expand Up @@ -20,8 +20,8 @@ import (

"github.com/digitalbitbox/bitbox02-api-go/api/firmware/messages"
"github.com/digitalbitbox/bitbox02-api-go/util/semver"
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
)

const hardenedKeyStart = 0x80000000
Expand Down
2 changes: 0 additions & 2 deletions api/firmware/device.go
Expand Up @@ -27,8 +27,6 @@ import (
"github.com/flynn/noise"
)

//go:generate sh -c "protoc --proto_path=messages/ --go_out='import_path=messages,paths=source_relative:messages' messages/*.proto"

var (
lowestSupportedFirmwareVersion = semver.NewSemVer(9, 0, 0)
lowestSupportedFirmwareVersionBTCOnly = semver.NewSemVer(9, 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion api/firmware/device_test.go
Expand Up @@ -25,8 +25,8 @@ import (
"github.com/digitalbitbox/bitbox02-api-go/api/firmware/mocks"
"github.com/digitalbitbox/bitbox02-api-go/util/semver"
"github.com/flynn/noise"
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
)

// newDevice creates a device to test with, with init/pairing already processed.
Expand Down

0 comments on commit 4968e9a

Please sign in to comment.