Skip to content

Commit 2e479ee

Browse files
committed
Merge branch 'optional-pairing'
2 parents 5783747 + cc1d289 commit 2e479ee

File tree

13 files changed

+81
-7
lines changed

13 files changed

+81
-7
lines changed

backend/devices/bitbox02/device.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func NewDevice(
5151
product bitbox02common.Product,
5252
config firmware.ConfigInterface,
5353
communication firmware.Communication,
54+
opts ...firmware.DeviceOption,
5455
) *Device {
5556
log := logging.Get().
5657
WithGroup("device").
@@ -64,7 +65,9 @@ func NewDevice(
6465
version,
6566
&product,
6667
config,
67-
communication, logger{log},
68+
communication,
69+
logger{log},
70+
opts...,
6871
),
6972
deviceID: deviceID,
7073
log: log,

backend/devices/usb/hid.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ type hidDeviceInfo struct {
5353
hid.DeviceInfo
5454
}
5555

56+
// IsBluetooth implements DeviceInfo.
57+
func (info hidDeviceInfo) IsBluetooth() bool {
58+
return false
59+
}
60+
5661
// VendorID implements DeviceInfo.
5762
func (info hidDeviceInfo) VendorID() int {
5863
return int(info.DeviceInfo.VendorID)

backend/devices/usb/manager.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/BitBoxSwiss/bitbox-wallet-app/util/logging"
2929
"github.com/BitBoxSwiss/bitbox-wallet-app/util/socksproxy"
3030
bitbox02common "github.com/BitBoxSwiss/bitbox02-api-go/api/common"
31+
"github.com/BitBoxSwiss/bitbox02-api-go/api/firmware"
3132
"github.com/BitBoxSwiss/bitbox02-api-go/communication/u2fhid"
3233
"github.com/BitBoxSwiss/bitbox02-api-go/util/semver"
3334
"github.com/sirupsen/logrus"
@@ -46,6 +47,8 @@ const (
4647

4748
// DeviceInfo contains the usb descriptor info and a way to open the device for reading and writing.
4849
type DeviceInfo interface {
50+
// IsBluetooth means the communication layer is Bluetooth, otherwise USB.
51+
IsBluetooth() bool
4952
VendorID() int
5053
ProductID() int
5154
UsagePage() int
@@ -218,6 +221,7 @@ func (manager *Manager) makeBitBox02(deviceInfo DeviceInfo) (*bitbox02.Device, e
218221
product,
219222
bitbox02.NewConfig(manager.bitbox02ConfigDir),
220223
u2fhid.NewCommunication(hidDevice, bitboxCMD),
224+
firmware.WithOptionalNoisePairingConfirmation(deviceInfo.IsBluetooth()),
221225
), nil
222226
}
223227

backend/mobileserver/mobileserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ type GoReadWriteCloserInterface interface {
7777

7878
// GoDeviceInfoInterface adapts usb.DeviceInfo's Open method to return the adapted ReadWriteCloser.
7979
type GoDeviceInfoInterface interface {
80+
IsBluetooth() bool
8081
VendorID() int
8182
ProductID() int
8283
UsagePage() int

frontends/android/BitBoxApp/app/src/main/java/ch/shiftcrypto/bitboxapp/GoViewModel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public long write(byte[] p0) throws Exception{
7979
throw new Exception("nope");
8080

8181

82+
}
83+
public boolean isBluetooth() {
84+
return false;
8285
}
8386
public String product() {
8487
return device.getProductName();

frontends/ios/BitBoxApp/BitBoxApp/Bluetooth.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,10 @@ class BluetoothDeviceInfo: NSObject, MobileserverGoDeviceInfoInterfaceProtocol {
484484
return BluetoothReadWriteCloser(bluetoothManager: bluetoothManager)
485485
}
486486

487+
func isBluetooth() -> Bool {
488+
return true
489+
}
490+
487491
func product() -> String {
488492
// TODO: return bluetoothManager.productStr() and have the backend identify and handle it
489493
return productInfo.product

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/BitBoxSwiss/bitbox-wallet-app
33
go 1.23
44

55
require (
6-
github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20250508091842-e5b786c4a88d
6+
github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20250526110026-4c21ece5b081
77
github.com/BitBoxSwiss/block-client-go v0.0.0-20241009081439-924dde98b9c1
88
github.com/btcsuite/btcd v0.24.2
99
github.com/btcsuite/btcd/btcec/v2 v2.3.4

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20250508091842-e5b786c4a88d h1:Zd6ISD5tzAFEsy+Td0XwmENqssuL+9aKHHBFyMpPUCg=
2-
github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20250508091842-e5b786c4a88d/go.mod h1:lyYwD22hA6TQ8XNXx37VE75Exp6qYdgZgUAO4+lyhSU=
1+
github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20250526110026-4c21ece5b081 h1:57aszTkvQz1aQcL9pbNUpyVepFuRlrBaoNyKV0rMdIM=
2+
github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20250526110026-4c21ece5b081/go.mod h1:lyYwD22hA6TQ8XNXx37VE75Exp6qYdgZgUAO4+lyhSU=
33
github.com/BitBoxSwiss/block-client-go v0.0.0-20241009081439-924dde98b9c1 h1:5hjP8mYSVKFibesrz8L6U0Vp5zSJt0LwXB3DSZGhnSo=
44
github.com/BitBoxSwiss/block-client-go v0.0.0-20241009081439-924dde98b9c1/go.mod h1:SJTiQZU9ggBzVKMni97rpNS9GddPKErndFXNSDrfEGc=
55
github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=

vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/btc.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/device.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)