Documentation ¶
Overview ¶
Package bitbox02bootloader contains the API to the physical device.
Index ¶
- Constants
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func BundledFirmwareVersion(edition bitbox02common.Edition) *semver.SemVer
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type Communication
- type Device
- func (device *Device) Close()
- func (device *Device) Erased() (bool, error)
- func (device *Device) GetHashes(displayFirmwareHash, displaySigningKeydataHash bool) ([]byte, []byte, error)
- func (device *Device) Identifier() string
- func (device *Device) Init(testing bool) error
- func (device *Device) KeystoreForConfiguration(configuration *signing.Configuration, cosignerIndex int) keystoreInterface.Keystore
- func (device *Device) ProductName() string
- func (device *Device) Reboot() error
- func (device *Device) ScreenRotate() error
- func (device *Device) SetOnEvent(onEvent func(event.Event, interface{}))
- func (device *Device) SetShowFirmwareHashEnabled(enabled bool) error
- func (device *Device) ShowFirmwareHashEnabled() (bool, error)
- func (device *Device) Status() *Status
- func (device *Device) UpgradeFirmware() error
- func (device *Device) Versions() (uint32, uint32, error)
- type Status
Constants ¶
const EventStatusChanged event.Event = "statusChanged"
EventStatusChanged is fired when the status changes. Check the status using Status().
const ProductName = "bitbox02-bootloader"
ProductName is the name of the BitBox02 bootloader product.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func BundledFirmwareVersion ¶
func BundledFirmwareVersion(edition bitbox02common.Edition) *semver.SemVer
BundledFirmwareVersion returns the version of the bundled firmware.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type Communication ¶
Communication contains functions needed to communicate with the device.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device provides the API to communicate with the BitBox02 bootloader.
func NewDevice ¶
func NewDevice( deviceID string, version *semver.SemVer, edition bitbox02common.Edition, communication Communication, ) *Device
NewDevice creates a new instance of Device.
func (*Device) GetHashes ¶
func (device *Device) GetHashes(displayFirmwareHash, displaySigningKeydataHash bool) ( []byte, []byte, error)
GetHashes queries the device for the firmware and signing keydata hashes. If the display flags are true, the hashes are also shown on the device screen.
func (*Device) Identifier ¶
Identifier implements device.Device.
func (*Device) KeystoreForConfiguration ¶
func (device *Device) KeystoreForConfiguration(configuration *signing.Configuration, cosignerIndex int) keystoreInterface.Keystore
KeystoreForConfiguration implements device.Device.
func (*Device) ProductName ¶
ProductName implements device.Device.
func (*Device) ScreenRotate ¶
ScreenRotate rotates the device screen.
func (*Device) SetOnEvent ¶
SetOnEvent implements device.Device.
func (*Device) SetShowFirmwareHashEnabled ¶
SetShowFirmwareHashEnabled returns whether the bootloader will automatically show the firmware hash on boot.
func (*Device) ShowFirmwareHashEnabled ¶
ShowFirmwareHashEnabled returns whether the bootloader will automatically show the firmware hash on boot.
func (*Device) UpgradeFirmware ¶
UpgradeFirmware uploads a signed bitbox02 firmware release to the device.