bitbox02-api-go

module
v0.0.0-...-b5eea13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2024 License: Apache-2.0

README

BitBox02 Go library

The API of the api packages are currenly unstable. Expect frequent breaking changes until we start tagging versions.

Comand to update the BitBox02 protobuf message files

Clone the BitBox02 firmware repo:

Make sure you have protoc and protoc-gen-go installed:

git clone https://github.com/BitBoxSwiss/bitbox02-firmware.git

rm -rf api/firmware/messages/{*.pb.go,*.proto}
cp /path/to/bitbox02-firmware/messages/*.proto api/firmware/messages/
rm api/firmware/messages/backup.proto
./api/firmware/messages/generate.sh

Simulator tests

The TestSimulator* tests run integration against BitBox02 simulators. They are automatically downloaded based on api/firmware/testdata/simulators.json, and each one is tested with.

To run them, use:

go test -v -run TestSimulator ./...

If you want to test against a custom simulator build (e.g. when developing new firmware features), you can run:

SIMULATOR=/path/to/simulator go test -v -run TestSimulator ./...

In this case, only the given simulator will be used, and the ones defined in simulators.json will be ignored.

Directories

Path Synopsis
api
bootloader
Package bootloader contains the API to the physical device.
Package bootloader contains the API to the physical device.
common
Package common contains common functionality to firmware and bootloader of the bitbox02.
Package common contains common functionality to firmware and bootloader of the bitbox02.
firmware
Package firmware contains the API to the physical device.
Package firmware contains the API to the physical device.
firmware/mocks
Package mocks contains the mock implementations to be used in testing.
Package mocks contains the mock implementations to be used in testing.
cmd
miniscript
Package main is a playground to play with the BitBox02 miniscript support.
Package main is a playground to play with the BitBox02 miniscript support.
paymentrequest
Package main is a playground to play with the BitBox02 miniscript support.
Package main is a playground to play with the BitBox02 miniscript support.
playground
Package main is a playground for devs to interact with a live device.
Package main is a playground for devs to interact with a live device.
communication
u2fhid
Package u2fhid implements the U2F HID message framing protocol.
Package u2fhid implements the U2F HID message framing protocol.
usart
Package usart implements a framing protocol for messages sent over UART.
Package usart implements a framing protocol for messages sent over UART.
util
errp
Package errp wraps the github.com/pkg/errors package, because its name clashes with the builtin errors package, which confuses the automatic imports tool goimports.
Package errp wraps the github.com/pkg/errors package, because its name clashes with the builtin errors package, which confuses the automatic imports tool goimports.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL